LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Triangular signal on fpga

Solved!
Go to solution

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

0 Kudos
Message 1 of 6
(3,467 Views)
Solution
Accepted by topic author lebanon

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

 

 

Peter Vago
0 Kudos
Message 2 of 6
(3,447 Views)

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

 

0 Kudos
Message 3 of 6
(3,426 Views)

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

 

Peter Vago
0 Kudos
Message 4 of 6
(3,423 Views)

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

0 Kudos
Message 5 of 6
(3,402 Views)

This is the VI I forgot to attach to the last post

10x again

0 Kudos
Message 6 of 6
(3,401 Views)