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.
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.
09-15-2020 09:48 AM
Hey,
I think I'm getting somewhere with the new setup. I removed the "recording process" out of the state machine and am now triggering the data collection with a queued message handler.
The -200279 error is gone, but I was hoping for any last tips in the new V006 code (saved to 2017) before I mark this one resolved?
I'm still going to get ride of the locals too.
Thanks a bunch.
09-15-2020 09:49 AM - edited 09-15-2020 09:50 AM
I would get this working as a state machine first. The message handler can come later. You do not need the inner loop if you properly set up your state machine. Your state machine might have an initialize state, a waiting state, a start acquisition state, and acquiring state, a stop acquisition state, and a shutdown state, for example. Pass the task and error wires through all of the states via shift registers (make sure you wire them through all states).
Edited to add: I started writing this reply before seeing your last response.
09-15-2020 09:56 AM
You're off to the wrong start. Take a step back and get the state machine running first. You're QMH will not run as written. LabVIEW is a dataflow driven language. This means that a node (loop, etc) can't run until all of it's inputs are available. Also, an output won't be available from a node (loop) until the node (loop) has fully completed.
09-16-2020 06:34 AM
So, I've been working to switch things over to a state machine, but I'm running into a few concerns.
1. I seem to have a lot of shift registers and I'm not confident in how their being used or how I am initializing. For example, when I close a daq task doesn't the shift register disappear at that point?
2. I'm not sure the best way to shut down the code. Before I would just use a boolean and attach it into the while loop, but now I'm not sure.
3. There seems to be a lot of code in the state machine compared to all the examples I can find, is this wrong?
See V008 for reference.
09-16-2020 07:13 AM
@jescameron wrote:
So, I've been working to switch things over to a state machine, but I'm running into a few concerns.
1. I seem to have a lot of shift registers and I'm not confident in how their being used or how I am initializing. For example, when I close a daq task doesn't the shift register disappear at that point?
You can reduce the number of shift registers by bundling some of the information and using bundle by name/unbundle by name to get to the information that you need.
Open the DAQ task at startup and don't close the task until shutdown. This way the task remains valid. You can start and stop the task without issue.
@jescameron wrote:
2. I'm not sure the best way to shut down the code. Before I would just use a boolean and attach it into the while loop, but now I'm not sure.
Do the shutdown in your Wait for Event loop. One way to do this would be to have two shift registers for your Next state - one would always be Wait on Event and the other would be the next state. Go to the Wait on Event after every state. Use a small timeout to check for events. If timeout then go to the next prescribed state. If an event occurred (stop button pressed, for example) then the timeout code will be ignored and it will go to the stop state (or whatever state you tell it to go to).
@jescameron wrote:
So, I've been working to switch things over to a state machine, but I'm running into a few concerns.
3. There seems to be a lot of code in the state machine compared to all the examples I can find, is this wrong?
See V008 for reference.
You really don't have that much code in there - it just needs to be cleaned up a bit.
09-16-2020 12:51 PM
I lowered the number of items by bundling, but I have no idea why these controls are not initializing. Do you have any ideas?
See V010.
09-16-2020 01:23 PM - edited 09-16-2020 01:25 PM
Here is what I see in your "Configurate" state. (PS. "Configurate" is not a word. It should be "Configure".)
(EDIT: Same problem in your Start Acquisition state.)
When you bundle new values into your cluster, you are using the empty cluster constant from outside the while loop and not the cluster wire from your shift register.
Red = bad. Green = good.
09-17-2020 07:17 AM
Thanks for both your help with the code.
In the end things are working much better in a state machine and correctly wired bundling.