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.

I want to type a message on hyper terminal and send it to Micro controller usng Rs232

Status
Not open for further replies.

euro007

Newbie level 2
Joined
Oct 8, 2010
Messages
2
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Activity points
1,293
I want to type a message on hyper terminal and send it to Micro controller by using Rs-232 serial cable. Can any one tell me how to do this ??

Regards:
Tipu Pasha
 

Follow the following steps
1>Enable the serial communication in MC
2>Write the ISR for the serial communication such that whenever the serial interrupt occurs the data is stored in some memory location(this is to ensure that next character will not spoil the previous data).

The wiring can be done as follow(assuming a fullduplex)

Txn(MC)---->Rxn(PC)
Rxn(MC)---->Txn(PC)
Gnd(MC)---->Gnd(PC)

NOTE:Since RS-232 standard does not meet the TTL signal level, use a RS232 to TTL level translator(MAX232) between the MC and PC com port.
 
if you dont want to use ISR you can even use printf and scanf in you MCU program. ..
prinft will give you instruction on HT and whatever you type in HT will be read by scanf
 

//#include<stdio.h>
#include<reg51.h>

sbit rs=P3^6;
sbit en=P3^7;

void cmdwrt();
void delay();
void datawrt();

unsigned char dis[7]={0x30,0x38,0x01,0x06,0x0f,0x80};
unsigned char a;

main()
{
int i;
for( i=0;i<=7;i++)
{
a=dis;
cmdwrt();
delay();
}

TMOD=0x20;
SCON=0x50;
TH1=0xfa;
TR1=1;
while(1)
{
while(RI==0);
a=SBUF;
RI=0;
datawrt();
delay();
}
}

void cmdwrt()
{
rs=0;
P0=a;
en=1;
delay();
en=0;
}
void datawrt()
{
rs=1;
P0=a;
en=1;
delay();
en=0;

}

void delay()
{
int i;
for(i=0;i<1000;i++);
}



connect lcd pins as shown in the code and use rs232 cable and connect MC and serial port of comp. config hyperterminal as per settings done in the code and you get the output
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top