I have been working in a polarimeter, for which I am using two KDC101 motors and a power meter PM 100, all from Thorlabs. I based my program using templates in Labview: Continuous Adquisicion and Logging, and Queue Message Handler.
The problem I encounter is that whenever I press Exit or simply close the window, the program sends the error: Error 91 occurred at Variant To Data.This occurs even when I simply start the program and then press Quit.
I already verify the tunnels in the case and all are properly connected. Even I explictly put the input for the stop of the loop for each case to be able to disable the Default if Unwired, nothing changed.
Then, I compared it with the templates and I did not see any big difference. As in the templates, I only use variants for the settings and for the Quit and Confirm Quit cases in the Message Handler Loop.
I would appreciate if you can check if there is something I am missing.
Solved! Go to Solution.
A pet peeve around here is not attaching the actual code. While you can see some things in a picture you can't see other things eg. other cases in case structures, inside SubVIs or even code outside the picture (perhaps your "Acquisition" loop in this case) etc. You also can't play with the code in order to gain some native understanding of where the problem could be. Your trouble-shooting assistance will likely be limited and possibly not that useful without the actual code.
Having said that I see your Exit case is dequeueing some data from the "UI" queue and assuming its an error cluster - I assume that's where the error is being generated (via the error popup attached) since I believe code 91 is to do with the variant not being of the correct type. Presumably whatever is firing this Exit message to the UI queue is attaching the appropriate data?
Thank you for answering.
I attached the files, the main file is MainPolarimeter.vi.
As I mentioned before, when I press Quit or close the window, I get the error. I imagine that it is because it is not receiving anything but I just base it to the template, so maybe I change something on the process but I can't find the error.
You've got automatic error handling enabled, and the variant to data function is returning an error - The 'Exit' command does not include any error data - so where you wire up the variant to the variant to data function in the 'Exit' Case of the message handling loop, you are trying to convert an empty variant to an error. This returns an error, which will display an error popup because automatic error handling is enabled.
I would disable automatic error handling (File>VI Properties>Execution Page - un-check the 'Enable Automatic Error Handling' checkbox) and remove that variant to data to error handler, unless you plan on using it.