C.5.1 encoding the identifier field values – Campbell Hausfeld SDM-CAN User Manual

Page 58

Advertising
background image

SDM-CAN CAN-Bus Interface User Guide

'\\\\\\\\\\\\\\\\\\ 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

Due to current system constraints the ID parameter must be entered
directly into the CanBus instruction.

NOTE

C.5 Retrieving J1939 Accelerator Pedal Position Data

using a CR23X/CR10X (Bus Speed 250k Baud)

C.5.1 Encoding the Identifier Field Values

The following example shows how to encode the identifier field values into the
format for the CR23X/CR10X ID parameter.

The identifier field values for the CAN Data Frame are as follows:

Priority

3

10

Reserved

0

10

Data Page

0

10

PDU Format

240

10

PDU Specific

3

10

Source Address 0

10

These decimal values then need to be converted to binary and encoded into the 29
bit identifier

.

Priority

011

2

Reserved

0

2

Data Page

0

2

PDU Format

11110000

2

PDU Specific

00000011

2

Source Address 00000000

2

C-4

Advertising