Section 5. Programming the Datalogger

^J^M – this is a way of entering control characters for carriage return/linefeed into a string

The following program example works as follows:

1.The first P113 sets up a simple filter to search for floating point numbers.

2.The first parameter of this command is used to transmit a string which will prompt the sensor into taking measurements and then transmitting the numbers to the SDM-SIO4.

3.A delay is required by the set up formatter command and is calculated as follows:

delay=chars*0.26*ports.

This works out as the following: 11*0.26*1 = 2.86ms. Also you will have to wait long enough for the sensor to respond which must include the time to receive and transmit the data. This example is using a 9600 baud rate, and so 11 characters could take 12ms for the sensor command and another 20 characters (21ms) for output data from the sensor. The total time before the datalogger can get the data would therefore be 2.86+12+21 = 35.86ms. This time does not allow for any delay that the sensor may have in executing and taking any measurements. This example gives the sensor 4.24ms for measurements by giving P22 a 40ms delay.

4.By doing the above, the datalogger can get the two floating point values returned from the sensor into locations 1 and 2.

*Table 1 Program

01: 2 Execution Interval (seconds)

;set up the filter and then send string 101.

1:SDM-SIO4 (P113)

1:

1

Reps

 

2:

0

Address

 

3:

1

Send/Receive Port 1

4:

2304

Command

 

5:

8101

1st Parameters

 

6:

1999

2nd Parameters

 

7:

0

Values per Rep

 

8:

0

Loc [

]

9:

1.0

Mult

 

10:

0.0

Offset

 

;wait long enough for sensor to send data.

2:Excitation with Delay (P22)

1:1 Ex Channel

2:0 Delay W/Ex (units = 0.01 sec)

3:4 Delay After Ex (units = 0.01 sec)

4:0 mV Excitation

5-17

Page 47
Image 47
Campbell Hausfeld SDM-SIO4 manual Set up the filter and then send string, Wait long enough for sensor to send data