04-20-2011 03:08 AM
hi,
I am trying to create a triangular signal on an FPGA target so I can compare it to an analog input signal so I can create a PWM signal. If you can help me to generate a triangular signal on an fpga target and I was wondering if using a simple comparison is enough to compare the two signals point by point?
thx
Solved! Go to Solution.
04-21-2011 04:40 AM
Hello,
Thank you for contacting us.
If you would like to do something like this: http://decibel.ni.com/content/docs/DOC-2387 , you can try it.
Simple comparison is enough, although if you have a noisy input signal you should use some filtering.
Regards,
Peter
04-27-2011 06:13 AM
hi again,
I thank for your solution, it was exactly what I was asking for and I was wondering if you can help me in one more problem I am encountering: I am receiving an analog signal with a rate of 6 us per sample and I want to make the average of every 8 samples I receive to have an averaged value every
40 us.
10x
04-27-2011 08:27 AM
Hi lebanon,
I'm glad that you managed to resolve the previous problem.
If I understood well the other question, you would like to averaging every 8 sample, but you want to get the avearage value in each 40 us.
So, you can use two while loops in the FPGA. In the forst loop you can acquire data with 6us loop time, and you can calculate average of them in each cycle. The result of the averaging can be stored in Memory or FIFO.
Averaging with multiple shift register terminals: http://zone.ni.com/reference/en-XX/help/371361G-01/lvhowto/using_shift_registers_to_r/
In the other loop, which can running with 40 us loop time, you can read the current average value from the Memory or FIFO.
I hope this solution will be good for you. If not, just write us again. 🙂
Regards,
Peter
05-04-2011 06:40 AM
hi again,
I have attached a VI in which I am receiving an analog signal with a rate of 6 us per sample and I am averaging every 6 samples, and also I am comparing the result to the triangular signal so I can get a PWM signal. Two questions I need to ask you:
1) Can I get a more accurate signal by averaging or this is the maximum accuracy I can get by averaging? (P.S.:I can get the signal with a rate of 40 us max per sample after averaging but I don t want to use any memory or FIFO)
2) I need to have the triangular signal with a frequency of 25 KHz, do you have any idea how can I do so?
10x
05-04-2011 06:43 AM
This is the VI I forgot to attach to the last post
10x again