/* filename ********** tof.c ***************** Simulator tutorial program showing timer overflow interrupts This example accompanies the book "Embedded Microcomputer Systems: Real Time Interfacing", Brooks-Cole, copyright (c) 2000, Jonathan W. Valvano 7/16/99 Interface between the TExaS simulator running a MC68HC11 EVB with ICC11 freeware compiler TExaS Copyright 1999 by Jonathan W. Valvano for more information about ICC11 see http://www.imagecraft.com You may use this file without restrictions */ #include "HC11.h" /* counts the number of TOF interrupts */ unsigned int time; void main(void){ time=0; TMSK2=0x80; /* arm TOF */ TFLG2=0x80; /* initially clear TOF */ asm(" cli"); /* enable interrupts */ while(1){} } /* ----------called when TCNT=0--------- */ void TOFhndlr(void){ time++; PORTB ^= 0x40; /* toggle PB6 */ TFLG2 = 0x80; /* acknowledge TOF */ asm(" rti"); } /* 6811 interrupts supported by TExaS $FFFE Reset $FFFC COP Clock Monitor Fail (not supported) $FFFA COP Failure Reset (not supported) $FFF8 Unimplemented Instruction Trap (not supported) $FFF6 SWI $FFF4 XIRQ (not supported) $FFF2 IRQ or STRA (IRQ not supported, STRA is supported) $FFF0 Real Time Interrupt (not supported) $FFEE Timer input capture 1 $FFEC Timer input capture 2 $FFEA Timer input capture 3 $FFE8 Timer output compare 1 $FFE6 Timer output compare 2 $FFE4 Timer output compare 3 $FFE2 Timer output compare 4 $FFE0 Timer output compare 5 $FFDE Timer Overflow $FFDC Pulse Accumulator Overflow (not supported) $FFDA Pulse Accumulator Input Edge (not supported) $FFD8 SPI Serial Transfer Complete (not supported) $FFD6 SCI Transmit Buffer Empty SCI Transmit Complete (not supported) SCI Receiver Buffer Full */ void resetVectors(void){ /* not really a function, but this must be last */ asm(" org $FFDE"); asm(" FDB _TOFhndlr"); asm(" org $FFFE"); asm(" FDB __start"); asm(" org $FC00"); /* puts rts in a harmless place */ /* string constants also placed here */ /* the value FC00 means you can have up to 1000 characters of strings */ }