Click here to view 703

CyQ 703 COMMANDS



Introduction



Logic conventions:



Standard logic is used for the input and output voltages where less than 0.7 volts is treated as 0 (zero) or false and greater than 4.5 volts is true or 1.



A bit has a value of 1 or 0 corresponding to logical true or false states. The true or false states represent a contact condition in the 703, either closed (1 or true) or open (0 or false). In CyQ703 commands where a logical value, L, is needed true may be represented by either T or t ; false may be represented by F, f. The default is TRUE, that is, sending cr; is the same as sending crT;



Commands

Commands may be either upper or lower case characters. All commands MUST end with either a semi-colon ';' or \r (the ENTER key). The command is buffered, but not processed by the 703 until a ';' or '\r' (ENTER key) is received. The backspace key may be used for corrections.



For brevity we will use the following symbols for values in commands:

L is a logical value where TRUE is ; or T or t or 1, and FALSE is F or f or 0 .

X is a hexadecimal number.

N is an integer number.





Summary of commands

Basic:

wNL; Write L to channel N.

wXX; write to all channels.

rN; read channel N, transmits NL.

r; read all channels, transmits XX (in read on change transmits XX,XX).

s; stop means no reads and no writes for the channels; you will stop it, forget this, and later think that it has died when it will not respond.

g; go.



Configure:

cmr=XX; configure read enable mask; default is FF, all channels are inputs.

cmw=XX; configure write enable mask; DEFAULT is 00, NO channels are OUTPUTS.



crL; configure read on change either on or off.

crhL; configure read on low-to-high either on or off for all channels.

crlL; configure read on high-to-low either on or off for all channels.

crlNL; configure read on change high-to-low for channel N either on or off.

crhNL; configure read on change low-to-high for channel N either on or off.



clL; configure local write from lookup table control on or off.

clmr=XX; configure lookup table read AND mask to value XX.

clmw=XX; configure lookup table write enable mask to value XX.

clXX=XX; configure lookup table input entry XX to cause output value XX.



ctNL; timing for channel N output (monostable output mode) on or off;

ctN=N; Set time for output on for channel N (1-8) to N (0-60,000) ms.



Utility:

e; turn error light off

?; status (command summary and current values).

ckL; configure keystroke (received character) echo on or off.

cq@X; configure baud rate to value X (0 to A).

cq?; will cause "cyq(Version)" to be transmitted.

; or \r will cause cr lf to be transmitted.

mss; memory save setup, causes current configuration to be saved.

mls; memory load setup, loads the saved setup configuration.

msd; memory save as default, saves the current configuration as the power up default.

mpd; purges the power up default settings.



NOTE: on power up, while the lights are flashing, pressing the Esc key ONCE will cause our original safe configuration to be loaded. Do NOT hold down the Esc key.



$@R (case sensitive) will cause the module to restart (reset).

Basic Commands



Write output command: w



Single channel write commands

"wNL;" Single channel output control examples: The letter w followed by an output channel number between 1 and 4, followed by either true or false. That is wN1; or wN0 where N is a channel number between 1 and 4. wN; defaults to true.

"w1t;" or "w1;" Causes the output for channel 1 to go high (the left first two pins on the lower row of the connector); output 1 LED will light).

"w1f;" or "w10;" Causes the for channel 1 to go low; output 1 LED will go off).

"w2T;" or w2; Causes the relay contacts to close for channel 2 (the first two pins on the lower row of the connector will be shorted; output 2 LED will light).

"w2F;" Causes the relay contacts to open for channel 2 (the first two pins on the lower row of the connector will be open or infinite resistance; output 2 LED will go off).



Byte wide output write examples:

"wXX;" where XX is a hexadecimal number corresponding to the 8 bit output. In hexadecimal format the hexadecimal character (8 bit) is translated to the 4 bit binary representation of the hexadecimal digit. The channels are in bit order: bit 0 corresponds to channel 1, bit 1 corresponds to channel 2 .....



