I am interfacing an led with via serial port. I have set up the serial port already.
I have a display with these specification parameters: baudrate:2400 data:8 bits end code:1bit
I am trying to display the test code which comes in the following format: "10"+"01H"+"0FFH"
I tried printf but didn't work: printf("10"+"0x01"+"0x0FF"); Any suggestions??
10x
"I am interfacing an led with via serial port."
What, exactly, do you mean by that?!
It sounds like this is not just a single LED, but some display module - is that right?
You need to give details!
"I am trying to display the test code which comes in the following format: "10"+"01H"+"0FFH"
What exactly do you mean by that? Is that supposed to be a 17-character string consisting of a double-quote followed by a '1' followed by a '0', etc...? Or is it supposed to be the 2-character string "10" followed by the 3-character string "01H" followed by the 4-character string "0FFH"? Or is it supposed to be three bytes having hex values 10, 01, FF? Or what?!
"I tried printf but didn't work: printf("10"+"0x01"+"0x0FF"); Any suggestions??"
First, you need to get a 'C' textbook - that printf call will certainly not print what you are hoping for!
Then take a look at the Keil example for using printf on the 8051: http://www.keil.com/support/man/docs/uv3/uv3_ex_hello.htm
sorry for that missed some details in my prev post:
I am interfacing 8051 to an LED display module.
What i mean is that according to the display's protocol the format to display its test code is: "10"+"01H"+"0FFH"
"10":Leading code "01H":testing code "0FFH":end code
if i were using assembly to write to serial port i would use MOV SBUF,#B;
to write to serial port using C u use putchar() but thats for a single character only right? My question is what do i do for the test code format above??
My guess is that you want to send the character '1' followed by the character '0' followed by the hexadecimal value 0x01, followed by the hexadecimal value 0xff. Just remember that you must check that the UART is ready for more characters before writing a character to SBUF.
test code which comes in the following format: "10"+"01H"+"0FFH"
No, it doesn't, because that's no format. It's gibberish. You apparently ripped a possibly useful description out of its context so thoroughly that there's nothing useful left for anybody to work with. What do you mean by '+'? What are all those "quotes" doing there, and what's the difference between values with a trailing 'H' and those without it?
If i were using assembly to write to serial port i would use MOV SBUF,#B;
And what on earth would #B have to do with "10"+"01H"+"0FFH"?
Mov SBUF,#B is just an example of how one can write to a serial port using assembly it has nothing to do with "10"+"01H"+"0FFH".
My difficulty lies in how to send information to serial port using C.
Can I in anyway upload the protocol pdf file for u to clearly see what i mean?
As I said to you initially, you need to start with a 'C' textbook.
There are some suggestions here: http://www.keil.com/books/ www.8052.com/books.phtml
Then you need to study the Keil manuals, and take a look at the Keil example for using printf on the 8051: http://www.keil.com/support/man/docs/uv3/uv3_ex_hello.htm
View all questions in Keil forum