Microcontroller › 8051 › serial communication in proteus and hyperterminal
- This topic has 16 replies, 11 voices, and was last updated 12 years, 2 months ago by amit.
-
AuthorPosts
-
October 12, 2011 at 7:15 am #1308JulianParticipant
Hi, I just started some research on serial communication between pc and 8051. But i want to do it on proteus first, meaning hyperterminal will be linked with proteus. If i were to send characters from the pc to the 8051 to be displayed on a LCD, when I simulate on proteus I just type the characters on the terminal and write codes for the microcontroller to receive data serially right? Do I have to write codes for the terminal to send data too?
October 12, 2011 at 11:00 am #6692nikhiljainParticipantWell don’t know whether it will work or not…I think you will have to use the serial port because how will the hyper terminal get connected to Proteus. Check there should be some opiton of using sending or receiving dsta serially in Proteus.
October 12, 2011 at 11:57 am #6701QaisarParticipanthi
yes proteus has built in virtual terminal that works as hyperteminal ..
u can simulate ur code …
u can find virtual terminal in virtual instrument list …
here i have simple code that sends alphabets(A-Z) to PC..
if u really want to send any data from controller to PC or from PC to controller u need MAX232 between PC and micrcontroller…
Code:
/// programme to send alphabetic(A-Z) to PC through serial Port#include <AT89X51.H>void delay(unsigned int d){unsigned int i,j;for(i=0;i<=d;i++)for(j=0;j<=1000;j++);}void main(void){unsigned char z;TMOD=0x20;TH1=0xF3;SCON=0x50;TR1=1;while(1){for(z=65;z<=92;z++) // 65 is equivalent code for A.{SBUF=z;if(z==92){SBUF=13; /// carriage return}while(TI==0);delay(50);TI=0;}}}
October 12, 2011 at 11:59 am #6702QaisarParticipantOctober 12, 2011 at 2:10 pm #6703JulianParticipantHi Qaisar,
Thx so much 4 your reply and the code you provided. Yes, I know there is a virtual terminal in Proteus. Question, are the virtual terminal same as the hyperterminal of windows? Let’s say if i were to use the virtual terminal, i will need a virtual serial port driver right (read this from somewhere else)? The code you provided is to send characters to the virtual terminal from 8051. However, what I am trying to do is to send data from terminal to 8051 uC. Question, I know I wil have to write codes 4 the uC to receive data but do I have to also write codes for the terminal to send data? So is it automatically the virtual port will understand?
Ya, I know about the max232 and rs232. I’m just very confuse about the terminals. Read through a lot of forums however no one discussed bout this.
October 12, 2011 at 3:08 pm #6704QaisarParticipanthi
no…
there is no additional driver required to send data from PC hyperterminal to microcntroller..
all the coding has to do in microcontroller end …
u just write any character in hyperterminal and it to will transfer to SBUF reg in microcontroller..
copy the content of SBUF reg and use that data ..
important thing is that the recieved data is in ascii format ..u have to convert to some other format as per ur requirement ..
regards…
October 12, 2011 at 3:55 pm #6705JulianParticipantHi,
So meaning that I just have to write my program in Keil uVision and generate hex file and load into proteus and setup the hyperterminal?
October 12, 2011 at 5:24 pm #6706QaisarParticipantyes it is …
October 13, 2011 at 2:56 pm #6709JulianParticipantThanks so much for your contribution. I appreciate your guidance
January 28, 2012 at 7:09 pm #7085Aniket DeshpandeParticipantHi Qaisar,
I tried your code on Proteus:
1. by connecting 8051 TXD directly to virtual terminal RXD as shown in the figure- I got garbage data on the virtual terminal.
2. by connecting MAX232 and RS232 between 8051 and virtual terminal- no data was recieved on the virtual terminal.
Another doubt I have is, shouldn’t we enter the ASCII values in hex instead of decimal?
Aniket.
May 29, 2012 at 4:44 am #7926AKSHAY KAUNDALParticipanthow to create a virtual terminal
June 20, 2012 at 12:25 am #8091AnonymousGuestGarbage values are due to unmatched baudrates … set the baudrate of virtual terminal to 4800 … and You’ll get the desired output
June 20, 2012 at 12:35 am #8092mani sankarParticipantHow to receive data from PC ??
June 20, 2012 at 2:08 am #8093AmrithParticipanthi mani,
you can receive data using hyperterminal.. Go to start–> All Programs–>Accessories–>communication–> HyperTerminal
June 27, 2012 at 8:22 pm #8144midhunParticipantDo you know visual basics? if yes it will be a very easy task 4 u to do serial communication between PC and controller. you can make your own GUI to transmit data and also to receive data. it will be very helpful in your future projects too..
-
AuthorPosts
- You must be logged in to reply to this topic.