ST2202A
9.1 Port-A Transistion Interrupt
PortꢁAꢀisꢀdesignedꢀforꢀtheꢀreturnꢀlineꢀinputsꢀofꢀkeyboardꢀscanꢀ
withꢀtransitionꢀtriggeredꢀinterruptꢀandꢀdeꢁbounceꢀoption.ꢀ
Differenceꢀbetweenꢀcurrentꢀvalueꢀandꢀtheꢀdataꢀkeptꢀpreviouslyꢀ
ofꢀPortꢁAꢀwillꢀgenerateꢀanꢀinterruptꢀrequest.ꢀTheꢀlastꢀstateꢀofꢀ
ꢀ
PortꢁAꢀmustꢀbeꢀlatchedꢀbeforeꢀtransition,ꢀandꢀthisꢀcanꢀbeꢀdoneꢀ
byꢀoneꢀreadꢀinstructionꢀtoꢀPortꢁA.ꢀStepsꢀandꢀprogramꢀexampleꢀ
areꢀshownꢀbelow.ꢀ
Operate Port-A interrupt steps:
Example:
.
.
1. Setꢀinputꢀmode.
2. ReadꢀPortꢁA.
STZꢀ ꢀ <PCAꢀ
;ꢀSetꢀinputꢀmode.ꢀ
3. Clearꢀinterruptꢀrequestꢀflagꢀ(IRPT).
4. Setꢀinterruptꢀenableꢀflagꢀ(IEPT).
5. ClearꢀCPUꢀinterruptꢀdisableꢀflagꢀ(I).
6. ReadꢀPortꢁAꢀbeforeꢀ‘RTI’ꢀinstructionꢀinꢀISR
LDAꢀ
STAꢀ
LDAꢀ ꢀ <PAꢀ
RMB4ꢀ <IREQꢀ
SMB4ꢀ <IENAꢀ
#$FFꢀ
<PAꢀ
;ꢀPAꢀbeꢀPULLꢁUP.ꢀ
;ꢀKeepꢀlastꢀstate.ꢀ
;ꢀClearꢀIRQꢀflag.ꢀ
;ꢀEnableꢀINT.ꢀ
CLIꢀ
.
.
Interrupt subroutine
.
.
LDAꢀ ꢀ <PAꢀ
RTI
;ꢀKeepꢀlastꢀstate.ꢀ
ꢀ
Verꢀ2.5ꢀ
17
/75
ꢀ
9/16/2008ꢀ