Hi All, When simulating an interupt from serial port RX0, I cannot succeed in affecting SBUF0 to a local variable, the watch window shows this variable to 0 even if SBUF0 is set. Here is my code : static void serial_port_0_isr (void) interrupt COM0_VECT { unsigned char data_received; if (RI != 0) { RI = 0; data_received = SBUF0; ... } } on the above code, data_received is always 0 even if SBUF0 is set. To set SBUF0, I use the serial port window from the simulator. any idea would be appreciated.
I forgot to mention, yes I initialized PORTCFG registers in order to use the serials ports of the ezusb: // Inititalize IOs shared functions PORTACFG = 0; // Port A is a standard GPIO PORTBCFG = 0x0C; // Port B uses RX1 & TX1 PORTCCFG = 0x0F; // Port C uses RX0 & TX0 & INT0 & INT1
After several hours spent on this, I can resume my problem as follow: What can cause R7 to not beeing affected on the following, assuming SBUF0 is a SFR register at D:0x99 which contains a value different than 0 : MOV R7,SBUF0(0x99) After steping the above, R7 is still equal to 0 ! maybe a data banking issue ? I do not use any data or code banking, also I did not included any startup.a51 file in my project. My target option uses a small memory model, and the option "use onchip Xram memory (0x000 to 0x3FF)" is checked. I did not define anything in the offchip code memory and offchip xdata memory fields since I do not use exetrnal memory Any help GREATLY appreciated. thanks again
"maybe a data banking issue?" I didn't say data banking; I was talking about Register Banks. Remember that the 8051 has 4 Banks of registers: so there's an R7 in Bank 0; an R7 in Bank 1; an R7 in Bank 2; and an R7 in Bank 3. Are you sure that you're looking at the correct Bank? Maybe R7 is changing in a different Bank?
How up to date is your version of Keil? I recall that some time ago I was having problems with the IDE showing the values of registers other than those of the currently selected register bank. You can check by using a memory window to look at data directly.
I installed the last eval version 7.07 and uvison 2.39 how can I see the four registers banks corresponding to the four R7 registers from the simulator environment ?
I checked data addresses from D:0x00 to D:0x1F which should show me all R0 to R7 registers in all 4 banks. When affecting SBUF0 to R7, none of the R7 registers is affected, I mean addresses 07, 0F, 17 and 1F left unchanged ! The PSW register value is 00 and should therfore affect the address 07. I also tried to add "using 1" in my serial port ISR definition, now the PSW value is 08, pointing to register bank 1, as expected. Unfortunately R7 in this bank is still not affected ! joe