LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to generate digital pulse of variable duty cycle using Labview FPGA

Solved!
Go to solution

Hi everyone,

I am trying to generate pulses that I can change the duty cycle. I am using cRIO 9014 and NI-9403 DIO module connected on my chassis. I am able to see digital pulses which are coming from DIO module and I can change the period. I have this program and I am able to control and change the period of the pulses but I can not change the duty cycle of the pulses as I want. So How to do it on LabVIEW FPGA?

And My system clock rate is 40 MHz and since there is a timed loop, program should run at the clock rate. But when I start the program couple of times, there are different values in my indicator instead of 1 tick per iteration.

Does anyone explain to me why it is working like this? 

I am new to LabVIEW so any ideas or any example VI's would be much appreciated.

Regards,

Kaan

0 Kudos
Message 1 of 7
(2,846 Views)

I have attached the program as well.

Regards,

Kaan 

Download All
0 Kudos
Message 2 of 7
(2,787 Views)
Solution
Accepted by topic author kaan13

Hi Kaan,

 

where do you output your DO values? All you do is "enable" a certain output pin, but you don't set its value!

 

My system clock rate is 40 MHz…

The NI9403 does NOT support writing its DO values so fast. It only allows <= 140kHz…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 3 of 7
(2,780 Views)

I changed DO output connection and I am able to change duty cycle and period. Can I use while loop or for loop instead of timed loop which is in SubVI? And Do I have to use case structure in this case?

Many thanks,

Kaan

0 Kudos
Message 4 of 7
(2,748 Views)

Hi kaan,

 

you can use any kind of loop - when it suits to your requirements…

In a FPGA I usually use while loops as you don't know in advance how long that loop wil iterate.

 

Do I have to use case structure in this case?

???

For "cases" you should use "case structures"… 😉

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 7
(2,741 Views)

Thank you for your reply.

I also need to generate single pulse by PWM output.

My question is : How to do it in Labview FPGA? And how can I implement it to my code?

Regards,

Kaan

0 Kudos
Message 6 of 7
(2,709 Views)

Hi kaan,

 

I also need to generate single pulse by PWM output.

Please define a PWM outputting just a single pulse!

Right now it's a quite contradictionary description…

(A single pulse is just an ordinary DO: switch on, wait, switch off.)

 

How to do it in Labview FPGA? And how can I implement it to my code?

By programming!

After you define your requirements (and the algorithm) you can easily create the block diagram in LabVIEW…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 7
(2,679 Views)