Instruction Set
4-58
HLT
HLT
Examples
This example interrupt-service routine (ISR) flashes the LEDs that are mapped to eight of
the microcontroller’s programmable input/output (PIO) pins and then suspends instruction
execution.
This example implements a polling of a PIO-based request, which is done based on a timer
or any other interrupt.
; flash the LEDs a few times and stop executing instructions
ISR_DEFAULT:
PUSHA
; save general registers
; turn the PIOs on as outputs to the LEDs in case
; this has not already been done
MOV
DX,PIO_MODE0_ADDR
MOV
AX,0C07Fh
OUT
DX,AX
MOV
DX,PIO_DIR0_ADDR
MOV
AX,0
OUT
DX,AX
MOV
CX,0FFh
ISR_D_LOOP:
MOV
AX,0Fh
; bottom 4 LEDs
mLED_OUTPUT
; turn them on (macro)
MOV
AX,0F0h
; top 4 LEDs
mLED_OUTPUT
; turn them on (macro)
DEC
CX
; subtract 1 from counter
JNZ
ISR_D_LOOP
; if counter is not zero, then jump
; suspend instruction execution
HLT
; return never expected, but just in case
POPA
; restore general registers
IRET
; return to interrupted procedure
; set up timer for periodic interrupts
; this specifies the maximum time between polls
LOOP_START:
HLT
; wait for an interrupt, then poll
; after ISR returns
MOV
AX,PIO_DATA0
TEST AX,PIO_ACTION_INDICATOR
JNZ
DO_ACTION
JMP
LOOP_START
DO_ACTION:
; do whatever action needs to be taken
JMP
LOOP_START
;return to idle state
Содержание Am186 Series
Страница 1: ...Am186 and Am188 Family Instruction Set Manual February 1997...
Страница 10: ...Table of Contents x...
Страница 18: ...Programming 1 8...
Страница 40: ...Instruction Set Listing 3 14...