Hiya guys, need a bit of help here I have put this code in ----------------------------------------- void noreturn (void) interrupt 1 { send_serial("Timer0 Overflow"); } ------------------------------------------ but the target is not created when this code is in. what could it be??
I take it dScope is a simulator? The problem appears to be that your chip's hardware directs interrupts to 0xBF00 while the dScope simulator directs them to 0x0000 as most 8051s do. If you can add some assembly code in the 0x0000 block to redirect the interrupts to the 0xBF00 block the simulator will act like the chip. In most simulators there is a way to add assembly instructions to your code already loaded into the simulator. I think the: ASM 0x0000 ASM LJMP 0x1000 etc. stuff may have been instructions that you can issue from some kind of command line in dScope. Dig into the dScope docs. Somewhere in there it should tell you how to edit the code that has been loaded into the simulator by "hand" adding assembly instructions.
Maybe a faster option is to use the #pragma statement to change the interrupt vector block depending on whether you are compiling your code for use in the development board or for use with the dScope simulator. That is, #pragma iv (0xBF00) //for use on HW #pragma iv (0x0000) //for use w/simulator
thought i would just change the interrupt vector start address, depending on which im using. but i would really like to to a nice program. can some one pls explain how i include assembly into C code. i have tried to read the help file, but im alittle stuck with it. how do i get access to adress locations in c and put assembly code?
whats the best interupt to use as a 3rd external interrupt?
I'm just about positive that you can't use absolute code addresses in C. You would have to write an assembly file and add it to your project so that it is linked with your C code. In the assembly file, you'd have: .org 0x0000 LJMP 0x1000 .org 0x0003 LJMP 0x1003 etc. But, then you are still stuck adding this file to your project when compiling for the simulator and taking it out when compiling for use in HW. If you really want something "clean" how about this?: #define USING_SIMULATOR x // x=1 if "using simulator" // x=0 if using hardware #if (USING_SIMULATOR) #pragma iv (0x0000) #else #pragma iv (0xBF00) #endif You just change "x" depending on how you want it. I often write code that must be compiled differently for different situations and this is the best way to compile two different versions from the same source code.
I have never heard of a '51 derivative with vectors based anywhere but from 0. What chip are you using? Erik
well the development board was develop by a lectuer at uni. The process is: On on board Rom, which has the Download software on, and then the code and data goes onto the onboard ram. But the vectors for the RAM are offset in the rom.