LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

initializing shift registers within subvi

Hi all,
 
This appears to be simple but its giving me hard time.......................................
 
I need to initialize the shift registers in the for loop in the subvi.The subvi is called continuously in the main program.But i need the shift registers value to be zero when the main program runs for the first time.Thereafter the shift registers should remember the previous run values until the main program is stopped.
 
If i initialize the shift register in the subvi , the output is always the same whenever the subvi is called.
Also i need all the iteration values in the main program , but here only the final iteration value is indicated.
 
I used control reference to get all of the iteration values , it doesnt seem to work.I hate local variables.
Any help in this regard is highly appreciated.
 
 
Thanks,
radhika
 
Download All
0 Kudos
Message 1 of 9
(3,747 Views)
Consider using the FIRST CALL function (in the SYNCHRONIZATION palette).

Use a SELECT function:

If FIRST CALL
   Value = 0
else
   Value = previous value (from left Shift reg.)
end

Message Edited by CoastalMaineBird on 02-28-2007 07:33 PM

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 2 of 9
(3,741 Views)

Use the "first call?" function from the synchronization palette.

Message Edited by altenbach on 02-28-2007 05:36 PM

0 Kudos
Message 3 of 9
(3,739 Views)
Hi,
 
thanx for ur responses....sorry i missed this part,
i cannot use first call also , because first time i need it to be zero and it has to be zero for a certian amount of time (depends on the control from main program) then when the numeric part changes m the shift register value has to change.
 
I have attached the edited main program.
Hope this explains my situation ..........
 
Thanks
radhika
0 Kudos
Message 4 of 9
(3,732 Views)

Well, it's not obvious to me why it has to be a subVI with a shift register. Why don't you do this directly in the main VI?

Anyway, just make a second input connector in the subVI for the boolean, wire it from the main VI, and used its value there too to switch things.

0 Kudos
Message 5 of 9
(3,722 Views)

Try This Method.

 

-Kumar B.

 

Download All
Message 6 of 9
(3,708 Views)
hi,
 
thanx for all ur responses , i tried all of ur ideas earlier itself , but it didnt workout for me may be i'm not explaining my application properly
i guess....
 
k here is my need.......
I have 2 sets of data input,i obtain these data in the main program
Time     Data
0             5
10          15
20           35
 
I need to sample the data and obtain the intermediate points (between 0 and 10 , 5 and 15) for analysis.( I am doing  this in the subvi)
The way i did is ,in a for loop i calculated ,
(15-5) /(10-0) = X
(10-0)/5 (5 = N = number of samples) = Y
Sampled data value =X * time , where time will be incrementing in steps of Y ;here it is 0 , 2 ,4 , 6 , 8 , 10
 
and i need to get each sampled data ( say 0,3,6,9,12,15)of every iteration for analysis..............................
 
First time when the subvi is called it has 0 and 5.It gets the next set of data ( 10 , 15 ) only when the main program time is greater than 10.
until then the subvi should have 0 and 5 only.
 
its getting more and more complicated................
 
Is there any other simpler way to achieve this...........................................................
 
thanks,
radhika
0 Kudos
Message 7 of 9
(3,696 Views)

Time     Data
0             5
10          15
20           35
I need to sample the data and obtain the intermediate points (between 0 and 10 , 5 and 15) for analysis.

Consider this:

Create a cluster of {Time | Data } for each of your entries.

Create an array of those clusters.

Generate an array of TIMES that you want to know the intermediate values at ( 4, 8, 12, 16, for example).

For each of those times:

Feed the CLUSTER array, and the time into an INTERPOLATE ARRAY function.

Read out the corresponding DATA value.

In your example, for 4,8,12,16 you would get 9.0, 13.0, 19.0, 27.0.

Is that what you need?

Here's a picture:

Message Edited by CoastalMaineBird on 03-01-2007 02:35 PM

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

Message 8 of 9
(3,691 Views)

Hi coastal maine bird............

Finally this worked out.............

Thanks a lot for your time and effort.......

 

Thanks,

radhika

 

0 Kudos
Message 9 of 9
(3,654 Views)