04-08-2022 09:01 AM
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
04-08-2022 09:22 AM
There is some discussion about this.
https://forums.ni.com/t5/LabVIEW/2-s-complement/td-p/280843?profile.language=en
04-08-2022 07:53 PM - edited 04-08-2022 07:55 PM
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.:
04-08-2022 10:45 PM
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.
04-08-2022 11:44 PM
So, is the received string binary (2 bytes per value) or hex formatted (4 bytes, each a character 0...F ?
04-09-2022 12:20 AM - edited 04-09-2022 12:21 AM
It's hex formatted 4bytes each value.
04-09-2022 01:23 AM
So if it is hex formatted, why would you use "fract/Exp String To Number"??? Makes no sense!
04-09-2022 01:39 AM
See if this works for you:
(Then you still need to scale it to the voltage range, of course. Should be easy, right?)
04-09-2022 07:16 AM
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
04-09-2022 09:38 AM - edited 04-09-2022 09:41 AM
(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..
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?