LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

triangle wave into comparator issues

Solved!
Go to solution

Hi all, I am very new at using labview and have encountered a problem. 

I am trying to compare 2 dc voltages with a triangle waveform, in a similiar manner to PWM comparing a triangle wave to sine wave. I'm building the schematic to load onto an FPGA but am having trouble with the wires going in the comparator from the triangle waveform generator, and into the I/O interface from the comparator. 

 

I think the problem is that the triangle waveform is an array, which is not a proper input for the comparator. I thought the block which converts the array to a dynamic input would solve this but it didn't. 

 

Attached pictures of the schematic and error list. Again i'm really new at this. Thanks for any help 

 

errors.jpg

dv.zip

0 Kudos
Message 1 of 5
(3,745 Views)

Hi colek,

 

I would strongly suspect, this has to do with you using dynamic datatypes and double arrays, which are not supported on an FPGA. You should try to replace all functions with double or dynamic output with corresponding FPGA functions. This probably means no Express VIs, but I'm not 100% certain.

 

Also, have you done a class in LabVIEW FPGA? If not, I would suggest doing so, because it helps you prevent problems like these in the future. If you happen to be a student, you can get them really cheaply, too.



Remember Cunningham's Law
Message 2 of 5
(3,710 Views)

Thanks for the response PeterFoerster, I won't be able to get on Labview until tomorrow so I'm trying to figure this out from memory. How do I go about replacing the functions with FPGA functions? Are you saying I need to rewrite this into an FPGA VI since this is an Express VI?

 

Thanks again. 

0 Kudos
Message 3 of 5
(3,688 Views)

That's almost what I'm saying: You need to replace the functions you're using that use dynamic and double datatypes with functions that are designed for FPGA. It won't be necessary to write everything yourself, just look for the corresponding functions for FPGA. A good place to start would be the FPGA palette.

 

Are you sure you even need an FPGA? Since you're using express VIs, performance doesn't seem to be an issue...



Remember Cunningham's Law
Message 4 of 5
(3,654 Views)
Solution
Accepted by colek1

Right.  FPGA doesn't allow arrays (unless the length is configured to a constant), or DDT.  You might notice that if you open the Functions pallette while editing an FPGA .vi, they dont' even show up.  The error message is that the subVIs can't execute.

 

Check out the NI Example Finder (Help menu/Find Examples...), and look up 'PWM'.  there are several examples, the first one (PWM Generation) probably applies very well (use a calling .vi, and pass it something like [1000+1000 * sin(i)], and [1000-1000 * sin(i)], and change the [F] to [T] to stop the while every cycle).  Check out the other examples.  There may be one more like what you want.

 

In general, FPGA code works by looping very quickly, and processing only one value at a time.  Instead of generating a whole sine wave, and a triangle wave pattern, you should generate a single point in the waves each time through the loop.  

 

If you want your own solution (instead of starting with the example):  On the Functions pallette, use 'search' to find sine (ni FPGA Sine Wave Generator), etc., and use a normal Programming/Numeric/Greater for comparing the sine to the triangle.

___________________
CLD, CPI; User since rev 8.6.
0 Kudos
Message 5 of 5
(3,634 Views)