Download presentation
Presentation is loading. Please wait.
1
Example 18 Pulse Train Using Interrupts
Lecture L8.2
2
PIM_9DP256 Block Diagram Timer module
3
Timer Pins PT0 – PT7 Pins 9,10,11,12, 15,16,17,18
4
Timer Pins PT0 – PT7 Pins 9,10,11,12, 15,16,17,18 PT6 = Pin 17
5
16-bit free-running counter, TCNT
Pulse train Output Compare 16-bit free-running counter, TCNT
7
MC9S12DP256B Interrupt Vectors
8
// Example 18: Interrupt-Driven Pulse Train
#include <hidef.h> /* common defines and macros */ #include <mc9s12dp256.h> /* derivative information */ #include "main_asm.h" /* interface to the assembly module */ #pragma LINK_INFO DERIVATIVE "mc9s12dp256b" int period; // period of pulse train int pwidth; // high pulse width of pulse train // Timer channel 6 interrupt service routine void interrupt 14 handler(){ ptrain6(period, pwidth); } void main(void) { PLL_init(); // set system clock frequency to 24 MHz ptrain6_init(); period = 0x4567; pwidth = 0x1234; while(1) { // do nothing while generating pulse train
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.