Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
12/03/02 10:16
Read: times


 
#33644 - RE: Serial programming problem
Dear John,
may be u need to use the interrupts for the serial module. i had one long back.u can
try this.
this will receive the data from the hyperterminal and will send back the letters changed to uppercase.
Before u try this check out ur serial interface for the following problems.
1.chk the rx and tx lines wrt gnd
2.just short rx and tx lines at the ur PC end without connecting any thing on the other end( at ur 9-pin D-type connector u can do this). chk whether with this u r getting the whatever u r sending. this will ensure that ur serial port is working properly and also ur hyper terminal tool.
3. u can also chk with a oscilloscope for the waveforms wrt gnd.

If all these things are ok and if u feel that the only problem is with the code then try this one

org 00h
SJMP MAIN
;-------------------------------------------
org 23h
SJMP SERINT ; jump to serial interrupt

;-------------------------------------------
org 0050h
MAIN:
MOV TMOD,#20H ;TIMER IN MODE 2 USED
MOV TH1,#0FDH ; RELOAD VALUE FOR TH1
MOV SCON,#50H ; SELECT SERIAL MODE
MOV TCON,#40H ;START THE TIMER

MOV R0,#60H ; POINTER FOR THE DISPLAY

MOV SP,#40H

SETB ES ; ENABLE SERIAL INTERRUPT
SETB EA ; ENABLE MASTER INTERRUPT

LOOP:
LJMP LOOP ; PROGRAM ALWAYS LOOPS HERE. SORT OF WHILE
;-------------------------------------------

SERINT:
JB RI,RECEVIE_RTN
CLR TI
RETI

RECEVIE_RTN:
PUSH PSW
PUSH ACC
MOV A,SBUF ; GET THE DATA
CLR RI

MOV @R0,ACC
INC R0
CLR C

SUBB A,#32 ; CHANGE IT TO UPPERCASE

MOV SBUF,A ; SEND IT BACK TO THE TERMINAL

POP ACC
POP PSW
RETI
;-------------------------------------------

END
;-------------------------------------------


good luck
-sathish

List of 13 messages in thread
TopicAuthorDate
Serial programming problem            01/01/70 00:00      
RE: Serial programming problem            01/01/70 00:00      
RE: Serial programming problem            01/01/70 00:00      
RE: Serial programming problem            01/01/70 00:00      
RE: Serial programming problem            01/01/70 00:00      
RE: Serial programming problem            01/01/70 00:00      
RE: Serial programming problem            01/01/70 00:00      
RE: Serial programming problem            01/01/70 00:00      
RE: Serial programming problem            01/01/70 00:00      
RE: Serial programming problem            01/01/70 00:00      
RE: Serial programming problem            01/01/70 00:00      
RE: Serial programming problem            01/01/70 00:00      
RE: Serial programming problem            01/01/70 00:00      

Back to Subject List