1 setup of mask and filter / trigger, 2 reading / polling buffer, Setup of mask and filter / trigger – Campbell Scientific SDM-CAN Datalogger to CANbus Interface User Manual

Page 36: Reading / polling buffer

Advertising
background image

SDM-CAN Datalogger-to-CANbus Interface

Each buffer can be configured as a standard ring buffer with no trigger or filter
associated with it. The buffer can also be set to start to capture data when a
predefined trigger pattern is encountered within the CAN data, or it can filter
and buffer only the CAN frames that have some part of the data that fits a
pattern.

To configure a filter or trigger two masks are used. The first is user defined as
a 64 bit include AND mask applied to the CAN data of the CAN ID of interest.
A second 64 bit user defined pattern is compared with the CAN data and when
it matches the results of the previous `AND’ operation the buffer will either
trigger or filter CAN data of a specific ID until the buffer is full.

The buffer is a fill and stop ring buffer so if the buffer is full no more data will
be stored until the logger reads a frame and makes room for another frame to
be stored. With no mask and pattern bits set in trigger mode the buffer will
trigger on any frame and behave as a normal ring buffer. This is useful for
collecting fast back to back bursts of packets as the logger can collect them
later in the knowledge the SDM-CAN will have captured up to 256 packets and
stored them in its buffer.

3.4.3.1 Setup of Mask and Filter / trigger

To implement this buffer function the build data frame Data type (7) is used as
follows:

a) If “start bit number” (parameter 9) is NON-zero then data type 7 will build

a data frame as normal.

b) If (parameter 9) is zero, the number of bits (parameter 10) is set to 8 with

index (--) NOT SET and number of bytes (parameter 11) is set to 16 then
an `Include mask’ and `Filter mask’ can be set at run time. The first 8
bytes are the Include mask mapped directly as a 64 bit frame with the first
byte as the right most byte of the data frame. The second 8 bytes is the
Filter mask mapped directly as a 64 bit frame with the first byte as the
right most byte of the data frame. This instruction will also flush the
buffer. This is used to create the buffer and attach it to a particular ID.

c) If (parameter 9) is zero, the number of bits (parameter 10) is set to 8 with

the index (--) SET and number of bytes (parameter 11) is set to 16 then an
`Include mask’ and `Trigger mask’ can be set at run time. The first 8 bytes
are the Include mask mapped directly as a 64 bit frame with the first byte
as the right most byte of the data frame. The second 8 bytes is the Trigger
mask mapped directly as a 64 bit frame with the first byte as the right most
byte of the data frame. This instruction will also flush the buffer and reset
ready for trigger. This is used to create the buffer and attach it to a
particular ID.

3.4.3.2 Reading / Polling Buffer

To implement this buffer function the read switch Data type (33) is used as
follows:

a) If “start bit number” (parameter 9) is zero then data type 33 will read the

internal switches as normal.

28

Advertising