CAN Mask & Filter setting at ---- software level
Dinesh Guleria <[email protected]>
| Newsgroups | gmane.comp.hardware.bus.can |
|---|---|
| Message-ID | <CAKpDV8tGVptpwQX88h7z1dGpg-pmRORk7=tvoVXd14cr1OyPPg@mail.gmail.com> |
Hi,
I have enable my can controller to receive all messages & trying to
filtering messages it at software level.
I referred following link by Heikki
http://old.nabble.com/Setting-CAN-MASK---ID-registers-td14881913.html
Suppose i want to receive only ID_1 & ID_2.
But I was not able to get the desired result ID-0x03 is still passing the
software filter
ID_1 = 0x01; // 0000 0001
ID_2 = 0x33; // 0011 0011
mask = 0x32; // 0011 0010
filter = 0x01; // 0000 0001
if ---- messageID_Rx = 0x03
========== CODE ======================
result = !( ( filter ^ messageID_Rx ) & mask );
if ( result )
{
// ID accepted
}
====================================
Can someone on list help me to correct this. Or can suggest me where i am
getting wrong ?
Any reply will be appreciable.
Thanks & Regards,
Dinesh