LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Event Handling in labview with arrays as event data

Hey folks,

 

I have a Labview Application which uses a dll to read Ethernet data. The setup is such that, when the dll has fresh data it sends out an event to the Labview Application so that the fresh data can be displayed.

 

However i have only managed to get this event based mechanism to send out a single structure at a time. Hence if there are 10 fresh data values, i need to send out 10 events (each event structure contains the parameter name, parameter value, unit and time stamp). It would be more efficient to send out an array of structures in a sigle shot.

 

I have tried this but Labview keeps crashing saying that an error was encountered and Labview needs to close along with an access violation message. I did a lot of online searching and found some LV code for event handling but not come accross any implementation which uses arrays as evend data. Is this supoorted? And if so is there any example vi that can be shared so that i get some knowledge about this.

 

Many Thanks in adavance,

 

Abel. 

0 Kudos
Message 1 of 12
(4,584 Views)

Even you manage to fire event as an array, LabVIEW will handle one event at a time anyway. Instead, you should group a chunk of data as an array, and send them together with one event.

0 Kudos
Message 2 of 12
(4,581 Views)

Hey Kate,

 

 

Just to check if i understood the suggestion correctly, your saying sending out one structure which has an array of parameter names and array of parameter values is the better idea. This would make handling the incoming data a little more complicated but its something that i can try out.

 

0 Kudos
Message 3 of 12
(4,569 Views)

Yes, that's what I mean.

0 Kudos
Message 4 of 12
(4,564 Views)

Hey Folks,

I am trying Event Handling to pass data from a dll to the Labview Application. This works great as long as the event data is a simple structure. The minute i add an array of floats into the event data cluster (Instead of a single float) I get an access violation & labview shuts down.

 

Any example code or any pointers on how to get this to work?

 

Thanks for the help. I shall upload the logs too in my next post.

 

Regards,

Abel.

0 Kudos
Message 5 of 12
(4,506 Views)

Crashdump 😞

0 Kudos
Message 6 of 12
(4,502 Views)

I also gave a try by using a variant as the event data type instead of the cluster which contains the array of floats. I converted the cluster into a variant and used that to create the user event reference. Followed the same logic while decoding the dats.

 

But still the crash.... Here is the windbg output...

 

ModLoad: 07580000 075b7000 C:\Program Files\National Instruments\LabVIEW 2012\resource\lvalarms.dll
ModLoad: 0ca90000 0cb72000 C:\Program Files\National Instruments\LabVIEW 2012\resource\mesa.dll
ModLoad: 0c7f0000 0c7f9000 C:\Program Files\National Instruments\LabVIEW 2012\resource\lvuste.dll
ModLoad: 35000000 3509b000 C:\Program Files\National Instruments\Shared\TDMS\tdms.dll
ModLoad: 0c860000 0c87c000 D:\SapphireViewer\dll\SapphireClientDll.dll
ModLoad: 0e240000 0e2c7000 C:\WINDOWS\WinSxS\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.6195_x-ww_44262b86\MSVCP80.dll
ModLoad: 0e2d0000 0e36b000 C:\WINDOWS\WinSxS\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.6195_x-ww_44262b86\MSVCR80.dll
(1cb0.1a34): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
eax=0e47f8b4 ebx=051f0040 ecx=051f0040 edx=061e5764 esi=22820840 edi=07b10040
eip=03c2050c esp=0e47f5cc ebp=0e47f810 iopl=0 nv up ei pl nz na po nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00010202
*** ERROR: Symbol file could not be found. Defaulted to export symbols for C:\Program Files\National Instruments\LabVIEW 2012\resource\tdcore_12_0.dll -
tdcore_12_0!LvVariant::SetContents+0xac:
03c2050c 837e3100 cmp dword ptr [esi+31h],0 ds:0023:22820871=????????

 

I cannot really tell whats going on. Looking for some pointers.

 

Regards,

Abel.

0 Kudos
Message 7 of 12
(4,482 Views)

Hey Folks,

 

Is this related to "388419 — Registering a cluster containing an array of user-defined events crashes LabVIEW 64-bit"?

 

I think i should give a try with Labview 2013....

0 Kudos
Message 8 of 12
(4,448 Views)

A crash dump isn't very useful to anyone outside NI, I think. If you upload your code - both the VI and the code for the DLL that generates the event - that will be much more helpful to the rest of us in assisting with your problem.

0 Kudos
Message 9 of 12
(4,435 Views)

Ok, so in the last few days i migrated to Labview 2013 hoping that this would solved the problem but it still persists. I have modified the NI example of passing data from a dll to a labview application to use a cluster containing a single float (in package 1 which runs fine) and to use an array of two floats (in package 2 which crashes).

 

There is some memory corruption when the event data consists of an array. Since the size of the array is 2 in the C code, in the Labview cluster i have initialized only 2 elements in the array.

 

Waiting for some tips 🙂

 

The code can be run by executing "LVUserEvent.vi" in LVUserEvent.llb. I used Visual Studio for building the dll.

0 Kudos
Message 10 of 12
(4,365 Views)