VersaLogic VL-EBX-37 Reference Manual page 43

Intel core 2 duo sbc with video, ethernet, usb, serial, sata, audio, analog + digital i / o, pcie mini card, eusb, and spx
Table of Contents

Advertisement

;Configure MCP23S17 register IODIRA for outputs
MOV
MOV
OUT
MOV
MOV
OUT
MOV
MOV
OUT
CALL
;Write 55h to MCP23S17 register GPIOA
MOV
MOV
OUT
MOV
MOV
OUT
MOV
MOV
OUT
CALL
BUSY: MOV
IN
AND
JNZ
EBX-37 Reference Manual
DX, CABh
AL, 00h
;SPIDATA1: 00h for outputs
DX, AL
DX, CACh
AL, 00h
;SPIDATA2: MCP23S17 register address 00h
DX, AL
DX, CADh
AL, 40h
;SPIDATA3: MCP23S17 write command
DX, AL
BUSY
;Poll busy flag to wait for SPI transaction
DX, CABh
AL, 55h
;SPIDATA1: data to write
DX, AL
DX, CACh
AL, 14h
;SPIDATA2: MCP23S17 register address 14h
DX, AL
DX, CADh
AL, 40h
;SPIDATA3: MCP23S17 write command
DX, AL
BUSY
;Poll busy flag to wait for SPI transaction
DX, CA9h
AL, DX
;Get SPISTATUS
AL, 01h
;Isolate the BUSY flag
BUSY
;Loop if SPI transaction not complete
Interfaces and Connectors
37

Advertisement

Table of Contents
loading

Table of Contents