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

8051 sbuf program

dear sir

I am writing  c code to write to rs232 port using aduc831 kit
SBUF=1+48;
SBUF=1+48;
SBUF=1+48;
SBUF=1+48;
initially sbuf didnt take SBUF=1 doing above it did but now want to send nibble continuously from io port P3 such that it should display 0 to 0f on hyperterm
now frm program 0f 1111 should be displayed on hyperterm.kindly help

regards
khn

Parents
  • Of course SBUF can handle the value 1. But the value 1 isn't the printable character '1' but a control character that many terminal programs will not show.

    So you either give '1' to SBUF, or you feed it 1 + '0'. Avoid using magic numbers like 48 in your code - it is way easier to see '0' and understand that your goal is to emit printable digits.

    But next thing is that you can't normally feed SBUF multiple values directly after each other, unless your specific chip have a FIFO that can queue many characters for transmission. The world is full of small hello-world applications that shows you how to send characters one-by-one, while waiting for one to transmit before trying to send the next character.

Reply
  • Of course SBUF can handle the value 1. But the value 1 isn't the printable character '1' but a control character that many terminal programs will not show.

    So you either give '1' to SBUF, or you feed it 1 + '0'. Avoid using magic numbers like 48 in your code - it is way easier to see '0' and understand that your goal is to emit printable digits.

    But next thing is that you can't normally feed SBUF multiple values directly after each other, unless your specific chip have a FIFO that can queue many characters for transmission. The world is full of small hello-world applications that shows you how to send characters one-by-one, while waiting for one to transmit before trying to send the next character.

Children