LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

number to array

Hello guys,

I am getting 0s and 1s continuously and I want these values in an array format so that later I want to add all the ones and find the summation. So can anyone pleas tell me how to store these values of zeros and ones??

0 Kudos
Message 1 of 14
(3,305 Views)

ashnu a écrit :

Hello guys,

I am getting 0s and 1s continuously and I want these values in an array format so that later I want to add all the ones and find the summation. So can anyone pleas tell me how to store these values of zeros and ones??


Why store them in an array? Just add the received values, you can store the sum in a shift register.

 

Ben64

0 Kudos
Message 2 of 14
(3,295 Views)

If all you want to do is add every value being generated, you should consider using shift registers to sum the values as they are generated.

 

http://www.ni.com/getting-started/labview-basics/shift-registers

Matt J | National Instruments | CLA
0 Kudos
Message 3 of 14
(3,294 Views)

Without a clue as to how you are getting the numbers, it is difficult to answer your question.  Do you want to "gather numbers for a while" and then have a single array as the output?  Do you want an "array that grows" as the numbers are produced?  Are the numbers being produced by a loop of some sort?

 

I presume you have some existing LabVIEW code that is producing the numbers.  Do you know how to make a "snippet" of your code?  [Select the code, and on the Edit menu, choose the "Save Selected as Snippet", which will make a .png image that you can paste into your Forum post using the 

 

0 Kudos
Message 4 of 14
(3,288 Views)

Digital__RPM.PNG

I want to insert something in between the summation and boolean to (0,1) so that I will be able to count the number of ones (which helps me to calculate rpm) 

 

 

0 Kudos
Message 5 of 14
(3,278 Views)

I just now realised tat if i keep adding or storing those numbers I won't get real time data... So can anyone tell me how to I calculate the time taken to change from 0 to 1? (the change is very quick).... Is it possible to program? Any sample VI will help me the most.

 

Thanks in advance

0 Kudos
Message 6 of 14
(3,268 Views)

If all of the values are 0 or 1, what do you think a summation will tell you?

 

1+1 = 2.  There are 2 ones.

1+0 = 1.  There is a single one.

 

1+1+1+0+0+1+0+1 = 5.  There are five ones.

 

This pattern will be true regardless of the number of ones you have.

 

Honestly, you DON'T want the number of ones.  You want the number of rising edges.  RPM doesn't change if something stays high.  You want to know how often the edge rises.  You've already got logic that your VI is documented claiming counts rising edges.  Why are you trying to re-invent the wheel?

0 Kudos
Message 7 of 14
(3,260 Views)

Yes u r right. But it is not working. When I manually run the turbine (say less than a minute) the instrument (picoturn) shows 500rpm. Whereas my labview program doesn't give that answer. It just gives 3 rpm.

0 Kudos
Message 8 of 14
(3,255 Views)

Maybe you should use a counter instead of a digital IO. Simply read the increase in counts at regular intervals and calculate the RPM based on the time interval and the number of encoder pulses per revolution.

0 Kudos
Message 9 of 14
(3,228 Views)

@altenbach wrote:

Maybe you should use a counter instead of a digital IO. Simply read the increase in counts at regular intervals and calculate the RPM based on the time interval and the number of encoder pulses per revolution.


It seems this got already suggested in your other thread. Please try to keep the discussion in one single place, it is not productive to run several parallel discussions about the same thing.

 

Let's close this thread and continue in the other one.

0 Kudos
Message 10 of 14
(3,224 Views)