Capturing external clock

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

Capturing external clock

872 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by zmogedra on Sun Feb 17 07:02:11 MST 2013
Hi, I have some kind of problem with timer on LPC1347. I would like to run timer from external TTL clock source(200kHz).
 LPC_IOCON->PIO0_8 |= 0x02; // Pin08 timer enable
LPC_GPIO->DIR[0] &=  ~(1 << 8); //set dir as input
LPC_SYSCON->SYSAHBCLKCTRL |= (1 << 7); // CT16B0 enable clock LPC_SYSCON->SYSAHBCLKDIV   = 0x01;     // no division
LPC_CT16B0->CTCR  |= 0x1; // Counter Mode: TC is incremented on rising edges on the CAP input
LPC_CT16B0->TCR |=0x1; // start timer
but for some reason nor TC nor CR0 isn't increasing. What em I missing here?
0 Kudos
Reply
2 Replies

852 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by zmogedra on Sun Feb 17 09:56:10 MST 2013
Thank you very much it worked:))
0 Kudos
Reply

852 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Sun Feb 17 09:31:59 MST 2013

Quote: zmogedra
What em I missing here?



#1 IOCON Clock in SYSAHBCLKCTRL :confused:

#2 Capture function is no GPIO, so setting DIR is nonsense :eek:

#3 PIO0_8 is [COLOR=Red]CT16B0_MAT0[/COLOR], could be useful to use a capture pin to capture :rolleyes:

#4 LPC1343 sample is shown in #2 of http://knowledgebase.nxp.com/showthread.php?t=915 :)
0 Kudos
Reply