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.
06-16-2015 02:01 PM
Hi. I am working on a code that measures the voltage of from a mems mirror using an optical fiber, and I am having problems figuring out why the flat sequencing stuctrue isn't working. I think that the scanning is stuck in an infinite loop. I am not very good with labview, and I am not sure this is the right way to have the code structured. I need the mirror to be scanned to find the highest voltage position, and then I need the mirror to move to that position. Thanks for your help in advance.
06-16-2015 02:08 PM
Flat sequence structure is a throwback that is rarely used and never really needed. There's probably a better way to do what you want.
I haven't updated to LabVIEW 2014 quite yet so I can't open your file to take a look. I'm sure you'll get some help soon or you can always do a File > Save for Previous Version and post an older version so more people can view your code and help...
06-16-2015 02:19 PM
I'm seeing all kinds of issues here.
1. Combine your two Analog Outputs into a single task.
2. You have a tunnel over the shift register for the inner FOR loop. You should just be wired to the shift register.
3. The local variables make no sense at all.
4. Not sure what you are trying to do in the second sequence frame. But you should just use the same task(s) and just remove the sequence structure (use data flow to enforce when it will run). Stop and clear the task after you are completely done with the task.
5. FOR loop that just runs once? No need for that.
6. Probably should not use the DAQ Assistant. Use the actual DAQmx API like you did for that Analog Outputs.
7. You can expand the Index Array. You also do not need to wire up the index since the default for the first index is 0 and it just adds 1 from there.
8. Feedback nodes at the bottom of the code makes absolutely no sense since you are not inside of a loop.
06-16-2015 02:30 PM
Hi,
OK, so as a first guess I see several things wrong with your code:
These are just some things you might want to think about, but to your problem: To see if the for loops are in fact infinite, you can check the iterator output and see if it's counting up. From what I see, it should do 21 iterations and be done. That's 21x21 iterations for the middle loop.
Other than that I hope you know that there's a boatload of free tutorials out there, which you access to get better acquainted with the old lady we call LabVIEW:
3 Hour Introduction
6 Hour Introduction
LabVEW Basics
Self Paced training for students
Self Paced training beginner to advanced, SSP Required
LabVIEW Wiki on Training
Learning NI
Getting Started with NI Products
06-16-2015 03:58 PM
I'll hopefully try and explain a little bit more about what I am doing. The feedback loops at the bottom set up a filter cut-off point. The high voltage amplifier is then turned on. The three for loops input voltage data to a mems mirror, where the mirror is scanned by infared light to find the point of highest intensty. What I am trying to do is take the "Volts X" and "Volts Y" data points (which tell me where the highest voltage occurs) and input them into the high voltage amplifier to move the mems mirror to that specific location. Once that is finished, I then want to turn off the high voltage amplifier.
I have never used DAQmx in labview before, so I would really appreciate well explained solutions because I don't know how to fix this.
I also think I converted it to the 2013 version of LabVIEW, but I'm not sure.
Thanks
06-16-2015 10:00 PM
I havent looked at the rest of the code, but your local variables for "volts X" and "Volts Y" will get read immediately at the start of that frame and way before the code in the FOR loop has a chance to write to the respective terminals. All you get in the following frame are the stale values from the previous run. Eliminate the local variable and wire directly from the wire going to the terminals, disable indexing when crossing the loop boundaries. Now you can even delete the flat sequence structure, because execution order is fully determined by dataflow.
06-17-2015 09:03 AM
@NIquist wrote:
Flat sequence structure is a throwback that is rarely used and never really needed.
I disagree. It is true that flat sequence structures are overused, but there are many valid uses for them. Flat sequences can be essential for coercing the order of execution of nodes that don't contain error terminals. They just need to be used carefully. You may be referring to stacked sequence structures, which should never be used under any circumstances.
06-17-2015 11:40 AM
@CMal wrote:
You may be referring to stacked sequence structures, which should never be used under any circumstances.
No I agree with what NIquist said. Very rarely do I need an operation to happen in a specific order, that doesn't have error wires for data flow, or a state machine or QMH.
Often times the data flow itself is all that is needed. When are you performing an action, that doesn't generate an output, that another function needs as an input? Are you writing to globals variables all the time and you want to set it before calling a subVI that uses it? Well that's poor design anyway. Allowing the compiler to determine the order of functions is best, when the order doesn't matter.
I've probably used the sequence structure less then 5 times in all the real applications I've written. Sure I've used them in demo software, where I'm trying to measure the time between functions and don't want new values written to controls, and maybe once or twice I used one with just a local variable in it to force data flow, but calling them a throwback, that is rare, and never really needed is an accurate statement. Even the CLAD had a question like "What should you do with sequence structures" and the answer was "Replace it with a state machine".
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
16 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
06-18-2015 09:08 AM
@CMal wrote:
@NIquist wrote:
Flat sequence structure is a throwback that is rarely used and never really needed.
I disagree. It is true that flat sequence structures are overused, but there are many valid uses for them. Flat sequences can be essential for coercing the order of execution of nodes that don't contain error terminals. They just need to be used carefully. You may be referring to stacked sequence structures, which should never be used under any circumstances.
Actually I was thinking about the stacked structure. I do rarely use the flat sequence but it's generally for making code more readable (I use the "sub-diagram labels" to title each section), not enforcing dataflow. For nodes that don't contain error terminals I usually have my own version of them that does have error handling.
Anyway, this topic has been beaten to death so let's not hijack the OP's thread over it.
06-18-2015 11:42 AM
Speak of the devil. I just opened a co-workers project and found one of those valid uses: