Programming Example - Intel 80C188EC User Manual

Hide thumbs Also See for 80C188EC:
Table of Contents

Advertisement

INPUT/OUTPUT PORTS

13.3 PROGRAMMING EXAMPLE

Example 13-1 shows a typical ASM86 routine to configure the I/O ports. GCS7 through GCS4
are routed to the pins, while P1.0 through P1.4 are used as output ports. The binary value 0101 is
written to P1.0 through P1.3. The states of pins P3.5 and P3.4 are read and stored in the AL reg-
ister.
$MOD186
NAME
IO_PORT_UNIT_EXAMPLE
;This file contains an example of programming code for
;the I/O Port Unit on the 80C186EC.
;
;PCB EQUates in an include file.
#INCLUDE PCBMAP.INC
CODE_SEG
SEGMENT PUBLIC
ASSUME CS:CODE_SEG
IO_UNIT_EXMPL
PROC NEAR
;Write 0101B to data latch for pins P1.3 through P1.0
MOV
MOV
OUT
;Gate latch data to output pins.
;P1.3 to P1.0 are port pins
MOV
MOV
OUT
;Route DMA interrupts to package pin...
MOV
MOV
OUT
;Read P3.4, P3.5. We assume they have not been changed to output
;pins since reset.
MOV
IN
AND
;AL now holds the state of the P3.5 and P3.4 pins
IO_UNIT_EXMPL
ENDP
CODE_SEG
ENDS
END
13-12
DX, P1LTCH
AL, 0101B
DX, AL
DX, P1CON
AL, OF0H
DX, AL
DX, P3CON
AX, 001100B
DX, AL
DX, P3PIN
AX, DX
AX, 3H
Example 13-1. I/O Port Programming Example
;Strip unused bits

Advertisement

Table of Contents
loading

This manual is also suitable for:

80c186ec

Table of Contents