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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
11/19/00 15:52
Read: times


 
#6597 - RE: Lcd program
indeed, i thought i'll have fun with those Lcd's but they're tricky :)
my program is not that long,
it's just big for a lazy guy like me
[joking], and i'll be happy
to reciev your source code.
thanks, ofir.
welll... what the heck [sorry]:

*************************************
jmp start
MSG1: db 'Ofir Yacobi V1.0',000

stringwrite:
clr a
movc a,@A+dptr
jz eom ;jump to end of message
call cmdwrite
inc dptr
jmp stringwrite
eom: ret



cmdwrite:
Mov p1,A ; Post Accumulator at LCD data input
Clr p3.1 ; Set RS low (Instruction)
Clr p3.2 ; Set RW low (Write)
Nop ; Wait circuit settling
Setb p3.0 ; Tells the LCD to work (receive instruction byte)
Nop ; Wait a little bit
Nop ;
Clr p3.0 ; Drop the selection line
Ret ; Return to Caller
;END Of "cmdwrite"

LCDInitialize:
Mov A,#038h ; Data Lenght (8 bits), 2 lines, char 5x7
Call CmdWrite ; Needs 3 times this byte (1st)
Call Delay10ms ; Some delay routine 10 milliseconds
;
Call CmdWrite ; (second)
Call Delay10ms ; Some delay routine 10 milliseconds
;
Call CmdWrite ; (third)
Call Delay10ms ; Some delay routine 10 milliseconds
;
Mov A,#006h ; Move direction and Shift Display
Call CmdWrite ;
Call Delay10ms ; Some delay routine 10 milliseconds
;
Mov A,#00Eh ; Display and Cursor On, not blinking
Call CmdWrite ;
;
Mov A,#001h ; LCD Clear
Jmp CmdWrite ; ... and return to caller
ret

;END OF INiTIaLIZATION

delay10ms:
mov r0,a
clr p3.2 ; R/w low for a write mode
clr p3.0
nop
setb p3.0 ;enable pulse
nop
;******************* Check Busy Flag
mov p1,#0ffh ;configure port1 to input mode
setb p3.2 ;set RW to read
clr p3.1 ;set RS to command
clr p3.0 ;generate enable pulse
nop
setb p3.0
bloop: nop
mov a,p1
anl a,#80h ;check bit#7 busy flag
cjne a,#00h,bloop;keep waiting until busy flag clears
;*****************************************
; check busy flag twice
;*****************************************
bwait:
mov a,p1
anl a,#80h
cjne a,#00h,bloop
clr p3.2 ;return to write mode
mov a,r0
ret



start:
call LCDInitialize
mov dptr,#msg1
call stringwrite

end
***************************************
wow.. well, thanks for reading it
[or paged down it:)
if you find n-e mistake, notice me about that. thanks,
The 'Lcd troublemaker', ofir.

List of 14 messages in thread
TopicAuthorDate
Lcd program            01/01/70 00:00      
RE: Lcd program            01/01/70 00:00      
RE: Lcd program            01/01/70 00:00      
RE: Lcd program            01/01/70 00:00      
RE: Lcd program            01/01/70 00:00      
RE: Lcd program            01/01/70 00:00      
Lcd program            01/01/70 00:00      
RE: Lcd program            01/01/70 00:00      
RE: Lcd program            01/01/70 00:00      
RE: Lcd program            01/01/70 00:00      
RE: Lcd program            01/01/70 00:00      
RE: Lcd program            01/01/70 00:00      
RE: Lcd program            01/01/70 00:00      
RE: Lcd program            01/01/70 00:00      

Back to Subject List