LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use an FFT with decimal I32

Hi

 

I am new to Labview I wonder can anyone help I have used LabJack SPI to pull in samples of my accelerometer 125Hz

I end up with  Decimal I32 and can graph it fine. But I have no Idea how to use it with an FFT I think I must have to convert it as most want 1D can someone please advise me.

 

Many thanks

David

0 Kudos
Message 1 of 31
(4,138 Views)

Hi DP,

 

I have used LabJack SPI to pull in samples of my accelerometer 125Hz I end up with  Decimal I32 and can graph it fine.

I guess you read single samples and use a chart to display them?

For a FFT you need to collect your data in arrays: use a shift register in your loop…

What kind of data do you read when you get just integer values?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 31
(4,120 Views)

Hi Gerd

Yes I have 3 bytes at 125Hz I then convert to a U32 loose the top 4 bits and do a 2s compliment convert to G and show on Graph it works well but I dont know how convert for FFT can you please show me?

 

Many Thanks 

David

 

0 Kudos
Message 3 of 31
(4,096 Views)

Hi David,

 

I have 3 bytes at 125Hz I then convert to a U32 loose the top 4 bits and do a 2s compliment convert to G and show on Graph it works well

Well, it looks complicated. There surely is an easier way… 😄

 

but I dont know how convert for FFT can you please show me?

You need to collect your data in an array.

Easiest option is the autoindexing output tunnel of a loop. An other option is a shft register with a BuildArray function. Both options should be known after taking the beginner courses offered for free by NI!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 31
(4,076 Views)
@David wrote:


You can't be serious! Can you give us some typical input array and the expected result? such a simple conversion should not take datatypes of all colors of the rainbow. 😮

 

"decimal" is just a display convention, using the numbers 0..9 and "-" to display an integer value to the user. Decimal is not a datatype.

 

A FFT will be in floating point, so as Gerd said, all you need is collect your values in an array and wire it to one of the FFT functions and correctly transforming the dt into a df. Why FFT? Does your signal show some periodicity? What features of the signal are you interested (frequency, phase, magnitude, harmonics, etc.). If you don't have an array, there is also FFT ptbypt.

0 Kudos
Message 5 of 31
(4,057 Views)

Hi

 

The data comes in on the SPI of a LabJack 3 Bytes are read in first byte in the array  is 19:12 second byte 11:4 LSB is 3:0 lower 4 bits notused  not used pleas advise how it could be simplified.

 

Best Regards

David

 

 

 

0 Kudos
Message 6 of 31
(4,052 Views)

@DPJones wrote:

 

The data comes in on the SPI of a LabJack 3 Bytes are read in first byte in the array  is 19:12 second byte 11:4 LSB is 3:0 lower 4 bits notused  not used pleas advise how it could be simplified.


According to your code picture, the data comes in as a 2D floating point array, not as 3 bytes.

 

If you want help, please show us a typical 2D orange array as output from your driver VI (who wrote the driver? Is there documentation?).

 

Just create an indicator on that orange 2D array wire, run the VI until it displays data, then stop the VI and create a constant from that indicator. Save under a new name and attach the VI.

0 Kudos
Message 7 of 31
(4,047 Views)

Hi David,

 

3 Bytes are read in first byte in the array  is 19:12 second byte 11:4 LSB is 3:0 lower 4 bits notused

check.png

combine bytes to U32, shift up 12 bits, convert to I32, shift down 12 bits…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 31
(4,043 Views)

Hi

I dont understand I am using the top 20 bits of my 3 bytes and it is in 2s compliment I dont need the bottom 4 bits hence I rotate then I perform a 2s compliment then convert for G   I have tried your circuit but it gives nothing like mine?

Thanks

David

0 Kudos
Message 9 of 31
(4,032 Views)

DPJones wrote:

 I have tried your circuit but it gives nothing like mine?

 


This is graphical code, not "circuits". If you know that your code is correct, why don't you attach a simplified version of your VI as requested multiple times? There are millions of ways for something to be "nothing like mine", so you are not really narrowing down the problem for us. We cannot help if we don't have sufficient information, so stop spoon-feeding us tiny, ambiguous parts of the problem.

 

Code pictures are not sufficient. For example, we cannot see the FXP configuration you are using.

 

You also still have not answered my questions about your FFT needs.

0 Kudos
Message 10 of 31
(4,027 Views)