CyQ 514 COMMANDS
There are three kinds of commands. Configure commands are used to change parameters such as interval between conversions or number of points to average. Acquire commands cause or enable conversions to occur. Utility commands include memory, baud rate, and other housekeeping chores .
Typing ?; or ?<ENTER> will print out the current status.
All commands MUST end with either a semi-colon ';' or the ENTER key. The command is buffered, but not processed by the A/D until a ';' or '\r' is received. The backspace key may be used for corrections on screen.
Where possible the command format allows a value to be assigned with an '=' following the command code or for the feature to be turned on or off with a logical t,f character instead of the '=' sign. This allows setup values to be defined and preserved for future use. It allows the feature to be reactivated with a minimum of hassle. For example: "cam=3;" will set median points to 3, but it will not affect the usage of the median filter. If the median filter was initially off, then it may be turned on at a later time by "camt;" (or the abbreviated "cam;') To stop using this filter issue the command "camf;" Again, note that "cam=5" neither turns the filter on or off.
In the following N is an integer number; L is a logical for true false. A logical, L, may be T, t ,1 or ';' for true, or F, f, 0 for false;
SUMMARY OF COMMANDS
aN; acquire where N is a channel number(s).
s; stop.
g; go
Configure commands:
camr: configure acquire mode rate
camt; mode timed
camp; mode polled
car=N; Sampling rate in rate mode
cat=N; Time between samples in timed mode
cofi; Integer output format -2048 to 2048 or 0 to 4096
cofv; Voltage format
cofx; Hexadecimal format
cofb; Binary format
cfbL; Burst mode averaging on-off
cfb=N; Number of conversions to average in burst mode
cfr=N; Burst mode sampling rate
cfsL; Sample averaging on-off
cfs=N; Number of samples to average
cfmL; Median filter on-off
cfmN; Median size (1 to 12)
Utility:
e; error light off.
ck; keystroke (Rx char) echo.
?; Transmit command summary and current settings.
mss; Memory save setup.
mls; Memory load saved setup.
msd; Memory save current setup as default.
mpd; Memory Purge default.
$@R Restart.
ACQUIRE COMMANDS
1. Acquire: "aNN...;" where NN... are 1 or more channel numbers. This assigns the channel numbers to be converted in either rate, timed or poll mode. If no channels numbers are present, "a;", then the previously defined channel numbers will be used. In polled mode this will cause a poll to occur. In rate and timed modes this command is used to define the channels. Modes are assigned in configure using "camr;" or "camt;" or "camp;" commands for rate, timed or poll.
2. Stop: "s;" Stops conversions from occurring. If in rate or timed modes and poll cannot occur, conversions are stopped. CAUTION: Stop MUST be exited with a GO ("g;") command for the poll (or rate or timed) acquires to work. You will forget this, and frantically pound the keyboard, wondering why nothing is happening.
3. Go: "g;" Allows poll and continuous commands to resume. If stop occurred while a continuous conversion was in effect then the continuous mode is resumed. The DEFAULT mode on power up is go.
CONFIGURE COMMANDS:
Current configuration: "?;" causes modes, rate, and the number of points to be averaged to be printed followed by the interval between conversions for averaging. This is helpful during the development phase to make sure that the command you thought you entered was the command you entered. It also serves as a Help file for the command mnemonics.
Basic acquire mode commands
"camr;" Configure acquire mode as rate. Sampling rate conversion. Channels following the acquire command ("aNN...;" will be converted repeatedly at the default rate or previously set value for rate (see setup command "car=;").
"camt;" configure acquire more as timed. Channels following the acquire command ("aNN...;" will be converted repeatedly at the default interval (1 sec) or previously set value (see setup command "cat=;").
"camp;" configure acquire mode as polled. An aNN..; will cause channels NN... to be polled.
Rate in rate mode: "car=N;" where N ranges from 1 to 4000 samples per second. DEFAULT=10 samples per second. This command sets overall conversions per second.
Time between conversions in timed mode: "cat=N;" where N ranges from 1 to 60,000. DEFAULT=1000 ms. This may be an averaged conversion.
Filters
Median
"cfmL;" enable or disable median filter.
"cfm=N;" Set median filter size to N where N is 2 to 12.
Burst mode averaging.
Enable, disable burst mode averaging "cfbL;" where L is logical.
"cfb;" or "cfbt" or "cfb1;" enables burst mode for N samples set by "cab=N;".
"cfbf;"or "cfb0;" disables burst mode averaging.
Number of conversions to average in burst mode averaging: "cfb=N;" where N ranges from 1 to 255. Conversion results are summed until this number is reached then divided, and the result submitted to the sample averaging filter. DEFAULT= 10.
Burst mode sampling rate: "cfr=N;". The rate in sample per second that the active AD channels are sequentially sampled and summed. A sampling rate of 600 with a count of 10 will attenuate power line noise by >50 db.
Sample averaging
"cfsL;" Enable or disable sample averaging.
"cfs=N;" Set number of samples to average to N. N samples will be acquired and summed at the rate set for rate mode or at intervals set by timed mode. The sum will then be divided by N and the average transmitted on the N'th acquire. For example, if cfs=10 and car=5 conversions per second, then an averaged sample will be transmitted every 2 seconds.
DATA OUTPUT FORMAT
The output format command is: "cf#;" where # is 'i' or 'b' or 'c' or 'i' or 'x' or 'v'. NOTE: all output begins with the special character all bits set, hexadecimal 0xFF, binary 1111 1111 (all 8 bits set to 1).
'v' volts output: "<0xFF>#.###....." Channel values are printed in volts with 0.001 volt (1 mv) resolution. Values range from -4.999 to 4.999 in bipolar, and 0.000 to 9.999 in unipolar mode (precision +/- 2.5 mv. typical accuracy +/- 10 mv . Channels are comma separated followed by a CR LF at he end, where CR is carriage return and LF is linefeed. In other words: start separator followed by comma delimited variable length numbers (due to the sign), and ending with a carriage return. Makes nuts and bolts sense, especially if you are using the AD to actually measure a voltage instead of, say, a pressure related to voltage only as an intermediate scale factor.
'i' causes the output format to be integer characters: <0xFF>number, number,....CR LF . In other words: start separator followed by comma delimited variable length numbers, and ending with a carriage return line feed. This is the DEFAULT. The range is -2048 to 2048 in bipolar and 0 to 4096 in unipolar. (varies slightly with A/D offset error) Easy to see what is going on with the A/D.
'x' causes the output format to be in hexadecimal notation: <0xFF>number, number,....CR LF. In other words: start separator followed by comma delimited variable length numbers, and ending with a carriage return. Included for the comfort of programmers.
'b' binary output: "<0xFF>####....." each channel value is represented by two ascii characters; many unprintable. The digits are concatenated without delimiters. There is no CR at the end. This is a fixed length format with the length determined by the number of active channels. This allows much higher conversion speeds. Each character transmitted requires 10 bits. In integer mode one channel requires at least 5 digits plus a start character and final CR,LF; that's 80 bits. In binary mode only 2 digits plus a start character are used or 30 bits. Almost three times as fast. However, it is completely unreadable nonsense on a screen. For a computer a fixed length format with a start byte is quite easy to decode to an integer using either basic or c languages (wait for the start byte, shift left 8 next byte, add next byte, repeat for each channel).
"cofoL;" True (the default) causes Hex and binary outputs to be Offset Binary instead of two's complement. Offset binary, like binary, yields a fixed length format since there is no sign to pop on and off. A fixed length format is better at detecting and recovering from errors. Furthermore, offset binary is independent of the base, number of bits, 2's complement is not. Equating a 12 bit 2's complement to a 16 bit signed integer yields garbage (depends on casting ability of the compiler and programmer).With offset binary simply subtracting off the one-half range value in the new base gives a correct 2's complement in the new base. (Note that in signed formats we transmit a 16 bit 2's complement. Threrefore, shift lefts into a 32 bit number on the receiving end will no longer be two's complement, hence the need for offset binary.
"cofc;" causes channel numbers to be included in the transmission
ch:value,ch;value....
"cofiL; " will cause the first number to be an index number. This number will increment by 1 for each transmission. 000 001 002 003,....255 and roll over to 000. This feature is helpful in reassuring you that there is no missing data due to the communication link.
Turning it off reduces the bandwidth requirement which is in the direction of goodness, that is, if it works correctly with the index then it is even more likely to work without it.
Utility commands
1. Baud rate:"cqX;" where X ranges from 0 to A. Sets the transmit and receive baud rates for the A/D serial output. The DEFAULT rate at power up is 9600. There is always 1 start bit, 8 data bits, and 1 stop bit; there is no parity. The baud rate of the computer 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 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.
2. Error reset: "e;" turns off the error LED.
3. Memory: m
a. Save setup: "mss;"
Memory write setup .... stores the current setup including modes, channels, and configuration. The setup can be reloaded with a "mls;" command.
b. Read and load setup: "mls;"
Memory load setup ... loads a saved setup if one is present.
c. Change power up default to be the present settngs "msd;"
Memory save default... stores the current setup (baud, mode, configuration) as the power up default. Replaces (over writes) a previously stored default. You may wish to first test using the write and read saved setup commands,
However, should you accidently save a setup that renders the AD inaccessible (high data rate, etc.) or a year has passed and you forgot the baud rate ... there is an out. The device always powers up at 9600 baud; it checks for and, if present, loads the stored default after the led's flash (about 2 sec). During the time the led's are flashing pressing the escape (ESC) key will cause the module to skip the load stored default. It will come up with the original safe defaults shown in this manual.
d. Purge stored default: "mpd;"
Restores the power up defaults of the module to those shown in this manual.
4. Reset the module: $@R will cause a power on restart.
5. Echo received characters: "ck;" Incoming characters are transmitted back to the serial source sending the characters; keystrokes are echoed.
Why both rate and interval modes?
The two modes allow for the precise control of data collection from over 3000 samples per second to less than 1 sample every 60,000 ms (or sec). At low data rates the resolution of rate mode is poor. For example, you can only choose between 1 or 2 samples per second, corresponding intervals of either 1000 or 2000 ms. In interval mode you can choose 1001, 1002....1999 ms, you have all 1000 choices.
On the other hand, at high data rates in interval mode, you can only have either 1 or 2 ms corresponding to rates of either 1000 or 500 samples per second. Kind of frustrating when you need high data rates and the highest is between 500 and 1000 samples per second. In rate mode you can choose 500, 501,....999 samples per second.
So between the two modes you have the capability to precisely optimize the A/D to your situation.
Why three averaging modes?
The different methods allow you to choose the most effective combination for the noise content in your environment. They relieve the main computer of performing these common tasks thereby freeing it up for other tasks. The filters reduce the need for high serial bandwidth. Timing accuracy is improved because the 514 microcontroller is a dedicated single task device as opposed to the multitasking time sharing OS in larger computers.
The sample averaging filter is the classic add them up and divide filter for gaussian (normal distribution) noise. The median filter is for popcorn noise, and signals near the limits artifact. Burst mode averaging is over sampling and is helpful in reducing aliasing problems, specifically in removing power line noise.