Writing To A Digital I/O Port - VersaLogic Python EBX-11 Reference Manual

Amd lx 800 based sbc with ethernet, video, audio, industrial i/o, and spi
Table of Contents

Advertisement

MOV
AL, 44h
OUT
DX, AL
MOV
DX, 1DCh
MOV
AL, 0Ah
OUT
DX, AL
MOV
DX, 1DDh
MOV
AL, 40h
OUT
DX, AL
BUSY: MOV
DX, 1D9h
IN
AL, DX
AND
AL, 01h
JNZ
BUSY
MOV
DX, 1D8h
MOV
AL, 27h
OUT
DX, AL
MOV
DX, 1D9h
MOV
AL, 30h
OUT
DX, AL
MOV
DX, 1DBh
MOV
AL, 44h
OUT
DX, AL
MOV
DX, 1DCh
MOV
AL, 0Ah
OUT
DX, AL
MOV
DX, 1DDh
MOV
AL, 40h
OUT
DX, AL
W
D
RITING TO A
IGITAL
The following code example initiates a write of 55h to Digital I/O port bits DIO15-DIO8.
;Write 44h to configure MCP23S17 register IOCON
MOV
MOV
OUT
MOV
MOV
OUT
MOV
MOV
OUT
MOV
MOV
OUT
MOV
MOV
OUT
CALL
;Configure MCP23S17 register IODIRA for outputs
MOV
MOV
OUT
MOV
MOV
OUT
EBX-11 Reference manual
;SPIDATA1: Mirror & Open-Drain interrupts
;SPIDATA2: MCP23S17 address 0x0A
;SPIDATA3: MCP23S17 write command
;Get SPI status
;Isolate the BUSY bit
;Loop back if SPI transaction is not complete
;SPICONTROL: SPI Mode 00, 24bit, auto DIO_1_SS#
;SPISTATUS: 8MHz, no IRQ, left-shift
;SPIDATA1: Mirror & Open-Drain interrupts
;SPIDATA2: MCP23S17 address 0x0A
;SPIDATA3: MCP23S17 write command
I/O P
ORT
DX, 1D8h
AL, 26h
;SPICONTROL: SPI Mode 00, 24bit, DIO_0_SS#
DX, AL
DX, 1D9h
AL, 30h
;SPISTATUS: 8MHz, no IRQ, left-shift
DX, AL
DX, 1DBh
AL, 44h
;SPIDATA1: mirror and open-drain interrupts
DX, AL
DX, 1DCh
AL, 0Ah
;SPIDATA2: MCP23S17 IOCON register address 0Ah
DX, AL
DX, 1DDh
AL, 40h
;SPIDATA3: MCP23S17 write command
DX, AL
BUSY
;Poll busy flag to wait for SPI transaction
DX, 1DBh
AL, 00h
;SPIDATA1: 00h for outputs
DX, AL
DX, 1DCh
AL, 00h
;SPIDATA2: MCP23S17 register address 00h
DX, AL
Interfaces and Connectors
53

Advertisement

Table of Contents
loading

Table of Contents