01-25-2013 11:17 AM
@bcooke wrote:
You know, there is really no need to be so rude about this. I told you that I am new at this. A group of us are trying to write this code for an experiment we are doing in class. None of us have background in LabView and our professor taught us nothing about it. We have to figure it all out for ourselves. I'm sure you all were like this when you first starting learning LabView as well.
About how I said we tested it before: we were getting data points in our file that were saying the same frequency (which seemed to show that the inner loop was taking data more than once) so it looked like it was working.
Rudness wasn't intented. We've all seen clients and customers with the exact same "The problem can't be there I Know that works fix your code" problems before. These become little gems for conversation when we sit down over beverages. As far as what my first LabVIEW project looked like..... Well if you've ever seen spaghetti that has been regurgitated that comes close......
01-25-2013 11:22 AM
Ok, let's go to the beginning. What instruments are you using? What commands are you sending them? And I want specifics so I can go look up the instrument and make sure you are interacting with it correctly. Because you are not getting data during the second iteration, I think there is a problem with your setup.
01-25-2013 11:26 AM
Jeff·Þ·Bohrer wrote:We've all seen clients and customers with the exact same "The problem can't be there I Know that works fix your code" problems before.
For me, it was VHDL programmers I had to work with:
Them: "We changed a bunch of stuff. It isn't working. You broke it."
Me (and other test engineers): "Wait a minute. It was working before. It isn't working now. I changed nothing. You changed a bunch of stuff. So is that my fault?"
01-26-2013 08:11 AM
I am using a Keithley Model 6221 AC and DC Current Source and using the command SYST:KEY 45, which, when we have the machine on the screen for changing the frequency, moves it up by 10 Hz each time. The machine we are talking to in the inner loop is an SR830 lock-in amplifier and the command we are using is SNAP? 1,2,9
01-28-2013 09:24 AM
Ok, the Keithley is not going to keep sending data. It needs a request for data. It might be sending data when you send the SYST:KEY 45 command. This is why the inner loop works on the first iteration, but not the rest (only 1 read is available). Move the read of the Keithley to the outer loop after sending the command.
01-29-2013 02:15 PM
Moving the Keithley read to the outer loop did fix the inner loop! Thank you so much! Now there is another problem showing up. The inner loop runs as many times as I tell it to, but now the outer loop will stop after one loop. Is this also because of the Keithley read?
01-29-2013 02:24 PM - edited 01-29-2013 02:24 PM
01-29-2013 02:31 PM
Can you upload your latest code? I'm sure you've made some major changes since the last upload you provided.
01-29-2013 03:15 PM
Sorry. I thought I had posted it. Here you go.
01-30-2013 07:09 AM - edited 01-30-2013 07:10 AM
Ok, first let's talk about some tweaks.
Now let's talk about your immediate problem. You will notice that your stop condition for the inner loop is being ORed as part of the stop condition of the outer loop. That is why the out loop only executes once. If you take my advice above about changing to FOR loop, your ORs for combining the error condition and the number of loops to run will become not needed.
I took the liberty of cleaning up your code with the suggestions I made above.