Campbell Hausfeld manual Programming the SDM-SIO4, Command Line Operation and Structure

Page 25

Section 4. Programming the SDM-SIO4

This section gives both the basic commands and advanced command line options which allow testing and advanced configuration of the SDM-SIO4.

4.1 Command Line Operation and Structure

To use the command line mode, connect a computer to port 1 of the SDM-SIO4. The computer should run a terminal emulation program (e.g. GraphTerm) which is set to 9600 baud, 8 data bits and 1 stop bit. If connecting to a PC you will need a null modem cable.

When the computer is connected, the command line can be made active by pressing the small momentary push-button switch, next to the Status LED. When this happens the SDM-SIO4 prompt ( SDMSIO4->) is sent out of port 1. At this prompt a number of commands can be typed and executed.

The command line buffer is 512 bytes long so no command with parameters must be longer than this.

After ten minutes of inactivity (where no valid commands are executed) the command line mode will time out and port 1 will return to its normal function.

The command line mode can be activated while the datalogger is running a program which communicates with the SDM-SIO4. However, all datalogger activity related to port 1 is ignored.

Complicated or long string definitions are best set up by editing a text file which includes the string definition commands. This file can then be sent out to the SDM-SIO4 once it is configured in the command line mode. The SDM-SIO4 can accept multiple configuration strings sent within one file.

NOTE By using (datalogger) Instruction P113 Command 321 it is possible to execute a command line command from a datalogger program. See Section 5 of this manual for further details.

4.2 Entering Commands

A command is executed when a carriage return (CR) is sent. This is normally sent by pressing the ENTER key on a computer. The method of entering control characters was discussed in Section 3.1, but is repeated here for convenience.

To enter a control character in the range of 0-255 decimal in a filter string, formatter string or a user string you must use the ‘&hh’ format, where ‘&’ defines the following two characters, ‘hh’, to be a hexadecimal number between 00 and

FF.For example, ‘&de’ would be character 222 decimal. To use ‘&’ within the string you must type ‘&&’ (i.e. && = & when in a string).

NOTE

The hex. number must always be two ASCII characters.

 

 

4-1

Image 25
Contents Issued Page Guarantee Page Contents Appendix A. Ascii Table Data Error DetectionIntroduction What is the SDM-SIO4?Datalogger Command Control SDM-SIO4 Serial Port Pin Configuration SpecificationsSerial Ports Serial Port BuffersSDM Port Power RequirementsCase Environmental Operating RangeOther Key Features Page Setting the SDM Address Installation and Hardware Set-UpAddress Settings Selector Block Settings SDM AddressConnections to the SDM-SIO4 Selecting RS232 or 5V Logic for Each PortTransient Protection and Grounding Status LED Error Codes Power-on Tests the Status LEDNo. of Flashes Description of error/status Page Introduction Understanding How the SDM-SIO4 Handles DataMethod of Entering Special / Control Characters Filter Types Input FiltersSimple Filters Filter Strings Ibn8Ficn8F Simple Output Formatter Output FormattingPredefined Filter Strings Filter No Filter String UsedOutput Format Strings CR10X Program Example Fmtst 123 z261 f62 iBattery z257 f61z273Get panel temperature Get battery voltageEntering Commands Command Line Operation and StructureProgramming the SDM-SIO4 Basic Commands Advanced Commands Hexdump start address number of bytes ErrorresBytewr address byte WD n Wderr n Wdaddr nTestio returns Testio test#Page Instruction 113 Parameters Programming the DataloggerParameter 7 Values per Rep Commands and Options Parameters 4, 5Parameter 8 Starting Input Location Parameters 9 and 10 Multiplier and OffsetUnderstanding Parameter Options and Returned Values Command 1 Poll of Available DataCommand 3 Flush all Receive Buffers Command 2 SignaturesCommand 4 Send Data to Datalogger Command 5 StatusCommand 7 Activate Command Line Command 6 Flush Transmit BufferCommand 8 Poll Tx Buffers for Data Command 9 Flush Converted Data BufferCommand 320 Send Byte Data to SDM-SIO4 Command 67 Get Return CodeCommand 321 Execute Command Line Command Program Example for P113 CommandExecute the command line string Command 1025 Transmit a Byte Command 1024 Send String to DeviceCommand 1026 Serial Port Status First Value ReturnedSecond Value Returned First Command Option Reset Error CountersThird Value Returned Fourth Value ReturnedCommand 2049 Set Communications Parameters Command 1027 ‘Manual’ Handshake ModeSecond Command Option Parameter First Command Option ParameterCommand 2054 Set Up Receive Filter String Number or Character Code Command 2305 Transmit Bytes SDM-SIO4 Configuration ExamplesExample CR10X Program Set flag one high so the above will only be done once End of serial and filter setupGet two floating point numbers into locations 1 Strst 101 Send DataJM Example CR10X Program Using Instruction P113 CommandWait long enough for sensor to send data Set up the filter and then send stringGet data from SDM-SIO4 and put into locations 1 Sensors Which Send Data Out Without PromptingTime stamp Instantaneous sample form the sensorFltst 200 tdataA5xff Example CR10X Program without Polling or InterruptsEnd of set up Example CR10X Program using the Polling MethodGet the two floating point values from the SDM-SIO4 Instantaneous values stored to final storageDelay required by filter set-up command Set up string filterDo filter set-up only if flag one is clear Set flag one high so the filter set-up is only done onceGet voltages into locations 3 and 4 if poll was true Example CR10X Program using InterruptsInstantaneous value stored into final storage Delay required by filter setup command Do filter setup only if flag one is clearSet control port 8 to i/p so it can be used as an interrupt Get voltages into locations 3 Interrupt routine for control portInstantaneous readings stored into final storage End of interrupt routineOutputting Datalogger Data Flushing the Input and Output Buffers Return Error CodesError Detection with the SDM-SIO4 Data Error DetectionReceived Data SDM-SIO4 User Guide 2 CR10X Program Example Example of Using Received Data FiltersFltst 100 TFrequency=xg2n10fCCG8 End of filter setup Minimum delay of 4ms is required by the above P113Tell the SDM-SIO4 to use filter string End of get data CRC32 Transmitted DataFmtst 100 g1i123456789G8 Example of Using Transmitted Data FiltersFmtst 100 g1 Fmtst 101 isome data Fmtst 102 f62 G8 Alternative CR10X ProgramMinimum delay of 1ms is required after this command Use formatter string 100 to set up the CRC16 on portMinimum delay of 3.8ms is required after this command Send the Ascii characters ‘Y’ and ‘Z’ to portCRC16-CCITT-IBM Data Error Detection Page Dec Char Appendix A. Ascii TablePage Baud rates Appendix B. Serial Port Data Transfer ModesStop Bits Data LengthSerial Handshake Modes Parity Bits