SDM-CAN CAN-Bus Interface User Guide
'\\\\\\\\\\\\\\\\\\\\\\\\\ CANBUS CONSTANTS //////////////////////
'------------------- Physical Network Parameters -----------------
Const TQUANTA = 4 ')Set SDM-CAN to 250K
Const TSEG1 = 5 ')Network speed
Const TSEG2 = 2 ')
'---------------------- Data Frame Parameters --------------------
'___________________________CANbus Block1_________________________
Const CANREP1 = 1 'Repetitions
Const ADDRESS1 = 0 'SDM address of SDM-CAN Module
Const DATATYPE1 = 1 'Collect and retrieve data values
Const STARTBIT1 = 1 'Start position in data frame
Const NUMBITS1 = -16 'Number of bits/value – for interrupt
Const NUMVALS1 = 1 'Number of values
Dim CANBlk1(CANREP1) 'Dimensioned source
Dim NewData
'\\\\\\\\\\\\\\\\\\ ALIASES & OTHER VARIABLES //////////////////
Alias CANBlk1(1) = Accel_Pedal 'Assign an alias name to CANBlk1(1)
'\\\\\\\\\\\\\\\\\\\\\\\\\\\ PROGRAM ///////////////////////////
BeginProg 'Program begins here
'MainSequence
Scan(PERIOD,P_UNITS,0,0) 'Scan once every 1 Secs, non-burst
'__________________________ CAN Blocks __________________________
'Read status of digital I/O port, return value to NewData variable
ReadIO(NewData,7,&B1)
'When digital I/O port is high retrieve data from CAN network
If NewData > 0 Then
CanBus(CANBlk1(),ADDRESS1,TQUANTA,TSEG1,TSEG2, 217056000,
DATATYPE1,STARTBIT1,NUMBITS1,NUMVALS1,1,0)
EndIf
Next Scan 'Loop up for the next scan
EndProg 'Program ends here
Due to current system constraints the ID parameter must be entered
directly into the CanBus instruction.
NOTE
4.2.4 SlowSequence Instruction
It is also possible to have a SlowSequence Scan for low priority CANbus
measurements that are not needed at the rate of the primary scan interval. The
CR9000 or CR5000 tags on measurement instructions from the slow sequence
scan to the normal scan as time allows.
Please refer to the CR9000 or CR5000 on-line help for a more detailed
explanation of the SlowSequence instruction.
4-6