In hex format a string of binary digits (ones and zeros, 0 is off and 1 on), such as 1101, are numbered from 0 for the least significant bit ascending to the left. For 1101: Bit 0 is 1, bit 1 is 0, bit 2 is 1, and bit 4 is 1. In binary the bits are numbered in order of increasing significance. The right most bit is the least significant (bit 0) while the left most (bit 7) is the most significant. This is the same as money; in price $427 the least significant digit is the 7, and the most significant digit is 4. The channels are bit mapped accordingly: channel 1 corresponds to bit 0, channel 2 is bit 1, channel 3 is bit 2, and channel 4 is bit 3.



"w17;" Outputs 1,2,3 and 5 will go high. The binary representation of hexadecimal digit 1 is 0001, and for 7 is 0111.

"w0A;" Hexadecimal digit A is binary 1010, so this is 0000 1010, therefore, outputs 1 and 3 are low, two and four are high.





The following table may be helpful:





HEX binary Channel 4

Channel 8

Channel 3

7

Channel 2

6

Channel 1

5

0 0000 low low low low
1 0001 low low low high
2 0010 low low high low
3 0011 low low high high
4 0100 low high low low
5 0101 low high low high
6 0110 low high high low
7 0111 low high high high
8 1000 high low low low
9 1001 high low low high
A 1010 high low high low
B 1011 high low high high
C 1100 high high low low
D 1101 high high low high
E 1110 high high high low
F 1111 high high high high















Read Channel Command: "rN;" or "r;"



Read Examples:



a. Single channel input detection.

"r1;" If Pin 2 on input channel 1 (the leftmost two pins on the upper row of the connector) is low a "10" will be sent. If input 1 is high, then an r1; command causes the string "11" to be transmitted. Channel 1 panel LED on the input (top) row will be ON if input 1 is high.



"r4;" If input channel 4 (the last two pins on the upper row) is low a "40" will be sent. If input 4 (PIN 8) is high (PIN 7), then the either the hex string "41" is transmitted. Channel 4 LED on the input (top) row will be on if input 4 is high.



The channel value is sent because the serial inputs and outputs are asynchronous The lag between computer command and computer response to an input from the 703 is unknown. Without the channel number it is quite easy to lose track of the relationship between outgoing commands and incoming data.



b. Byte wide read

"r;"

A byte is transmitted with bits 0 through 7 containing the logic state of input channels 1 through 8. The resulting byte is an integer number that the computer converts to hexadecimal character format for transmission. Thus, the reception of 0b means that input channels 1 , 2 , and 4 are high while 3, 5, 6, 7, and 8 are low.







Configure commands

These configure commands set up when and how reads are writes are done.



Masks

The purpose of the read and write masks is to define the input and output channels for serial input commands. These are enable masks where 1 is enabled and 0 is disabled in an 8 bit number with bits 0 through 7 corresponding the channels 1 through 8.



"cmr=XX;" Sets the read enable mask to XX. Prevents outputs from being read and left in a tristate condition because they have been converted to inputs buy the read operation. Default is FF, all channels are inputs.



"cmw=XX;" Sets the write enable mask to XX. Prevents inputs from being written to in a byte wide write; thereby preventing damage to whatever is connected to the input. Default is 00, no channels are outputs. This is the safest power up condition since we have no way of knowing what channels you intend to use for inputs and outputs.





Debounce

"cdN;" Configure debounce value. N is an integer number from 0 to 250. It is the time in tenth of a millisecond that the input is allowed to settle after a change is detected. When all inputs are stable the inputs are read and transmitted.



Read on Change

"crL;" If L is either ';' or true (T or t) then read on change is activated. A change on an input will cause an all channel read per the configuration described below. The initial change will be detected; after a delay equal to the debounce time the contacts will be read again. If the change is still present, then the read will be transmitted. If L is false (F, f, 0) then read on change will be deactivated.



"cr(state)NL; where state is either 'l' for low or 'h' for high. The channel number is 'N', and L is ;,T, t ,1 for true(on) or F, f, 0 for false(off). Activates read on change for channel N on high to low, and low to high edges. Default is all channels and both changes.

crl1t; Read when channel 1 goes low, goes from high to low.

crl1f; Disable read when channel one goes low.

crh2t; Enable read when channel two goes high, goes from low to high.

