LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

issue with square wave generation using fpga.

Solved!
Go to solution

Hi

i am trying to generate two square wave with 520Hz freq.,12v amplitude ,50% duty cycle and 20 degree phase angle.i am using square wave express vi with DO 9474.i am giving 12v dc to DO from SMPS.but i am not getting correct waveform.i don't why off state of square wave coming like that. i have attached the vi and waveform.

Download All
0 Kudos
Message 1 of 9
(4,007 Views)
Solution
Accepted by topic author Risuraj

My initial suspicion was about the use of multiple copies of an express VI on a non-desktop target, but based on the photograph of the waveform it looks like you don't have any grounding path perhaps? Or at least that the problem is more likely electrical.

 

I'd suggest checking your wiring (and if appropriate the design and construction of your SMPS) is appropriate and that you have some ground path for the output, and that there isn't some floating connection in your system. 

 

As a slightly picky addition, I want to point out that you didn't attach either the VI or the waveform, but rather a screenshot of the VI (at least in this case clear, but prevents checking details) and a photograph of the waveform (which took quite some time to download on my phone). That oscilloscope is capable of outputting the captured waveform to a picture on a USB device which you could then have uploaded making it easier to read and smaller to download.

 

If possible in future, when asking questions please upload the actual VI, and if appropriate place an image or snippet in line with the text or as an attachment. This allows both checking/testing and also reading on a mobile device.


GCentral
0 Kudos
Message 2 of 9
(3,973 Views)

Hi

i got the solution here.

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z000000P8gGSAS&l=en-IN

so the generation part now ok.now i want to do reverse.i want to read this same square wave through NI H/W.

how to proceed further.

0 Kudos
Message 3 of 9
(3,952 Views)

Well, as a first step, what hardware do you have to acquire the signal?


GCentral
0 Kudos
Message 4 of 9
(3,944 Views)

For generation i used Do 9474.

what hardware do you have to acquire the signal?

i have DI 9411 and AI 9201.

how to start with this one??

0 Kudos
Message 5 of 9
(3,934 Views)
Solution
Accepted by topic author Risuraj

@Risuraj wrote:

For generation i used Do 9474.

what hardware do you have to acquire the signal?

i have DI 9411 and AI 9201.

how to start with this one??


Ok - so if you'd like to read the value as an analog input, connect it to the NI-9201, and if you instead prefer to only know if it is "high" or "low" relative to a threshold value, use the NI-9411.

 

From there, the code will be similar to what you have - a While loop (you can't do analog input in a SCTL, but you can use digital input, if that's important) containing the I/O Node and an appropriate reference to the port/line to be acquired.

 

A simple example can be found in video 3 here: Getting Started With LabVIEW FPGA.

 


GCentral
0 Kudos
Message 6 of 9
(3,927 Views)

i want to measure the phase angle ,amplitude and time period for both the signal.

0 Kudos
Message 7 of 9
(3,922 Views)

You're only going to have a meaningful measurement of amplitude if you treat the signal as an analog value.

 

However, period or frequency measurements may be easier to make using the 9411.

 

Does your chassis (cRIO) support DAQmx? These are the newer chassis - the 904x and 905x types.

 

That will allow you to make Counter based measurements much more easily - in that case, you should search for DAQmx examples to get the frequency or period and phase angles and implement that code on the RT target.

 

Otherwise (or if you must use the FPGA specifically) you can do it manually, but it will be significantly more work. In that case, you should first read about the methods to calculate those things based on counting ticks vs a known timebase or similar methods. Then, once you're confident with a mental model of how you want to carry out the calculation, you can program it using a threshold value for analog input or the change in value for digital input. 


GCentral
0 Kudos
Message 8 of 9
(3,911 Views)

 

Does your chassis (cRIO) support DAQmx? These are the newer chassis - the 904x and 905x types

yes DAQmax is supported by chassis.i am using CRIO 9045.

you should search for DAQmx examples to get the frequency or period and phase angles and implement that code on the RT target.

ok i will try go with this way.

Otherwise (or if you must use the FPGA specifically) you can do it manually, but it will be significantly more work. In that case, you should first read about the methods to calculate those things based on counting ticks vs a known timebase or similar methods

is dere any inbuilt function in fpga where i can directly measure these parameter.

0 Kudos
Message 9 of 9
(3,891 Views)