C.4.2 finding the start bit, C.4.2 – Campbell Scientific SDM-CAN Datalogger to CANbus Interface User Manual

Page 59

Advertising
background image

Appendix C. Application of the SDM-CAN on Networks Complying with the J1939 SAE Standards

TABLE C-4. Mapping of J1939 Identifier Field values into a 29-Bit Identifier

Bit

28 27 26 25

24 23 22

21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

SOF P

3

P
2

P
1

R
1

D
P

P
F
8

P
F
7

P
F
6

P
F
5

P
F
4

P
F
3

P
F
2

P
F
1

P
S
8

P
S
7

P
S
6

P
S
5

P
S
4

P
S
3

P
S
2

P
S
1

S
A
8

S
A
7

S
A
6

S
A
5

S
A
4

S
A
3

S
A
2

S
A
1

Value 0 1 1 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0


This gives a binary value of 01100111100000000001100000000 that can then
be converted to 217056000

10

and used as the ID parameter.

C.4.2 Finding the Start Bit

The byte number of the Accelerator pedal position value is 2

TABLE C-5. Accelerator Pedal Position Value Byte Number

1

2 3 4 5 6 7 8

87654321

87654321 87654321 87654321 87654321 87654321 87654321 87654321


The start bit for this value is 49, as it is the least significant bit of the data value
within the data frame that this parameter refers to.

An example for Accelerator pedal position is shown below.

'Set scan rate
Const PERIOD = 1 'Scan interval number
Const P_UNITS = 2 'Scan interval units (Secs)

'\\\\\\\\\\\\\\\\\\\\\\\\\ CANBUS CONSTANTS //////////////////////
'------------------- Physical Network Parameters -----------------

Const TQUANT = 4 ')Set SDM-CAN to 250K
Const TSEG1 = 5 ')Network speed
Const TSEG2 = 2 ')

'---------------------- Data Frame Parameters --------------------
'___________________________CANbus Block1_________________________
'Collect and retrieve 16 bit data value

'Data type 2, unsigned integer, least significant byte first
Const CANREP1 = 1 'Repetitions
Const ADDRESS1 = 0 'SDM address of SDM-CAN

Const DATATYPE1 = 2 'Collect and retrieve data values
Const STARTBIT1 = 49 'Start position in data frame

Const NUMBITS1 = 8 'Number of bits/value
Const NUMVALS1 = 1 'Number of values
Dim CANBlk1(CANREP1) 'Dimensioned source


'\\\\\\\\\\\\\\\\\\ ALIASES & OTHER VARIABLES //////////////////
Alias CANBlk1(1) = Accel_Pedal 'Assign an alias name to CANBlk2(1)

'\\\\\\\\\\\\\\\\\\\\\\\\\\\ PROGRAM ///////////////////////////
BeginProg 'Program begins here
'MainSequence

Scan(PERIOD,P_UNITS,0,0) 'Scan once every 1 Secs, non-burst
'__________________________ CAN Blocks __________________________
'Retrieve Accelerator pedal position Data from CAN network

CanBus(CANBlk1(),ADDRESS1,TQUANTA,TSEG1,TSEG2,217056000,
DATATYPE1,STARTBIT1,NUMBITS1,NUMVALS1,0.4,0)

Next Scan 'Loop up for the next scan
EndProg 'Program ends here

C-3

Advertising