Galil DMC-1800, DMC-1700 user manual Accessing extended I/O, CO n, OP m,a,b,c,d

Models: DMC-1800 DMC-1700

1 253
Download 253 pages 18.39 Kb
Page 228
Image 228
CO n

CO n

Where, n is a decimal value, which represents a binary number. Each bit of the binary number represents one block of extended I/O. When set to 1, the corresponding block is configured as an output.

The least significant bit represents block 2 and the most significant bit represents block 9. The decimal value can be calculated by the following formula. n = n2 + 2*n3 + 4*n4 + 8*n5 +16* n6 +32* n7 +64* n8 +128* n9 where nx represents the block. If the nx value is a one, then the block of 8 I/O points is to be configured as an output. If the nx value is a zero, then the block of 8 I/O points will be configured as an input. For example, if block 4 and 5 is to be configured as an output, CO 12 is issued.

8-Bit I/O Block

Block

Binary Representation

Decimal Value for Block

 

 

 

 

 

17-24

2

2

0

1

 

 

 

 

 

 

 

 

25-32

3

21

2

33-40

4

22

4

41-48

5

23

8

49-56

6

24

16

57-64

7

25

32

65-72

8

26

64

73-80

9

27

128

 

 

 

 

 

The simplest method for determining n:

Step 1. Determine which 8-bit I/O blocks to be configured as outputs.

Step 2. From the table, determine the decimal value for each I/O block to be set as an output. Step 3. Add up all of the values determined in step 2. This is the value to be used for n.

For example, if blocks 2 and 3 are to be outputs, then n is 3 and the command, CO3, should be issued. Note: This

calculation is identical to the formula: n = n2 + 2*n3 + 4*n4 + 8*n5 +16* n6 +32* n7 +64* n8 +128* n9 where nx represents the block.

Saving the State of the Outputs in Non-Volatile Memory

The configuration of the extended I/O and the state of the outputs can be stored in the EEPROM with the BN command. If no value has been set, the default of CO 0 is used (all blocks are inputs).

Accessing extended I/O

When configured as an output, each I/O point may be defined with the SBn and CBn commands (where n=1 through 8 and 17 through 80). Outputs may also be defined with the conditional command, OBn (where n=1 through 8 and 17 through 80).

The command, OP, may also be used to set output bits, specified as blocks of data. The OP command accepts 5 parameters. The first parameter sets the values of the main output port of the controller (Outputs 1-8, block 0). The additional parameters set the value of the extended I/O as outlined:

OP m,a,b,c,d

where m is the decimal representation of the bits 1-8 (values from 0 to 255) and a,b,c,d represent the extended I/O in consecutive groups of 16 bits. (values from 0 to 65535). Arguments which are given for I/O points which are configured as inputs will be ignored. The following table describes the arguments used to set the state of outputs.

220 • Appendices

DMC-1700/1800

Page 228
Image 228
Galil DMC-1800, DMC-1700 user manual Accessing extended I/O, CO n, OP m,a,b,c,d