This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

can't assign a value to SBUF in simulator

hello every body

i have a problem when i use debugger
i assign a value to sbuf but i can't get that?!?!?
it seems that i can't simulate serial recieve?!?!
plz help me :(

Parents
  • "You can't write values directly to SBUF"

    Well, you can - but you will not see the same value when you read SBUF.

    SBUF is essentially two separate registers - one is read-only, the other is write-only.
    These two separate registers share the same SFR address - read accesses to that address read from the read-only register; write accesses to that address write to the write-only register.

    That's why you can't read-back the same value that you wrote!

    Writing to the write-only register causes data to be transmitted by the 8051 serial port hardware;
    Characters received by the 8051 serial port hardware can be read via the read-only register.

Reply
  • "You can't write values directly to SBUF"

    Well, you can - but you will not see the same value when you read SBUF.

    SBUF is essentially two separate registers - one is read-only, the other is write-only.
    These two separate registers share the same SFR address - read accesses to that address read from the read-only register; write accesses to that address write to the write-only register.

    That's why you can't read-back the same value that you wrote!

    Writing to the write-only register causes data to be transmitted by the 8051 serial port hardware;
    Characters received by the 8051 serial port hardware can be read via the read-only register.

Children