I took a look at the VI you had attached....
You might want to debug the VI using the lightbulb icon to watch the
dataflow:
1. Labview is connected by wires, but this deceptive because it doesn't work
like electric wires. This really only represents the dataflow. When LV
executes a terminal (control, local variable, function output, etc) thats
it! You still need to poll controls like you do this this program... Unlike
real electrical wires, the value of the wire doesn't change once the inputs
have been evaluated.
2. Labview is dataflow driven and will execute any VI or function when all
of its inputs are ready. Dependancy is how you can control execution-order.
If you're getting a cycle it is because a VI depends upon data as input
which is generated by an output. Pretty straightforward; the only exception
is recursion which is messy in LV anyway since you can't have cycles.
You are already close to what you want, good job. It looks like you generate
the "next sample to go to" with some conditions, but mainly SamplesRead *
Bytes/Scan right? Then you poll for GoToSample being pressed (and some other
conditions) and eventually end the while loop. But in the end the readoffset
you calculated way earlier gets wired to a shift-register and used for the
Read Offset on the next loop iteration.
If you look closely TestNumeric will ALWAYS evaluate to 1 because of the two
things I mention above. The loop will only terminate if GoToSample is 0 and
(GoToSample?0:1) will always evaluate to 1 because that wire leaving the
loop is a constant. So wiring TestNumeric somewhere probably isn't what you
want to do?
I'm guessing the problem you're seeing is that you change Initial Sample,
click GoToSample and it's not moving there? Remember you calculated the
ReadOffset long ago and its value might be out of date if you change Initial
Sample while polling GoToSample. You can rearrange the code a bit and make
this work like you want.
Also for the inner-most while-loop. The triangles on the sides are shift
registers. Wire data to the right-most and it will appear at the left-most
on the next loop iteration, so you can have a "datavalue during the previous
loop". You never read the value again so the shift register isn't necessary.
Just wanted to make sure you knew how those work.
And another hint, you probably want to initialize the shift register for
PosRead offset. Just like uninitialized variables in C++ you want to make
sure you add a value of 0 so theres no random garbage in there. Just right
click and Create >> Constant.
Sorry I can't make more specific suggestions. I just looked quickly. I also
hope this is what you were asking for and is helpful. Post again or email me
if you have further questions......
-joey
"Skutch" wrote in message
news:50650000000800000045520000-1023576873000@exchange.ni.com...
> Please refer to the attched "Acquire Data (Analog Tach)
> FromBinaryFile.vi"
>
> I want to make the “Read file+[I16].vi” read at a
> particular sample when I click the GoToSample button. All I seem able
> to do is break the vi.
>
> You can see one attempt. I have “Test Neumeric” all ready
> to wire to the “pos mode” terminal of the “Read
> file+[I16].vi”. This “creates a cycle”.
>
> HELP!
>
> A frustrated C++ guru but vi idiot.