09-12-2018 06:32 AM
Hello Everyone,
Attached a subVI that is used in a larger VI to control temperature acquisition from a cDAQ 9174. The VI itself works. However, due to some hardware fault (most likely a bad USB 2.0 A cable) the cDAQ disconnects freezing/crashing the whole application. Now, of course we are going to substitute the faulty hardware, however I was wondering if there is a way to pause a loop like the one attached to this post when the DAQ channel is not detected and have the VI start again once the channel is connected again.
Thank you,
Michele
Solved! Go to Solution.
09-12-2018 06:58 AM
Try to reduce the timeout in DAQmx Read. It will give an error if the data is not acquired within that timeout period.
09-12-2018 07:24 AM
Thanks kartiknattar, however I wonder if there is a way to bypass displaying the error and stop the program. I'll try to explain better. I would like the application to keep on running and waiting for the user to reconnect the DAQ rather than stop and restart. I am not sure that is possible that is why I am asking it here in the forum.
09-12-2018 07:53 AM
I beleive LabVIEW creates new session everytime DAQ is initialized but you can still try the below method to bypass the error.
Just insert the error number which you get when the device is disconnected
Let me know if it helps you.
09-12-2018 11:26 AM
You would need to reconfigure your simple example, don't know if what you posted is an example or your real program. I have implemented what you want in some of my programs with the following modifications:
You need to decide what you want to do when an error occurs, ie, stop the program, try to restart the task, etc. Best method in my opinion is to make a state machine.
cheers,
mcduff
09-13-2018 02:12 AM - edited 09-13-2018 02:12 AM
Hi McDuff,
thanks for your reply. Could you post your VI so I could test it? I would like to check how you implemented point 3.
Best Regards,
Michele
09-13-2018 10:16 AM
Unfortunately due to company policy I cannot post it. But I can describe in more detail what I did along with some pictures.
I use an Event Structure that tells me when N number of points is ready from the device, in my case I choose N such that the time is 100ms. (For example if my sampling rate is 1kSa/s, then N is 100 samples) Before starting the acquisition I change the timeout on my Event structure from -1(infinite) to something like 500ms. If I go to the time out state then I know my DAQ did not read in 100ms and something went wrong. I then start a sequence of events to clear the error, clear the task etc, send a message and wait for the user to respond.
mcduff
N points event
timeout error
Ignore the comment, never changed it
09-13-2018 10:45 AM
I made a state machine and I obtain the goal of giving the user the choice of waiting for the DAQ to be reconnected before making a new measurement or stop the loop.
Thanks McDuff