LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to hold a signal until next sample is taken?

i am doing a project where in i am switching  four sensors by using the port0 of ni daq6009. the labview version is 8.2. it works in such a way that first sensor is swiched initially and it goes to second, third, and fourth and again it starts from the first. is there anyway to hold the signal from the sensor untill the next sample is taken. can anyone please help me to solve this. thanks in advance.
 
 
thanks
vineet
0 Kudos
Message 1 of 9
(3,298 Views)
Hi vineet,

you should use an array (of 4 elements) where you store the readings from those 4 sensors. Keep this array in a shift register and replace only the value for the current sensor reading...
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 9
(3,282 Views)

This is one implementation of Gerd's idea.  It may not be the most memory efficient, but with four data points, it doesn't really need to be.



Message Edited by JeffOverton on 03-26-2008 11:08 AM
Message 3 of 9
(3,275 Views)

 

hi,

thanks a lot for the reply. i am not fully clear with the reply. so i am attaching the vi program what i am using.  i have four colour ramps whose colour change is with respect to change in four sensor outputs. if the first output changes, and if it switches to the next element, still it should hold the first element untill its updated in the next swiching pulse. in the current program the holding part is not there. can u please help me to solve this

 

thanks

vineet

 

0 Kudos
Message 4 of 9
(3,245 Views)
I'm not sure what you mean by "switching pulse" but if you right click on any of the wires and click "create wire branch" it will give you a new branch.  Wire that branch to the right edge of your while loop, then right click on the square tunnel that was just created, and click "Replace with Shift Register."  This will turn the tunnel into a shift register input and create a matching output on the left edge of the while loop.  Any data that your DAQ read puts into a shift register input (on the right) will be available at the shift register output (on the left) at the beginning of the next while loop iteration.
0 Kudos
Message 5 of 9
(3,227 Views)
Hi vineet,

I included the first hint into your vi - you only have to adapt the "switching" to your needs...

But why do you read 4 channels when you switch between those sensors? Usually you should need only one channel here...


Message Edited by GerdW on 03-27-2008 11:17 PM
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 9
(3,212 Views)

hi

thanks a lot for the reply. i was thinking to hold the signal until the same block is updated in the next cycle. in the present vi, if there is a change in the 1st element, it holds the the change in signal until it moves to the 2nd element. but is there any way to hold the signal  until the same block is updated in the next cycle of the loop.

 

thanks

vineet

0 Kudos
Message 7 of 9
(3,194 Views)


JeffOverton wrote:

This is one implementation of Gerd's idea.  It may not be the most memory efficient, but...



Yeah Jeff, if you want still more efficient memory management for that code, you can use the In Place Element structure.
But that is available only from LV 8.5, I think...
- Partha ( CLD until Oct 2024 🙂 )
0 Kudos
Message 8 of 9
(3,191 Views)
8.2.1 Here 😞
0 Kudos
Message 9 of 9
(3,182 Views)