
3–402
Motorola Sensor Device Data
For More Information On This Product,
Go to: www.freescale.com
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
jsr ALLINIT ;general initialization
jsr WARMUP ;give LCD extra time to initialize
brset 1,porta,nocalib
brset 2,porta,nocalib
jmp CALIB ;do calibration if SEL & ENT at reset
nocalib: ldhx #msg01 ;otherwise skip and show welcome messages
jsr lcdstro ;”Reference Design” msg
jsr del1s
ldhx #msg01a ;”Water Level” msg
jsr lcdstro
jsr del1s
MENU: ldhx #msg01b
jsr lcdstro
clr RA ;menu choice=0 to begin with
lda #$0D
jsr lcdcmdo ;blink cursor on menu choice
luke: ldx RA ;get current menu choice
clrh
lda menupos,x ;and look up corresponding LCD address
jsr lcdcmdo
warm: brclr 1,porta,PB1 ;wait for SEL
brclr 2,porta,PB2 ;or for ENT
bclr 4,porta
bset 5,porta ;toggle LEDs
jsr del100ms ;delay
bset 4,porta
bclr 5,porta ;toggle again: SEL ***or*** ENT
jsr del100ms ;delay and repeat until SEL or ENT
bra warm
PB1: inc RA ;***SEL*** toggles menu choices
lda RA
cmp #$02 ;menu choices are $00 and $01
blt PB1ok
cmp #$03
bgt menureset
; shift up and display 3
MENU2: ldhx #msg01c
jsr lcdstro
menureset:
clr RA ;back to $00 when all others have been offered
PB1ok: bclr 4,porta
bclr 5,porta ;LEDs off
jsr del100ms ;wait a little bit
brclr 1,porta,PB1ok ;make sure they let go of SEL
bra luke
PB2: bclr 4,porta ;***ENT*** confirms menu choice
bclr 5,porta ;LEDs off
lda RA ;get menu choice
cmpa #$00
bne skip00
jmp LEVEL ;do ===LEVEL=== if choice=$00
skip00: cmpa #$01
bne skip01
jmp UNITS ;do ===UNITS=== if choice=$01
skip01: cmpa #$02
bne skip02 ;do ==MANCALIB= if choice=$02
F
Freescale Semiconductor, Inc.
n
.