Timer0 is used for freq. generation at port 3.5 (Portf) of my AT89C4051 @ 24MHz. Each time the timer overflows the port is toggled. 1st case in asm: ORG 00BH tim0_int cpl Portf reti 2nd case in C51: void timer0_int (void) interrupt 1 { Portf = ~Portf; } The problem in the second case is that a LJMP is added to the service routine and this consumes extra time. How do I implement this in C without the LJMP. Thanks. Han
//Replacement for timer0 routine wich toggles a port #pragma asm CSEG AT 0bh db 0b2h ; cpl db 0b5h ; P3.5 db 32h ; reti #pragma endasm cleaner and simpler: remove the ISR from your C file link an a51 file with ORG Obh col p3.5 reti end
ORG Obh col p3.5 reti Why can nobody make a keyboard that is fit for thumb typing :) the above should, of course be ORG Obh cpl p3.5 reti
It gets better and better: In the C file: // replacement timer0 interrupt #pragma asm CSEG 0bh cpl P3^5 reti #pragma endasm Tnx, Han
I'm sorry, forgot something... #pragma asm CSEG at 0bh cpl P3^5 reti #pragma endasm Han.