Timer Delay program

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Timer Delay program

跳至解决方案
2,297 次查看
admin
Specialist II

Hello there,

 As a beginner, I am quite confused with the programming of HCS12X (MC9S12XDP512)MCU.

Can anyone help me write a simple timer program ? also please give the basic difference between a Periodic Timer interrupt and Enhanced Capture Timer, when are they used.... 

标签 (1)
标记 (1)
0 项奖励
回复
1 解答
1,058 次查看
isionous
Contributor III

This webpage has lots of starter code for the C32 and DP512:  http://users.ece.utexas.edu/~valvano/Starterfiles/

 

You'll probably be interested in OC_DP512.zip but searching the page for "output compare" will help you find other timer-related code.

 

The ECT contains a set of 8 timers that trigger when TCNT (the main counter/timer) is equal to a certain number.  For example, output compare 7 interrupt triggers when TC7 is equal to TCNT.  TC7 and TCNT are 16-bit registers.  If you want an output compare 7 interrupt 500 TCNT ticks from now, set TC7 = TCNT + 500.  The output compare interrupts can also be set to automatically toggle a pin.  The ECT also can change output compare interrupts into input capture interrupts, where interrupts are triggered on edges on pins.

 

The periodic timers are 4 timers that trigger once every 1 bus cycle to 2**24 bus cycles.  The timing of the interrupts is less flexible.

 

You'll probably want to read chapter 7 and chapter 13 of the XDP512 datasheet.

在原帖中查看解决方案

0 项奖励
回复
2 回复数
1,059 次查看
isionous
Contributor III

This webpage has lots of starter code for the C32 and DP512:  http://users.ece.utexas.edu/~valvano/Starterfiles/

 

You'll probably be interested in OC_DP512.zip but searching the page for "output compare" will help you find other timer-related code.

 

The ECT contains a set of 8 timers that trigger when TCNT (the main counter/timer) is equal to a certain number.  For example, output compare 7 interrupt triggers when TC7 is equal to TCNT.  TC7 and TCNT are 16-bit registers.  If you want an output compare 7 interrupt 500 TCNT ticks from now, set TC7 = TCNT + 500.  The output compare interrupts can also be set to automatically toggle a pin.  The ECT also can change output compare interrupts into input capture interrupts, where interrupts are triggered on edges on pins.

 

The periodic timers are 4 timers that trigger once every 1 bus cycle to 2**24 bus cycles.  The timing of the interrupts is less flexible.

 

You'll probably want to read chapter 7 and chapter 13 of the XDP512 datasheet.

0 项奖励
回复
1,058 次查看
admin
Specialist II

Well thank you,

I will see to it again

0 项奖励
回复