Campbell Hausfeld manual Understanding How the SDM-SIO4 Handles Data, Introduction

Page 17

Section 3. Understanding How the SDM-SIO4 Handles Data

For simple applications the SDM-SIO4 can be configured and controlled from the datalogger alone, using the datalogger program instruction P113 (CR10X and CR7 dataloggers only). Future developments will include support for other dataloggers.

More complicated applications require configuration of the SDM-SIO4 using the ‘command line’ function on a PC running a terminal emulator. This allows you to set up mechanisms to control the transmission of long, formatted output data and filtering of numerical values out of received data. This is done by storing the detailed formatting and filtering configurations in the SDM-SIO4 (see the section about the command line mode below).

Thus when the datalogger needs to send out long or complicated data strings it only needs to send a short command to the SDM-SIO4 to tell it to do this, i.e. it does not have to pass the whole string via the SDM interface. Likewise, by telling the SDM-SIO4 how to process received data, it can strip off the unwanted characters and reduce the data to either binary or floating point numbers. This minimises the time it takes for the datalogger to get the data and so allows the datalogger to load the data values into its memory with minimal processing.

3.1 Introduction

For collection of data from an intelligent sensor the datalogger programming is typically broken down into several steps, which might be:

1.Set up and configure the serial ports, e.g. baud rate, parity, handshaking. This can be done by one call of the datalogger instruction either at program compilation (so it is done only once) or perhaps in a subroutine which is called when a flag is toggled.

2.Use a second call of the instruction to tell the SDM-SIO4 to send out a string to request data from a sensor and to tell it how to process the returned data.

3.At some point later in the program use a third call to collect the pre-processed data from the SDM-SIO4.

Before examining the detail of the datalogger instruction it is necessary to understand the data output formatter and the input filters. These work in principle (and in certain details) like the formatting and filtering options used to write and read data from files in some high-level programming languages.

3.1.1 Method of Entering Special / Control Characters

Before going on to discuss filters, you should understand how to enter special / control characters.

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).

3-1

Image 17
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 AddressTransient Protection and Grounding Selecting RS232 or 5V Logic for Each PortConnections to the SDM-SIO4 No. of Flashes Description of error/status Power-on Tests the Status LEDStatus LED Error Codes Page Method of Entering Special / Control Characters Understanding How the SDM-SIO4 Handles DataIntroduction Simple Filters Input FiltersFilter Types 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 voltageProgramming the SDM-SIO4 Command Line Operation and StructureEntering Commands 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 Example CR10X Program SDM-SIO4 Configuration ExamplesCommand 2305 Transmit Bytes Get two floating point numbers into locations 1 End of serial and filter setupSet flag one high so the above will only be done once 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 onceInstantaneous value stored into final storage Example CR10X Program using InterruptsGet voltages into locations 3 and 4 if poll was true Set control port 8 to i/p so it can be used as an interrupt Do filter setup only if flag one is clearDelay required by filter setup command 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 CodesReceived Data Data Error DetectionError Detection with the SDM-SIO4 SDM-SIO4 User Guide Fltst 100 TFrequency=xg2n10fCCG8 Example of Using Received Data Filters2 CR10X Program Example Tell the SDM-SIO4 to use filter string Minimum delay of 4ms is required by the above P113End of filter setup 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