LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Processing binary data and doing FFT

Hi there, i posted this question on another board but found this board more relevant to my situation.

 

I have the following questions.

 

I have accquired a series of 34 bits data(binary data), from bit 0 to bit 33 through data accquriation using NI card(PXI-6552). I

woud like to retrieve bit 1,3,5, all the odd number from this string of data and finally convert this retrieved bits to decimal

number and then plot this on a graph and finally do FFT on it.

 

 

Ok, this might sound confusing. I will try to sum up everything. I would like to get a frequency from the sine wave that is accquire into my card. Since NI card can only read digital signals, I have converted the analog sine wave using Analog to Digital IC chip and pump the digitalise sine wave into labview. 

 

Now, I realised that labview cannot do FFT directly using the binary data that i have accquired (or maybe there is a way). Therefore, my boss suggested me to convert the binary data that i have collected to decimal number, then plot it on a graph to form a sine wave and finally do FFT on that.

 

I hope I have explained my situation well. Now the main question is, can labview get the frequency of the sine wave from binary data? Or do I really need to do what my boss suggested? If so, can any kind soul provide a brief VI on how I should convert 34bits data into decimal, plot them on a graph and finally do FFT.

 

I am very new to labview, hope I can get some help from here. I am desperated for help.

 

Thanks guys!

Teck Hui 

 

 

 

0 Kudos
Message 1 of 22
(5,044 Views)

Hello Keith,

LabVIEW have some built in measurement functions to do FFT. One example of such a function is FFT Spectrum (Mag-Phase) but in term of the requirement for the function, the input signal should be in a waveform datatype (Timestamp t0, Double dt, Double[] WaveformData). What your boss suggested can create the WaveformData and the use the built in functions to get the FFT spectrum of the signal.

 

In order to convert from boolean array to a number, have you try to use the Boolean Array to Number function?

 

Actually, instead of using a HSDIO, you should be using either a DAQ AI channels or Digitizer to get the signal into the computer. This will save the processor time and remove the complexities to convert the digital signal to numbers and also remove many unforeseen disadvantages of using HSDIO to sample an analog signal.

 

- James

- Meadow -
LabVIEW 7.0 - 2011, Vision, RT, FPGA
TestStand 3.0 - 4.5
0 Kudos
Message 2 of 22
(5,016 Views)

One of the few thing I have never done in Labview is digital data collection. But how are your data organized. Is it in a boolean array or is it something else? Anyway it should not be very hard to extract anything you want, and create a number. This number can then be sent to the FFT function.

Tell me/us about your data format and we will quite sure be able to work something out.  



Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 3 of 22
(5,005 Views)

Thanks for the prompt response. Didnt notice the reply and I open another thread. Sorry.

 

Ok, here's what i had achieved so far.

 

- I have successfully convert the binary data to decimal number.

 

Now what I have now is a huge set of decimal number that is arranged horizontally, when I plot it in table form. But I dont know whether it's boolean array or whatsoever, I am really weak in this. But in any case, i managed to convert it to decimal number. I have attached my VI, hope you can understand my program.

 

 

So now that I have the decimal number ready, I will need to either

 

 

1. feed this set of decimal number straight away to do FFT ( as what Coq rouge suggested )

 

or

 

2. convert this set of decimal number to a waveform and finally perform FFT ( as what my boss and Meadow mention )

 

 

I had tried both methods, maybe it's because I used the wrong function or just because I am plain idiot, I couldnt get what I wanted.

 

Spent the whole week thinking of this, but to no avail.

 

Seriously hope I can get some help here.

 

Thanks very much!

 

 

0 Kudos
Message 4 of 22
(4,980 Views)

I am not sure if this help. I have 8.6 so I can not send you any VI. But try this as shown in picture. It will help you to extract your number from odd bit number



Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 5 of 22
(4,973 Views)

Oh my god, you guys are very helpful. Thanks a lot, really appreciate that!

 

 Ok Coq rouge , I understand the concept of the program that you sent to me, in fact I had already able to retrieve the selective data that I want in the attached VI that I posted.

 

Therefore, on to the next question, how do I do FFT from here? Or is it that, I will need to change it to Waveform Data first then do FFT?   I had tried both case but fail. In actual fact, I totally have no club on how to do it  Smiley Sad

 

What I understand from the numerous failure I made is that, there are quite a handful of FFT function to use, I tried almost everyone of them, but it cant work. There are several possibilities as to why it cant work :

 

1. I cannot pump data( in this case, should be decimal ) directly to FFT function block

 

2. The FFT function that I used it wrong

 

3. The wavefrom graph function I used it wrong

 

4. I am just plain stupid

 

 

Thanks for the help guys!

0 Kudos
Message 6 of 22
(4,941 Views)
Is this a duplicate of this? If so, please stick to one thread so everyone can see what's already been covered and suggested, and folks don't waste their time answering something that's already been answered.
0 Kudos
Message 7 of 22
(4,937 Views)

First up, I will like to apologise for the double thread posting I had post on. In any case, please refer to this thread instead.

 

 

By smercurio_fc  

 

It's not clear what you're exactly doing. You said "I tried to pump the set of 10bits words into a graph". What does this mean? How are you converting the 10 bits to a number? What numeric representation are you using? Integer or floating point? Also, are you using a waveform graph, or a waveform chart? If you feed one number to a graph, then you will only see one point. A chart, on the other hand, has a history, so it will plot that point, plus all the others that have been fed before (up to the history length).

 

Can you show us some code?

 

 

I guess I have attached my VI in this thread. I am using a PXI-6552 card, therefore I have to use HSDIO functions to construct my VI. 

 

Sorry I wasnt clear on the 10bits words part. The 10 bits will be converted into a decimal(integer). I am currently using waveform graph.

 

As you can see from this thread, my main objective is to eventually do FFT with the set of decimal data I processed. 

 

The reason why I need plot the data onto the graph, is mainly because I want to check whether the signal that I am getting is correct before I proceed on to FFT function.

 

 

 

Once again, I apologise to my double post. I am just too eager to solve the problem and forgot the previous thread I had posted. Very sorry

 

Keith Tan 

0 Kudos
Message 8 of 22
(4,936 Views)

I don't have the hardware you have, and I don't have the niHSDIO library, but looking at the code it appears that you are reading an array of integers, and each integer is a value of 0 or 1, indicating a bit value. You are then using the Not Equal to 0? and Boolean Array to Number to get your actual number. This means that each iteration reads just one numerical value. As I pointed out in the other thread, if you use a waveform graph you will only see the value from the current iteration. If you want to see all the values you need to use a waveform chart and wire the output of the Boolean Array to Number function to the chart. This should get you the graphical display.

 

As for the FFT, that's a different story. Normally you would have an array of values to feed to the FFT function. I assume your numbers are some scaled values. Based on how I understand your code to work, this will only happen when your loop stops and you've auto-indexed the individual values out of the loop. If you want to calculate the FFT while the loop is running you can try to use the FFT PtByPt VI.

 

Also, you should recode your VI. You should not be reconfiguring the PXI card in each iteration. This is pointless. Do the initialization and configuring outside the loop since you only need to do this once. 

0 Kudos
Message 9 of 22
(4,927 Views)

Ok, now I managed to display the data using chart instead of graph.

 

The next part will be doing FFT. I still couldnt get the result after passing through the FFT function.

 

Thanks in advance.

0 Kudos
Message 10 of 22
(4,914 Views)