SYSAHBCLKCTRL and Polling Timer

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

SYSAHBCLKCTRL and Polling Timer

893 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by cwpjr on Sat Jan 19 16:16:19 MST 2013
Using LPCxepresso 1114 stick with Code Red V5.

Writing in assembly language.

After reading all the manuals and searching this forum I have 2 questions.

From the manual:
The CT32B0/1 are configured using the following registers:
1. Pins: The CT32B0/1 pins must be configured in the IOCONFIG register block
(Section 7.4).
2. Power and peripheral clock: In the SYSAHBCLKCTRL register, set bit 9 and bit 10

RE> 1:
*must* I configure pins if I just want to poll the timer?
RE>2:
Simply writing those two bits seems dangerous. Won't that simply disable everything else and "brick my stick"?
0 Kudos
Reply
2 Replies

880 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by cwpjr on Sun Jan 20 20:42:36 MST 2013
Works for me. Thanks!:)
0 Kudos
Reply

880 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Sat Jan 19 21:30:47 MST 2013
Sample:

#define EN_CT32B0 (1<<9)


//init 32bit_timer
 LPC_SYSCON->SYSAHBCLKCTRL |= (EN_CT32B0);//enable clock CT32B0
 LPC_TMR32B0->TC   = 0;                       //reset counter
 LPC_TMR32B0->TCR  = 1;                       //start timer

 while(1)
 {
  if(LPC_TMR32B0->TC >=5000)            //poll timer
  {
   LPC_TMR32B0->TC =0;                    //reset timer    
   ...do something funny
  }
 }
#1 As described in user manual:

Quote:
Pins: The CT32B0/1 pins must be configured in the IOCONFIG register block.

If you don't need timer pins (capture, match...) it's of course not necessary to configure them

#2 Read SYSAHBCLKCTRL, set bit 9 /10 and store it again 
0 Kudos
Reply