AN1950
Sensors
Freescale Semiconductor 7
SOFTWARE LISTING
;NitroWater 2.0 24Jan03
;--------------
;
;Water Level Reference Design
;****************************
; - uses 908QT4 (MC68HC908QT4) and MPAK (MPXM2010GS)
; CALIB: 2-point pressure calibration (0mm and 160mm)
; LEVEL: displays water level, flow, and graphics
; UNITS: allows user to select between cm and inches
;
;__________________________________________________________
ram equ $0080 ;memory pointers
rom equ $EE00
vectors equ $FFDE
;__________________________________________________________
porta equ $00 ;registers
ddra equ $04
config2 equ $1E
config1 equ $1F
tsc equ $20
tmodh equ $23
icgcr equ $36
adscr equ $3C
adr equ $3E
adiclk equ $3F
flcr equ $FE08
flbpr equ $FFBE
;__________________________________________________________
org $FD00 ;flash variables
N1 db $96 ;1st calibration pt. = 0mm
org $FD40
N2 db $F6 ;2nd calibration pt. = 160mm
org $FD80
;__________________________________________________________
org vectors
dw cold ;ADC
dw cold ;Keyboard
dw cold ;not used
dw cold ;not used
dw cold ;not used
dw cold ;not used
dw cold ;not used
dw cold ;not used
dw cold ;not used
dw cold ;not used
dw cold ;TIM Overflow
dw cold ;TIM Channel 1
dw cold ;TIM Channel 0
dw cold ;not used
dw cold ;IRQ
dw cold ;SWI
dw cold ;RESET ($FFFE)
;__________________________________________________________
org ram
BB ds 1 ;variables
flshadr ds 2
flshbyt ds 1
memSP ds 2
mem03 ds 2
AN1950
Sensors
8 Freescale Semiconductor
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 ;initialize default units to cm ($A0=cm, $3F=in)
sthx UnitType ;UnitType set to $A0; UnitDiv set to $14
ldhx #$039E
sthx UnitEmpt ;UnitEmpt set to $03; UnitFull set to $9E
MENU: ldhx #msg01b
jsr lcdstro ;Menu msg
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 ;reposition cursor
AN1950
Sensors
Freescale Semiconductor 9
warm: brclr 1,porta,PB1 ;check for SEL
brclr 2,porta,PB2 ;or for ENT
bclr 4,porta ;otherwise
bset 5,porta ;turn on "SEL" LED
jsr del100ms ;delay
bset 4,porta ;toggle LEDs
bclr 5,porta ;"ENT" now on: means choice is 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
bne PB1ok
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
bne skip00
jmp LEVEL ;do ===LEVEL=== if choice=$01
skip00: jmp UNITS ;do ===UNITS=== if choice=$00
;__________________________________________________________
;__________________________________________________________
CALIB: lda #$01
jsr lcdcmdo
clr ram0
ldhx #msg05 ;===CALIB=== 2-point calibration
jsr lcdstro ;Calibration current values
lda N1 ;0mm
jsr lcdbyto
lda #'/'
jsr lcdchro
lda N2 ;160mm
jsr lcdbyto
bset 4,porta
bset 5,porta ;LEDs on
lego1: brclr 1,porta,lego1
lego2: brclr 2,porta,lego2
bclr 4,porta
bclr 5,porta ;LEDs off when both SEL & ENT are released
jsr del1s
jsr del1s ;wait 2s
ldhx #msg05a
jsr lcdstro ;show instructions
waitPB1: brset 2,porta,no2 ;if ENT is not pressed, skip
jmp nocalib ;if ENT is pressed then cancel calibration
no2: brclr 1,porta,do1st ;if SEL is pressed then do 1st point cal
bra waitPB1 ;otherwise wait for SEL or ENT
do1st: ldhx #msg05b ;1st point cal: show values
jsr lcdstro
clr CNT ;CNT will count 256 A/D readings
clr RB
clr RA ;RB:RA will contain 16-bit add-up of those 256 values

KITMPVZ5004EVK

Mfr. #:
Manufacturer:
NXP / Freescale
Description:
Pressure Sensor Development Tools WATER LEVEL BOARD
Lifecycle:
New from this manufacturer.
Delivery:
DHL FedEx Ups TNT EMS
Payment:
T/T Paypal Visa MoneyGram Western Union

Products related to this Datasheet