jsr lcdchro
bra goflow
;display "cm" for centimeters
;display "in" for inches
dsplIN: lda #'i'
jsr lcdchro
lda #'n'
jsr lcdchro
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
goflow: lda #$C0
jsr lcdcmdo
lda MA
;******** now let's display the flow in decimal ********
;position cursor on 1st character 2nd line
;get flow
lsla
bcc positiv
;test sign of rate (in MA)
;if positive, then it's easy
lda MA
coma
;otherwise 1's complement of MB
inca
sta MA
cmp #$64
bcs not2lo
lda #'<'
jsr lcdchro
lda #$63
sta MA
bra goconv
;check to see if >100
;if not we are OK
;otherwise display that we exceeded min rate
;that LCD can display (<9.9)
;force value to 99
not2lo: lda #'-'
jsr lcdchro
;display that minus sign
bra goconv
positiv: lda MA
cmp #$64
bcs not2hi
lda #'>'
;check to see if >100
;if not we are OK
;otherwise display that we exceeded max rate
;that LCD can display (>9.9)
;force value to 99
jsr lcdchro
lda #$63
sta MA
bra goconv
not2hi: lda #'+'
jsr lcdchro
;display the plus sign (to keep alignment)
;get flow
goconv: lda MA
clrh
ldx #$0A
div
;and divide by 10
jsr lcdnibo
lda #'.'
;display "tens" digit
jsr lcdchro
pshh
;display decimal point
pula
jsr lcdnibo
lda UnitType
cmp #$3F
beq dsplINf
;and first decimal
;check for cm ($A0) vs. in (#3F)
dsplCMf: lda #'c'
jsr lcdchro
lda #'m'
bra reusef
AN1950
Sensors
Freescale Semiconductor
13