Cr10x program example – Campbell Hausfeld Serial I/O Interface SDM-SIO4 User Manual

Page 23

Advertising
background image

Section 3. Understanding How the SDM-SIO4 Handles Data

3-7

Table 4 Fixed Strings Currently Allocated

String number

String (enclosed in quotes)

256

‘+0000000000123.45670000000000CrLf’

257

‘Voltage’

258

‘Amps’

259

‘Watts’

260

‘Joules’

261

‘Temperature’

262

‘Pressure’

263

‘Speed’

264

‘Power’

265

‘Depth’

266

‘Length’

267

‘Height’

268

‘Enter’

269

‘Password’

270

‘Correct’

271

‘Incorrect’

272

‘Overrange’

273

The ASCII characters: carriage return, linefeed.

If the datalogger sends more data than is defined in the SDM-SIO4’s formatter
string, the SDM-SIO4 starts at the beginning again unless ‘s’ (stop formatting) is
used, in which case any extra data within that transmission is ignored.

CR10X Program Example

This program example will output the battery voltage and panel temperature
received from the datalogger input locations to port 2 on the SDM-SIO4, using the
SDM-SIO4 Output Formatter.

The user defined format string, which is entered in the command line mode (see
Section 4), is as follows:-

fmtst 123 "z261 f6:2 i[Battery ]z257 f6:1z273"

Typical example output from this formatter string is:-

Temperature 27.23 Battery Voltage 12.6

Here is a description of what each part of the formatter does:-

fmtst 123 – This is the command word for storing the formatter string in area 123.

z261 – This outputs the fixed string ‘Temperature’.

space – This outputs an ASCII space.

f6:2 – This takes the value from location 1 and outputs it in a field with a total
width of 6 characters. There are 2 decimal places available within the field.

space – This outputs an ASCII space.

i[Battery ] – This outputs the word between the brackets [ ].

z257 – This outputs the fixed string ‘Voltage’.

space – This outputs an ASCII space.

f6:1 – This takes the value from location 2 and outputs it in a field with a total
width of 6 characters. There is 1 decimal place available within the field.

Advertising