Hello, I am not able to receive the value of SBUF into a char. The part of code is shown below. Always when I try, the value is 0x00. I will be obliged for helpful commends. SCON = 0x50; char Byte; The code below is in ISR for Serial interrupt if(RI) { Byte = SBUF; RI = 0; } Thanks
Have you set up the simulator so that something is actually being loaded into SBUF before you try to read it?
Yes I tried entering values thru program as SBUF = 0x0f; and also by setting the value in the serial window of the simulator, both on the run and before the start.
"SCON = 0x50;" Did you also initialise all the other relevant SFRs?
Yes I tried entering values thru program as SBUF = 0x0f; SBUF is TWO registers, you can NOT read what you write. Erik Study "the bible" Chapter 1 http://www.semiconductors.philips.com/acrobat/various/80C51_FAM_ARCH_1.pdf chapter 2 http://www.semiconductors.philips.com/acrobat/various/80C51_FAM_PROG_GUIDE_1.pdf chapter 3 http://www.semiconductors.philips.com/acrobat/various/80C51_FAM_HARDWARE_1.pdf Erik
Open up the serial window in the simulator and type or paste what you want to send.
The SBUF register is split into two VTREG's. SIN and SOUT. You may also write to SIN (see: http://www.keil.com/support/docs/1944.htm) to simulate serial input.