Timer1 does not count in LPC1778

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Timer1 does not count in LPC1778

795件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mostafanfs on Tue Mar 08 02:35:01 MST 2016
I wanted to measure the width of a incoming pulse to an IO pin using Timer1 in LPC1778. The IO pin is not a CAP pin so I figured to do it simply by starting the timer when the pulse goes to low state and reading TC register after the pulse goes to high state. Peripheral clock is 60 MHz and I set PR register to 0. In PCONP register TImer1 is enabled by default.


 LPC_TIM1->TCR  = 0x02;  
 LPC_TIM1->IR   = 0x02;  
 LPC_TIM1->CTCR = 0;     
 LPC_TIM1->TC   = 0;     
 LPC_TIM1->PR   = 0;     
 LPC_TIM1->MCR  = 0x18;  

 while(ISO7816_READ_DATA_BIT); // wait on high state
 LPC_TIM1->TC = 0;  // clear Timer Counter
 LPC_TIM1->TCR = 0x01 ;// start Timer
 while(!ISO7816_READ_DATA_BIT); // wait on low state
 oneBitTime = LPC_TIM1->TC;  // pulse width
 LPC_TIM1->TCR = 0x02; // stop Timer 


But oneBitTime is zero meaning the timer was not running or counting.
Is it missing something ?
ラベル(1)
0 件の賞賛
返信
1 返信

759件の閲覧回数
lpcware
NXP Employee
NXP Employee
bump
0 件の賞賛
返信