Showing results for 
Search instead for 
Did you mean: 

Serial Write and Read

Hello everybody,

I have a problem with serial comunication - when I put '8', I receive some unusual characters like 'Ć', and then '8'. On the end - error. I did something wrong?





0 Kudos
Message 1 of 5

You should only open and close the serial port ONCE.  Open and configure the serial port before the loop and close it after the loop.  You can read and write inside the loop all you want then.  I've seen weird situations where constantly configuring the port will give you weird random characters.


You should probably also use an Event Structure to control when the buffer is written.  For instance, only write out of the serial port when you hit a "Send" button.


Are you using a loopback cable?  Or are you trying to talk to an instrument that is just sending back the data you sent?

There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 5

Could you show me example of solution similar to my problem? I did as you tell, but still problems occur. Maybe not weird characters but slow transmission and I have to reset my program before sending one character.  I'm using USB cable with RS-232 adapter. Microcontroler Atmega32A (pins TxD and RxD are in charge of data transmission)

0 Kudos
Message 3 of 5

I have already found a solution. Thanks for your help 🙂

0 Kudos
Message 4 of 5

@eadfaedwda wrote:

I have already found a solution. Thanks for your help 🙂

The best way to say thank you is with kudos.

0 Kudos
Message 5 of 5