NEXCOM NSA 5130 User Manual

Page 101

Advertising
background image

Copyright © 2011 NEXCOM International Co., Ltd. All Rights Reserved.

88

NSA 5130 User Manual

Appendix B: GPI/O Programming Guide

GPIO Sample Code

;#########################################################

;MSB LSB

GPIO17 GPIO16 GPIO15 GPIO14 GPIO13 GPIO12 GPIO11 GPIO10

;#########################################################

;#########################################################

;Enable Configuration mode.

;#########################################################

out 2eh, 87h

out 2eh, 87h

;#########################################################

;Select logical device (GPIO1).

;#########################################################

out 2eh, 07h

out 2fh, 07h

;#########################################################

;Activate GPIO Function.

;#########################################################

out 2eh, 30h

out 2fh, 01h

;#########################################################

;CRF0 (GP10-GP17 I/O selection register. Default 0xFF)

;When set to a ‘1’, respective GPIO port is programmed as an input port.

;When set to a ‘0’, respective GPIO port is programmed as an output port.

;#########################################################

out 2eh, 0f0h

out 2fh, f0h ;GPIO10-13 as output pin , GPIO14-17 as input pin

;#########################################################

;CRF1 (GP10-GP17 data register. Default 0x00)

;If a port is programmed to be an output port, then its respective bit can
be read/written.

;If a port is programmed to be an input port, then its respective bit can
only be read.

;#########################################################

out 2eh, 0f1h

in 2fh

Advertising