
AIV-HM76V1FL Series User Manual
46
Acrosser Technology Co., Ltd.
To transmit a CAN packet, the programmer has to ll in the elds in the variable of
type CanMsg and pass this CanMsg variable as an argument to invoke the APIs.
The elds in CAN message are described below:
id:
This eld holds the ID information of the CAN packet. In a ‘Standard Data Frame’
CAN packet, the ID eld consists of 11 bits of binary digitals. In an ‘Extended Data
Frame’ CAN packet, the ID eld 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’ eld in the CanMsg variable.
The ‘id’ eld in the CanMsg variable is a 32-bit long space. If a CanMsg variable is
congured as a ‘Standard Data Frame’ CAN packet, the bit[0] ~ bit[10] in the ‘id’ eld
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 congured as an ‘Extended Data Frame’ CAN packet, the
bit[0] ~ bit[28] in the ‘id’ eld 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 eld identies 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 eld identies the number of data bytes in the next eld ‘data[8]’ which are lled
with effective data. Because the ‘data’ eld is an 8-byte long array, the range of this
eld ‘length’ is 0 ~ 8.
data[8]:
This array of data will be lled with effective data.
For example:
struct CanMsg msg;
msg.data[0] = 0xa1;
msg.data[1] = 0xb2;