#include <mc9s12dp256.h> void TOC7_Init(void) { asm sei TIOS=0x80; // IOS7 = 1, channel 7 is output compare TCTL1=0x40; // OM7 = 0, OL7 = 1, Toggle output on PTT7/IOC7 TSCR2=0x0F; // TCRE = 1, counter reset enable // Prescaler = 128 (Timer clock freq = 25MHz/128 = 195.31kHz) TC7=48828; // LED on/off duration = 48828/195.31kHz = 0.25s TIE=0x80; // Timer interrupt enable, C7I=1 TSCR1=0x90; // Timer enable TEN=1, fast flag clear TFFCA=1 asm cli; } void main() { TOC7_Init(); DDRP=0xFF; // Port P as output PTP=0x00; // Initialize LED off } // definition #pragma interrupt_handler TOC7_ISR(); void TOC7_ISR(void) { PTP ^= 0x80; // Toggle output bit (PTP7) } // interrupt vector declaration extern void TOC7_ISR(); #pragma abs_address:0xffee; void (* TOC7_handler[])() = { TOC7_ISR }; #pragma end_abs_address
Your help is highly appreciated.Thanks in advance.