Dear friends
i would like to know how to send any bit of a char to any port pin ie. unsigned char a = 0xAA; now at memory location for a will contains 10101010b can i send the bit 0 of "a" to P1_0? i don't want to send the entire a to P1
thanking you
sunish
I am not a C51 guy, but why don't you try something like this:
P1_0 = (a & 0x1) ;
to place bit 0 on the pin.
use a buffer like MyBuffer[20], as you know you can now put 19 characters in this buffer. if your strings are fixed for example always 5 chars, test if the 6th char is pressed, or use * or # or any other button for entering the string. Don't forget to collect the previous chars in the buffer.
for example:
char MyBuffer[20],input; // buffer and current key input int i=0; // counter while (input != '#') // "#" key is assumed as ENTER key { input = MyBuffer[i]; i++; }
hope this helps
didn't he want to send data, rather than to receive it?
for the transmit the code needs o be this
use a buffer like MyBuffer[20], as you know you can now put 19 characters in this buffer. if your strings are fixed for example always 5 chars, test if the 6th char was sent, or use $ or any other characteur for finnishing the string. Don't forget to send the previous chars in the buffer.
char MyBuffer[20],output; // buffer and current display output int i=0; // counter while (output != '$') // "$" key is the end of dos string { MyBuffer[i] = output; i++; }
hope this helps better whot the last do
yavuz, yavuz, yavuz... help your friedn with something else rather than chewed C code...how about showing him how to work/configure a peripheral like the UART? I cannot help him with that, as I don't know the processor (do you...?)
View all questions in Keil forum