취소
다음에 대한 결과 표시 
다음에 대한 검색 
다음을 의미합니까? 

Pulse width calculation

Hello !

 

In order to learn about sine wave pwm and LabView, i've done a little code which i attach for reference.

 

I am comparing a sine wave with a triangular wave.

 

There are a few things i don't understand :

 

1. Why does the PWM graph have a X scale of 0 to 1000 ?

 

2. How to calculate how long a pulse lasts (i.e the duty cycle).

 

Can you give me please answer this questions ?

 

I've searched the forums but i can't find a clear answer.

 

Some hints or ideas/threads that deal with this issue are greatly appreciated.

 

P.S. Using LabView 8.5.1.

 

Thank you !

 

 

 

 

0 포인트
1/5 메시지
4,241 조회수

Is there anyone that can help me ?

 

Thank you !

0 포인트
2/5 메시지
4,229 조회수

Please be patient.  You only posted the original question half an hour ago.  Most of us on the Forums are volunteers who have other jobs.

 

The PWM graph x-axis scales to 1000 because you gave it no timing information and waveform has 1000 points.

 

The PWM generation can be simplified as shown below.  This does not generate the array of timestamps but gives exactly the same PWM waveform.

 

PWM Modified.png

 

The Pulse Measurements VIs should be able to find the duty cycle for you or you could calculate it fairly easily from the boolean array.

 

Lynn

3/5 메시지
4,223 조회수

Thank you 4 your reply !

 

I've been working for several days on this before i've decided to post this question.

 

I've seen that there are some functions that can calculate the pulse width but how can it be calculated from the boolean array ?

 

I want to fully understand what is going on, and that is why i'm asking these questions.

 

Thank you 4 your time and patience.

0 포인트
4/5 메시지
4,216 조회수

From the boolean array: Loop through the array. Note the index of the first F to T transition (t0).  Note the index of the next T to F transition (t1). Note the index of the next F to T transition (t2).  Then the period is dt*(t2-t0) and the duty cycle is (t1-t0)/(t2-t0), where dt is the time interval between samples.  Repeat for the next pulse by setting the new value of t0 to the previous value of t2.

 

If you are a beginner with LV, this will be a good learning exercise.  Hint: Use shift registers.

 

Lynn

5/5 메시지
4,210 조회수