serial communication

SgtWookie

Joined Jul 17, 2007
22,230
I posted a schematic that shows one complete schematic with the parts necessary for a single 8051 controller to communicate via RS-232.

It is as simple as building two of those circuits. Then since they are both DCE devices, you simply connect the TX of the 1st one to the RX of the 2nd, the RX of the 1st to the TX of the 2nd, and connect the two grounds together.

The connections are also mentioned at the bottom of the schematic.

If you are connecting to DTE (Data Terminal Equipment), you connect TX->TX and RX->RX.
 

Thread Starter

mehtab102

Joined Jun 21, 2011
62
Org 00h
mov tmod,#-3
mov scon,#50h
setb tr1
again:mov sbuf,#'y'
here:jnb ti,here
clr ti
mov p0,#'n'
sjmp again
end


sir i have this code.....
What would be the schematics for this??
M waiting...
Thnx.
 
Last edited:

SgtWookie

Joined Jul 17, 2007
22,230
I have NO clue what that code is supposed to do, except loop to "here:" waiting for something called "ti" to not be "b", whatever that is.
 

Thread Starter

mehtab102

Joined Jun 21, 2011
62
AHH!
this is the code for tranfer a letter 'y' serially at the baud rate 9600 continously and also send the letter 'N' through port 0,which is connected to a display device...

this was the question from my girl friend...wwe are class fellow..for making friendship with her i told her that i know about serial communication..

so plz help me...
 

SgtWookie

Joined Jul 17, 2007
22,230
You left out some commands, and you did not comment anything, and you had everything starting in the 1st column.
Lack of comments makes code meaningless. Only labels should start in the 1st column.

I'm not going to try to decipher any more of your code after this unless it has meaningful comments included - on every line.

Rich (BB code):
         Org    00h         ' Program start location
Serial_Init:
         mov    tmod,#20h   ' set timer 1 mode to ?.
         mov    scon,#50h   ' set serial port mode to 8 bit UART, 50h = 80d =  1010000b
         mov    th1,#0FDh   ' baudrate 9600 @ 11.0592MHz
         mov    tl1,#0FDh   ' "        "    " "
         setb   tr1         ' start timer
again:
         mov    sbuf,#'y'   ' move a "y" to the send buffer, wherever that is.
Serial_Send:
         jnb    ti,Serial_Send  ' Wait for last data to be sent completely
         clr    ti          ' Clear transmit interrupt flag
         mov    p0,#'N'     '  output an "N" to port 0
         sjmp   again
         end
 

Thread Starter

mehtab102

Joined Jun 21, 2011
62
i said m bigginer with serial communication...
m very thankful to sgtwooki.
he help me in stepper motor ...
when i perform in my class with code and practically.
all of them appreciate me...
thanks sir..
now, i again want help....about serial communication..
i will thank full to all
 

Thread Starter

mehtab102

Joined Jun 21, 2011
62
i want schematics such as on proteous...
these links are bed...
yo should help me like sir sgtwooki...
he understand every thing. even year a 16 year old boy...
you should also work like them..plz
 

strantor

Joined Oct 3, 2010
6,875
i want schematics such as on proteous...
these links are bed...
yo should help me like sir sgtwooki...
he understand every thing. even year a 16 year old boy...
you should also work like them..plz
I think sgtWookie understands everything except you. How about you work like a 16 y/o boy and post some schematics yourself. We will go from there. You still haven't said what you want. Try that. We can work around bad english, but we cannot read your mind. Maybe you should just tell that chick you really don't know anything about serial comms but you play a mean guitar and you're great in bed.
 

praondevou

Joined Jul 9, 2011
2,942
Maybe you should just tell that chick you really don't know anything about serial comms but you play a mean guitar and you're great in bed.
LOL, thanks for making me laugh!!:)

@Mehtab

Have a look at this link:

http://www.freewebs.com/maheshwankhede/index.html

You will have to work through the examples, meaning you'll have to READ what's written on this site. In the upper part you'll see a tab saying 8051 interfacing, start from there. You will find under "RS232 devices" an example in assembly and a circuit diagram. However this is to connect two MCs via RS232. As a few people already said, you can connect two MCs directly if they have the same power supply / reference. Tx to Rx, Rx to Tx.

Try to work through the link, understand it and THEN ask questions again.
 
Top