hello to all !!!
I am using ADUC841 and i want do sent a string in that format (8 bit ,1 stop bit, odd - parity) I am writing in C51
how can i set the my MCU to output this string with parity ?????
how i a setup the UART to send with parity ???
my program
void main(void) { T3CON = 0x86; // Configure the baud rate 9600 T3FD = 0x08; SCON = 0x52;
printf("hello"); // the string i want to set with // odd pariy }
thanks in advance to the helpers
mayer
This is the code to send with parity i tesed on the hyper terminal and it work great !!
sending:
ACC = in_string[i]; // P = Even TB8 = ~P; // ~p = Odd SBUF = ACC; while (! TI); // while (TI == 0); TI = 0;
reciving :
while (RI == 0); // while (! RI); RI = 0; ACC = SBUF; RB8 = P; input_line[i] = ACC;
I would not use the ACC to make an assignment to a variable: don't use ACC as an rvalue...
sending: ACC = in_string[i]; // P = Even TB8 = ~P; // ~p = Odd SBUF = in_string[i]; // changed from ACC while (! TI); // while (TI == 0); TI = 0; reciving : while (RI == 0); // while (! RI); RI = 0; temp = SBUF; ACC = SBUF; RB8 = P; input_line[i] = temp; // changed from ACC
You aren't too sure what the actual accumulator (ACC) will contain by the time you choose to use it as an rvalue. "ACC" is not to be treaded like a 'normal' variable.
--Cpt. Vince Foster c/o VRWC (founding member) 2nd Cannon Place Fort Marcy Park, VA
Oops..
while (RI == 0); // while (! RI); RI = 0; temp = SBUF; ACC = temp;