LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using the counter to create a input variable in while loops

I'm using a loop to increment oscillator freq on my lock-in. I want this incrementation to be based off the loop counter. But when I do this, it gives me some kind of circular reference error. Can I make my own counter inside the loop instead? How? See the attached screen shot for details.
0 Kudos
Message 1 of 3
(2,346 Views)
Hi Jesse,

You can attach a copy of your vi instead of a screen capture, because the the screen capture is difficult to read. Unless there is confidential code, of course.

The first thing I noticed is that there are some improperly wired vi's. I can't comment much because the screen capture was not clear.

However, the "circular referrence error" means that you have a wire which exits a loop and re-enters it.
If you need to pass a value back to the beginning of a loop, then use a Shift Register. Right click on the edge of a loop and select "Add Shift Register". It can be initialized by wiring a value (or control) to the input of the loop.

-JLV-
0 Kudos
Message 2 of 3
(2,346 Views)
Appologies...

I looked at your screen capture by zooming in.
The error is simple.

You are connecting the output of the counter and feeding it to "Multiply.vi" by 0.04. The problem is that it is feeding values which are input to a vi "VISA WRT/RC". That is the circular reference which is not allowed.

Can you move the vi's that do the calculations inside the loop? That will resolve the problem. I did not see anything preventing you from doing that.

Sorry about my first reply...

-JLV-
0 Kudos
Message 3 of 3
(2,346 Views)