Hi, I'm facing some problem in 8051 microcontroller(cygnal family). If we changed the default base address of interrupt vector(0x0000)to different base address, while simulating and debugging it with Keil Compiler, it goes to default base address of interrupt vector(0x0000). (Here default base address of interrupt vector is changed using INTVECTOR directive of pragma and also put in C51 Tab of Target Options). How to divert the compiler into a new different base address. (code is attached below). Regards, Saravanan (saravan78@yahoo.com) #pragma iv(0x1000); #include<c8051f020.h> int Mil_Sec=0; int overflow_count=0; int sec; void main() { TMOD = 0x20; CKCON = 0x10; TH1 = 256 - 250; TL1 = TH1; ET1 = 1; TR1 = 1; EA = 1; while(1) { if(Mil_Sec>=1000) { sec++; } } } void timer1_ISR (void) reentrant interrupt 3 { overflow_count++; if(overflow_count > 4) { Mil_Sec++; overflow_count =0; overflow_count =0; } }
The actual chip will ALWAYS go to the defines reset/interrupt vectors at 0000h, 0003h, 000Bh, 0013h, 001Bh, and so on. There is no way to get the chip to jump elsewhere. If you relocate the reset/interrupt vectors of a program, you must ensure that there is something at the REAL reset/interrupt vector that jumps to the relocated vectors. You can do that in assembly as follows:
#define OFFSET 0x8000 CSEG AT 0003h LJMP $+OFFSET CSEG AT 000Bh LJMP $+OFFSET . . .