3–249
Motorola Sensor Device Data
For More Information On This Product,
Go to: www.freescale.com
Figure 5. DEVB–158 Software Flowchart
TIMER
INTERRUPT
SERVICE TIMER REGISTERS
SETUP COUNTER FOR NEXT INTERRUPT
SERVICE LIQUID CRYSTAL DISPLAY
RETURN
ACCUMULATE 100 A/D CONVERSIONS
COMPUTE INPUT PRESSURE
CONVERT TO DECIMAL/SEGMENT DATA
PLACE IN RESULT OUTPUT BUFFER
COMPUTE SLOPE CONSTANT
INITIALIZE DISPLAY I/O PORTS
INITIALIZE TIMER REGISTERS
DETERMINE SENSOR TYPE
ENABLE INTERRUPTS
START
The “C” 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 a software loop delay.
read_a2d()
multiplexer channel 0 and returns the accumulation.
Performs 100 reads on the A/D converter on
fixcompare()
compare interrupts.
Services the internal timer for 15 ms. timer
TIMERCMP()
the liquid crystal display.
Alternates the data and backplane inputs to
initio()
enables processor interrupts.
Sets up the microprocessor’s I/O ports, timer and
adzero()
to let the power supply and the transducer stabilize. It then
calls “read_atod()” and saves the returned value as the
sensors output voltage with zero pressure applied.
This routine is called at powerup time. It delays
cvt_bin_dec(unsigned long arg)
the unsigned binary argument passed in “arg” to a five
This routine converts
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. This is then output to the display.
display_psi()
return. The A/D converter routine is called, the pressure
is calculated based on the type sensor detected and the
pressure applied to the sensor is displayed. The loop
then repeats.
This routine is called from “main()” never to
sensor_type()
from reading J1 to J3, setting the full scale pressure for
that particular sensor in a variable for use by display_psi().
This routine determines the type of sensor
sensor_slope()
constant to be used by display_psi() for engineering units
output.
This routine determines the slope
main()
“initio()” to setup the system’s I/O. “display_psi()” is called
to compute and display the pressure applied to the
sensor.
This is the main routine called from reset. It calls
F
Freescale Semiconductor, Inc.
n
.