How to interface a Ericsson A2618 / A2628 lcd with a PIC16F84A microcontroller


Ericsson A2618 / A2628 lcd interface schematic


A2618 lcd screen can be fitted into a R320 screen housing.


Download assembler code file for Ericsson A2618 / A2628 lcd interface.
;=====i2c lcd test for Ericsson A2618 / A2628 / Version 1.0======24/08/03==
;	iic lcd driver: real PCF8548 with mirror higher and lower rows
;	ra0,ra1,ra2,ra3     sdata, sclock, _reset,lcd power control
;	rb0 to rb7	led outputs
;	internal clock
;	standard crystal 4.000 MHz XT - 1us pe instructiune
;	www.module.ro
;------------------------------------------------------------
	list	p=16f84A;f=inhx8m
_CP_OFF	equ	H'3FFF'	      ;code protect off
_PWRTE_ON	equ	H'3FFF' 		;Power on timer on
_WDT_OFF	equ	H'3FFB'		;watch dog timer off
_XT_OSC		equ	H'3FFD'	;crystal oscillator
	__CONFIG       _CP_OFF & _PWRTE_ON & _WDT_OFF & _XT_OSC
;------------------------------------------------------------
;      cpu init
status	equ	03
porta	equ	05
portb	equ	06
count1	equ	0C
count2	equ	0D
count3	equ	0E
transo	equ	0F
count4	equ	10
count5	equ	11
trisa	equ	85
trisb	equ	86	
#DEFINE pwroff	porta,3
#DEFINE rset	porta,2
#DEFINE sclk	porta,1
#DEFINE sdta	porta,0
;------------------------------------------------------------
;      bit init
rp0	equ	5
w	equ	0
f	equ	1
;------------------------------------------------------------
	org	0
;
;------------------------------------------------------------
init	bsf	status,rp0  ;switch to bank 1
	movlw	0	; porta and portb set to outputs
	movwf	trisa
	movwf	trisb
	bcf	status,rp0  ;switch back to bank 0
	movlw	0xFF
	movwf	porta	
	movwf	portb	; led test
;***************************************************
start	bcf	rset
	bcf	pwroff
	call	halta	; rset time - min. 100ns
	bsf	rset	; reset finished
;***************************************************
;* Lcd init commands                               *
;***************************************************
	call	iict	; i2c start
	movlw	0x7A	; device write address 
	call	act	; i2c send subroutine
	movlw	0x00	; many command bytes follow - see pcf8548 data sheet	
	call	act	; i2c send subroutine
	movlw	0x21	; extended set command
	call	act
	movlw	0x0F	; DSR=TSR=DO=1 lcd configuration - LSB up, mirror upper and lower rows
	call	act
	movlw	0x15	; bias
	call	act
	movlw	0xEA	; Vop
	call	act
	movlw	0x20	; normal command set
	call	act
	movlw	0x0C	; normal lcd mode
	call	act
	call	iicp	; i2c stop
;***************************************************
;* Lcd data commands                               *
;***************************************************
	call	iict	; i2c start
	movlw	0x7A
	call	act
	movlw	0x40	; multiple data bytes
	call	act
	call	cbild	; clear screen
	call	iicp	; i2c stop
;***************************************************
	call	iict	; i2c start
	movlw	0x7A
	call	act
	movlw	0x00	; (0x80 for just one command)
	call	act
	movlw	0x44	; Y address
	call	act
	movlw	0xA7	; X address
	call	act
	call	iicp	; i2c stop
;***************************************************
	call	iict	; i2c start
	movlw	0x7A
	call	act
	movlw	0x40	; multiple data bytes
	call	act
	movlw	0x1F	;P
	call	act
	movlw	0x05
	call	act
	movlw	0x07
	call	act
	movlw	0x00
	call	act
	movlw	0x1F	;H
	call	act
	movlw	0x04
	call	act
	movlw	0x1F
	call	act
	movlw	0x00
	call	act
	movlw	0x1F	;I
	call	act
	movlw	0x00
	call	act
	movlw	0x1F	;L
	call	act
	movlw	0x10
	call	act
	movlw	0x10
	call	act
	movlw	0x00
	call	act
	movlw	0x1F	;I
	call	act
	movlw	0x00
	call	act
	movlw	0x1F	;P
	call	act
	movlw	0x05
	call	act
	movlw	0x07
	call	act
	movlw	0x00
	call	act
	movlw	0x12	;S
	call	act
	movlw	0x15
	call	act
	movlw	0x09
	call	act
	movlw	0x00
	call	act
	call	iicp	; i2c stop
homa	goto	homa
;***************************************************
cbild	movlw	0x08	; 64 rows 
	movwf	count5
	bcf	sdta	
linee	movlw	0x66	; 102 columns
	movwf	count4
wdh	movlw	0x08	; 8 bit data
	movwf	count3
wbit	bcf	sclk
	call	pause
	bsf	sclk
	call	pause
	bcf	sclk
	decfsz	count3,f
	goto	wbit
	call	ackp
	decfsz	count4,f	
	goto 	wdh 	
	decfsz	count5,f
	goto 	linee
	retlw	00 
;***************************************************
act	movwf	transo	; iic data transmission 
	call	oled	
	movlw	0x08
	movwf	count3
vbit	bcf	sclk
	call	pause
	btfsc	transo,7	
	bsf	sdta
	btfss	transo,7
	bcf	sdta
	call	pause
	bsf	sclk
	call	pause
	bcf	sclk
	call	pause
	rlf	transo,f
	decfsz	count3,f
	goto	vbit
	call	ackp
	retlw	00
;***************************************************
iicp	bcf	sdta	; stop condition module
	call	pause
	bsf	sclk
	call	pause
	bsf	sdta	; stop command
	call	pause
	bcf	sclk
	call	pause
	retlw	00
;***************************************************	
iict	bsf	sdta	; start condition module 
	bsf	sclk
	call	pause
	bcf	sdta	; start command
	call	pause
	bcf	sclk
	call	pause
	retlw	00
;***************************************************
ackp	bsf	status,rp0  ;switch to bank 1
	movlw	0x01	; sdta set to input
	movwf	trisa
	bcf	status,rp0  ;switch back to bank 0
	bsf	sclk	; one clock step for acknowledge (no read data)
	call	pause
	bcf	sclk
	bsf	status,rp0  ;switch to bank 1
	movlw	0	; porta set to output
	movwf	trisa
	bcf	status,rp0  ;switch back to bank 0
	bcf	sclk
	bcf	sdta
	retlw	00
;***************************************************
oled	call	halta	; iic data before transmission displayed on portb
	movlw	0x00
	movwf	portb 
	movf	transo,w
	movwf	portb
	call	halta
	movlw	0x00
	movwf	portb
	retlw	00
;***************************************************
pause	movlw	0xFF
	movwf	count1
d1	decfsz	count1,f	
	goto 	d1		
 	retlw	00
;***************************************************
halta	movlw	0x04	; cca. 320ms delay
	movwf	count3
r3	movlw	0x7F
	movwf	count1
r1	movlw	0xFF	  
	movwf	count2
r2	decfsz	count2,f	
	goto 	r2		
	decfsz	count1,f	
	goto 	r1		
	decfsz	count3,f    
	goto	r3          
	retlw	00
;------------------------------------------------------------
	end
;============================================================

Back to my home page
Last updated August, 2003
© Copyright 2003 Bergthaller Iulian-Alexandru