Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

phase shifted PWM with Ni 9401 and Crio

Solved!
Go to solution

Hi

Do you have an idea about 180 degree phase shifted pwm?

(fix frequency and variable duty cycle)  

I have tried a design, but it seems in the graphs that the design works on the realtime.vi but it does not work with the fpga.

FPGA pwm output graphs are different from the realtime as you can see in the pictures.

On the other hand, Fpga VI produce two pwm as seen in the oscilloscope when the fpga VI runs.

However, there is no phase shift between PWM waves.
This is a part of my thesis but I got stucked in this problem so I need an assistance from you.

Thank you.

 

Best regards;

 

My hardware:

cRIO-9024 and cRIO-9118 chassis

ni-9223, ni-9263, ni-9401, ni-9474

two ni-9225 and ni-9227

Download All
0 Kudos
Message 1 of 6
(5,169 Views)

Hi m2b,

 

I noticed that you are using one of our digital lines with a scaling factor and an amplitude offset. Out of curiosity, why do you even need the amplitude or scaling factor in this scenario? I believe wiring the output of the Square Wave Generator directly into the DIO output should suffice. Specifically, it looks to me like the fixed point math operations performed in the FPGA code may be the culprit behind your incorrect PWM signals in this case.

 

Please let me know if this works for you!

 

 

0 Kudos
Message 2 of 6
(5,138 Views)

Hi Yiran

 

Thank you for taking care of my trouble.

-------------------------------------------------------------------------------------------------

History: 
I am new at Labview. I am trying to learn during the project developing process.
My first PWM experince was boolean logic and high_time/low_time delay with in the 'Flat squence structure' for single channel.
In order to design 180 degree phase shifted PWM, I have researched the examles with in the labview.
I have found a NI example "Square Wave" which uses "Square Wave Generator". The amplitude or the scaling factor scenario is the part this sample. I did not change these parts of the example. The fixed point math operations performed are not necessary for my aim. Phase offset (0,5) have seen to be working in the waveform chart as in the example. The FPGA I/O node of the NI 9401 acccepted boolean in my firts PWM test. Therefore I have tried to find a way to convert the integer output of the "Square Wave Generator" into boolean logic. Actually, it worked and I saw two pwm output but there was not the phase shift.

-------------------------------------------------------------------------------------------------

Shortly:

 

As you said, I have directly wired the output of the Square Wave Generator into the DIO output.The output is same. There is no phase shift between PWM channels.Besides, the front panel waveform charts are not in the form I thought.

 

I will possibly add two PWM more in future. For now, I need at least two PWM output. There must be 180 degree phase shift between the channels with fixed frequency and variable duty cycle. I have tried some other examples but I failed. Maybe this is quite easy but i am not good at labview. I guess I need to work harder. I am waiting with hope for your and any other friends' advices.


Thank you

best reagards;

Download All
0 Kudos
Message 3 of 6
(5,114 Views)

Do you want them to be just phase shifted? So if duty is above 50 %, they will both be on at same time?

 

Also modules can only handle 100 ns update and i think you are trying to run 25 ns update? Set the tick to 4 instead of 1.

 

Or try putting in a while loop instead using "Loop Timer Express VI" and input 4 ticks. 

 

Also put outputs in same output block, then they are synced at update.

 

Hope this helps.

0 Kudos
Message 4 of 6
(5,093 Views)
Solution
Accepted by topic author m2b

Hi Mauritius

Thank you for your help.

Yes I want them to be shifted with the variable duty and 10kHz. I have set the duty 49% at most.

I have put the outputs in the same output block. 

Square wave generator do not accept 'while loop'.  

I have attached a simple FPGA project file. Would you please tell me what my fault is?

The obtained Pwm frequency is 10 kHz, the only problem is still the phase shifting.

So, I still need an assistance.

 

 

0 Kudos
Message 5 of 6
(5,029 Views)
Solution
Accepted by topic author m2b

Hi

I have found the problem.

The trigger settings of my oscilloscope were wrong.

I am sorry to occupy your time.

Smiley Sad

0 Kudos
Message 6 of 6
(5,007 Views)