LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to Create Digital Array?

I thought they were bytes too but when I use the Boolean to 0,1 VI it returns a U16. This is why I thought they may be storing them as U16. I agree though that storing them as bytes would be the normal and effecient way to store them.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 11 of 23
(836 Views)

Hi,

 

I tried to use initialize array and tried to output it to a digital waveform but theres no output - is there any way I can output it successfully to a digital waveform so I can then append/insert other arrays into the waveform?

 

Thanks a lot,

Mitchell

0 Kudos
Message 12 of 23
(833 Views)

Can you show us the code you have made?  It helps to add context.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 13 of 23
(828 Views)

Attached is the program I've been working on - the digital array part I am having trouble with is inside the true part of the case structure - I put a boolean false value to represent 0 and wired it to an initialize array, where I tried to build an array and make create a digital waveform out of it.

 

I am hoping to create a long digital array/data list of 0s and insert 1's at specific points to create a digital waveform.  Could you please look at it and tell me what I'm doing wrong?

 

Thanks a lot,

Mitchell

0 Kudos
Message 14 of 23
(826 Views)

@Mark_Yedinak wrote:

I thought they were bytes too but when I use the Boolean to 0,1 VI it returns a U16. This is why I thought they may be storing them as U16. I agree though that storing them as bytes would be the normal and effecient way to store them.


Yes, they are stored as bytes and anything !=0 is a TRUE. An illustrative example is JeanPierre's Hello World program (posted here).

 

Note that arrays of booleans were stored as 8 booleans/byte prior to LabVIEW 5.0. This made some sense with the very limited memory in those ancient times. You can still set typecast to 4.x mode if you need to operate on flattened data compressed this way.

 

Today, a boolean array takes the same memory per element as a U8 array.

0 Kudos
Message 15 of 23
(816 Views)

@theodyssey12 wrote:

Attached is the program I've been working on - the digital array part I am having trouble with is inside the true part of the case structure - I put a boolean false value to represent 0 and wired it to an initialize array, where I tried to build an array and make create a digital waveform out of it.

 

I am hoping to create a long digital array/data list of 0s and insert 1's at specific points to create a digital waveform.  Could you please look at it and tell me what I'm doing wrong?



You seem to be aimlessly coverting 1D arrays to 2D arrays and vice versa.

You want to initilize the 2D boolean array on one step as all false, then use "replace array subset" in a FOR loop to edit certain locations. Keep the array in a shift register.

 

Here's a quick example (LabVIEW 8.6).

 

Download All
Message 16 of 23
(808 Views)

Thanks a lot! 

 

I think I have a much better understanding of how it works now.  For the purposes of my project, I have two more questions:

 

1. Since I have 50,000 samples, how can I insert a function/algorithm to insert true values at specific points?

2. After I have this array, how can I have it shown on the front diagram and change it to a digital waveform format (for outputting to my DAQ board)?

 

I really appreciate the help,

Mitchell

0 Kudos
Message 17 of 23
(798 Views)

@theodyssey12 wrote:

1. Since I have 50,000 samples, how can I insert a function/algorithm to insert true values at specific points? Use the Replace Array Subset

2. After I have this array, how can I have it shown on the front diagram and change it to a digital waveform format (for outputting to my DAQ board)? Use the Boolean Array to Digital Waveform like you already have in your VI


 


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 18 of 23
(792 Views)

@theodyssey12 wrote:

1. Since I have 50,000 samples, how can I insert a function/algorithm to insert true values at specific points?


Instead of the fixed "TRUE positions" in my example, you can calcuate TRUE or false based on the valie of the iteration terminal, for example. What kind of function do you have in mind?

 


@theodyssey12 wrote:

2. After I have this array, how can I have it shown on the front diagram and change it to a digital waveform format (for outputting to my DAQ board)?


It does not sound reasonable to show 50000 elements on the front panel. I don't use digital waveforms, but is whatever you were doing in your code working in principle?

 

Message 19 of 23
(791 Views)

I am trying to use T_n = T_0 (sqrt(n+1) - sqrt(n)) where:

T_n = time between pulses, which I can convert to distance between samples

T_0 = sqrt (pi/(250n))

n = pulse number (0,1,2, ...)

 

The pulses are responsible for causing a potential difference which I am using to drive a stepper motor, and I need a digital waveform with a shortening period (as given by the equation) in order to accelerate it.

 

Yes, what I have been was working in the attachment you gave me, but when I tried to run it in my program (to test whether it would work in my case structure) the edited array indicator didn't seem to light up.  Is there a reason why this happened?

 

Also, when I tried to use the vi to convert it from array to digital waveform it didn't seem to accept it (see wiring in attached doc).  How can I convert 2d boolean to true/false boolean and vice versa so the wiring can be accepted?

 

Thanks a lot for all of the help and explaining, I have been working on this program for several days now and have made a lot more progress in these few hours than I've had in the last few days.  I'd really like to get my program up and running so I can finish my project!

 

Mitchell

0 Kudos
Message 20 of 23
(787 Views)