bset 3,porta
bclr 3,porta
bsr del100us
rts
;toggle E
;data only requires 40us for LCD to execute
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
;
;
shiftA: shifts A into shift register and provides 8-bits to LCD
------
shiftA: psha
mov #$08,BB
all8: lsla
bcc shift0
shift1: bset 4,porta
bra shift
;will be shifting 8 bits
;get bit
;if bit=0 then shift a 0
;otherwise shift a 1
shift0: bclr 4,porta
shift: bclr 5,porta
bset 5,porta
bclr 5,porta
dbnz BB,all8
pula
;bit 4 is data to shift register
;bit 5 is shift register clock
;toggle CLK
;do all 8 bits
rts
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
;
;
lcdnibo: displays 1 character (0-9,A-F) based on low-nibble value in A
-------
lcdnibo: psha
add #$30
;convert 4 bits from binary to ascii
;add $30 (0-9 offset)
cmp #$39
bls d0to9b
add #$07
d0to9b: bsr lcdchro
pula
;is it a number (0-9) ?
;if so skip
;else add $07 = total of $37 (A-F offset)
rts
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
;
;
lcdbyto: displays 2 characters based on hex value in A
-------
lcdbyto: psha
psha
lsra
lsra
lsra
lsra
;remember A (for low nibble)
;shift right 4 times
bsr lcdnibo
pula
and #$0F
bsr lcdnibo
pula
;high nibble
;low nibble
rts
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
;
;
lcdstro: displays message ending in '@', but also sends commands to LCD
-------
lcdstro: psha
lda 0,x
lcon: cmp #$80
bhs iscmd
;if ASCII >=$80
cmp #$1F
bls iscmd
isdta: bsr lcdchro
reuse1: aix #$0001
lda 0,x
;or <=$1F then
;assume it is a command to LCD
;otherwise it is data to LCD
;next character
;indexed by x
cmp #$40
;continue until
bne lcon
;character = '@'
AN1950
Sensors
Freescale Semiconductor
21