Breakdown of the program
The program is designed so that the door will not open unless the car is running or is in Auxiliary mode. When the system is loaded it assumes that the garage door has been installed in the open position. The program accommodates for this and forces the door to close if there is no obstruction of the door sensor. In the final version of the program we aim to allow the user or system technician to modify the original position of the motor when it is installed. This feature will be important if there was a power failure and the door was in a closed position. After forcing the door to a certain position, the program then enters a continuous loop that constantly updates and requests changes of the input signals (Sensor A, B, Door Sensor).
The program also uses a robust structural approach while still allowing flexibility for changes. The main functions for the program are: scancar, delay, opendoor, closedoor, leavegar, entergar, notmovin and updatinp. After initialising the sequence of closing the door it is assumed that the car is inside the garage, once again the user may alter this setting. The inputs are then updated via the update input function (updatinp), once updated the program will then pass through the functions notmovin, entergar and leavegar, making use of the other functions when required.
This is the function which initialises the control of the base transmitter / receiver via the M68HC11, this function will also be responsible and checking the returned acknowledgment signal from the remote transmitter. The remote transmitter will only receive or transmit if the car is on. The way that we wish to process the returned signal is by masking. The signal sent by the base will be masked by the on-car chip and returned back to the base receiver. By knowing what the mask will be the scancar function will compare the incoming signal from the car with the previously masked signal by the base transmitter. If the signal comparison is TRUE then the function will initiate the door open procedure. A similar function to this scancar will be written to process and mask the signal for the on-car chip.
This function will be interrupt driven and will direct the M68HC11 to control the opening of the door. It will also register that the door has been opened and at what point in time it was opened.
This function will be interrupt driven and will direct the M68HC11 to control the closing of the door. It will also register at what time the door has been closed and that it has been closed. During the closing of the door if the door sensor is engaged then the closing will be interrupted and the door will cease to close and/or re-open.
This possibly useless function was written to allow sufficient time for the car to leave the garage and driveway without the door reopening. This replacement of this function is currently being explored as this is a sequential function and not a concurrent function, one form of replacement is using a real time clock.
This function tracks the movement
of the car as it exits the garage. If a sensor A is engaged while the car
is inside then the program will attempt to communicate with the car via
the scancar function. If communication is not successful it will assume
that the car is not the object moving in the garage or the car is not turned
on. The function will proceed to retransmit at specific time intervals,
after a time has expired the system may engage a security alarm.
If there is movement inside the garage and the car has effectively communicated
with the base then the function will call the open door procedure (opendoor).
This procedure will not open the door if the door is already open.
Once the door is open it flags a register to acknowledge that the car maybe
leaving, it will then update the inputs with updatinp. The clock will count
up until 30 seconds, if the door sensor is not engaged the door will close,
the flag register will be reset. If the sensor is engaged, once the car
passes the door sensor and disengages the door sensor the door will close.
Once the door closes, the flag register will be reset and initialises another
register. This function will then give the car sufficient time to leave
the proximity of the base transmitter so that the movement that triggers
sensor B will not re-open the door as the user is leaving the area.
If there is any movement Sensor
B will be activated and the scancar function will be activated. If the
scancar function is TRUE and the door is closed, the door will open. The
clock will count up until 30 seconds, if the door sensor is not engaged
the door will close, the flag register will be reset. If the sensor is
engaged, once the car passes the door sensor and disengages it, the door
will close. Once the door closes, the flag register will be reset and initialises
another register. This function will then give the car sufficient
time to enter garage, switch the engine off and remove the key. The user
may require extra time before switching off the vehicle( i.e.. turbo powered
cars), this should be an option available to be adjusted by the user.
This is more a function for security
than the operation of the garage door itself. It includes the possibility
of movement inside the garage while the car is not inside, as well as the
possibility of movement outside the garage while the car is inside. The
exact functions that will take place when the above happens are yet to
be confirmed but will most likely trigger an unrelated security alarm.
This is the procedure that is continuously called to ask for changes of the input signals. This function will temporarily pause the program until there has been a change to one or more of the three input signals.