Specifications

39
4.6 The Software
The software used to control the Mobile Manoeuvring Robot was created in assembly
language for the Motorola HC12. This allowed direct communication with the
microcontroller and convenient access to all of its ports and functions. The software
used to control the heading of the robot follows a relatively simple structure with small
subroutines for each separable function or routine. Interrupts are used for the odometer
counting and a tight loop in the main function keeps track of the direction of travel and
sensor readings.
A software design procedure (available in Appendix C) was used to analyse the problem
and deal with suitable specifications and provide an appropriate software structure. The
software design procedure encompassed the major points of software design; such as
objectives, user information and program structure. The objective of the software was
stated to be “To control the mechanical hardware of a two drive-wheel robot in order to
avoid collision with obstacles. The software must be able to control the unit to travel in
a straight line between objects and is based on assembly level language of the Motorola
68HC12 microcontroller.” It was necessary to base the software structure around this
as well as encompassing the user information. The user information is listed below.
User Information
The code has five sensors that input to the software. Three of these are obstacle
avoidance sensors read in as data through port A and the other two are concerned
with odometer readings read in as interrupts through port G. The program starts at
$0400 with data starting at $0200. The stack pointer must be set in a clear location
such as $0700 and the program counter to $0400 to start the procedure.
When run, the program will output through the serial port the status of the odometer
readings and also controls the speed and direction of both motors to achieve the
desired performance. The program loops continuously to give real time control the
mechanical components
From these listed objectives and user information, while also including any other
specific requirements, a structure was decided upon to control the Mobile Manoeuvring