From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Converting from a 16 bit integer to a 12 bit integer

I believe I've done that, feel free to correct me if I'm wrong. Do the trailing zeros stay there? The documentation for the DAC says that data is sent in 24 bit cycles, and the VI only accepts U8 arrays.

LV_question.PNG

0 Kudos
Message 11 of 16
(769 Views)
  • I don't see anywhere where it interacts with the driver VI.
  • An "AND TRUE" is Rube Goldberg code. It just returns the upper input unchanged. Remove it!
  • We cannot see what's in the other cases.
  • You have a potentially dangerous race condition due to blantant overuse of local variables. You modify the "binary voltage string" via a local variable in parallel of running the Aztec pyramid of loops. The outcome is potentially unpredictable, because you don't know in what order things happen.
  • Your two controls inside the case structure  probably belong before the loop unless they are allowed to be changed at unpredictable times during execution of the loop. Just use a wire, eliminating the local variable at the same time.
  • You only need one "7" diagram constant. Branch the wire! Most likely you should not wire N at all, because the number of iterations should depend on the sizes of the 2D arrays. Are both the same size? (the smaller wins, no matter what you wire to N)
  • A picture is insufficient to troubleshoot further (we cannot see what's in the other case, and we cannot see what's outside the cropped area.
  • ...
0 Kudos
Message 12 of 16
(763 Views)

You're right, the VI is not connected, but the VI will be connected to Array and Array 2. I am preemptively troubleshooting by monitoring the values stored in Array and Array 2. I am still unsure if whether or not the data will be input into the arrays correctly (specifically, I am concerned about trailing and leading zeros).

 

- I will change the Rube code part.

- Other case (False) is empty, VI not finished.

- will remove local variable and just insert the wire.

- will remove the 7s. But yes, it is an 8x8 array.

- outside the cropped area is the picture I posted before, just going from the slider value to a 12 bit number with 4 trailing zeros.  

 

Thanks

0 Kudos
Message 13 of 16
(757 Views)

If the array is 8x8 and you only want to use 7x7 of the data, you need to wire N.

If you want to watch the data for verification, maybe you should add a small wait (e.g. 0.5-1 second in the inner loop. Binary data is just that, zeroes are a cosmetic property of the indicator. Format the elements of the output arrays  (U8 array) as binary with 8 digits and zero-padding (%08b)to more easily see what it contains when troubleshooting.

0 Kudos
Message 14 of 16
(751 Views)

@lmcohen2 wrote:

Do the trailing zeros stay there?


Why would a 16-bit value suddenly drop bits?  There are 16 bits allocated specifically for that value.


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 15 of 16
(746 Views)

Ok. When I do that, the data output into the arrays is displayed on the front panel as I would like it to be sent to the Aardvark. I was unsure if this was is way it will be sent to the VI, but crossrulz answer gave me some reassurance that it is. 

 

I am not a very experienced programmer, so I am just trying my best to understand it all. Thanks for all the responses and help, though. 

0 Kudos
Message 16 of 16
(744 Views)