01-14-2008 09:51 AM
Dear all,
Thanks for taking the time to read my post.
Though I have published this in other post I will include this in the post for clarity.
I am using Labview 8 on Win XP CPU 3.4, 2GB RAM PC.
I am using a microcontroller PIC24 (on the Explorer 16 development board), which I have programmed to acquire an AC singal at a rate of about 4096 Hz. The PIC24 has a 10bit ADC and the acquire value is then padded to16bits in total (format: 0-0-0-0-0-0-d9-d8-d7-d6-d5-d4-d3-d2-d1-d0) as an unsigned int.
To make things a bit more clear, the PIC has a small, 4-bytes Hardware buffer and I have implemented a 2049-byte software buffer before that. I should point out that the PIC is sending its acquired data in uncontrolled chunks of data.
The serial settings for the PIC and my Labview program are 115200, 8 data bits, no parity, 1 stop bit.
In order to send the acquired value to my PCs serial port (Remember UART = 8-bits of data only) I divide the 16 bit word into MSB and LSB. I then send the MSB and LSB 8-bit value one after the other.
The format I use is:
ADC_High = 0-0-0-d9-d8-d7-d6-d5
ADC_LOW = 1-0-0-d4-d3-d2-d1-d0
After the VISA Read VI has read and outputted the data (in string format), I am removing the 3-MSB from both ADC_HIGH and ADC_LOW.
Once the 3-MSB have been removed, I concatenate the two strings (ADC_HIGH and ADC_LOW).
After that I type cast the concatenated string back to unsigned int and normalize the value.
Now for the question.
I added to the program a simple ‘FFT and THD VI’, that I had written previously. However the ‘Amplitude and Phase Spectrum VI’ does NOT work.
I am trying to investigate why this is, but any help would be much appreciated.
Would some one be as kind as to check the attached VI’s and give me some advice on what I might be doing wrong?
Regards
Alex
01-15-2008 09:45 AM
01-15-2008 10:13 AM
01-15-2008 10:43 AM - edited 01-15-2008 10:43 AM
01-15-2008 10:43 AM
01-15-2008 11:23 AM
Thanks for your reply Kosta.
I understood my mistake but I am having some problems ratifying it.
How would I go about creating an array with out knowing before hand the number of elements? I tried using a FOR loop but had no success.
Any ideas would be much appreciated.
Regards
Alex
01-15-2008 11:34 AM - edited 01-15-2008 11:35 AM
Have a look at the 'Building arrays.vi' in the shipping examples. In general, you can wire the data on the border of the loop and use auto-indexing .
The picture illustrates the creation of a 100x1 array.
Regards,
KostasB
NI Applications Engineering
01-15-2008 12:04 PM
Thanks for your reply Kosta.
This is exactly what I did, as you can see in the attached VI.
However, I am not getting the excepted results. I do NOT know why this is.
I am trying to correct the problem, but any advice would be more the welcome.
Regards
Alex
01-16-2008 03:40 AM
01-16-2008 09:04 AM
Thanks for your reply Kosta.
This is very close to what I was trying to do myself. It can be very frustrating when you know what you want to do but have difficulty doing it.
I will go through the content of the link you suggested looking at. Hopefully that will improve my
I do however, have a few questions on the code.
I am under the impression that, once an FFT has been performed on 1024 points, those exact number of points need to be removed form the shift register. What seems to happen is the shift register get bigger and bigger and the program gets slower and slower as it tries to perform an FFT on an ever increasing number of points.
Also the ‘# elements in queue’ variable gets larger and larger as the program can not process all the data fast enough.
My question to you would be, how would I go about removing the 1024 (or say X) number of points, from the shift register once the FFT-THD VI has processed those specific number of points?
Please have a look at the attached VI. I have used Array Subset to remove 1024 point once the True Case has been triggered and the FFT VI has executed. However, now I am not getting any points in the shift register.
Any advice would be more than welcome.
Regards
Alex