Read/write command that returns/sets the input/output status of general-purpose I/O ports.


Applies to: CMD-4CR, CMD-4EX-SA


ASCII/Standalone                IO        Read/write all I/O ports at once

       IO[portNo]        Read/write individual I/O ports

Syntax:                        

Read:

IO[portNo]                

Where:        [portNo] specifies the port number (1-32); if not specified, then the status of all general-purpose I/O ports are returned.


Write:

IO[portNo]=[value]                 

Where:        [portNo] specifies the port number (1-32), 

[value]      specifies status of output, 0 = off, 1 = on


[portNo] If not specified, then the status of all general-purpose I/O ports are set.

[value]      specifies a decimal value representing a 32-bit number, which identifies port and status according to the chart below.   Input values are NOT changed due to this command.

Reply: 

Command is accepted and executed

Read: 

Individual general-purpose I/O port (IO[portNo])        

Returns the status of general-purpose I/O port [portNo], With a value of 0 or 1 (0 off, 1 on).


All general-purpose I/O ports (IO)        

Returns status of all I/O based on each a 32-bit value based on the following:

Bit

Description

Status


Bit

Description

Status

0

General-purpose IO 1

0  Off          1  On


16

General-purpose IO 17

0  Off          1  On

1

General-purpose IO 2

0  Off          1  On


17

General-purpose IO 18

0  Off          1  On

2

General-purpose IO 3

0  Off          1  On


18

General-purpose IO 19

0  Off          1  On

3

General-purpose IO 4

0  Off          1  On


19

General-purpose IO 20

0  Off          1  On

4

General-purpose IO 5

0  Off          1  On


20

General-purpose IO 21

0  Off          1  On

5

General-purpose IO 6

0  Off          1  On


21

General-purpose IO 22

0  Off          1  On

6

General-purpose IO 7

0  Off          1  On


22

General-purpose IO 23

0  Off          1  On

7

General-purpose IO 8

0  Off          1  On


23

General-purpose IO 24

0  Off          1  On

8

General-purpose IO 9

0  Off          1  On


24

General-purpose IO 25

0  Off          1  On

9

General-purpose IO 10

0  Off          1  On


25

General-purpose IO 26

0  Off          1  On

10

General-purpose IO 11

0  Off          1  On


26

General-purpose IO 27

0  Off          1  On

11

General-purpose IO 12

0  Off          1  On


27

General-purpose IO 28

0  Off          1  On

12

General-purpose IO 13

0  Off          1  On


28

General-purpose IO 29

0  Off          1  On

13

General-purpose IO 14

0  Off          1  On


39

General-purpose IO 30

0  Off          1  On

14

General-purpose IO 15

0  Off          1  On


30

General-purpose IO 31

0  Off          1  On

15

General-purpose IO 16

0  Off          1  On


31

General-purpose IO 32

0  Off          1  On


Write:           

Individual general-purpose I/O port (IO[portNo])

OK


All general-purpose I/O ports (IO)        

       Returns status of all I/O based on each a 32-bit value.        


Command cannot be processed

       An error message is returned. See Error Codes

Example: 

Read:        

IO                * Returns value for all general-purpose I/O
                       Ex. Return a value of 54, or binary …. 0011 0110, IO2, IO3, IO5, and IO6 are on, all other general-purpose I/O is off.

IO8                * Returns the status of digital input 8



Write:        

IO18=1        * turns on general purpose IO18 if it is configured as an output

IO=147161088        * 147161088 in binary is 0000 1000 1100 0101 1000 0000 0000 0000; if setup as outputs, general-purpose I/O 16, 17, 19, 23, 24, and 28 are turned on, all other general-purpose I/O are turned off.  Any general-purpose I/O setup as inputs are not affected.



Notes:

  • Reading

This command reads the status of I/O regardless of whether it is set up as an input or output.

  • Writing

The IO command only changes general-purpose I/O setup as outputs. Input values are NOT changed due to this command.

See also:

I/O Setup

AI, DI, DIP, DO, DOBOOT, DOP, IOBOOT, IOCFG, IOP

Commander Manual

2.1.3.3.1 Configurable Digital I/O