10-20-2009 03:09 PM
I have some funky stuff going on in the attached VI. What the VI does is simply to log data to a text file. It is built up as a state machine. This VI's Create state is called from a mainVI (with the help of named queues). I get more than one error and it seems completely random.The error usually occurs if I stop the mainVI, then starts it again. So the second (or following) times the DP VI is called, I get random errors such as the two below:
Error 1 occurred at Dequeue Element in DP.vi->PSS.vi
Possible reason(s):
LabVIEW: An input parameter is invalid.
---
NI-488: Command requires GPIB Controller to be Controller in Charge.
Error 1 occurred at Close File in DP.vi->PSS.vi
Solved! Go to Solution.
10-20-2009 03:24 PM
I have not looked at your VI, but I can answer part of your question. The error message can occur in two different circumstances. One is the invalid input parameter and the second is the GPIB error. If you do not have a GPIB device, then only the first definition applies.
My guess is that when you restart the system, some queue reference does not exist and this causes the error.
Lynn
10-20-2009 04:08 PM - edited 10-20-2009 04:08 PM
10-20-2009 04:23 PM
Lynn is right - your error is the "invalid input parameter" error.
because some VISA (NI-488) errors have the same numbers as LabVIEW errors, labview shows them both. This is both helpful (when you have NI-488 errors) and confusing (when you aren't using NI-488). Better to have too much info than not enough?
-Barrett "Controller in Charge" Lawson
10-20-2009 04:24 PM
10-20-2009 04:46 PM - edited 10-20-2009 04:51 PM
Are your shift registers uninitialized on purpose?
if you ever have an error in the dequeue element, the shift registers will be filled with the error from the DQ and a blank file ref. on the next call to this VI, if there is an error in the DQ, it will throw the invalid file ref on close error dialog. if there is not, the old error will propagate and you will get the dialog for it.
and I'll bet your DQ element is throwing an error because your enum in the DP QSM queue is a non-strict typedef and you've changed it somewhere. make it strict!
I think there's something mixed up with your error case selector and the error case of your state machine.
10-20-2009 06:01 PM
blawson, I think you found the error!
So shift registers only gets uninitialized again if I close the actual VI, and not when I start executing it again? So in reality, they actually behave like real shift registers? I found two solutions to this problem.
1) To initialize the error shift register with an empty error constant.
2) To remove the wire from the shift register to the Write to Text File. This works since I always call the Create state first.
Which one would you recommend?
Also, what is the reason to keep the typedef strict? I have seen non-strict in other code.
10-20-2009 07:33 PM
I went back and checked my assumptions on strict vs. non-strict type defs on enums and there's no difference between the two as far as which to use for a case selector enum. sorry about that!
So you're trying to use the error out of the DQ element to signal that the queue has been released, right? Well what's happened is that some other error snuck in and ate your cookies. from the help file: "If queue becomes invalid (for example, the queue reference is released), the function stops waiting and returns error code 1122." so just test for error code 1122 in the error cluster and treat it like a dead queue if true, and handle it like you regularly handle errors if not. The same thing is happening in both VIs.
-B
10-21-2009 12:14 AM
Siniz wrote:blawson, I think you found the error!
So shift registers only gets uninitialized again if I close the actual VI, and not when I start executing it again? So in reality, they actually behave like real shift registers? I found two solutions to this problem.
1) To initialize the error shift register with an empty error constant.
2) To remove the wire from the shift register to the Write to Text File. This works since I always call the Create state first.
Which one would you recommend?
Also, what is the reason to keep the typedef strict? I have seen non-strict in other code.
Generally you should always explicitly initialize your shift registers unless you want to retain the values from one execution to the next. This is required for Action Engines but in most other cases you should use initialized shift registers to avoid side effects like you encountered in this application.
10-21-2009 09:22 AM