Campbell Scientific CR9000X Measurement and Control System User Manual

Page 248

Advertising
background image

Section 7. Measurement Instructions

7-24

Parameter Enter

SDMCAN PARAMETERS

NumBits

The NumBits parameter is used to specify the number of bits that will be used in a
transaction. The number can range from 1 to 64 (there are 64 bits in a CAN data
frame).
The SDM-CAN can be configured to notify the datalogger when new data is
available by setting a control port high. This allows data to be stored in the
datalogger tables faster than the program execution interval. This interrupt function is
enabled by entering a negative value for this parameter.
Note: This parameter may be overridden by a fixed number of bits, depending
upon the data type selected.

NumVals

The NumVals parameter defines the number of values (beginning with the value
stored in the Dest array) that will be transferred to or from the datalogger during one
operation. For each value transferred, the Number of Bits (NumBits) will be added to
the Start Bit number so that multiple values can be read from or stored to one data
frame.

Mult,
Offset

The Mult and Offset parameters are each a constant, variable, array, or expression by
which to scale the results of the measurement.

This instruction cannot be used in a SubScan.

SDMCAN Example 1

The following example reads a 16-bit engine speed value from a CAN-bus
network running at 250K baud.

'------------------------- Physical Network Parameters ------------

'Set SDM-CAN to 250K

Const TQUANT=4 : Const TSEG1=5 : Const TSEB2=2

'___________________ SDMCAN 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(1,2,0,0)

'____________________ CAN Blocks_______________________

'Retrieve Data from CAN-bus network

SDMCAN

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

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

Next Scan

EndProg

NOTE

Advertising