2 LCD in serial using interrupts with 8051

Thread Starter

PY01A0080

Joined Mar 7, 2013
42
Hi,
i'm trying something very hard for me, i want to connect two 8051 and each one with one LCD (16X2) in serial using Interrupts.

So after learning interrupts with books, i tried to do something like this,
i created two projects in keil and one file in Proteus with the design mentioned above.

so for Transmission:
Rich (BB code):
org 0000h
ljmp main
main:
mov tmod,#29h
mov th1,#0fdh
setb tr1;
mov scon,#50h

mov p2,a
mov sbuf,a
jnb ti,$
clr ti
ret

mov a,#38h; 
lcall led_command
lcall delay
mov a,#0eh; 
lcall led_command
lcall delay
mov a,#01h; clear screen
lcall led_command
lcall delay
mov a,#06h; auto-increment
lcall led_command
lcall delay
mov a,#80h; cursor position at 1 
lcall led_command
lcall delay
mov a,#'P'
lcall led_data; send P 
lcall delay
mov a,#'A'; send A
lcall led_data
lcall delay
Loop: sjmp Loop
led_data:
setb p0.0; RS
clr p0.1; RW
setb p0.2; E
mov p2,a
clr p0.2
ret

led_command:
clr p0.0; RS
clr p0.1; RW
setb p0.2; E
mov p2,a
lcall delay
clr p0.2; E
ret
delay: 
mov r4,#04h	
mov r5,#080h
mov r6,#0ffh
djnz r6,$
djnz r5,$-2
djnz r4,$-4
ret
end
and the second file for Reception:
Rich (BB code):
 org 0023h 
ljmp main
org 0023h
mov a,sbuf
mov p2,a
clr ri
reti
 
main:
lcall led_command
lcall led_data
									 
mov tmod,#20h			 
mov th1,#0fdh			  
mov scon,#50h			  
setb tr1
mov ie,#90h
sjmp $
end
so when i try this, nothing's happen but i can see some data going very fastly in the virual terminal.

do i have to add the same lines for sending data and command in the reception file? or anything else to do here?
Thank you for your help
PY01A0080
 

Attachments

Thread Starter

PY01A0080

Joined Mar 7, 2013
42
Yes , i added these lines:
in the reception file.

Rich (BB code):
main:
mov a,#38h; Initialization of lcd screen 2X16
lcall led_command
lcall delay
mov a,#0eh; Display on, curson on, cursor blinking OFF
lcall led_command
lcall delay
mov a,#01h; clear screen
lcall led_command
lcall delay
mov a,#06h; auto-increment
lcall led_command
lcall delay
mov a,#80h; cursor position at 1 
lcall led_command
lcall delay

mov a,#'P'
lcall led_data; send P 
lcall delay
mov a,#'A'; send A
lcall led_data
lcall delay

led_data:
setb p0.0; RS
clr p0.1; RW
setb p0.2; E
mov p2,a
clr p0.2
ret

led_command:
clr p0.0; RS
clr p0.1; RW
setb p0.2; E
mov p2,a
lcall delay
clr p0.2; E
ret
 									 
mov tmod,#20h			 
mov th1,#0fdh			  
mov scon,#50h			  
setb tr1
mov ie,#90h
sjmp $
delay: 
mov r4,#03h	; use 04h for 1 second delay
mov r5,#080h
mov r6,#0ffh
djnz r6,$
djnz r5,$-2
djnz r4,$-4
ret
 

Thread Starter

PY01A0080

Joined Mar 7, 2013
42
Yes it's working now.
so here's the correction to the Transmission file:
Rich (BB code):
transmit:
mov sbuf,a
jnb ti,$
clr ti
lcall delay
ret
and in the Reception file:
Rich (BB code):
mov a,sbuf
clr ri
lcall led_data
reti
after that it works fine
sorry for the late.
 
Top