Freescale Semiconductor, Inc.
; Enable the output compare interrupt
; Interrupt begins here
LDA
STA
CLI
LDA
STA
LDA
STA
LDA
STA
LDA
JSR
DECA
BNE
LDA
STA
LDA
STA
LDA
STA
JSR
LDX
LDA
STA
MUL
STA
TXA
STA
CLR
LDA
STA
LDA
STA
LDA
STA
LDA
STA
JSR
CLR
CLR
CLR
CLR
CLR
CLR
CLR
JSR
LDA
ADD
CMP
BLO
LDA
ADD
STA
CLRA
ADC
STA
CLRA
ADC
STA
LDA
ADD
STA
CLRA
ADC
STA
CMP
BNE
LDA
CMP
BNE
INC
LSR
ROR
ROR
LDA
CMP
BLO
LDA
#$40
TCONTROL
#$CC
PORTC
#$BE
PORTB
#$C4
PORTA
#16
; Port C = 1100 1100
; Port B = 1011 1110
; Port A = 1100 0100
Letter ”C”
Letter ”A”
Letter ”L”
IDLE
DLY20
; Idling for a while (16*0.125 = 2 sec)
; for the zero offset to stabilize
; before perform auto–zero
; Sample the data 32,768 times and take
; the average 8000 H = 32,768
; Right shift of 15 equivalent to divide
; by 32,768
IDLE
#$00
DIV_LO
#$80
DIV_HI
#!15
NO_SHIFT
READAD
#5
PTEMPLO
ZERO_ACC
; Overall sampling time = 1.033 s)
; Zero acceleration calibration
; Calculate the zero offset
; DC offset = PTEMPLO * 5
DCOFFSETLO
; Save the zero offset in the RAM
DCOFFSETHI
HOLD_CNT
#$10
DIV_LO
#$00
DIV_HI
#$4
NO_SHIFT
ZERO_ACC
MAXACC
ADTOLCD
START_TIME
AVE_CNT1
AVE_CNT2
SHIFT_CNT
AVERAGE_L
AVERAGE_M
AVERAGE_H
READAD
ZERO_ACC
#$04
PTEMPLO
CRASH
; Sample the data 16 times and take
; the average 0100 H = 16
; Right shift of 4 equivalent to divide
; by 16
; Overall sampling time = 650 us
; Display 0.0g at the start
REPEAT
; Read acceleration from ADC
; If the acceleration < 2.0g
; Accumulate the averaged results
; for 128 times and take the averaging
; again to achieve more stable
; reading at low g
PTEMPLO
AVERAGE_L
AVERAGE_L
AVERAGE_M
AVERAGE_M
AVERAGE_H
AVERAGE_H
#$01
AVE_CNT1
AVE_CNT1
AVE_CNT2
AVE_CNT2
#$04
REPEAT
AVE_CNT1
#$00
REPEAT
SHIFTING
SHIFT_CNT
AVERAGE_H
AVERAGE_M
AVERAGE_L
SHIFT_CNT
#$0A
; Take the average of the 128 samples
SHIFTING
AVERAGE_L
2–72
www.motorola.com/semiconductors
Motorola Sensor Device Data
For More Information On This Product,
Go to: www.freescale.com