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.
did you try simlulating this code using the cypress an21xx target processor ? I just did. It works perfectly. Once opnened, I change the SBUF0 value which is the serial data received, and click on RI_0 to jump to the serial ISR. Well, that won't work. Writes to SBUF are sent to the transmitter. Reads from SBUF are values received. You can't write to SBUF and then read that value back. Either in the real chip on in the simulator. Have you set a breakpoint on the data_received = SBUF0; line to see what happens when you type a letter like 'A'. It works just fine. To send a character with an ACSII value higher than 0xF7 you'll probably have to use the VTREGs. Run the program, and while it's waiting for a serial character, enter S0IN = 0xF8 in the Command Window. Refer to http://www.keil.com/support/docs/2083.htm for more information on that. Jon
YES ! it works now ! I was thinking it was possible to simulate incoming serial data by simply entering them in sbuf0 field from the serial channel 0 window. Thanks to everybody for your time. joe