crl1; Enable read when channel goes one high, goes from high to low.

To completely disable read on change for channel 1 enter:

'crl1f;' and 'crh1f;' to turn off both edges.

To Enable all channels for read on high to low enter:

crl; or crlL; where L is t orT.

To Disable all channels for read on low to high enter:

'crhf;' or 'crhF;'



When read on change is enabled, a read will result in 4 hexadecimal characters; the first two digits will be a map of the channel(s) that changed (followed by a comma ','), and the second two digits will be the current (new) values of the 8 channels.





































































Local Lookup Table Write Control



"clL;" Enable local write control. The outputs are determined from the inputs by a look up table stored in memory. The look up table is programmable, and is saved by the memory save command. In this mode the 703 will control the outputs without the need for serial communication with a computer; it becomes a stand alone device. Handy way to create SPDT, DPDT, SP4T switches and other logic such as 6 input or's.

"cl;" or "clt;" : enables local lookup table control.

"clf;" : disables local LUT control.



Set Read and Write Masks for look up table write control



"clmrXX;" sets the read mask (a logical AND mask, this is not an enable mask) to hexadecimal XX (default is 0xFF, 1111 1111, use all as inputs). For example:



"clmr0E;" corresponds to 0000 1111 and channels 5,6,7,8 inputs are forced to zero when looking up the input in the lookup table.

"clmrF7;" corresponds to 1111 0111 and channel 4 input is forced to zero.

This command reduces the number of entries needed in the look up table. More importantly, it allows for an arbitrary distribution of inputs and outputs among the 8 channels. It also allows inputs to be used for other purposes than lookup table control.



"clmwXX;" sets the write enable mask. A zero bit value blocks an individual output from being written to. Allows channels to be used for inputs or other purposes. For example:

"clmwF7;" will block channel 4 (1111 0111) from being written to from the look up table.



Load Write Lookup Table

"clXX=XX;" write table, loads lookup table location left XX with right XX. The first hexadecimal character pair XX is the input state. The second XX pair is the output state that is produced. For example:



"cl09=F0" will cause the upper four channels to go high and the lower four to go low when channels 3 and 4 high and channels 1,2 and 5,6,7,8 are low.

In binary 0000 1100 -> 1111 0000.



Timing (Monostable output)

"ctNL;" timing for channel N output on or off; Activates monostable operation for output channel N. The output will remain True for a programmable time interval and then return to false.



"ctN=N;" Set time for output on (True) for channel N (1-4) to N (0-60,000) ms.





Utility Commands

Utility commands perform general functions unrelated to reading and writing the input channels.



Status

"?;" Provides (sends to terminal) a summary of commands with current values.



Scroll

";" or Enter causes a cr lf to be transmitted (echoed). Allows the cursor to be bumped down to a blank line in hyperterminal.



Echo

"ck;" Activates echo received character.



Memory

"mss;" : Save setup. The present status is written to nonvolatile memory. This includes configure commands and baud rate. Useful for testing before saving as default. Allows multiple configuration settings to be switched on the fly with one command.



"mls; Loads the saved setup.



"msd;" Save default. Saves the current configuration as the power up default.



"mpd;" Purges the saved power up default. The module will boot as originally shipped.



Error LED

Reset Command: "e;" turns off the error LED.



Baud rate

"cq@X;" where X ranges from 0 to A. This sets the transmit and receive baud rates for the serial output. The DEFAULT rate at power up is 9600. There is always 1 start bit, 8 data bits, and 1 stop bit; no parity; no handshaking. The computer baud rate must be changed to match after this command is executed (in hyper terminal you must click properties, and then configure. The baud rate will not change until you click disconnect, and then connect on the main toolbar).



The values are: 0=1200, 1=2400, 2=4800, 3=9600, 4=14,400, 5=19,200, 6=28,800, 7=38,400, 8=57,600, 9=115,200, A=230,400.



RESTART

"$@R" will cause the module to do a power up reset. This command is CASE Sensitive, $@r will not work.



VERSION

You found me' command: "cq?;" Causes "cyqVERSION" to be transmitted. Used by our software to find and identify our stuff on serial ports.