
3–404
Motorola Sensor Device Data
For More Information On This Product,
Go to: www.freescale.com
jsr lcdbyto
lda RA
jsr lcdbyto
dbnz CNT,do256b
lsl RA
bcc nochg2
inc RB
nochg2: lda RB
cmp N1 ;compare N2 to N1
bne validcal ;if different, we are OK
ldhx #msg05e ;otherwise warn of INVALID CAL!
jsr lcdstro
jsr del1s
jsr del1s
jsr del1s ;wait 2s
jmp CALIB ;try cal again
validcal: ldhx #N2
jsr wrflash ;burn N2 into flash
ldhx #msg05 ;and display new current cal values from flash
jsr lcdstro
lda N1 ;0mm value
jsr lcdbyto
lda #’/’
jsr lcdchro
lda N2 ;160mm value
jsr lcdbyto
jsr del1s
jsr del1s
jmp nocalib ;done!
;__________________________________________________________
LEVEL: lda #$01 ;===LEVEL=== main routine: displays level, flow & graphics
jsr lcdcmdo ;clear screen
lda #$0C
jsr lcdcmdo ;cursor off
lda #$88 ;position cursor at LCD graphics portion
jsr lcdcmdo ;(2nd half of first line)
clra ;and write ascii $00 through $07
fillgfx: jsr lcdchro ;which contain the graphics related to
inca ;40 different readings
cmp #$08
bne fillgfx
LVL: ldhx #ramfree ;point to 40 pressure readings
lda #$28 ;count down from 40
purge: clr 0,x ;clear all those locations
incx ;next (H cannot change: we are in page0 RAM)
dbnza purge
jsr adcbyta ;get Lref: reference A/D reading
jsr LfNx
sta Lgfx ;store in ”Level graphics”
LVLwarm: bset 4,porta
bset 5,porta ;LEDs on during this cycle
ldhx #ramfree ;point to 40 pressure readings
mov #$27,RA ;count down from 39
shiftgfx: lda 1,x ;take location+1
sta 0,x ;and move to location+0, i.e. shift graphics left
incx ;next X (once again: we are in page 0, no need to worry about H)
dbnz RA,shiftgfx ;do this 39x
lda #$80
jsr lcdcmdo
lda Lgfx
jsr adcbyta ;get averaged A/D reading (i.e. LX)
jsr LfNx ;LX:=(NX–N1)*160/(N2–N1)
mov RA,OA
clr RB
cmp #$03 ;if <=2mm
bcs Lzero ;then ”empty”
cmp #$9E
bcc Lsat ;then ”full”
clrh
ldx #$14 ;div by 20
div
mov #$01,RB
F
Freescale Semiconductor, Inc.
n
.