CNT
ds 1
Lgfx
ds 1
weath ds 1
UnitType ds 1
UnitDiv ds 1
UnitEmpt ds 1
UnitFull ds 1
ram0
ds 1
NC
ds 1
NB
ds 1
NA
ds 1
DC
ds 1
DB
ds 1
DA
ds 1
MB
ds 1
MA
ds 1
OB
ds 1
OA
ds 1
RB
ds 1
RA
ds 1
P0C
ds 1
P0B
ds 1
P0A
ds 1
NPTR
ds 1
ramfree ds 80
;used both for running RAM version of wrflash & storing 40 readings
;__________________________________________________________
;__________________________________________________________
;__________________________________________________________
org rom
cold: rsp
;reset SP if any issues (all interrupt vectors point here)
jsr ALLINIT
;general initialization
jsr WARMUP
;give LCD extra time to initialize
brset 1,porta,nocalib
brset 2,porta,nocalib
jmp CALIB
;only do calibration if SEL & ENT at reset
nocalib: ldhx #msg01
;otherwise skip and show welcome messages
jsr lcdstro
;"Reference Design" msg
jsr del1s
;wait 1s
ldhx #msg01a
;"Water Level" msg
jsr lcdstro
jsr del1s
;wait 1s
initCM: ldhx #$A014
sthx UnitType
ldhx #$039E
sthx UnitEmpt
MENU:
jsr
clr
lda
jsr
luke:
;initialize default units to cm ($A0=cm, $3F=in)
;UnitType set to $A0; UnitDiv set to $14
;UnitEmpt set to $03; UnitFull set to $9E
ldhx #msg01b
lcdstro
;Menu msg
RA
;menu choice=0 to begin with
#$0D
lcdcmdo
;blink cursor on menu choice
ldx RA
;get current menu choice
clrh
lda menupos,x
;and look up corresponding LCD address
jsr lcdcmdo
;reposition cursor
AN1950
8
Sensors
Freescale Semiconductor