LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to convert signed values and display that in waveform.

I meant it just doesn't convert some values in 2's complement and display in hex form same as a raw value. Just for an example the input is 0x000A and it has to convert and display 10 but instead, it displays 0x000A.

ADC raw output is 2's complement hex value or hex code.

I'm writing FPGA code in VIVADO and building applications in VITIS LabVIEW is used just as a GUI.

Writing on and reading from memory through DMA and that's built-in vivado and vitis. Formatting of data and other operations all are done in vitis.

I'm sending my data through UART by the printf command and that's raw data in the form of hex.

The shot is attached that shows hex values stored in an array. Though the shot contains a chunk of values, all other values are like this according to the data from ADC. 

 

Regards

0 Kudos
Message 11 of 13
(418 Views)

What your picture is showing you is that you have unsigned integer values (U16) stored in an Array.  All your numbers have the value EF7B, which (in decimal) is 61307.  If your A/D converter is using signed values, then (because the first bit is set, which makes the first Hex digit 8 or higher), this value is really 61307 - 65536 = -4229.

 

How do you do this conversion?  The easiest way is simply to wire output to an I16 (a signed 16-bit number) instead of a U16 -- no need to do any math!

 

Don't bother changing this perfectly-good numeric value to a String, sending the String, then converting the string back to another number -- just send the (2-byte) number, it will go twice as fast as a 4-byte string, and saves you a number of steps, each one ready to "pounce" with some error ...

 

Bob Schor

 

0 Kudos
Message 12 of 13
(391 Views)

@Moris9999 wrote:

The shot is attached that shows hex values stored in an array. T


No, it does not!!!. It just shows a formatted table, not the underlying raw data.

 

Please attach a small VI that contains a typical received string in a diagram constant. (create an indicator for the received string...wait until it contains data, stop the VI, right-click the indicator terminal...change to constant... copy that constant to a new VI, attach it here in LabVIEW 2020 or lower)

0 Kudos
Message 13 of 13
(351 Views)