Campbell Hausfeld SDM-SIO4 manual Filter Strings

Page 19

Section 3. Understanding How the SDM-SIO4 Handles Data

See Section 5 – ‘Programming the Datalogger’.

Filter Strings

These are used to define how to filter incoming data from a port into a format the datalogger can use. This is done by having a user-defined filter string pre-stored in the battery-backed memory of the SDM-SIO4. These strings have to be created via the command line (see Section 4), in a similar fashion to the format strings. The filter commands are as follows:

An Define a filter time-out. The range is from 0 to 255 in 50ms steps, giving a range of 0 to 12.75 seconds. The accuracy is -50ms +0ms so an ‘n’value of 1 is not practical as the time-out could be between 0 and 50ms. This filter type can be put anywhere in the string. If a time-out occurs before the entire filter is complete, any data already processed is disregarded and the filter is restarted. When the filter string is finished the time-out is stopped and set to zero. If n=0 then this stops the time-out and the filter will operate with no time-out. While the time-out is active the SDM-SIO4 will not shut down into the low power state unless the filter is complete or the time-out has finished. Note it best to start the time-out after a trigger command.

B[n,n,n,...] Carry out a bit field to floating point conversion. The SDM-SIO4 gets or waits for as many bytes as are required to fulfil the total number of bit fields. ‘n’ can be any number of bits from 0 to 255, but more than 23 bits is beyond the floating point range of the datalogger so the value returned to the datalogger will be invalid. There can be any number of bit fields, only limited by the command line buffer and the 255-byte limit for string storage. If there is part of a byte unconverted and there are no more bit fields remaining then those bits are discarded.

bn A binary number should be at this position. The SDM-SIO4 converts ‘n’ bytes (1, 2 or 3 bytes) to Campbell Scientific floating point.

C Discard one byte (character).

c Read one byte (not converted to Campbell Scientific floating point).

D A signed integer should be at this position. If it is found, the signed integer is sent to the datalogger and removed from the buffer. If no signed integer is found, the SDM-SIO4 sends -99999 to the datalogger.

d Search for a signed integer indefinitely, skipping non-numeric characters.

e[ ] Scan until any ASCII character not entered between the brackets is encountered. The maximum number of non-trigger characters is 255. Note that this filter does not remove the non-matching character from the buffer.

F A floating point number should be at this position. If it is found, the signed floating point number is sent to the datalogger and removed from the buffer. If no floating point number is found, the SDM-SIO4 sends -99999 to the datalogger.

f Search for a floating point number indefinitely, skipping any non- numeric characters.

gn Error detection – start of signature calculation for received data – see Section 6.

Gn Error detection – marks end of signature calculation for received data

– see Section 6.

3-3

Image 19
Contents Issued Page Guarantee Page Contents Appendix A. Ascii Table Data Error DetectionIntroduction What is the SDM-SIO4?Datalogger Command Control Serial Port Buffers SpecificationsSDM-SIO4 Serial Port Pin Configuration Serial PortsEnvironmental Operating Range Power RequirementsSDM Port CaseOther Key Features Page Selector Block Settings SDM Address Installation and Hardware Set-UpSetting the SDM Address Address SettingsConnections 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 Filter No Filter String Used Output FormattingSimple Output Formatter Predefined Filter StringsOutput 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 WD n Wderr n Wdaddr n ErrorresHexdump start address number of bytes Bytewr address byteTestio returns Testio test#Page Instruction 113 Parameters Programming the DataloggerParameters 9 and 10 Multiplier and Offset Commands and Options Parameters 4, 5Parameter 7 Values per Rep Parameter 8 Starting Input LocationUnderstanding Parameter Options and Returned Values Command 1 Poll of Available DataCommand 5 Status Command 2 SignaturesCommand 3 Flush all Receive Buffers Command 4 Send Data to DataloggerCommand 9 Flush Converted Data Buffer Command 6 Flush Transmit BufferCommand 7 Activate Command Line Command 8 Poll Tx Buffers for DataProgram Example for P113 Command Command 67 Get Return CodeCommand 320 Send Byte Data to SDM-SIO4 Command 321 Execute Command Line CommandExecute the command line string First Value Returned Command 1024 Send String to DeviceCommand 1025 Transmit a Byte Command 1026 Serial Port StatusFourth Value Returned First Command Option Reset Error CountersSecond Value Returned Third 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 stringInstantaneous sample form the sensor Sensors Which Send Data Out Without PromptingGet data from SDM-SIO4 and put into locations 1 Time stampFltst 200 tdataA5xff Example CR10X Program without Polling or InterruptsInstantaneous values stored to final storage Example CR10X Program using the Polling MethodEnd of set up Get the two floating point values from the SDM-SIO4Set flag one high so the filter set-up is only done once Set up string filterDelay required by filter set-up command Do filter set-up only if flag one is clearGet 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 End of interrupt routine Interrupt routine for control portGet voltages into locations 3 Instantaneous readings stored into final storageOutputting 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 ProgramSend the Ascii characters ‘Y’ and ‘Z’ to port Use formatter string 100 to set up the CRC16 on portMinimum delay of 1ms is required after this command Minimum delay of 3.8ms is required after this commandCRC16-CCITT-IBM Data Error Detection Page Dec Char Appendix A. Ascii TablePage Data Length Appendix B. Serial Port Data Transfer ModesBaud rates Stop BitsSerial Handshake Modes Parity Bits