Hi Tim,
The sample code, supplied by your colleague, was most helpful. I ran that code and saw that the filter performed exactly as intended. It passed only the intended message. Yet my program continued to pass more than I expected. I’m afraid I pondered the difference for too long before realizing what the difference was. Let me explain with snippets of the program code:
When program begins, I do typical prep for the hardware
oVCI.VCI_SelectHardware
oVCI.VCI2_PrepareBoard
oVCI.VCI_ReadBoardInfo
oVCI.VCI_InitCan
Next initialize transmit & receive buffers:
intRetVal = oVCI.VCI_ConfigQueue(intBoardHdl, 0, VCI_TX_QUE, 20, 0, 0, 10, lngTxQueHdl)
intRetVal = oVCI.VCI_ConfigQueue(intBoardHdl, 0, VCI_RX_QUE, 40, 1, 0, 10, lngRxQueHdl)
When program connects to CAN network, the following code is implemented:
'Set filter for ISO Address Claim messages
'Change mask - open to include ISO Acknowledgement 059392 (18E800)
intRetVal = oVCI.VCI_AssignRxQueObj(intBoardHdl, g_lngInitRxHdl, VCI_ACCEPT, &H18EE0000, &HFFF80000) 'Mask was &HFFFF0000
oVCI.VCI_StartCan
Up to this point, all is good and my program performs just like the sample code supplied. FIltering works exactly as expected. The program enumerates all devices present on the CAN network. The user is to then select a device from created list to establish a communication session. Here is where my program code departs from the sample program and where I create the problem with Rx filter:
Select device
intRetVal = oVCI.VCI_AssignRxQueObj(g_intBoardHdl, g_lngInitRxHdl, _
VCI_ACCEPT, CLng("&H18EF" & g_strSource & “00”), &HFFFFFF00)
My intent here was to change the Rx filter from 18E8xxxx - 18EExxxx to 18EFxxxx. Using the old VCI-V2-20-855-0 wrapper, it appears that the filter is indeed changed from the first ID group to the second group. Using the VCI2 on VCI4 wrapper, my findings indicate that the filter is set for both of these ID groups rather than the second replacing the first. This is why I initially thought the mask was not functioning properly.
I tried the following code to get the filter acting as I wanted - shift from first group to second group:
’ intRetVal = oVCI.VCI_ResetCan(g_intBoardHdl, 0)
’ intRetVal = oVCI.VCI_AssignRxQueObj(g_intBoardHdl, g_lngInitRxHdl, _
VCI_ACCEPT, CLng("&H18EF" & g_strSource & “00”), &HFFFFFF00)
’ intRetVal = oVCI.VCI_StartCan(g_intBoardHdl, 0)
The above attempt appeared to make no difference in filter actions. Finally, I tried the following code and the filter now worked as expected, allowing only 18EFxxxx to pass:
Select device
lngRetVal = oVCI.VCI_SetAccMask(g_intBoardHdl, 0, CLng("&H18EF" & g_strSource & “00”), &HFFFFFF00)
The above is a viable solution for my program. I can make the change and the end user should have a seamless transition from VCI2 to VCI4. What I am hoping is that you could provide me with some education as to the proper way, if any, to change the filter from one message to another. My lack of understanding of the filter mechanism is causing me to work around the issue. I’d like to know the proper intended implementation.
Thanks to all for the assistance,
Greg