Hardware Command Reference


General Command Information

The serial I/O board uses text-based ASCII commands to communicate with the controlling PC. Each command is uniquely identified by the first letter in that command, and is terminated by a carriage return. The extra characters in between are parameters for the command, such as which port number it applies to.

Responses

Whenever the I/O board sends a response (either from a command or because of an event), the response is terminated with a carriage return. If the serial board receives an unrecognized command or the parameters are invalid, the board will return an exclamation point (!) followed by a carriage return.

Usage

In most cases, these commands should only be used directly by the end user of the board during testing of the board. When the board is being used from a PC application, the application should use the included software library to access the board, since the library provides a much easier method for using the board and handling hardware events.

Default Board State

When the I/O board is initially powered up, all of the port buffers are enabled by default. Each port is configured as a digital input port. Also, all byte and bit events are disabled by default.

Command Summary

Command Summary Example Details
En Enable buffer on port n E1 @@
Xn Disable buffer on port n X1 @@
Sn,d Set port n to be input or output S1,0 @@
In Read in (Input) data from port n I1 @@
in.b Read bit b of port n i1.0 @@
On=xx Write (Output) the value xx to port n O1=d5 @@
on.b=x Write value x to bit b of port n o3.5=1 @@
A Set Port 1 to be analog mode A @@
D Set Port 1 to be digital mode D @@
a.n Read analog value on channel n of Port 1 a.0 @@
Vn Enable byte events on port n V2 @@
vn.b Enable bit event on bit b of port n v2.7 @@
Cn Disable all events on port n C1 @@
cn.b Disable bit event on bit b of port n c1.0 @@
L Toggle between CR and CRLF L @@
R Reset the board configuration R @@
P Ping the board (verify serial connection) P @@

Command Usage Details

EEnable buffer
Syntax:En
Returns:(nothing)
Values:n = {1,2,3}
Description: Enables the buffer that is connected to port n. Note that Port 1 does not have a buffer because it can be put into analog mode. The serial board does not return an error if port 1 is specified, but the command will have no effect on port 1. This command does not affect whether a port is configured as an input or output port.
Up

XDisable buffer
Syntax:Xn
Returns:(nothing)
Values:n = {1,2,3}
Description: Disables the buffer on Port n. Port 1 does not have a buffer, so the command X1 will have no effect. When a buffer is disabled, the port is put into a high-impedance mode by de-asserting the enable pin on the buffer chip. This command does not affect whether a port is configured as an input or output port.
Up

SSet port direction
Syntax:Sn,d
Returns:(nothing)
Values:n = {1,2,3}
d = {0 ... FF}
Description: Configures port n as an input port or an output port. If d = 0, the port is configured as an input port, otherwise it is configured as an output port.
Up

IRead a port value
Syntax:In
Returns:Pn=xx      (a 2-character hexadecimal number)
Values:n = {1,2,3}
xx = {00 ... FF}
Description: Reads the current value (a byte) of port n. Regardless of what the value is, the the serial board returns the value (xx) as a 2-character hexadecimal number. The value is padded with zeroes if necessary to make it two characters. This command does not affect whether the port is configured as an input or output port. If this command is used when the port is in output mode, it will return the current value present on the port.
Up

iRead a bit value
Syntax:in.b
Returns:pn.b=x
Values:n = {1,2,3}
b = {0 ... 7}
x = {0,1}
Description: Reads the current value of bit b on port n. If the bit is on (high), the x in the return string will be 1, otherwise it will be 0. The same extra notes apply to this command as do to the I command.
Up

OWrite to a port
Syntax:On=xx
Returns:(nothing)
Values:n = {1,2,3}
xx = {0 ... FF}
Description: Outputs (writes) the hexidecimal value xx to port n. This command does not affect whether the port is configured as an input or output port. If this command is used when port n is in input mode, it will have no immediate effect, however if the port is later put into output mode, the value of the port will then become the value of xx.
Up

oWrite to a bit
Syntax:on.b=x
Returns:(nothing)
Values:n = {1,2,3}
b = {0 ... 7}
x = {0,1}
Description: Outputs the value of x to bit b of port n. If x is 0, the bit is cleared (turned off), but if x is 1, the bit is set (turned on). This command does not affect whether the port is configured as an input port or an output port.
Up

AAnalog mode on port 1
Syntax:A
Returns:(nothing)
Description: Configures port 1 for analog mode. When in analog mode, each pin of port 1 becomes a separate analog input channel, numbered from 0 to 7 just as the digital bits are numbered.
Up

DDigital mode on port 1
Syntax:D
Returns:(nothing)
Description: Configures port 1 for digital mode (default).
Up

aRead an analog channel
Syntax:a.n
Returns:a.n=xxx
Values:n = {0 ... 7}
xxx = {000 ... 3FF}
Description: Reads an analog channel of port 1. This command does not affect whether port 1 is configured for analog mode or digital mode. Because each analog channel has a 10-bit precision, the board returns a value in from 0 to 3FF (1023 decimal). The value is returned in hexadecimal and, if necessary, is padded with zeroes to create a 3-character value.
Up

VEnable a byte event
Syntax:Vn
Returns:(nothing)
Events:Bn=xx
Values:n = {1,2,3}
xx = {00 ... FF}
Description: Enables byte event monitoring and notification for port n. When a byte event is enabled, the I/O board monitors the port, and sends an Event (format shown above) to the PC whenever the value on that port changes. The value of xx is sent in hexadecimal, and is padded with zeroes to two characters if necessary. Events cannot be enabled on port 1 when it is in analog mode.
Up

vEnable a bit event
Syntax:vn.b
Returns:(nothing)
Events:bn.b=x
Values:n = {1,2,3}
b = {0 ... 7}
x = {0,1}
Description: Enables bit event monitoring and notification for bit b of port n. An event (format shown above) is sent whenever the value of the bit changes. Events cannot be enabled on port 1 when it is in analog mode.
Up

CDisable a port's events
Syntax:Cn
Returns:(nothing)
Values:n = {1,2,3}
Description: Disables (clears) all events (both byte and bit) on port n. This has the opposite effect as the V and v commands. When the events of a port are disabled, the I/O board quits checking for changing values on the port.
Up

cDisable a bit event
Syntax:cn.b
Returns:(nothing)
Values:n = {1,2,3}
b = {0 ... 7}
Description: Disables event monitoring and notification on bit b of port n. This has the opposite effect of the v command.
Up

LToggle CR and CRLF
Syntax:L
Returns:(nothing)
Description: Toggles whether the I/O board sends just a carriage return (CR) or both a carriage return and a linefeed (LF) when it responds to the PC. By default, the I/O board sends only a carriage return to terminate its responses. However, when using the board from a terminal program, it may be helpful to enable CR and LF so that all responses can be seen and will not be overwritten by the next response.
Up

RReset board configuration
Syntax:R
Returns:(nothing)
Description: Resets the configuration of the I/O board to defaults. This command does NOT perform a hardware reset on the board, but it resets the configuration to its initial, default settings. This means that all buffers are enabled, all ports are configured as digital, and are configured as inputs. All events are also disabled.
Up

PPing the board
Syntax:P
Returns:G
Description: This command simply "pings" the board in order to test the serial connection to the PC, and to verify that the board is powered up and operational. The board will send back a G to indicate the connection is Good.
Up


Back to Contents Winford Engineering (2000)