Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

serial communication in proteus via virtual terrminal

Status
Not open for further replies.

barkatkhan

Newbie level 1
Joined
Jun 21, 2012
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,295
hi....
i want to send some strings serially using virtual terminal in proteus but i get garbage value on virtual terminal
can any one mail me proteus design for it on
hayatkhan015@yahoo.com
or
help me by some other way..

or there is some error in my program
which is..


#include <reg51.h>
void Delay();
void serialsend(char *ptr);

void main ()
{
char z;
code char command1[]={"AT12"};
code char command2[]={"ATC51" };
code char command3[]={"ADSING"};
code char command4[]={"12"};
code char command5[]={"ATMEL"};
code char command6[]={"CIPSEND"};
code char command7[]={"GPRS"};
code char command8[]={"26"};
TMOD=0x20;
TH1=0xFD;
SCON=0x50;
TR1=1;
serialsend(command1);
Delay();
serialsend(command2);
Delay();
serialsend(command3);
for(z=0; z<3; z++)
{ Delay(); }
serialsend(command4);
Delay();
serialsend(command5);
for(z=0; z<10; z++)
{ Delay();
}
serialsend(command6);
for(z=0; z<5; z++)
{ Delay(); }
serialsend(command7);
serialsend(command8);

}
void serialsend(char *ptr)
{
while(*ptr != '\0')
{
SBUF=*ptr;
while(TI==0);
TI=0;
ptr++;
}
}

void Delay()
{
unsigned char x;
for(x=0; x<40; x++)
{
TMOD=0x01;
TL0=0xFD;
TH0=0x4B;
TR0=1;
while (TF0==0);
TR0=0;
TF0=0;
}
}
 

What processor are you trying to use. Also, what is your baudrate set to. The most common cause of junk being spit out over uart is mismatched baudrates.

Regards,
Willis
 

Code:
    TMOD = 0x20;    //Timer-1, 8-Bit Auto Reload Mode
    TH1 = 0xFD;        //9600 Baud Rate When Crystal Used is 11.0592MHZ
    SCON = 0x50;
    TR1 = 1;        //Start Timer

this is right

Check your crystal frequency in proteus and also adjust the baud rate to 9600 by double clicking on Virtual Terminal
Hope this may solve your problem
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top