UART problem with AT90S8515

I'm having problems using the UART on my AT90S8515. I want to send ASCI characters from AT90S8515 to the PC. I am using STK200 and AVR GCC with library AVRlib from Procyon. I am using the function "void uartSendByte (u08 txData)" to send one byte. The problem is that I get wrong byte in the PC. I use hyperterminal in windows. I have set hyperterminal to 9600 baud, 2 stop bits and no parity. I don't know how to set these parameters on the AVR.

The code for the AT90S8515 looks like this.

#include #include #include

#include "global.h" #include "uart.h" #include "rprintf.h"

int main(void) { uartInit(); uartSetBaudRate(9600); uartSendByte(10);

return 0; }

When AT90S8515 sends 10 to the PC i get something else.

Reply to
Oualid
Loading thread data ...

Be sure to RTFM regarding that third-party library function. And not just that single function, either.

Well, what *do* you get, then? The less details you give, the harder it gets for anybody trying to help you.

2 stop bits is quite unusual. The usual mainstream setting is "8N1

--- 8 bit, no parity, one stop bit". Are you sure you need 2?

Then find out. Or use a scope to see what the AVR does send, in the state you get without setting any of these explicitly...

10 is '\n', i.e. the ASCII Linefeed character --- hardly a good choice for a test, because there are additional complication regarding it, like CRLF LF translation in various stages of the process. Better start out with a simple letter, e.g. 0x55 = 85 = 'U'.
--
Hans-Bernhard Broeker (broeker@physik.rwth-aachen.de)
Even if all the snow were burnt, ashes would remain.
Reply to
Hans-Bernhard Broeker

Did you remember to put the processor clock speed in? You need to tell the compiler the crystal speed so that it can calculate the correct baud rate.

Peter

Reply to
moocowmoo

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.