LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to convert signed values and display that in waveform.

Hello,

I am a newbie to Labview. I have to transfer data from Vivado Vitis through a serial port and have to display that in waveform or graph. I successfully established the serial connection via VISA (using the LabVIEW example). I want to display that data in the form of a waveform for that I need to convert the string into decimal. I used "fract/Exp String To Number" VI but the problem is my data is in the form of 2'complement so need to convert that into a signed data form. I didn't find out any VI to convert that hex value into a signed decimal for further processing. 

Regards

0 Kudos
Message 1 of 13
(2,370 Views)

There is some discussion about this. 

 

https://forums.ni.com/t5/LabVIEW/2-s-complement/td-p/280843?profile.language=en

______________________________________________________________
Have a pleasant day and be sure to learn Python for success and prosperity.
0 Kudos
Message 2 of 13
(2,364 Views)

If you would attach a small VI that contains a typical received string as default data, we could probably help. At the moment the question is way too vague.

 

All you need is get the correct numeric datatype from the raw string. (The mention of waveform chart is completely irrelevant for the problem. You can do whatever you want with it later 😉 )

 

Some things you might want to look up in your documentation before proceeding further (can you give us a link to the documentation, especially the page where you read about the 2'complement, etc.:

 

  • Number of bits per value? (i.e. resulting datatype, I8, I16, I32, etc.)
  • Byte order (big endian vs. little endian)
  • etc.

 

0 Kudos
Message 3 of 13
(2,337 Views)

Thanks for your reply, The data is 16bit and big-endian. My data is actually an output of an ADC and in the datasheet, it is mentioned that it's in the form of 2's complement and it's a hex value the following where they mentioned that. In addition to my previous question, as I'm applying an analog signal to adc so I need to capture those samples and plot, and yeah waveform would be a later step, the first step needs to get correct data. 

AD7616.JPG

0 Kudos
Message 4 of 13
(2,326 Views)

So, is the received string binary (2 bytes per value) or hex formatted (4 bytes, each a character 0...F ?

0 Kudos
Message 5 of 13
(2,321 Views)

It's hex formatted 4bytes each value. 

0 Kudos
Message 6 of 13
(2,313 Views)

So if it is hex formatted, why would you use "fract/Exp String To Number"??? Makes no sense!

 

 

0 Kudos
Message 7 of 13
(2,306 Views)

See if this works for you:

 

altenbach_0-1649486313743.png

 

(Then you still need to scale it to the voltage range, of course. Should be easy, right?)

0 Kudos
Message 8 of 13
(2,299 Views)

I tried this one but it skip many samples. I'm sending 8000 samples from Vitis via UART and trying to show those samples on the response block and on the graph. Let me try to explain what I am trying to do one more time, I'm taking adc output and writing that on the FPGA memory then I have to read data from the memory of FPGA and have to send it to LabVIEW to display in the form of the waveform or graph. 

Regards

0 Kudos
Message 9 of 13
(2,282 Views)

(Sorry, can you "save for previous". I only have LabVIEW 2020 here at the moment.)

 

Can you explain what you mean by "skip"? Are some values correct, but some values missing?

 

You seem to significantly move the problem description around compared to your first post..

 

  • What does the ADC put out?
  • Is this your LabVIEW FPGA code?
  • How are you writing to FPGA memory?
  • How are you reading from FPGA memory?
  • How are you sending it to LabVIEW?

It seems silly to go through formatting and back at any of these steps (doubling the number of bytes and only using a tiny subset of characters (i.e. 0..F in ASCII). Formatting and scanning are relatively expensive operations!

 

Can you show us a raw received string containing the 8000 samples? Is the string indicator in normal display or hex display?

 

 

0 Kudos
Message 10 of 13
(2,272 Views)