**************************************************************************
* RTI Example Steps   EEL-4744        EMS & AAA *
**************************************************************************
TMSK2	EQU	$24	;TIMER MASK REGISTER
TFLG2	EQU	$25	;TIMER FLAG REGISTER
PACTL	EQU	$26	;PULSE ACCUMULATOR CONTROL REG
PORTB	EQU	$04	;I/O PORT C REGISTER
PORTC	EQU	$03	;I/O PORT C REGISTER
DDRC	EQU	$07	;DATA DIRECTION REGISTER C
*
* Step 1: Set up the RTI Interrupt Vector
*


********************************************************
* MAIN PROGRAM
********************************************************
     	ORG 	$B600
*-----------------------------------------------------
* INITIALIZATION
*-----------------------------------------------------



*
* Step 2: INITIALIZE RTI INTERRUPT RATE TO 8.19 msec
*     RTR1:RTR0 = 01
*


*
* Step 3:  ENABLE RTI INTERRUPT
*

*
* Step 4: TURN ON INTERRUPT SYSTEM
*

*---------------------------------------------------
* Call/Execute Process #1
*----------------------------------------------------

*
********************************************************
* Real-Time Interrupt Service Routine
********************************************************
	ORG	$B700
*------------------------------------------------------
* INTERRUPT FROM REAL TIME INTERRUPT DEVICE?
*------------------------------------------------------
*
RTI_ISR

*
* ISR Step 0: Make sure the flag is set, i.e., check Is RTIF=1?
*

*
* ISR Step 1: CLEAR INTERRUPT FLAG, i.e., Write a "1" to RTIF
*

*
* ISR Step 2: Do the task you want to each time you are interrupted
*

* ISR Step 3: RETURN FROM INTERRUPT
*
ENDRTI	RTI

*
********************************************************
* Process #1: Clear PORT C and 
*	      Send $0F to PORT B
********************************************************
	ORG	$B760
PS1
*
* Clear OUTPUTS of PORT C
*


*
* Send $0F to PORT B
*

* Do this routine again (and again, and again)
