LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Why can't I store negative numbers on my FPGA memory?

I am trying to store a sinus on the fpga memroy with the write to memory function. When I try to read the data something goes wrong. the wave are not sinus like anymore. The negative part of the sinus is moved a bit above on the screen, making the graph to look like the letter M repeating it self. It can bee seen in the picture I have attached.
0 Kudos
Message 1 of 12
(6,979 Views)
You are probably interpreting data in U16 integer representation, so any value exceeding the interval (0,65535) is "recycled" into the interval.
What is the original data type? Probably you should use U32 integer data.
Hope this helps.

Paolo
Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 2 of 12
(6,972 Views)
It seems that the input data that I am writing to the memory is I16, but when I read the data from the memory it is in U16. Can I change this somehow? By the way thanks for your help
0 Kudos
Message 3 of 12
(6,964 Views)
You can simply type cast each value to I16 (in the Advanced -> Data Manipulation function palette). Maybe there is a better way, it's hard to say without taking a look at the code.
However, if I can judge upon your graphs, there's another problem: it seems that your output data span a range greater than 64K, while input is limited to about (-4000, 4000) - why ? is there any kind of rescaling ?
Those output data cannot be represented with I16, you should use I32 instead (not U32 as erroneously written in my first reply, as you need negative values).

Paolo
Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 4 of 12
(6,961 Views)
I don't realy know what you mean that I should do in the data manipulation section. I will attach the code so that yopu can see what I have done
0 Kudos
Message 5 of 12
(6,951 Views)
Ups, sorry I forgot the VI
0 Kudos
Message 6 of 12
(6,950 Views)
Sorry, I can't open you VI. I have 7.0

Paolo
Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 7 of 12
(6,949 Views)
This is an example of type cast from U16 to I16.
To make sure that the numeric constant is of the proper type, click on it, right click and choose from the Representation palette.

Paolo
Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 8 of 12
(6,840 Views)
Hmmm seems like I don't have those functions in My LabVIEW. Can I maybe find them somewhere and upgrade my Labview?
0 Kudos
Message 9 of 12
(6,937 Views)
Oh sorry, I found it. I looked in the FPGA palette first an´d couldn't find it, but now I have it.
0 Kudos
Message 10 of 12
(6,932 Views)