3–223
Motorola Sensor Device Data
For More Information On This Product,
Go to: www.freescale.com
Figure 5. DEVB–114 Software Flowchart
YES
START
NO
INITIALIZE DISPLAY I/O PORTS
INITIALIZE TIMER REGISTERS
ALLOW INTERRUPTS
PERFORMAUTO ZERO
TIMER
INTERRUPT
J1 OUT
ACCUMULATE 100 A/D CONVERSIONS
COMPUTE INPUT PRESSURE
CONVERT TO DECIMAL
PLACE IN RESULT OUTPUT BUFFER
SERVICE TIMER REGISTERS
SETUP COUNTER FOR NEXT INTERRUPT
SERVICE LIQUID CRYSTAL DISPLAY
RETURN FROMINTERRUPT
SLOPE = 64
SLOPE = 63
J2 OUT
NO
SLOPE = 65
YES
The compiler used in this project was provided by BYTE
CRAFT LTD. (519) 888–6911. A compiler listing of the
program is included at the end of this document. The following
is a brief explanation of the routines:
delay()
Used to provide approximately a 20 ms loop.
read_a2d()
Performs one hundred reads on the analog to
digital converter on multiplexer channel 5 and returns the
accumulation.
fixcompare()
Services the internal timer for 30 ms timer
compare interrupts.
TIMERCMP()
Alternates the data and backplane for the
liquid crystal display.
initio()
Sets up the microcomputer’s I/O ports, timer, allows
processor interrupts, and calls adzero().
adzero()
This routine is necessary at power–up time
because it delays the power supply and allows the
transducer to stabilize. It then calls ‘read_atod()’ and saves
the returned value as the sensors output voltage with zero
pressure applied.
cvt_bin_dec(unsigned long arg)
This routine converts the
unsigned binary argument passed in ‘a(chǎn)rg’ to a five digit
decimal number in an array called ‘digit’. It then uses the
decimal results for each digit as an index into a table that
converts the decimal number into a segment pattern for
the display. It is then output to the display.
display_psi()
This routine is called from ‘main()’. The ana-
log to digital converter routine is called, the pressure is
calculated, and the pressure applied to the sensor is dis-
played. The loop then repeats.
main()
This is the main routine called from reset. It calls
‘initio()’ to set up the system’s I/O. ‘display_psi()’ is called
to compute and display the pressure applied to the sensor.
F
Freescale Semiconductor, Inc.
n
.