Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

Nican drops frames using NCwait with vb but dosn't when using callback with VC

Using VB interfaced to OCX for nican. Frames are dropped while poling for can frames using NCwaitstate and NCread. Using call back with VC++ program works OK.
0 Kudos
Message 1 of 4
(4,227 Views)
Hi,

We don't provide an ActiveX control (OCX file) to access the NI-CAN driver. We only have the language interface files for C. You can use driver in Visual Basic by calling the dll directly. In this case, the functions used in Visual Basic are the same as the ones used in VC++.

What's the rate of the incomming frames?, What's the buffer size you're using?. If give can give a description of the conditions that cause this problem I could try it out. After we figure out the ocx file confusion.

Let me know if you have any questions.

DiegoF.
National Instruments
0 Kudos
Message 2 of 4
(4,227 Views)
We wrote the OCX interface to VB. We had problems with the DLL crashing when using it directly from VB. The ocx simply puts a wrapper around the C interface. We have written 2 routines to trouble shoot this. One uses C interface using Visual C++. The other is using VB with the OCX. Both are striped down to just gathering frames and loging them to a file. The VC++ uses the Callback function on the C interface. The VB checks the status for a read ready then does a read. I have also tried read multiple that seems to drop less frames. It apears that when the buffer is read that some frames can be dropped. I don't seem to get any error conditions. The visual C++ dosn't seem to drop frames.
Steve P
0 Kudos
Message 3 of 4
(4,227 Views)
Hi,

I've been doing some testing in Visual Basic and haven't been able to reproduce the problem. I'm using ncWaitForState configured to return when a frame is received. Then i use ncRead. Another program generates a frame every 100ms.

Is there anything in particular I should try?. Let me know.

DiegoF.
National instruments.
0 Kudos
Message 4 of 4
(4,227 Views)