CANpie FD
CAN programming interface environment - Version 3.08
Data Fields
CpCanMsg_s Struct Reference

Detailed Description

For transmission and reception of CAN messages a structure which holds all necessary informations is used. The structure has the following data fields:

Data Fields

uint32_t ulIdentifier
 
union {
   uint8_t   aubByte [CP_DATA_SIZE]
 
   uint16_t   auwWord [CP_DATA_SIZE/2]
 
   uint32_t   aulLong [CP_DATA_SIZE/4]
 
tuMsgData
 
uint8_t ubMsgDLC
 
uint8_t ubMsgCtrl
 
uint32_t ulMsgUser
 

Field Documentation

◆ aubByte

uint8_t CpCanMsg_s::aubByte[CP_DATA_SIZE]

byte access, array of bytes

◆ aulLong

uint32_t CpCanMsg_s::aulLong[CP_DATA_SIZE/4]

32 bit access, array of longs

◆ auwWord

uint16_t CpCanMsg_s::auwWord[CP_DATA_SIZE/2]

16 bit access, array of words

◆ tuMsgData

union { ... } CpCanMsg_s::tuMsgData

The data field has up to 8 bytes (for classic CAN) or 64 bytes (for ISO CAN FD) of message data. The number of used bytes is described via the structure member ubMsgDLC.

◆ ubMsgCtrl

uint8_t CpCanMsg_s::ubMsgCtrl

The structure member ubMsgCtrl defines the different data frames (2.0A / 2.0B) and the RTR frames.

  • Bit 0: Std. / Ext. Frame
  • Bit 1: ISO CAN FD: value of FDF bit
  • Bit 2: Remote Frame
  • Bit 3: Overload Frame
  • Bit 4: Remote Procedure Call
  • Bit 5: reserved, always 0
  • Bit 6: ISO CAN FD: value of BRS bit
  • Bit 7: ISO CAN FD: value of ESI bit
See also
Bit mask for message control

◆ ubMsgDLC

uint8_t CpCanMsg_s::ubMsgDLC

The data length code denotes the number of data bytes which are transmitted by a message. The possible value range for the data length code is from 0 to 8 for classic CAN and 0 to 15 for ISO CAN FD.

◆ ulIdentifier

uint32_t CpCanMsg_s::ulIdentifier

The identifier field may have 11 bits for standard frames (CAN specification 2.0A) or 29 bits for extended frames (CAN specification 2.0B). The three most significant bits are reserved (always read 0).

See also
Mask values for CAN messages

◆ ulMsgUser

uint32_t CpCanMsg_s::ulMsgUser

The field user data can hold a 32 bit value, which is defined by the user. This is an optional field (available if CP_CAN_MSG_USER is set to 1).