Don't ad-block us - support your favorite websites. We have safe, unobstrusive, robotics related ads that you actually want to see - see here for more.
0 Members and 1 Guest are viewing this topic.
for(;;;){ set(PIN1); delay_ms(10); clear(PIN1); delay_ms(10);}
By changing size of pulse (s, ms, us) You changed frequency and not duty cycle.
That mean it require PWM...!!
and what is inside a servo circuit what use of it??
QuoteBy changing size of pulse (s, ms, us) You changed frequency and not duty cycle.
That mean it require PWM...!!and what is inside a servo circuit what use of it??
Quote from: RITESH29 on January 20, 2012, 02:25:57 AMQuoteBy changing size of pulse (s, ms, us) You changed frequency and not duty cycle.That would have changed duty cycle as well.
Quote from: Soeren on January 20, 2012, 03:02:01 PMQuote from: RITESH29 on January 20, 2012, 02:25:57 AMQuoteBy changing size of pulse (s, ms, us) You changed frequency and not duty cycle.That would have changed duty cycle as well.How's that? Duty cycle is ratio between width of HIGH and LOW signals, so no matter if widths are 2s and 18s, or 2ms and 18ms, or 2us and 18us, duty cycle is still the same - 10%.
So, if it was the pulse length he changed, but kept the pause length (since he didn't mention it) it would change the duty cycle as well as the frequency [...]
{{ CenterParallaxServo.spinFor centering Parallax Continuous Rotation Servoor holding Parallax Standard Servo at 90° position.Sends a 1.5 ms pulse approx every 20 ms }}CON_clkmode = xtal1 + pll16x ' System clock → 80 MHz_xinfreq = 5_000_000 ' Using 5 MHz external crystal oscillatorservoPin = 0 ' Servo signal to this I/O pin-change if neededPUB CenterServo | tInc, tc, tHa, tctra[30..26] := %00100 ' Configure Counter A to NCOctra[8..0] := servoPinfrqa := 1dira[servoPin]~~' Set up cycle and high timestInc := clkfreq/1_000_000tC := tInc * 21_500tHa := tInc * 1500t := cnt ' Mark counter timerepeat ' Repeat PWM signal phsa := -tHa ' Set up the pulse t += tC ' Calculate next cycle repeat waitcnt(t) ' Wait for next cycle