Specifications

49
;*****************KEY WAKE UP PORT G ***********************
;ADDS 1 TO COUNTER FOR CORRESPONDING MOTOR
;****SENSOR G 0************
KWGISR BRCLR KWIFG,$01,NOTG0 ;CHECK BIT 0
LDAA ODMB ;IF MOTOR B, LDA WITH ODOM COUNT B
ADDA #$01 ;ADD 1 TO ODMB COUNT
STAA ODMB ;STORE BACK TO ODMB
LDAA #'B'
JSR TXBYTE ;WRITE TO SERIAL PORT (DEBUG)
;****SENSOR G 1************
NOTG0 BRCLR KWIFG,$02,NOTG1 ;CHECK BIT 1
LDAA ODMA ;IF MOTOR A, LDA WITH ODOM COUNT A
ADDA #$01 ;ADD 1 TO COUNT
STAA ODMA ;STORE BACK TO ODMA
LDAA COUNT
ADDA #$01
STAA COUNT
LDAA #'A'
JSR TXBYTE ;WRITE TO SERIAL PORT (DEBUG)
;********FALSE INTERRUPT********
NOTG1 MOVB #%00000011,KWIFG ;CLEAR WAKE UP FLAGS
RTI ;RETURN FROM INTERRUPT
4.6.9 IRQISR IRQ Interrupt Service Routine
This interrupt service routine waits for the falling edge on the IRQ interrupt. This is
input to the microcontroller from a push button switch which is intended to start the
operation of the robot. When the button is pressed, the service routine delays before
branching to the DRFWD subroutine which initiates a forward motion. The delay
provides some software switch bounce as this interrupt is set to be edge sensitive only.
;**********************IRQ SERVICE ROUTINE**************************
;THIS INTERRUPT STARTS THE ROBOT WHEN BUTTON IS PRESSED
IRQISR JSR DELAY ;PROVIDES SOME SWITCH BOUNCE
JSR DRFWD ;BEGIN DRIVING
RTI ;RETURN FROM INTERRUPT