#include <MC9S12NE64.h> /* derivative information */#include "lib.h"#include "Cpu.h"static long absoluteTime = 0;static long absoluteTimeUp = 0;static long msDelai = 0;static int b=1;static void startTimeBase(void){ absoluteTime = 0; msDelai=500; absoluteTimeUp=absoluteTime+msDelai; }volatile unsigned int count;#pragma CODE_SEG NON_BANKEDinterrupt void _Vtimovf (void) { int i =0; absoluteTime++; //i=setPortPinValue('g', 0, ON); TFLG2 = 0x80;// clear the interrupt flag count++; //increment counter } #pragma CODE_SEG DEFAULTvoid main(void) {int i =0; /* put your own code here */ TSCR1=0X80;//enable timer TSCR2=0x85; //select prescler bus clock/32 TFLG2=0x80;// clear timer flag i=setPortPinDirection('g', 0, OUTPUT); i=setPortPinDirection('h', 0, INPUT); PTG_PTG0 =1; //i=setPortPinValue('g', 0, OFF); startTimeBase(); EnableInterrupts; while(1) { while(absoluteTimeUp>absoluteTime) { } absoluteTime=0; if(b==0) { b=1; i=setPortPinValue('g', 0, OFF); } else { b=0; i=setPortPinValue('g', 0, ON); } } /* wait forever */}
here is my code