LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

shift register

 
Dear sirs/madams,
 
I have a basic problem which I need help with. In my code I'm trying to sum a number of waveforms (or arrays) in a For Loop using a shift register. I'm doing something very wrong but am having no joy getting it to work. If anyone can help I would be very grateful.
 
I have attached the code below (labview 8.2) and the For Loop can be found in the "aquisition" case, in "1" of the stacked sequence.
 
To recap, I wish to sum what comes out of the waveform function N times.
 
Thank you for your help.
0 Kudos
Message 1 of 12
(3,753 Views)

The problem is that you have your array constant onside the loop not attached to the shift register to initialize it. It's just running through an indexing terminal that will just grab one element at a time and pass it into the loop and to the Add function.

You need to delete the small white box with the [] in it that is on top of the left shift register and wire the array constant directly to the shift register. Then delete the broken wire inside the loop and wire from the left shift register to the Add function.

See if that works and let us know.

Ed



Ed Dickens - Certified LabVIEW Architect
Lockheed Martin Space
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
Message 2 of 12
(3,746 Views)

You've got a couple of problems. First, you have an empty array wired to the for loop. This should be wired to the shift register on the left to initialize it. Second, you don't have the input terminal of the add function wired to the shift register at all. It's wired to the empty array. Third, the result is not wired to the shift register on the right. It's just the Y array. In other words, nothing is wired correctly.Smiley Wink

It should be like this.

Message Edited by Dennis Knutson on 03-23-2007 07:56 AM

Message 3 of 12
(3,745 Views)


@Dennis Knutson wrote:

Third, the result is not wired to the shift register on the right.



Opps, I missed the result not wired to the shift register. Smiley Tongue


Ed Dickens - Certified LabVIEW Architect
Lockheed Martin Space
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
0 Kudos
Message 4 of 12
(3,728 Views)
There's one more thing... if you wire an empty array to a shift register and add another array to the empty array it will remain empty all the time. You have two options:
1) initialize the shift register with an array of zeros with the correct size
2) use an uninitialized shift register and in the first iteration of the loop wire the measured signal to the shift register from the inside (you'll need a case structure or a select function)

Hope this helps,
Daniel

0 Kudos
Message 5 of 12
(3,726 Views)

 

 

Sorry, I should look at what I'm sending more closely - I tried what you said and it still doesn't work. Here's the amended version.

0 Kudos
Message 6 of 12
(3,723 Views)

 

 

I'll try what you just sent - I think that's my main problem because the array that I hoped would be the sum is always empty.

0 Kudos
Message 7 of 12
(3,720 Views)

As others have said, you cannot add to an empty array. The result will be, and remain, an empty array. 🙂

Just don't add at iteration zero and the rest will fall into place. See image (the "other" case is shown in the insert on the left):

 

Also, do you really need to do a full initialization of the DAQ at each iteration? Wouldn't it be sufficient to do everything except the read operation outside the loop?

Message Edited by altenbach on 03-23-2007 08:09 AM

Message 8 of 12
(3,706 Views)
 
 
Who would like to save me an hour working out how to initialise my array by telling me how? Someone, I hope.
0 Kudos
Message 9 of 12
(3,702 Views)
altenbach made a nice picture of what i meant with option 2... I think that should do it... now it's just a few wires and a case structure...
0 Kudos
Message 10 of 12
(3,696 Views)