Specifications
26
The above arrangement of a 4013 Dual D Type Flip Flop is set to work on a rising edge
(0 to 5 volts). Using a falling or rising edge will not affect the accuracy of the counting;
it will still see two rising edges every rotation of the motor. When the sensor rises from
0v to 5v, the flip flop is triggered and Q NOT changes from high to low which triggers
the XIRQ (active low) interrupt. Before the end of the interrupt service routine, a logic
high can be sent from PORT A to reset the flip flop and await the next rising edge from
the sensor.
This concept did not work when attached to the sensor and microcontroller. When
voltages where manually applied to the flip flop slowly it would perform successfully
however when the process was applied through the XIRQ interrupt service routine, the
logic levels would not change appropriately. The IRQ interrupt was also not working
correctly. It was initialised to recognise falling edges but would not activate on the
falling edge coming from the sensors. It would however activate if an earth wire was
touched to it. It was decided that perhaps noise or other less obvious factors were
causing this.
There seemed to be too many problems for the simplicity of this idea so it was deemed
appropriate to disregard the use of XIRQ and IRQ for this purpose. The sensor wires
were connected to the PORT G key wake up port and instantly an accurate counter was
achieved. The major issue with this arrangement was to remember not to use any
higher priority interrupts to run a routine which would turn the motors in either
direction. This would make the position of the robot an unknown factor.
As a result of this testing the odometer sensors were made successful by simply using
an Infrared LED (DSE part number Z3235) and an Infrared Receiving Diode (DSE part
number Z1956) connected to the key wake up of PORT G and the software initialised
correctly to deal with this. A simple interrupt service routine was written to add one (1)
to the counter that recorded the revolutions of the respective motor. These counter
values are then available for calculating straight line driving or even position
monitoring.










