Acrosser AIV-HM76V1FL User Manual
Page 48
AIV-HM76V1FL Series User Manual
48
Acrosser Technology Co., Ltd.
To transmit a CAN packet, the programmer has to fill in the fields in the variable of
type CanMsg and pass this CanMsg variable as an argument to invoke the APIs.
The fields in CAN message are described below:
id:
This field holds the ID information of the CAN packet. In a ‘Standard Data Frame’
CAN packet, the ID field consists of 11 bits of binary digitals. In an ‘Extended Data
Frame’ CAN packet, the ID field consists of 29 bits of binary digitals. That the CAN
packet is a ‘Standard Data Frame’ packet or an ‘Extended Data Frame’ packet is
determined by the ‘id_type’ field in the CanMsg variable.
The ‘id’ field in the CanMsg variable is a 32-bit long space. If a CanMsg variable is
configured as a ‘Standard Data Frame’ CAN packet, the bit[0] ~ bit[10] in the ‘id’ field
is the ID of the CAN packet. The bit[11] ~ bit[31] are ignored when the APIs in the
library processing the CanMsg variable.
If a CanMsg variable is configured as an ‘Extended Data Frame’ CAN packet, the
bit[0] ~ bit[28] in the ‘id’ field is the ID of the CAN packet. The bit[29] ~ bit[31] are
ignored when the APIs in the library processing the CanMsg variable.
id_type:
This field identifies that the CAN packet is a ‘Standard Data Frame’ CAN packet or a
‘Extended Data Frame’ CAN packet:
struct CanMsg canMsg;
canMsg.id_type = EXT_ID; // A ‘Extended Data Frame’ packet
canMsg.id_type = STD_ID; // A ‘Standard Data Frame’ packet
length:
This field identifies the number of data bytes in the next field ‘data[8]’ which are filled
with effective data. Because the ‘data’ field is an 8-byte long array, the range of this
field ‘length’ is 0 ~ 8.
data[8]:
This array of data will be filled with effective data.
For example:
struct CanMsg msg;
msg.data[0] = 0xa1;
msg.data[1] = 0xb2;