Hi there..
Getting timer 2 to signal an interrupt using C code was a bigger task than I expected. This is the code that seems to work, but I don't have any clue on why it works - perhaps someone here can point me in the correct direction? When I look in the documentation to the 80c535 it mentions that interrupt 5 is tied to the CC2 / P1.2. When you look at the code you'll discover I don't touch the register/pin at all.
#include #include
void timer2(void) interrupt 5 { TF2 = 0; }
void main() {
TH2 = 0xff; // timer 2 high byte TL2 = 0x50; // timer 2 low byte EAL = 1; // enables global interrupt thingy ET2 = 1; // yup to timer 2 interrupt
CRCH = 0xff; CRCL = 0x50;
T2CON = 0x11; // boots the timer
while (1) {
} }Thanks in advance!