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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
04/12/07 21:05
Read: times


 
#137075 - RxD to LCD problems
Hi,

How do I display data received from the RxD pin onto the LCD screen?

I have 2 rf transceiver relaying data from one end to another and it's working fine. When I receive the data at the uC of the receiving end. I wish to display the data onto the LCD but I cannot seem to get it working.

Here's the code for the transmitting end:
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
ORG 0000H
MOV SCON, #01000000B ; set serial port for mode 1 operation
MOV TMOD, #20H ; set timer 1 to auto reload
MOV TH1, #0FDH ; set reload value for 9600 baud at 11.059MHz
SETB TR1 ; start timer 1
CLR TI

LOOP:
MOV SBUF, #55H ; transmit “55” hex out in TxD line
JNB TI, $ ; wait until done
CLR TI ; clear transmit flag ready to go again
END
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

And here's the code for the receiving end:
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
ORG 00H
JMP MAIN

ORG 23H
JMP SERIAL_ISR

MAIN: MOV SCON, #50H ; 50H=01010000B
MOV TMOD, #20H ;
MOV TH1, #0FDH ;

MOV IE, #10010000B

SETB TR1
CLR RI

SERIAL_ISR: JNB RI, SERIAL_ISR
CLR RI
MOV R2, SBUF
CALL INIT_LCD
CALL DATA_DISPLAY

INIT_LCD:
MOV A,#38H ; initialization
ACALL CMD ; issue command
MOV A,#0EH ; LCD ON, cursor ON
ACALL CMD ;
MOV A,#01H ; clear LCD
ACALL CMD ;
MOV A,#00H ; shift cursor right
ACALL CMD ;
MOV A,#80H ; cursor: line 1, position 6
ACALL CMD ;
RET


CMD: MOV P1,A ; issue command code
CLR P3.3 ; clear RS=0, for command
CLR P3.4 ; clear R/W=0, to write to LCD
NOP
SETB P3.5 ; set E=1
NOP
NOP
CLR P3.5 ; clear E=0, to generate an H-to-L pulse
ACALL DELAY ; give LCD some time
RET;


DELAY: MOV R1,#49 ; second-loop counter
LOOP2: MOV R0,#0FFH ; first-loop counter
LOOP1: DJNZ R0,LOOP1 ; loop 255 times
DJNZ R1,LOOP2 ; loop 49 times
RET

DATA_DISPLAY:
MOV P1,R2 ; issue data
SETB P3.3 ; set RS=1, for data
CLR P3.4 ; clear R/W=0, to write to LCD
NOP
SETB P3.5 ; set E=1
NOP
NOP
CLR P3.5 ; clear E=0, to generate an H-to-L pulse
ACALL DELAY ; give LCD some time

END

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

For your information, i have already tested on the LCD seperately. It's working fine.

Please assist.

List of 34 messages in thread
TopicAuthorDate
RxD to LCD problems            01/01/70 00:00      
   Serial ISR            01/01/70 00:00      
   work needed.            01/01/70 00:00      
   you need to control flow            01/01/70 00:00      
      confused            01/01/70 00:00      
         this is what I mean            01/01/70 00:00      
            OK            01/01/70 00:00      
               yes            01/01/70 00:00      
            Non-useful Serial ISR            01/01/70 00:00      
               AND it's stuck            01/01/70 00:00      
                  thanks            01/01/70 00:00      
               I was going for optimization.            01/01/70 00:00      
      It's functioning            01/01/70 00:00      
         now stay consistent            01/01/70 00:00      
            Terminating code?            01/01/70 00:00      
               .            01/01/70 00:00      
                  correct terminology            01/01/70 00:00      
                  Missing the point            01/01/70 00:00      
                     i get it now            01/01/70 00:00      
                        Most, but not all            01/01/70 00:00      
                        why on earth            01/01/70 00:00      
                        if it\'s almost correct, it\'s still wrong :-)            01/01/70 00:00      
                           ok            01/01/70 00:00      
                              Not R6 and R7            01/01/70 00:00      
                                 well it happend again            01/01/70 00:00      
                                    Q.E.D.            01/01/70 00:00      
                                       One further comment is needed            01/01/70 00:00      
                              Hey            01/01/70 00:00      
                        Dangerous recommendation            01/01/70 00:00      
                           good point            01/01/70 00:00      
                              they all do            01/01/70 00:00      
                  it 'trust' the same as 'experiment'?            01/01/70 00:00      
   more issues            01/01/70 00:00      
      Joe, please read this            01/01/70 00:00      

Back to Subject List