LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Generating PWM based on Analog Input

Hi everyone,

 

I am using a CRio 9074 with NI940 to build a VI, that generates PWM Signal based on Voltage Input. 

 

Till now I could build a VI (based on Scan Interface), that produce me a proper PWM-Signal (see attached Pic) with a given High&Low Pulse.

 

Now I would like to modify my VI in a way, that if a certain voltage comes as an input, that I can generate a certain  PWM signal.

 

For example: 5V as an Input  ---> PWM Signal with Frequency 5Hz by 50% duty

                        7V as an Input -->  PWM Signal with frequency of 5Hz by 70% duty

 

Does anyone have some Idea, how I can realize that?? I am quite new to labview, so I would appreciate any help!! 

 

Best Regards

 

Yun

PWM.png

     

 

 

 

 

0 Kudos
Message 1 of 2
(2,892 Views)

Hi yskpark,

 

You can use case structure to make a conditional code. For example you wire an analog output value (Round to nearest can be used to make an easier judgement) to a condition terminal of case structure.

Inside case structure, you can create a calculation for you duty cycle as you want.

Capture.PNG

 

There are many resources teach you how to use case structure. Some of the link can be found below

http://www.youtube.com/watch?v=cgS3u0nupfs

http://zone.ni.com/reference/en-XX/help/371361K-01/glang/case_structure/

 

Hope this help

 

Best regards,

TuiTui

0 Kudos
Message 2 of 2
(2,739 Views)