*Table 2 Program
02: 0.0000 Execution Interval (seconds)
*Table 3 Subroutines
End Program
The normal configuration would include setting the speed and serial data format by calling the datalogger instruction with command 2049 and the relevant parameters.
For the majority of sensor applications where data is returned in only one type of format to the SDM-SIO4, the receive data format filters can also be defined once only by using command 2054. Similarly, some sensors may also require set-up strings to be sent once; these actions can also be placed in the same configuration block.
There are two general methods of obtaining data from an intelligent RS232 device, depending on the sensor type, as indicated below:
5.3.1Sensors Where the Datalogger Can Request Data by Sending a Prompt or Using a Handshaking Line
For these sensors the measurement would consist of three phases:
1.For software-controlled sensors, use the datalogger instruction to send out a command string (to request data), using commands 0320, 1024, 1025 or 2304. (Command 2304 also allows you to set up the receive filter to match the expected data; this instruction is useful when several different types of data are being requested from the sensor, i.e. a one-off set-up of the receive filter with command 2054, is not appropriate.) For hardware-controlled sensors, use command 1027 to change the state of the handshaking lines.
2.The datalogger waits for a period long enough for the SDM-SIO4 to process the set-up data (minimum delay), plus time for the data to be transmitted out of the serial port, plus the time for the sensor to respond and the data string to be transmitted back to the SDM-SIO4. The delay can either be instigated by using Instruction 22, or a delay loop, or more efficiently by running some of the other measurement tasks required of the datalogger. After the minimum delay, these tasks could also include further communications with the SDM-SIO4 to deal with one of the other sensors connected to another port.
3.Finally the SDM-SIO4 instruction is used to read the collected data back from the SDM-SIO4. Commands 4 or 66 are used for this function.
Example CR10X Program Using Instruction P113 Command 4
This program is written so that, on every execution interval, the datalogger will send a string out of port 1 to command the sensor to transmit its measurements back to the SDM-SIO4, which has a filter set up ready to receive the data.
The output formatter is set up to transmit a string as follows:
strst 101 "Send Data^J^M"
Here is how the above string works:
strst 101 – this is the command to store a sting in area 101.
Send Data – this is the command string the sensor will execute.