2 digital i/o programming – ADLINK ACL-7120A/6 User Manual

Page 32

Advertising
background image

26

Programming

4.2 Digital

I/O

Programming

The ACL 7120A provides 32 digital input channels and 32 digital output
channels. Four I/O port address (Base+0, ..., Base+3) are reserved for these
digital I/O channels. The relationship between I/O address and I/O channels
are specified as following:

** Digital Input Register Format:

Address: BASE + 0, BASE + 1, BASE + 2, BASE + 3

Attribute: Read for digital input

Data Format:

Bit

7

6

5

4

3

2

1

0

Base + 0

DI7

DI6

DI5

DI4 DI3 DI2 DI1 DI0

Base + 1

DI15

DI14 DI13 DI12 DI11 DI10 DI9 DI8

Base + 2

DI23

DI22 DI21 DI20 DI19 DI18 DI17 DI16

Base + 3

DI31

DI30 DI29 DI28 DI27 DI26 DI25 DI24

** Digital Output Register Format:

Address: BASE + 0, BASE + 1, BASE + 2, BASE + 3

Attribute: write for digital output

Data Format:

Bit

7

6

5

4

3

2

1

0

Base + 0

DO7

DO6

DO5

DO4 DO3 DO2 DO1 DO0

Base + 1

DO15 DO14 DO13 DO12 DO11 DO10 DO9 DO8

Base + 2

DO23 DO22 DO21 DO20 DO19 DO18 DO17 DO16

Base + 3

DO31 DO30 DO29 DO28 DO27 DO26 DO25 DO24

Digital Input Operation (Read):

The digital input states are read as a single byte from the port at
address BASE+N (N= 0,1,2,3). For each of the 8 bits within the byte
corresponding to particular digital input, a high bit (1) signifies the
input is energized, a low bit (0) signifies the input is de-energized.

For example:

In BASIC,

05 BASE=&H2A0

10 VALUE1 = INP(BASE + 0) ‘Read DO0 - DI 7

20 VALUE2 = INP(BASE + 2) ‘Read DO16 - DI 23

Advertising