Section 3. Programming CR10X, CR7 and CR23X
3.5 Program Examples
Examples of specific instructions which decode/encode CAN data are shown in
Appendix C. This section gives some general examples of program constructs
which show the general principles of operation.
3.5.1 Reading CAN Data
The following example reads a 16 bit engine speed value from a CAN network
running at 250K baud.
;{CR23X}
;
*Table 1 Program
01: 1.0 Execution Interval (seconds)
;Retrieve Data from CAN network
1: SDM-CAN (P118)
1: 0 SDM Address
2: 4 Time Quanta
3: 5 Tseg1
4: 2 Tseg2
5: 1024 ID Bits 0..10 (-- for 11-bit CAN ID)
6: 7680 ID Bits 11..23
7: 12 ID Bits 24..28
8: 2 Rx, unsigned int, LSB 1st
9: 33 Start Bit No.
10: 16 No. of Bits
11: 1 No. of Values
12: 1 Loc [ Eng_Spd ]
13: 0.125 Mult
14: 0.0 Offset
*Table 2 Program
02: 0.0000 Execution Interval (seconds)
*Table 3 Subroutines
End Program
The above example uses the J1939 standard to define the ID
parameter and value position in the data frame. Please refer to
Appendix C for an explanation of the application of the SDM-CAN
interface to networks complying to the J1939 standard.
NOTE
3-17