AN1950
Sensors
Freescale Semiconductor 13
jsr lcdchro ;display "cm" for centimeters
bra goflow
dsplIN: lda #'i'
jsr lcdchro
lda #'n'
jsr lcdchro ;display "in" for inches
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
goflow: lda #$C0 ;******** now let's display the flow in decimal ********
jsr lcdcmdo ;position cursor on 1st character 2nd line
lda MA ;get flow
lsla ;test sign of rate (in MA)
bcc positiv ;if positive, then it's easy
lda MA ;otherwise 1's complement of MB
coma
inca
sta MA
cmp #$64 ;check to see if >100
bcs not2lo ;if not we are OK
lda #'<' ;otherwise display that we exceeded min rate
jsr lcdchro ;that LCD can display (<9.9)
lda #$63 ;force value to 99
sta MA
bra goconv
not2lo: lda #'-'
jsr lcdchro ;display that minus sign
bra goconv
positiv: lda MA
cmp #$64 ;check to see if >100
bcs not2hi ;if not we are OK
lda #'>' ;otherwise display that we exceeded max rate
jsr lcdchro ;that LCD can display (>9.9)
lda #$63 ;force value to 99
sta MA
bra goconv
not2hi: lda #'+'
jsr lcdchro ;display the plus sign (to keep alignment)
goconv: lda MA ;get flow
clrh
ldx #$0A ;and divide by 10
div
jsr lcdnibo ;display "tens" digit
lda #'.'
jsr lcdchro ;display decimal point
pshh
pula
jsr lcdnibo ;and first decimal
lda UnitType ;check for cm ($A0) vs. in (#3F)
cmp #$3F
beq dsplINf
dsplCMf: lda #'c'
jsr lcdchro
lda #'m'
bra reusef
AN1950
Sensors
14 Freescale Semiconductor
dsplINf: lda #'i'
jsr lcdchro
lda #'n'
reusef: jsr lcdchro
lda #'/'
jsr lcdchro
lda #'s'
jsr lcdchro
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
gfxupdt: lda #$40 ;======== Graphics Update: tough stuff ===========
jsr lcdcmdo ;prepare to write 8 bytes into CGRAM starting at @ $40
ldhx#ramfree;point to 40 pressure readings (this reuses wrflash RAM)
mov #$08,DA ;DA will count those 8 CGRAM addresses
cg8: lda 0,x
sta NC
lda 1,x
sta NB
lda 2,x
sta NA
lda 3,x
sta DC
lda 4,x
staDB;readings 0-4 go into NC,NB,NA,DC,DB and will form 1 LCD special
character
mov #$08,RA ;RA will count the 8 bits
fill:clrRB;start with RB=0, this will eventually contain the data for CGRAM
rol NC
rolRB
rol NB
rolRB
rol NA
rolRB
rol DC
rolRB
rol DB
rolRB;rotate left those 5 values and use carry bits to form RB (tough part)
lda RB
jsrlcdchro;and put it into CGRAM
dec RA ;do this 8 times to cover all 8 bits
bne fill
incx
incx
incx
incx
incx ;now point to next 5 values for next CGRAM address (5 values per
character)
dec DA ;do this for all 8 CGRAM characters
bne cg8
ldaweath;get weather variable and decide which message to display
cmp #$04
bne try3210
ldhx #msg02e ;if $04
bra showit
try3210: cmp #$03
bne try210
ldhx #msg02d ;if $03
bra showit
try210: cmp #$02
AN1950
Sensors
Freescale Semiconductor 15
bne try10
ldhx #msg02c ;if $02
bra showit
try10: cmp #$01
bne try0
ldhx #msg02b ;if $01
bra showit
try0: ldhx #msg02a ;otherwise this one
showit: jsr lcdstro
jsr del1s ;1s between pressure/altitude readings
brset 1,porta,contin ;exit only if SEL
brset 2,porta,contin ;and ENT pressed together
jmp MENU
contin: jmp LVLwarm
;__________________________________________________________
LfNx: sub N1 ;*** PX=f(NX,N2,N1) ***
ldx UnitType ;$A0=160 for cm, $3F=63 for in
mul
sta NA
stx NB
clr NC ;NCNBNA:=(NX-N1)* (conversion value: 160 or 63)
lda N2
sub N1
sta DA
clr DB
clr DC
jsr NdivD ;RBRA:=(NX-N1)*(conversion value)/(N2-N1)
lda RA
cmp #$C8 ;check to see if result is negative
bcs noovflw ;if <$C8 we are OK
ovflw: clr RA ;otherwise force level to 0!
noovflw: lda RA
rts
;__________________________________________________________
NdivD: clr RA ;RBRA:=NCNBNA/DCDBDA
clr RB ;destroys NCNBNA and DCDBDA
keepatit: lda RA
add #$01
sta RA
lda RB
adc #$00
sta RB ;increment RB:RA
lda NA
sub DA
sta NA
lda NB
sbc DB
sta NB
lda NC
sbc DC
sta NC ;NC:NB:NA:=NC:NB:NA-DC:DB:DA
bcc keepatit ;keep counting how many times until overflow
lda RA
sub #$01
sta RA
lda RB
sbc #$00
sta RB ;we counted once too many, so undo that

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