LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Event structure doesn't handle all events from external DLL source

Hi!

I use a DLL, wich handles an USB CAN transceiver device, and generates LabVIEW user events with extcode.h and PostLVUserEvent() function.

In my vi I use an event case structure to handle theese external events. The problem is, that if the events come too frequently, then it cannot handle all events.

The vi contains a couple of parallel while loops which process the incoming data from the external event.

In another application I use the same architecture, and that works fine. This one is more complex.

Do you think I have reached the limits of the program? Or what else can be the problem?

I have tried to use a queue in the  event structure, it helped a little, but yet, not all the events are handled. My external DLL sends all event, so the problem is not there.

Thanks in advance!

0 Kudos
Message 1 of 7
(3,681 Views)

Hi Wasz,

 

Thanks for the post and I hope your well.

 

It is not possible for the event structure to miss events - it simply queues them up. To keep the event structure 'in time' with the code you must ensure the code to execute in each event is minimal to allow the event structure to handle the next event. 

 

Please see this two links:

event structure buffering: leading to,

How to avoid built-up for "cursor move" events? : where somone is trying to avoid handling all events.

 

What sort of events are not being handled? Could it be an issue your events are not configured correctly? Maybe if you could produce a small example in LabVIEW code, so we can just test the event structure configuration... someone working around the external dll call - which you seem sure is working correctly.  

 

In terms of queuing to process the events in other loops is certainly an option to speed up the event structure. To do this, use a produce/consumer design pattern.

 

hope this helps,

Kind Regards
James Hillman
Applications Engineer 2008 to 2009 National Instruments UK & Ireland
Loughborough University UK - 2006 to 2011
Remember Kudos those who help! 😉
0 Kudos
Message 2 of 7
(3,658 Views)

Hi!

I use something similar, excep for that my event is generated in the dll directly, if there is new data in the USB buffer.

Then in another while loop i process the "message from dll" (which is, in my case, a structure, containing some integers) via local variable.

This is the only event handled by this event-structure.

So this is not a UI event, this is generated by calling the GenerateLVEvent() function. It is sure, that this function is called every time. If i send 100 messages via the CAN bus, then only 98 or 99 events take place in my VI,even though i call the function 100 times in the DLL, which is traceable, so i am sure it is done.

0 Kudos
Message 3 of 7
(3,654 Views)

Hi!

Meanwhile the problem has been solved. I rearranged a little tha application structure, and now it works fine... I dont know yet, what was the problem, but if i figure it out, ill post it, if anybody else had tha same problem.

Anyway, thanks for the help!

W

0 Kudos
Message 4 of 7
(3,628 Views)

wasz wrote:

Hi!

Meanwhile the problem has been solved. I rearranged a little tha application structure, and now it works fine... I dont know yet, what was the problem, but if i figure it out, ill post it, if anybody else had tha same problem.

Anyway, thanks for the help!

W


 

I would really like to hear what the answer to this riddle is. If you figure it out, please share.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 5 of 7
(3,617 Views)

Hi Wasz,

 

Thanks for getting back to us - sorry I didnt get a chance to see your reply sooner (bussiness times at NI UK :P).

 

What did you alter .. maybe this will help to explain what the issue was?

 

Thanks,

Kind Regards
James Hillman
Applications Engineer 2008 to 2009 National Instruments UK & Ireland
Loughborough University UK - 2006 to 2011
Remember Kudos those who help! 😉
0 Kudos
Message 6 of 7
(3,612 Views)

Hi, wasz,

 

Here just classical race condition: you starting firing events before registration!

Look code below - here we will lost first 40 events:

 

 

Andrey.

Message Edited by Andrey Dmitriev on 12-09-2008 06:56 PM
Message 7 of 7
(3,608 Views)