From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Data overflow or sampling rate problem?

I built a DLL in LV to output a voltage signal when I call the function in my C++ program. The function is called void volts(double Vx, double Vy).

I call this function in VC++ with these steps:

if leftbuttonmouse is down {
volts(point.x,point.y) //assume I have converted coordinates to volt
}

After I run this program, it works fine but most of the time the program hangs after 30 secs playing with leftmousedown.

Can anyone tell me when? I can post my VI and codes here if required.

Thanks a million.
0 Kudos
Message 1 of 11
(2,810 Views)
Hi there,

It seems that your DLL is stalling for some reason. Make sure that you are performing correct error handling to stop the DLL if an error occurs.

Make sure that all drivers are installed for the hardware, and remember to save the default values of controls if necessary.

I hope this helps.

Best regards,
Philip C.
Applications Engineer
National Instruments
www.ni.com/ask
- Philip Courtois, Thinkbot Solutions

Thinkbot Solutions
0 Kudos
Message 2 of 11
(2,810 Views)
Hi Philip

I attached a VI from LV default VI that I gotten from my colleague. The DLL I used for my program is built from this VI.

All drivers are installed (VI can work but calling DLL from VC++ program will hang sometimes). I have used all default value for all controls.

What do you mean by error handling? If you notice from my VI, I only use high level control instead of sub level control. Can you please advise after seeing the VI? I dont know is it legal to put up a VI here, if it is not please remove it.

Thanks
0 Kudos
Message 3 of 11
(2,810 Views)
In your VI you are calling the same hardware (device 1) two times in parallel. This is not recommended. You should make sure that there is a sequence in the flow, so one � AO Update Channel.vi�s will execute before the other.

What is more likely to be the issue in your case, is that the VIs include an error handler � a popup window, in case an error occurs. You shouldn�t have error handlers within your DLL, but rather a Boolean output of the DLL to tell if an error occurred or not. A simple solution would be to use two �AO Write One Update.vi�s connected by the error cluster (so one will run before the other) and then use an �unbundle by name� to get the error �status� � if an error occurred or not. Use this Boolean as an output from the DLL.



Best regards,
Philip C.
Applications Engineer
National Instruments
www.ni.com/ask
- Philip Courtois, Thinkbot Solutions

Thinkbot Solutions
0 Kudos
Message 4 of 11
(2,810 Views)
Thanks Philip,

From what I am required to do, I need to output at least two signals and unfortunately we only have a single device in my workplace. The signals have to be output at the same time.

My understanding from your reply is to make another Boolean output from my DLL to communicate with my VC++ program whether an error has occured.

Do you have any recommendation for articles I can refer to in NI Zone on the signal transmission? Thanks.
0 Kudos
Message 5 of 11
(2,811 Views)
Yes, you should use the Boolean output as a parameter to pass back to the caller (VC++) whether an error occurred or not.

I found an example here that outputs on two ports of the same device. Notice that the error cluster (pink wire) is being passed from subVI to subVI, so they execute sequentially. If you choose to use this code as a DLL, remember to remove the �Error Handler.vi� and instead pass the Status of the error cluster as a Boolean indicator.


I hope you will get it to work.

Best regards,
Philip C.
Applications Engineer
National Instruments
www.ni.com/ask
- Philip Courtois, Thinkbot Solutions

Thinkbot Solutions
0 Kudos
Message 6 of 11
(2,811 Views)
i tried to change and connect to a boolean indicator. The subVI become gray. Please advise. Thanks
0 Kudos
Message 7 of 11
(2,794 Views)
i tried to change and connect to a boolean indicator. The subVI become gray. Please advise. Thanks
0 Kudos
Message 8 of 11
(2,795 Views)
A SubVI becomes gray when the connector pane of the SubVI has changed. You will have to relink to the SubVI by right-clicking the gray icon and selecting "Relink to SubVI".
- Philip Courtois, Thinkbot Solutions

Thinkbot Solutions
0 Kudos
Message 9 of 11
(2,771 Views)
Thanks Philips

The LVBoolean is 1 or 0 in VC++? Thanks
0 Kudos
Message 10 of 11
(2,765 Views)