Microcontroller › AVR › UART communication problem
- This topic has 9 replies, 5 voices, and was last updated 9 years, 9 months ago by
T Kande.
-
AuthorPosts
-
September 29, 2014 at 6:56 pm #3278
bilal ahmed
ParticipantI have programmed the atmega16 to recive data serially and diaply it on LCD and perform the respective operations, but it shows the garbage/wrong characters on LCD if i send the data from hyperterminal/proteus and if i send the data from the serial port of an other atmega16 it works fine. so simply the code is correct but PC com port is not correctly communicating. any idea??
using internal clock @ 4 MHz.
September 30, 2014 at 4:31 am #12242AJISH ALFRED
ParticipantHi,
The PC serial port uses RS232 standard whereas the microcontroller uses TTL standard. You mentiioned that you were able to communicate between two atmega, you can since they are using the same TTL standard. Inorder to make the microcontroller communicate with a PC port you need a MAX232 converter IC inbetween the PC port and the microcontroller.
September 30, 2014 at 2:29 pm #12243bilal ahmed
Participantyeah I know it, I am using a max232 circuit and its transmitting garbage data
October 1, 2014 at 6:40 am #12249AJISH ALFRED
ParticipantAlright, please post the circuit diagram and the snapshot of your hardware connections.
October 2, 2014 at 5:58 am #12254Ashutosh Bhatt
Participantfor communicating with PC is is required to set exactly same baud rate at both ends. I think using 4 MHz crystal it wont be possible to generate standard baud rate of 4800 bps or 9600 bps. first calculate required crystal value from 9600 bps baud rate and then use that crysal.
one more thing is whatever you will get from PC will be HEX data. to display it on LCD you have to convert it into ASCII first
October 7, 2014 at 5:31 am #12266himanshu mittal
Participantthe same problem i am getting using atmega16 16 mhz crystal. Baudrate, max232 everything is fine . when i transmit data from microcontroller it works fine but when i transmit data from pc to microcontroller it shows garbage value. i can’t understand what is the problem.
October 8, 2014 at 6:19 pm #12268Ashutosh Bhatt
Participantin two AVR micro controller you will not get any problem in sending or receiving data because you have to set same crystal and same UBRR value thats it.
but when one end is computer matching baud rate is an issue.
how are you sending data from PC? through hyper terminal? flash magic? putty?
October 9, 2014 at 4:55 am #12271himanshu mittal
Participantusing tera term and a serial terminal software but both has same problem
October 13, 2014 at 6:25 pm #12281Ashutosh Bhatt
Participanthave you written the subroutine or any function to convert the HEX data available from serial port of computer into ASCII?
April 23, 2015 at 8:03 am #12818T Kande
Participanti am also having the same problem. i am reading 2 adc value from my atmega32 and send them serially via ftdi chip to GUI in vb. On the GUI im receiving the exact values since i have also an lcd displaying the values. The problem im having is receiving values on the atmega from the GUI, im getting garbage data instead of values and im failing to come up with the function to convert into actual integer values. Your help wil be appreciated
-
AuthorPosts
- You must be logged in to reply to this topic.