Dear All, I'm using this interrupt on my program
void timer1_ISR (void) interrupt 3 //timer1 interrupt services routine { .. } void it_ext1(void) interrupt 2 // external interrupt INT1 { .. } void timerisr(void) interrupt 1 //timer0 interrupt services routine { .. } static void com_isr (void) interrupt 4 //SERIAL COMMUNICATION INTERRUPT SERVICES ROUTINE { .. } void i2c(void) interrupt 5 //i2c interrupt services routines { .. }
Graham Cole said: "You can use the same register bank for each ISR that is at the same interrupt level." Oleg Sergeev replied: "...as long as you do not use these registers as variables." Oleg: Presumably you are doing this in Assembler, not 'C'? I did wonder about the kind of thing you're suggesting, but I couldn't immediately see how you'd do it in C51.
hi, yes, Andy, ISR was wrote with ASM (actually it must be wrote such way as it requires high-speed optimization I done with hands). Then it was placed in separate .A51 file together with other ASM routines. Inside ASM I used bank switching, like:
CSEG AT 0x002B ; TF2 LJMP INT2_ISR ; ... INT2_ISR_SEG SEGMENT CODE RSEG INT2_ISR_SEG USING 1 ; register bank 1 INT2_ISR: PUSH PSW MOV PSW,#REGBANK_1 ; .... POP PSW RETI
data struct { unsigned char fa_lb; unsigned char fa_mb; unsigned char fa_hb; } flash_addr _at_ 0x09; data struct { unsigned char pbl_lb; unsigned char pbl_mb; unsigned char pbl_hb; } playback_length _at_ 0x12;
oops, I did a typpo. second structure is defined from 0x0C. Sorry, Oleg