LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

frequency problem compact rio

Solved!
Go to solution

I recommend you check your math.  When I put 50% duty cycle at 1hz into your VI, I get wait times of 0.5ms.  Perhaps you meant to have your wait times in seconds?

0 Kudos
Message 21 of 36
(963 Views)

inputs :

duty cycle=50%

frequency=500Hz

outputs:

ms high=0,001seg

ms low=0,001 seg

 

inputs:

duty cycle=50%

frequency=1Hz

outputs:

ms high=0,5seg

ms low=0,5 seg

 

it is ok,isn´t it? i just want to generate the pwm signal, the normal frequency for me will be 100-500Hz

sorry,i don´t understand which is the problem

 

0 Kudos
Message 22 of 36
(957 Views)

ok ok,so my frequency is s^-1,then the mshigh and mslow which i am generating are in sec,aren´t them?

and i have my counter in ms, so i should change the values of mshigh and mslow to ms,after calculate it,yes?

0 Kudos
Message 23 of 36
(955 Views)

Yes.

0 Kudos
Message 24 of 36
(952 Views)

yes,it works thank you so much 🙂 i was thinking about this almost 2 weeks and i couldn´t see the problem!!

i have the problem that i just can see the signal when the frequency is around 50hz, is there a way to get it with more frequency,about 100 or 500 Hz?

0 Kudos
Message 25 of 36
(946 Views)

Again, think about the math.  The input of the Wait function is an integer.  At 500hz, what duty cycle values will give you an integer number of milliseconds to wait?  (Hint: not very many)

You might need to change the Wait function to use a smaller unit of time.  I'm not sure what the accuracy of the clock is on a cRIO.

0 Kudos
Message 26 of 36
(950 Views)

the counter can has ms or microms,but for example for a duty cucle of 50%:

frequency=50Hz i have mshigh and ms low=10ms(integer number)

and frequency=500hz i have mshigh and mslow=1ms(integer number)

so it should work to frequency <500hz, but i just can have <=50Hz, "the wait function has an integer number in its input",shouldn´t it?

 

and when i did it with the another code which i saw you before,i was able to generate a pwm signal with frequency=500Hz

0 Kudos
Message 27 of 36
(945 Views)

You will never match the performance of the built-in solution, where you write the duty cycle directly.  It's not worth trying.

 

Time the while loop and see how fast it's running (you can use the output from the Wait function, and a shift register, to do this).  That will give you the maximum frequency at which you can generate a pulse.  You might be able to improve performance slightly by using a timed loop.

0 Kudos
Message 28 of 36
(942 Views)

sorry,but i don´t understand how to do that

0 Kudos
Message 29 of 36
(937 Views)

could i use a timed loop?isn´t the wait function which determines the period of execution?

0 Kudos
Message 30 of 36
(933 Views)