Cd16ac (source, reps, sdmaddress) – Campbell Scientific CR5000 Measurement and Control Module User Manual

Page 162

Advertising
background image

Section 7. Measurement Instructions

7-36

'Set Scan Rate

Const Period=1
Const P_Units=2
' \ \ \ \ \ \ \ \ \ \ \ \ CANBUS Constants / / / / / / / / / / / /
'------------------------- Physical Network Parameters ------------
'Set SDM-CAN to 250K
Const TQUANT=4
Const TSEG1=5
Const TSEB2=2

'------------------------ Data Frame Parameters -------------------
'___________________ Canbus Block1_____________________
'Collect and retrieve 16-bit data value
'Data Type 1, unsigned integer, most significant byte first
Const CANREP1=1

'Repetitions

Const ADDR1=0

'Address of SDM-CAN module

Const DTYPE1=1

'Data values to collect

Const STBIT1=33

'Start position in data frame

Const NBITS1=16

'Number of bits per value

Const NVALS1=1

'Number of values

Const CMULT1=0.4

'Multiplier

Const COSET1=0

'Offset

Dim CANBlk1(CANREP1)

'Dimensioned Dest

' \ \ \ \ \ \ \ \ \ \ \ \ Aliases and other Variables / / / / / / / /
Alias Canblk1(1)=Engine_Speed
' \ \ \ \ \ \ \ \ \ \ \ \ \ PROGRAM / / / / / / / / / / / / / / / / /
BeginProg
Scan(PERIOD,P_UNITS,0,0)

'____________________ CAN Blocks_______________________

'Retrieve Data from CAN-bus network

Canbus

(CANBLK1(), ADDR1, TQUANT, TSEG1, TSEG2,

217056256, DTYPE1, STBIT1, NBITS1, NVALS2, CMJLT1, COSET1)
Next

Scan

EndProg

CD16AC (Source, Reps, SDMAddress)

The CD16AC instruction is used to control an SDM-CD16AC, SDM-CD16, or
SDM-CD16D 16 channel relay/control port device.

A port on an SDM-CD16xx is enabled/disabled (turned on or off) by sending a
value to it using the CD16AC instruction. A non-zero value will turn the port
on; a zero value will turn it off. The values to be sent to the CD16AC are held
in the Source array.

Advertising