Help!!! Reg interfacing LCD to 8051 using 8255

Status
Not open for further replies.

Dhans

Junior Member level 3
Joined
Sep 14, 2005
Messages
30
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,473
hi
I am interfacing LCD to 8051 using PPI(8255) using C programming. i Dont know how to define the 8255 port address and control word register. can anyone help in this ?
 

If the 8255 is connected to 8051 as per attached picture (except for A14-to-CS connection, CS should be connected to 0V) then you will be using the following addresses:
PA => 0000h
PB => 0001h
PC => 0002h
CR => 0003h
The following example shows how to address the above registers using DPTR and MOVX instruction:
Code:
#asm

test:
 	mov 	A, #80H 	; control word
	mov 	DPTR, #0003H 	; address of CR
	movx 	@DPTR, A 	; write control word
	mov 	A, #55h 	; will try to write 55 and AA alternatively

repeat:
	mov DPTR, #0000H 	; address of PA
	movx @DPTR, A 		; write 55H to PA
	inc DPTR 		; now DPTR points to PB
	movx @DPTR, A 		; write 55H to PB
	inc DPTR 		; now DPTR points to PC
	movx @DPTR, A 		; write 55H to PC
	movx @DPTR, A 		; write 55H to PC
	cpl A 			; toggle A (55àAA, AAà55)
	sjmp repeat

#endasm

Regards,
IanP
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…