#include <hc11.h> #include "pia.h" #define TRUE 1 void tof_isr(void); unsigned char upcount; main() { upcount = 0; PIA_CRB = 0x00; PIA_DDRB = 0xff; PIA_CRB = 0x04; PIA_B = upcount; TOF_JMP = JMP_OP_CODE; TOF_VEC = tof_isr; TMSK2 |= 0x80; TFLG2 = 0x80; enable(); while (TRUE) { asm(" wai"); } } #pragma interrupt_handler tof_isr void tof_isr(void) { PIA_B = upcount++; TFLG2 = 0x80; }