Campbell Scientific CR1000 Manuel D'utilisation page 192

Table des Matières

Publicité

Chapitre 7. Instructions de mesure
NumVals
Mult, Offset
NOTE
7-32
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.
The Mult and Offset parameters are each a constant, variable, array, or
expression by which to scale the results of the measurement.
Si plus d'une instruction Canbus est utilisée dans un programme de centrale
de mesure, les valeurs utilisées pour TimeQuanta, TSEG1 et TSEG2 doivent
être les mêmes à chaque instruction.
Exemple CANBUS
L'exemple suivant lit la valeur de la vitesse d'un moteur à 16 bits provenant d'un
réseau CAN-bus fonctionnant à 250K baud.
'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
Const ADDR1=0
Const DTYPE1=1
Const STBIT1=33
Const NBITS1=16
Const NVALS1=1
Const CMULT1=0.4
Const COSET1=0
Dim CANBlk1(CANREP1)
' \ \ \ \ \ \ \ \ \ \ \ \ 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
'Repetitions
'Address of SDM-CAN module
'Data values to collect
'Start position in data frame
'Number of bits per value
'Number of values
'Multiplier
'Offset
'Dimensioned Dest

Publicité

Table des Matières
loading

Table des Matières