??? 04/09/04 08:49 Read: times |
#68238 - RE: A broblem in serial communication Responding to: ???'s previous message |
hi,
you have not specigied OSC frequence. But looking on your code, I make some sonclusions: - you use 11059200Hz OSC freq.; - you use 2400 baud rate. If my idea is correct then I think that the problem on PC side: First of all, look about how you set COM-port baud rate in case 1 and case 2: case 1: outportb(0x3f9,0x0c); //Put in divisor MSB 30h outportb(0x3f8,0x00); //Put in divisor LSB 00h case 2: outportb(0x2f9,0x30); //Put in divisor MSB 30h outportb(0x2f8,0x00); //Put in divisor LSB 00h In case 1, you commented MSB 30h but in program it is 0x0c. Anyway, it is just a mistake. The main error is that for 2400 it must be vice versa: outportb(0x2f9,0x00); //Put in divisor MSB 0 outportb(0x2f8,0x30); //Put in divisor LSB 48 i.e. frequence divider must be 48, not 12288. Otherwise COM port uses baud rate about 9 bits per second. As result, UART of C52 (configured to 2400) detects start bit and then reads 8 bits as zero because COM port is too slow. PC even does not start data transmit at time when UART has already read all data. So you get 0x00. Regards, Oleg |
Topic | Author | Date |
A broblem in serial communication | 01/01/70 00:00 | |
Too many unknowns! | 01/01/70 00:00 | |
RE: Too many unknowns! | 01/01/70 00:00 | |
RE: A broblem in serial communication | 01/01/70 00:00 | |
RE: A broblem in serial communication | 01/01/70 00:00 | |
RE: A broblem in serial communication | 01/01/70 00:00 | |
RE: A broblem in serial communication | 01/01/70 00:00 | |
RE: A broblem in serial communication | 01/01/70 00:00 | |
RE: A broblem in serial communication | 01/01/70 00:00 | |
RE: A broblem in serial communication | 01/01/70 00:00 | |
RE: A broblem in serial communication![]() | 01/01/70 00:00 |