Freescale Semiconductor, Inc.
SOFTWARE SOURCE/ASSEMBLY PROGRAM CODE
******************************************************************************
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
Accelerometer Demo Car Version 2.0
The following code is written for MC68HC705B16 using MMDS05 software
Version 1.01
CASM05 – Command line assembler Version 3.04
P & E Microcomputer Systems, Inc.
Written by : C.S. Chua
29 August 1996
Copyright Motorola Electronics Pte Ltd 1996
All rights Reserved
This software is the property of Motorola Electronics Pte Ltd.
Any usage or redistribution of this software without the express
written consent of Motorola is strictly prohibited.
Motorola reserves the right to make changes without notice to any
products herein to improve reliability, function, or design. Motorola
does not assume liability arising out of the application or use of any
product or circuit described herein, neither does it convey license
under its patents rights nor the rights of others. Motorola products are *
not designed, intended or authorised for use as component in systems
intended to support or sustain life or for any other application in
which the failure of the Motorola product could create a situation
a situation where personal injury or death may occur. Should the buyer
shall indemnify and hold Motorola products for any such unintended or
unauthorised application, buyer shall indemnify and hold Motorola and
its officers, employees, subsidiaries, affiliates, and distributors
harmless against all claims, costs, damages, expenses and reasonable
attorney fees arising out of, directly or indirectly, any claim of
*
*
*
*
*
*
*
*
*
personal injury or death associated with such unintended or unauthorised *
use, even if such claim alleges that Motorola was negligent regarding
the design or manufacture of the part.
*
*
*
Motorola and the Motorola logo are registered trademarks of Motorola Inc.*
*
Motorola Inc. is an equal opportunity/affirmative action employer.
*
*
******************************************************************************
******************************************************************************
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
Software Description
This software is used to read the output of the accelerometer MMA2200W
and display it to a LCD as gravity force. It ranges from –55g to +55g
with 0g as zero acceleration or constant velocity. The resolution is
0.5g.
*
*
*
*
*
*
*
*
*
*
*
*
The program will read from the accelerometer and hold the maximum
deceleration value for about 3.0 seconds before resetting. At the same
time, the buzzer/LED is activated if the impact is more than 7.0g.
However, if the maximum deceleration changes before 3.0 seconds, it
will update the display using the new value. Note that positive value
implies deceleration whereas negative value implies acceleration
******************************************************************************
******************************************
*
*
*
*
*
*
Initialisation
******************************************
PORTA
PORTB
PORTC
ADDATA
ADSTAT
PLMA
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
$00
$01
$02
$08
$09
$0A
$0C
$12
$13
$16
; Last digit
; Second digit (and negative sign)
; First digit (and decimal point)
; ADC Data
; ADC Status
; Pulse Length Modulator (Output to Buzzer)
; Miscellaneous Register (slow/fast mode)
; Timer control register
; Timer Status Register
; Output Compare Register 1 High Byte
MISC
TCONTROL
TSTATUS
OCMPHI1
2–70
www.motorola.com/semiconductors
Motorola Sensor Device Data
For More Information On This Product,
Go to: www.freescale.com