Microcontroller › 8051 › serial communication between pc and AT89c52
- This topic has 8 replies, 4 voices, and was last updated 11 years ago by
AJISH ALFRED.
-
AuthorPosts
-
May 9, 2012 at 2:52 pm #1232
bll
Participanthelloo, i need codes to communicate pc with AT89c52, pls help me
May 10, 2012 at 3:00 am #7694Harsh Pandya
ParticipantSerial Communication
UART (Universal Asynchronous Receiver Transmitter) or USART (Universal Synchronous Asynchronous Receiver Transmitter) are one of the basic interface which you will find in almost all the controllers available in the market till date. This interface provides a cost effective simple and reliable communication between one controller to another controller or between a controller and PC.
RS-232 Basics
RS-232 (Recommended Standard 232) is a standard for serial binary data signals connecting between a DTE (Data terminal equipment) and a DCE (Data Circuit-terminating Equipment).
RS-232 Level Converters
Usually all the digial ICs works on TTL or CMOS voltage levels which cannot be used to communicate over RS-232 protocol. So a voltage or level converter is needed which can convert TTL to RS232 and RS232 to TTL voltage levels. The most commonly used RS-232 level converter is MAX232. This IC includes charge pump which can generate RS232 voltage levels (-10V and +10V) from 5V power supply. It also includes two receiver and two transmitters and is capable of full-duplex UART/USART communication.
MAX232 Pin Description
MAX232 Typical Connection CircuitFIG 3.28 MAX232
MAX232 Interfacing with Microcontrollers
To communicate over UART or USART, we just need three basic signals which are namely, RXD (receive), TXD (transmit), GND (common ground). So to interface MAX232 with any microcontroller (AVR, ARM, 8051, PIC etc..) we just need the basic signals. A simple schematic diagram of connections between a microcontroller and MAX232 is shown below
May 10, 2012 at 3:00 am #7713Harsh Pandya
ParticipantSerial Communication
UART (Universal Asynchronous Receiver Transmitter) or USART (Universal Synchronous Asynchronous Receiver Transmitter) are one of the basic interface which you will find in almost all the controllers available in the market till date. This interface provides a cost effective simple and reliable communication between one controller to another controller or between a controller and PC.
RS-232 Basics
RS-232 (Recommended Standard 232) is a standard for serial binary data signals connecting between a DTE (Data terminal equipment) and a DCE (Data Circuit-terminating Equipment).
RS-232 Level Converters
Usually all the digial ICs works on TTL or CMOS voltage levels which cannot be used to communicate over RS-232 protocol. So a voltage or level converter is needed which can convert TTL to RS232 and RS232 to TTL voltage levels. The most commonly used RS-232 level converter is MAX232. This IC includes charge pump which can generate RS232 voltage levels (-10V and +10V) from 5V power supply. It also includes two receiver and two transmitters and is capable of full-duplex UART/USART communication.
MAX232 Pin Description
MAX232 Typical Connection CircuitFIG 3.28 MAX232
MAX232 Interfacing with Microcontrollers
To communicate over UART or USART, we just need three basic signals which are namely, RXD (receive), TXD (transmit), GND (common ground). So to interface MAX232 with any microcontroller (AVR, ARM, 8051, PIC etc..) we just need the basic signals. A simple schematic diagram of connections between a microcontroller and MAX232 is shown below
May 10, 2012 at 5:48 am #7702Amrith
ParticipantHello,
There is an available solution on engineers garage for your query.
follow below link:
further doubts kindly post
May 10, 2012 at 5:48 am #7721Amrith
ParticipantHello,
There is an available solution on engineers garage for your query.
follow below link:
further doubts kindly post
May 10, 2012 at 8:10 am #7704bll
Participantim using these codes
#include <regx52.h>
unsigned char a ;void main(void)
{TMOD=0x20;
TH1=0xFD;
SCON=0x50;
TR1=1;IE=0X00;
while(1)
{
while(RI==0);
a=SBUF;
P1=a;
RI=0;
}}
but there is a problem at receiving data, i send numbers from 0 to 15, i got them properly at 89c52, but after 15 it doesnt work properly?, i cant see what is the problem.
May 10, 2012 at 8:10 am #7723bll
Participantim using these codes
#include <regx52.h>
unsigned char a ;void main(void)
{TMOD=0x20;
TH1=0xFD;
SCON=0x50;
TR1=1;IE=0X00;
while(1)
{
while(RI==0);
a=SBUF;
P1=a;
RI=0;
}}
but there is a problem at receiving data, i send numbers from 0 to 15, i got them properly at 89c52, but after 15 it doesnt work properly?, i cant see what is the problem.
May 11, 2012 at 2:44 pm #7742AJISH ALFRED
ParticipantIf everything else is right, I guess the problem might be there in the data type of the variable you are using. Well I’m not sure, anyway try changing the data type of ‘a’ to char a, or int a.
May 11, 2012 at 2:44 pm #7764AJISH ALFRED
ParticipantIf everything else is right, I guess the problem might be there in the data type of the variable you are using. Well I’m not sure, anyway try changing the data type of ‘a’ to char a, or int a.
-
AuthorPosts
- You must be logged in to reply to this topic.