Specifications

41
Process 2:
Process 2 is a large subroutine called every time a turn is needed. It accesses data
from port A. It checks sensors and turns relative to their status. After the motors
have been adjusted to gain desired performance the code returns to the main loop,
process 1.
Process 3:
This is an interrupt service routine that determines which odometer sensor has
triggered and increments the respective counter. The counter is a byte stored in
memory and is cleared regularly to avoid overflow issues.
Process 4:
This process is a subroutine used to maintain straight line driving. It is called
from the main program loop and works by comparing the odometer counters and
adjusting motor speeds to maintain a constant even speed between the motors.
This results in even wheel speed hence straight driving.
The above set-out of structure and processes has allowed the following code to be
written and implemented into the Mobile Manoeuvring Robot. The next sections will
break the code down into segments and subroutines and detail the operation of each
function. From this, the code can be easily understood and modified to suit similar
purposes. A full code listing is available in Appendix B.
4.6.1 Address Definition
“ ;ADDRESS DEFINITION
PORTA equ $00 ;Port A Data
PORTB equ $01 ;Port B Data
DDRA equ $02 ;Port A Data Direction
ADR16L equ $1FD ;
ADR17H equ $1FE ;
ADR17L equ $1FF ;
……..”