Specifications

108
4.3.2 Sampling Functions
The output of the alcohol and pressure sensors needs to be sampled on
separate channels of the ADC, at varying times. In order to simply program
structure, the functions for sampling have been isolated into their own
functionality and return values. Table 4.3.2-1 summarizes these functions.
Function
Description
void sampleThreshold()
Runs an infinite sample loop of the pressure
sensor, function exits when pressure reading
reaches an established threshold value for an
adequate breath sample
Int samplePressureInterval()
Samples the pressure sensor over a 4 second
interval. Increments return value for each valid
second over which the sample was taken. A
perfect sample will return a value of 4.
Int sampleAlcoholSensor()
Samples the alcohol sensor output over a 1
second period at the end of the breath
submission interval. Returns the number of
BAC points calculated using the calibration
standard value of 1 BAC point (0.01 BAC)
Table 4.3.2-1 Sampling Function Breakdown
4.4 Control Unit Software
The software process for the control box unit will be different being that this
system will be more of an active device. It will be query for messages from the
hand held unit. The control box unit will need to get information from the hand
held unit and be able to process it handle the message that will be coming from
the hand held unit. Being that this device is active there will be certain modules
that will define the states. When the control box unit transmits a response to the
hand held unit. The control box will run in different states. The first state will be a
RST which is receive transmission status. This state will run continuously until
the data is valid and has been validated as an accurate value. This state while
require a while loop that will run until an interrupt has been invoked. Once the
data has been processes and validated then the control box unit will call the
system mode module and pass either a high or low. Depending on if the value is
a high or low, the system will take different paths. If the data is set to high the car
will not be able to start. The system module will be able to handle the relay
portion.
The control box unit will have access to the relay and other components that will
enable the vehicle to start. If all these test pass, then the next state will transfer
into enter functionality state. The functionality state will enable the system mode