At 03:53 AM 12/19/2013, you wrote: >On Dec 18, 2013, at 11:49 PM, Lindy Mayfield wrote: > > > it's still not clear, what duty cycle is. > > > The frequency is the time between pulses. > >Technically, the PERIOD is the time of one cycle of the waveform=20 >(same as the "time between pulses.") >The FREQUENCY is the number of cycles you get in a particular time=20 >(one second.) >They're intimate related; f =3D 1/p To be absolutely clear here, the period is the time of one pulse plus=20 the time between two pulses. x-----x x-----x | | | | | | | | ----x x-----------x x------ <--- period ------> <-th-> <-----tl----> period =3D th + tl =3D 1/f duty cycle =3D th/(th + tl) =3D th/period If you put a low-pass filter on the output that's relatively low=20 cut-off frequency compared to f, you'll get a more-or-less steady voltage that varies from 0 to 100% of the pulse=20 voltage depending on the duty cycle. This is an easy way to make a DAC with a PIC PWM output, though it=20 runs out of gas if you need lots of bits at high bandwidth. PWM also tends to be a better way rather than voltage=20 to control power, since the power into a resistive load with be linearly proportional to duty cycle. > > The duty cycle is the percentage of time the line is high. So I=20 > guess that a perfect square wave would have a duty cycle of 50%? > >Yes. Exactly. > > > > PWM is simply changing the duty cycle from 1 - 99% > >0 to 100%, ideally. But you have the right idea. Your desired=20 >waveform (10us every 1s) has a duty cycle of 0.001% > > > > Normally the frequency is 20 ms? > >20ms is a typical period for Radio Control signals (ie to=20 >servos.) I didn't think that was what we were talking about. >There are various reasons why RC signals aren't quite "typical pwm." RC servo pulses are typically 1-2 msec long pulses repeated at 50Hz,=20 so every 20 msec. It's the absolute duration of the pulse that determines the target=20 servo position- the time between pulses is not very important (on a radio channel the dead time allows you to=20 time-multiplex a number of servos over a single RF signal with the simple circuitry possible in the early days). During the dead=20 time you're off servicing other servos. > > So when you say "high duty cycle" do you mean the time the line=20 > is high compared to low? So like 75% would be high? > >Yes. The 555 in "astable" (oscillator) mode tends to produce=20 >waveforms with greater than 50% "high" time. >In monostable (pulse) mode it produces output "low" pulses when=20 >triggered. Whether you set up a really extreme duty cycle=20 >oscillator (not too likely to work) or a double-555 configuration=20 >where a slow oscillator triggers a short pulse generator, the output=20 >waveform is going to have short "low" times and long "high" times,=20 >which is opposite what you said you wanted. > > > > why do you need to invert a square wave? > >You wouldn't. If you did the double-555 setup, you'd only need to=20 >invert the final output, not the (more square-shaped) wave between=20 >the two 555s. > >BillW > > > >-- >http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive >View/change your membership options at >http://mailman.mit.edu/mailman/listinfo/piclist --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .