PIC16F84 power supply
LPH 7366 controled power supply
LPH 7366 interfacing with PIC16F84
LPH 7366 Pins (front view)
pin1 V+
pin2 Sclk
pin3 Sda
pin4 DorC
pin5 Cs
pin6 Osc (32768Hz external clock)
pin7 Gnd
pin8 Vout(DC/DC voltage converter)
pin9 Reset
LPH 7779 or LPH 7677 interfacing with PIC16F84
LPH7779, LPH7677 Pins (front view)
pin1 V+
pin2 Sclk
pin3 Sda
pin4 DorC
pin5 Cs
pin6 Gnd
pin7 Vout(DC/DC voltage converter)
pin8 Reset
The Osc for LPH7779 and LPH7677 is cca. 16KHz only internal generated.
;=======LCD_Nokia nse1,nse3,nsm1 / Version 1.0====================21/12/02==
; cod LPH7366-1, LPH7779, LPH7677 / driver PCD8544
; rb6,rb7 sclock,sdata
; ra0,ra1,ra2,ra3 d/C,Reset,Vccmd,SCE
; internal clock
; standard crystal 4.000 MHz XT - 1us pe instructiune/pe aproape
; Program realizat de Ing. Bergthaller Iulian-Alexandru
;------------------------------------------------------------
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
porta equ 05
portb equ 06
count1 equ 0C
count2 equ 0D
count3 equ 0E
afisaj equ 0F
#DEFINE sclk portb,6
#DEFINE sdta portb,7
#DEFINE dorc porta,0
#DEFINE rset porta,1
#DEFINE tens porta,2
#DEFINE enab porta,3
;------------------------------------------------------------
org 0
;
;------------------------------------------------------------
init
movlw 0
tris portb ; set portb as output
movwf portb ; all ouput low
movlw 0
tris porta ; set portb as output
movwf porta ; all ouput low
start call pause
bsf dorc
bsf enab
bsf tens ;activare tensiune
call lcres ;resetare cca. 250ms
movlw 21H ;set extins
movwf afisaj
call lccmd
movlw .197 ;Vop
movwf afisaj
call lccmd
movlw 13H ;bias
movwf afisaj
call lccmd
movlw 20H ;afisare orizontala
movwf afisaj
call lccmd
movlw 09H ;mod control all on
movwf afisaj
call cbild ;resetare DDRAM
call lccmd
call pause
movlw 08H ;mod control blank
movwf afisaj
call lccmd
call pause
movlw 0CH ;mod control normal
movwf afisaj
call lccmd
movlw 40H ;x ini
movwf afisaj
call lccmd
movlw 80H ;y ini
movwf afisaj
call lccmd
adata movlw 1FH ;date
movwf afisaj
call lcdta
movlw 05H ;date
movwf afisaj
call lcdta
movlw 07H ;date
movwf afisaj
call lcdta
goto adata
lcdta bsf dorc
bcf enab ;activare chip si start date
call varsa
bsf enab
retlw 00
lccmd bcf dorc
bcf enab ;activare chip si start date
call varsa
bsf enab
retlw 00
lcres bcf rset ;resetare
call pause
bsf rset ;dezactivare reset
retlw 00
varsa bcf sclk
btfsc afisaj,7 ;bit0(MSB)
bsf sdta
btfss afisaj,7
bcf sdta
call halta
bsf sclk
call halta
bcf sclk
btfsc afisaj,6 ;bit1
bsf sdta
btfss afisaj,6
bcf sdta
call halta
bsf sclk
call halta
bcf sclk
btfsc afisaj,5 ;bit2
bsf sdta
btfss afisaj,5
bcf sdta
call halta
bsf sclk
call halta
bcf sclk
btfsc afisaj,4 ;bit3
bsf sdta
btfss afisaj,4
bcf sdta
call halta
bsf sclk
call halta
bcf sclk
btfsc afisaj,3 ;bit4
bsf sdta
btfss afisaj,3
bcf sdta
call halta
bsf sclk
call halta
bcf sclk
btfsc afisaj,2 ;bit5
bsf sdta
btfss afisaj,2
bcf sdta
call halta
bsf sclk
call halta
bcf sclk
btfsc afisaj,1 ;bit6
bsf sdta
btfss afisaj,1
bcf sdta
call halta
bsf sclk
call halta
bcf sclk
btfsc afisaj,0 ;bit7(LSB)
bsf sdta
btfss afisaj,0
bcf sdta
call halta
bsf sclk
call halta
bcf sclk
retlw 00
cbild bcf sdta
movlw .6
movwf count3
c3 movlw .84
movwf count1
c1 movlw .8
movwf count2
bsf dorc
bcf enab
c2 bcf sclk
nop
nop
bsf sclk
decfsz count2
goto c2
bsf enab
decfsz count1
goto c1
decfsz count3
goto c3
retlw 00
pause movlw .7
movwf count3
d3 movlw .50
movwf count1
d1 movlw .250
movwf count2
d2 decfsz count2
goto d2
decfsz count1
goto d1
decfsz count3
goto d3
retlw 00
halta movlw 20H
movwf count1
g1 movlw 40H
movwf count2
g2 decfsz count2
goto g2
decfsz count1
goto g1
retlw 00
;------------------------------------------------------------
end
;============================================================
The hex code can be download from here.
More details about how this program work.
For the data sheet of PCD8544 click here.
More info about LPH7366.
The last code version is this:
;=======LCD_Nokia nse1,nse3,nsm1 / Version 1.1====================24/12/02==
; cod LPH7366-1, LPH7779, LPH7677 / driver PCD8544
; rb6,rb7 sclock,sdata
; ra0,ra1,ra2,ra3 d/C,Reset,Vccmd,SCE
; internal clock
; standard crystal 4.000 MHz XT - 1us pe instructiune/pe aproape
; Program realizat de Ing. Bergthaller Iulian-Alexandru
;------------------------------------------------------------
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
porta equ 05
portb equ 06
count1 equ 0C
count2 equ 0D
count3 equ 0E
afisaj equ 0F
count4 equ 10
#DEFINE sclk portb,6
#DEFINE sdta portb,7
#DEFINE dorc porta,0
#DEFINE rset porta,1
#DEFINE tens porta,2
#DEFINE enab porta,3
;------------------------------------------------------------
org 0
;
;------------------------------------------------------------
init
movlw 0
tris portb ; set portb as output
movwf portb ; all ouput low
movlw 0
tris porta ; set portb as output
movwf porta ; all ouput low
start call pause
bsf dorc
bsf enab
bsf tens ;activare tensiune
call lcres ;resetare
movlw 21H ;set extins
movwf afisaj
call lccmd
movlw .197 ;Vop
movwf afisaj
call lccmd
movlw 13H ;bias
movwf afisaj
call lccmd
movlw 20H ;afisare orizontala
movwf afisaj
call lccmd
movlw 09H ;mod control all on
movwf afisaj
call cbild
call lccmd
call pause
call pause
call pause
call pause
movlw 08H ;mod control blank
movwf afisaj
call lccmd
call pause
call pause
movlw 0CH ;mod control normal
movwf afisaj
call lccmd
movlw 40H ;x ini
movwf afisaj
call lccmd
movlw 80H ;y ini
movwf afisaj
call lccmd
adata movlw 1FH ;date
movwf afisaj
call lcdta
movlw 05H ;date
movwf afisaj
call lcdta
movlw 07H ;date
movwf afisaj
call lcdta
goto adata
lcdta bsf dorc
bcf enab ;activare chip si start date
call varsa
bsf enab
retlw 00
lccmd bcf dorc
bcf enab ;activare chip si start date
call varsa
bsf enab
retlw 00
lcres bcf rset ;resetare
call pause
bsf rset ;dezactivare reset
retlw 00
varsa movlw 08H
movwf count4
vbit bcf sclk
btfsc afisaj,7 ;bit0
bsf sdta
btfss afisaj,7
bcf sdta
call halta
bsf sclk
call halta
rlf afisaj,1
decfsz count4
goto vbit
retlw 00
cbild bcf sdta
movlw .6
movwf count3
c3 movlw .84
movwf count1
c1 movlw .8
movwf count2
bsf dorc
bcf enab
c2 bcf sclk
nop
nop
bsf sclk
decfsz count2
goto c2
bsf enab
decfsz count1
goto c1
decfsz count3
goto c3
retlw 00
pause movlw .7
movwf count3
d3 movlw .50
movwf count1
d1 movlw .250
movwf count2
d2 decfsz count2
goto d2
decfsz count1
goto d1
decfsz count3
goto d3
retlw 00
halta movlw 20H
movwf count1
g1 movlw 40H
movwf count2
g2 decfsz count2
goto g2
decfsz count1
goto g1
retlw 00
;------------------------------------------------------------
end
;============================================================
The hex code for the last version can be download from here.
Nokia lcd links:
Assembly photo
Back to my home page
Last updated January, 2003