|
Operation Microcontroller 1
Figure 2 is the flowchart for
microcontroller 1 program operation. After power on, the baud rate is set,
then the port directions to allocate input and output ports and finally
the ATT, CLK and CMD pins of the joystick control pad are set high. The
control pad is then accessed and data received from it. The bits of the
data bytes are then rearranged into the correct order. A check is then
made to see whether or not the control pad is operating in digital mode,
selected by pressing the 'analog' button on the control pad to turn off
the LED indicator above the button. If it is operating in digital mode,
then a manual override mode is activated where the control pad buttons are
used to control the ROV thrusters instead of the joysticks. If analogue
mode is activated by pressing the 'analog' button until the LED turns on,
then the duty cycles are calculated and the joystick axes bytes are split
up. Finally the data is transmitted to microcontroller 2.

Figure 2, Program for microcontroller 1
Microcontroller 2
Figure 3 is the flowchart for microcontroller 2 program
operation. Microcontroller 2 initialises in much the same way as
microcontroller 1 except that different output ports are used. This
program runs an interrupt service routine that executes whenever data is
available in the receive buffer. When the routine is called it checks that
a 'heartbeat' code has been recently received, if it hasn't then the
thrusters are disabled until the connection is fixed an another heartbeat
code is received. A check is made for digital mode operation. If digital
mode is activated then when the isr returns, the sequencing and PWM code
are skipped. If analogue mode is activated then the appropriate axis is
updated. When the isr returns the sequence is updated and PWM is performed
for the appropriate thruster.

Figure 3, Program for microcontroller 2
When the system is switched on, it
starts in digital mode. The ROV can be maneuvered by pressing the buttons
on the control pad. If the 'analog' button is pressed until the LED turns
on, then the ROV can be maneuvered by the two joysticks. The left joystick
controls forward/reverse/left/right by moving the stick up/down/left/right
respectively. The right joystick controls the diving/surfacing by moving
the stick up/down respectively.
Top
|