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 using hyperterminal and 8051

Status
Not open for further replies.

saurabhprakash282

Newbie level 4
Joined
Sep 10, 2011
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,323
i am trying to send "hi how are you" serially to hyper terminal window from 8051....i have written my code in assembly language. i am getting the o/p in keil but when i am connecting the hardware on breadboard i am not getting the o/p. i have tried this on ISIS simulation without connecting to max232 and connecting directly to virtual terminal,i am getting the o/p but when i am connecting it to max 232 i am getting some garbage value.!!!!!!!!
plzzzzzzz helpppp......
 

yes sir both are same...and i am attaching the code and images..


---------- Post added at 18:32 ---------- Previous post was at 18:31 ----------

Mov tmod,#20h
mov th1,#-3
mov scon,#70h
setb tr1
mov a,#"h"
acall trans
mov a,#"i"
acall trans
mov a,#" "
acall trans
mov a,#"h"
acall trans
mov a,#"o"
acall trans
mov a,#"w"
acall trans
mov a,#" "
acall trans
mov a,#"a"
acall trans
mov a,#"r"
acall trans
mov a,#"e"
acall trans
mov a,#" "
acall trans
mov a,#"y"
acall trans
mov a,#"o"
acall trans
mov a,#"u"
acall trans
mov a,#"?"
acall trans
g:sjmp g
trans: Mov sbuf,a
here: Jnb ti,here
clr ti
ret

end
 

if the virtual terminal is giving correct reading when connecting to microcontroller UART (Tx) then it will not show the same reading with RS232 signal level.(your MAX232 output)
check this link and you will get the idea, I mean why it is showing the garbage value when you connected the virtual terminal to MAX232 o/p (RS232 standard)
MAX232 - Wikipedia, the free encyclopedia

But it should show the correct text in hyperterminal of PC...
In hyperterminal of PC, what you observed?
Nothing or any garbage?
 

Code:
        SCON	=	0x50;		//mode1, 8bit UART, Reception Enable
	TMOD	= 	0x20;		//timer 1 8-bit auto-reload
	TH1 	= 	UART_SetBaudRate(CLK_110592, UART_BAUD_19200); //Baud Rate 9600 8-n-1
	TL1 	= 	TH1;		//Reload count
	ES	=	ON;		//Enable Serial Intr 
	PS	=	ON;		//Set High Priority of Serial Intr
	EA	=	ON;		//Enable Global Intr
	TR1 	= 	ON;		// Start timer

//Start sending Data...

	SBUF	=	0x55;        //send data through serial port
	while(!TI)
	{
	}

I have written the above code in C and it is working fine.
Please check if your code has all the above settings done.
In place of UART_SetBaudRate() you can use a predefined count.

I guess you are using following configuration...

BaudRate - 9600
No of bits - 8
Parity - None
stop bit - 1


Make sure that this configuration is same on MCU side as well as on hyperterminal side.

If it still doesnt work, let me know.
 

please tell me that is there any thing wrong in my assembly program as i have to do it in assembly....and one more thing that can i use lcd to display the transferred data???
 

what is the crystal value it should be 11.0592mhz
 

check with this code. at first it displays ok in pc then what ever you type in keyboard will be retarnsmitted by themicro controller and same will be displayed in pc

ORG 0H
JMP MAIN

ORG 30H
MAIN:
CALL INIT

MOV SBUF,#'O'
JNB TI,$
CLR TI


CALL DELAY
MOV SBUF,#'K'
JNB TI,$
CLR TI

AGAIN:
JNB RI,$
MOV A,SBUF
CLR RI
MOV SBUF,A
JNB TI,$
CLR TI
JMP AGAIN
INIT:
MOV TMOD,#21H;;;;;;;;;;;;;9600BAUD RATE,8-BIT,1-STOP BIT;;;;;;;;;;;;;;
MOV TH1,#0FDH;
MOV SCON,#50H
SETB TR1
RET

DELAY:

MOV R7,#10D
L2: MOV R6,#100D
L1:
CALL DEL
DJNZ R6,L1
DJNZ R7,L2
RET

DEL:
MOV TL0,#7CH
MOV TH0,#0FCH
SETB TR0
JNB TF0,$
CLR TR0
CLR TF0
RET;


END
 

how is reception done in an 8051 uc...do we have to keep on resetting a ctsly transmting transmitter for the sequence to get received on the receiver????

---------- Post added at 15:24 ---------- Previous post was at 15:18 ----------

how is reception done in an 8051 uc???...do we have to keep on resetting a continuosly transmting transmitter for the sequence to get received on the receiver????
 

how is reception done in an 8051 uc...do we have to keep on resetting a ctsly transmting transmitter for the sequence to get received on the receiver????

---------- Post added at 15:24 ---------- Previous post was at 15:18 ----------

how is reception done in an 8051 uc???...do we have to keep on resetting a continuosly transmting transmitter for the sequence to get received on the receiver????

just connect the rx and tx pin to the pc through max232
 

its acually being sent over a 433mhz tx rx pair str 433...but the problem is that the sequence is not gattin received unless we press the reset switch on the transmitter...isnt it supposed to be asynchrinously receiving the sent info???...that means that as soon as it comes in the range of the transmitter it should start receiving the bits isnt it???but we need to continously pressing the reset button for it to work even if in range...plzz help
 

TRY THE CODE GIVEN BELOW :


Code ASM - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
org 00h
        mov TMOD,#20h
        mov TH1,#-3
        mov SCON,#50h
 
                
        setb tr1
 
         mov dptr,#msg
line:
clr a
movc a,@a+dptr
jz final2
lcall tran
sjmp line
 
final2:            sjmp $
 
 
 
tran:
mov SBUF,a
 
                JNB TI,$
                CLR TI
                inc dptr
                ret
 
org 23h
msg:
db "hi how are you",0
 
 
        
end




it will surely work , if still problem persists do let me know
 
Last edited by a moderator:

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top