beautypg.com

2 sdmspeed instruction – Campbell Scientific SDM-SW8A 8-Channel Switch Closure Input Module User Manual

Page 11

background image

SDM-SW8A Switch Closure Input Module

Parameter
& Data Type

Enter

FunctOp
Constant

The FunctOp is used to determine the result that will be returned by the
SW8A.

Numeric

Code

Function

0

Returns the state of the signal at the time the instruction is
executed. A 0 is stored for low and a 1 is stored for high.

1

Returns the duty cycle of the signal. The result is the
percentage of time the signal is high during the scan interval.

2

Returns a count of the number of positive transitions of the
signal.

3

Returns a value indicating the condition of the module:

positive integer:

ROM and RAM are good

negative value:

RAM is bad

Zero:

ROM is bad

StartChan
Constant

The first channel that should be read on the SW8A. If the Reps parameter is
greater than 1, measurements will be made on sequential channels.

Mult, Offset

Constant,
Variable,
Array, or
Expression

A multiplier and offset by which to scale the raw results of the measurement. See
the measurement description for the units of the raw result; a multiplier of one and an
offset of 0 are necessary to output in the raw units. For example, the TCDiff
instruction measures a thermocouple and outputs temperature in degrees C. A
multiplier of 1.8 and an offset of 32 will convert the temperature to degrees F.

SDMSW8A Example

The following program measures all eight channels of an SW8A and outputs a
sample of the pulse count to a table once every minute.

'Program Declarations
Public SW8ACount(8)

'Data Table Declarations
DataTable (CountTab,1,1000)
DataInterval

(0,1,Min,10)

Sample

(8,SW8ACount(),FP2)

EndTable

'Main Program
BeginProg
Scan

(1,Sec,3,0)

SDMSW8A

(SW8ACount(),8,0,2,1,1.0,0)

CallTable

CountTab

NextScan
EndProg

6.1.2 SDMSpeed Instruction

The SDMSpeed instruction is used to change the bit period that the datalogger
uses to clock the SDM data. Slowing down the clock rate may be necessary
when long cable lengths are used to connect the datalogger and SDM devices.

7