beautypg.com

NEXCOM NISE 103 User Manual

Page 78

background image

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

65

NISE 103 User Manual

Appendix A: Digital I/O Programming Guide

DIO Programming Sample Code

#define DIO_PORT

0x281

#define DO1

(0x01 << 4)

#define DO2

(0x01 << 5)

#define DO3

(0x01 << 6)

#define DO4

(0x01 << 7)

#define DO1_HI

outportb(DIO_PORT, 0x10)

#define DO1_LO

outportb(DIO_PORT, 0x00)

#define DO2_HI

outportb(DIO_PORT, 0x20)

#define DO2_LO

outportb(DIO_PORT, 0x00)

#define DO3_HI

outportb(DIO_PORT, 0x40)

#define DO3_LO

outportb(DIO_PORT, 0x00)

#define DO4_HI

outportb(DIO_PORT, 0x80)

#define DO4_LO

outportb(DIO_PORT, 0x00)

void main(void)
{
DO1_HI;
DO2_LO;
DO3_HI;
DO4_LO;
}