Dil ID: 8
Dil Adı: italy
Dil Kodu: it6tayfun Prodotti del Marchio Acrosser
Dünyanın En Büyük
Elektronik Bilgi Kütüphanesi



AIV-HM76V1FL Series User Manual
53
www.acrosser.com
Syntax: i32 setCanFilter(struct CanFilter *varFilter)
Description:
This function sets the bit pattern to the lter. By indicating
the ‘lterType’ eld in the ‘varFilter’ variable, the bit pattern
in the ‘lter eld will be taken as an ‘Standard ID’ lter or
‘Extended ID’ lter.
struct CanFilter {
u8 lterId; // There are six lters so the lterId = 0 ~ 5
u8 lterType; // lterType = STD_ID or lterType =
EXT_ID
u32 lter;
}
If a lter is congured as a ‘Standard ID’ lter, only bit18
~ bit28 in the mask take effect when ltering the CAN
packet.
Parameters:
This function takes a pointer to a variable of type ‘CanFilter’
as the parameter. Users set up the ‘lterId’. There are six
lters so the ‘lterId’ could be 0 ~ 5. Filter0 and lter1 are
associated with mask0. Filter2 ~ lter5 are associated with
mask1.
By setting up ‘lterType’, users indicate the type of the
lter. Filter type could be ‘STD_ID’ or ‘EXT_ID’.
Depending on the lter type, the ‘lter’ eld in the CanFilter
variable could be 0x0 ~ 0x7FF (11 bits) when lter type is
‘STD_ID’. If the lter type is ‘EXT_ID’, the ‘lter eld in the
CanFilter variable could be 0x0 ~ 0x1FFFFFFF (29 bits).
For example:
struct CanFilter varFilter;
i32 result;
varFilter.lterId = 3;
varFilter.lterType = STD_ID;
varFilter.lter = 0x555;
result = setCanFilter(&varFilter);
if( result != 0)
printf(“Fail to set up the lter!\n”);
Return Value:
If this function sets the lter successfully, it returns 0, any
other returned value stands for error.