3 basic sequence of buffer usage, 5 program examples, 1 reading can data – Campbell Scientific SDM-CAN Datalogger to CANbus Interface User Manual
Page 37: Basic sequence of buffer usage, Program examples, Reading can data

SDM-CAN Datalogger-to-CANbus Interface
b) If (parameter 9) is one, the number of bits (parameter 10) is set to 8 with
the index (--) NOT SET and number of bytes (parameter 11) is set to zero
then one CAN frame will be transferred from the buffer to the working
buffer ready for normal data collection using Data Types 1-6. Also the
number of CAN frames stored in the buffer will be stored in a logger
location specified by this instruction.
c) If (parameter 9) is one, number of bits (parameter 10) is set to 8 with the
index (--) SET and number of bytes (parameter 11) is set to zero then only
the number of CAN frames stored in the buffer will be stored in a logger
location specified by this instruction. This instruction would generally be
used for polling the buffer.
3.4.3.3 Basic Sequence of Buffer Usage:
1. Initialize buffer and trigger event or filter using an SDM-CAN instruction
with data type 7.
2. Wait long enough or poll the buffer until enough CAN frames are
collected using an SDM-CAN instruction with data type 33.
3. Transfer a CAN frame from the buffer to the working buffer using an
SDN-CAN instruction with data type 33.
4. Parse the CAN data frame using the normal SDM-CAN data types 1-6.
5. Repeat from (3) until you have collected and parsed all the CAN frames
you require from the buffer.
6. Do other processing ………..
7. Repeat from (1) to collect another set of CAN frames.
3.5 Program Examples
Examples of specific instructions which decode/encode CAN data are shown in
Appendix C, Application of the SDM-CAN on Networks Complying with the
J1939 SAE Standards. 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
29