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 a Double Array into an Array of 16 bit integers

Solved!
Go to solution

Need to convert an array of 1024 element double numbers into an array of 16 bit integers in RT. This array of 16 bit integers will be read or used as a Look-up table in FPGA.

0 Kudos
Message 1 of 5
(3,961 Views)

Functions -> Numeric -> Conversion -> To Word Integer

Note: This function will work on either a scalar or an array.

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 2 of 5
(3,946 Views)

Hi Paul,

 

The list is of 1024 element double array that makes a waveform (first 4 are shown below). If I directly convert it to 16 bit word integer it rounds it to nearest integer.

 

0

0.00390625

0.0078125

0.0117187

.......

 

I want to convert it to a list of integers (may be scaled) that would give me a waveform that ranges from 32767 to -32767.

 

Thanks.

0 Kudos
Message 3 of 5
(3,934 Views)
Solution
Accepted by topic author Marvin9

Just some simple mathematics:

 

image01.png

Regards, Jens

Kudos are welcome...
Message 4 of 5
(3,914 Views)
Solution
Accepted by topic author Marvin9

Run it through "Normalize Waveform.vi" and multiply by 32767

 

 


"Should be" isn't "Is" -Jay
Message 5 of 5
(3,820 Views)