beautypg.com

B: gpi/o p, Ppendix, Rogramming – NEXCOM EBC 352 User Manual

Page 68: Uide

background image

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

55

Appendix B: GPI/O Programming Guide

EBC 352 User Manual

A

ppendix

B: Gpi/O p

rOGrAmminG

G

uide

GPI/O (General Purpose Input/Output) pins are provided for custom system
design. This appendix provides definitions and default settings for the ten
GPI/O pins in the EBC 352 series. The pin definition is shown in the follow-
ing table:

J3 - GPIO Connector

GPIO Programming Sample Code

#define GPIO_PORT

0x284

#define GPO3

(0x01 << 4)

#define GPO5

(0x01 << 5)

#define GPO7

(0x01 << 6)

#define GPO9

(0x01 << 7)

#define GPO3_HI

outportb(GPIO_PORT, 0x10)

#define GPO3_LO

outportb(GPIO_PORT, 0x00)

#define GPO5_HI

outportb(GPIO_PORT, 0x20)

#define GPO5_LO

outportb(GPIO_PORT, 0x00)

#define GPO7_HI

outportb(GPIO_PORT, 0x40)

#define GPO7_LO

outportb(GPIO_PORT, 0x00)

#define GPO9_HI

outportb(GPIO_PORT, 0x80)

#define GPO9_LO

outportb(GPIO_PORT, 0x00)

void main(void)
{
GPO3_HI;
GPO5_LO;
GPO7_HI;
GPO9_LO;
}

Pin GPI/O

Mode

PowerOn

Default

Address Pin GPI/O

Mode

PowerOn

Default

Address

1

VCC

-

-

2

GND

-

-

3

GPO

Low

284h
(Bit4)

4

GPI

High

284h
(Bit0)

5

GPO

Low

284h
(Bit5)

6

GPI

High

284h
(Bit1)

7

GPO

Low

284h
(Bit6)

8

GPI

High

284h
(Bit2)

9

GPO

Low

284h
(Bit7)

10

GPI

High

284h
(Bit3)

Control the GPO pin (3/5/7/9) level from I/O port 284h bit (4/5/6/7).

The bit Set/Clear indicates output High/Low.