??? 03/11/05 15:06 Read: times |
#89461 - 19200??? Responding to: ???'s previous message |
hi,
Yueng Chun Chung said:
My program is for sending 8 bytes of 0xFF to the PC size.
When the speed is at 9600, 8 0xFF can be recevied. But When the speed is at 19200, 8 0xFE are received. Well, take a look at next lines mov th1,#0fdh mov tl1,#0fdh ;TH1=TL1 = 256 - (freq / (32 * 12 * BAUD)) mov pcon,#00h mov scon,#50h ;8-bit UART mode1 (Serial Mode 1 Set by Timer 1)Let me calculate: 256-(11059200/32/12/9600) = 256-3 = 0xFD that`s correct for 9600. Now the question: how do you obtain 19200? The code in your first message: mov th1,#0fah ;baud rate (fd=19200,fa=9600) mov tl1,#0fah ;TH1=TL1 = 256 - (freq / (32 * 12 * BAUD)) mov pcon,#00h mov scon,#50h ;8-bit UART mode1 (Serial Mode 1 Set by Timer 1)So you have used 0xFA (250). Now try calculate: BAUD = 11059200/32/12/(256-250) = 4800. You have configured UART to 4800, not 19200. My suggestion to obtain 19200: mov th1,#0fdh mov tl1,#0fdh ;TH1=TL1 = 256 - (freq / (32 * 12 * BAUD)) mov pcon,#80h mov scon,#50h ;8-bit UART mode1 (Serial Mode 1 Set by Timer 1) It is the same as for 9600 but PCON is loaded with 0x80 and so it sets bit SMOD which doubles baud rate. Regards, Oleg |
Topic | Author | Date |
About Serial Communication!!!!!Help | 01/01/70 00:00 | |
insufficient | 01/01/70 00:00 | |
Sorry, the crystal is 11.0592MHz | 01/01/70 00:00 | |
It's a miracle | 01/01/70 00:00 | |
amazing | 01/01/70 00:00 | |
Sorry, since the program is very large.. | 01/01/70 00:00 | |
Large program | 01/01/70 00:00 | |
Result | 01/01/70 00:00 | |
do you believe | 01/01/70 00:00 | |
MAX232C | 01/01/70 00:00 | |
19200??? | 01/01/70 00:00 | |
PCON vs 6 clock | 01/01/70 00:00 | |
P89C51RD2 6 clocks per machine cycle | 01/01/70 00:00 | |
DESCRIPTION | 01/01/70 00:00 | |
Here we go again | 01/01/70 00:00 | |
Re:amazing![]() | 01/01/70 00:00 | |
H or not | 01/01/70 00:00 | |
The chip is P89C51RD2 | 01/01/70 00:00 | |
insufficient | 01/01/70 00:00 | |
I am not sure about that... | 01/01/70 00:00 | |
the 'H' is important | 01/01/70 00:00 | |
is P89C51RD2HBP | 01/01/70 00:00 | |
Solved | 01/01/70 00:00 | |
0xFF ??? | 01/01/70 00:00 |