Discussion forum for the BasicX family of microcontroller chips.
|
Not too long ago Frank Manning posted some code to use Timer 2 to control PWM on pin 25. I'm using Timer 1 to control a motor at 14 kHz on pin 27 and would like to use timer 2 to control at servo at 56 Hz. Using the code supplied, pin 25 does indeed put out a pulse every approx 18 msec. However, for a 1 ms wide pulse the falling edge is not sharp but looks like a capacitor discharge curve. This is with only a 10x scope probe on the pin (the same scope output on pin 27 shows sharp rise and fall times). Two questions: 1) is the slow decay time normal for timer 2 or for timer 2 at 56 Hz? If not what can I do to remedy the situation? 2) The servo, which works with a pulseout on one of the regular I/O pins, does not work at all with timer 2 controlling pin 25. Is this a function of the slow decay time ? I'd appreciate any hints to make the servo work with the timer 2 output. Timer 2, to my knowledge, is not being used for any other function, ie Com3. Thanks, John Piccirillo |
|
|
|
From: "John Piccirillo" <> > Not too long ago Frank Manning posted some code to use > Timer 2 to control PWM on pin 25. I'm using Timer 1 to > control a motor at 14 kHz on pin 27 and would like to use > timer 2 to control at servo at 56 Hz. Using the code > supplied, pin 25 does indeed put out a pulse every approx > 18 msec. However, for a 1 ms wide pulse the falling edge > is not sharp but looks like a capacitor discharge curve. > This is with only a 10x scope probe on the pin (the same > scope output on pin 27 shows sharp rise and fall times). > > Two questions: > > 1) is the slow decay time normal for timer 2 or for timer > 2 at 56 Hz? If not what can I do to remedy the situation? No, it shouldn't be doing that. The on-board red LED is connected to pin 25, but that shouldn't be causing the problem. We'll have a look at it. > 2) The servo, which works with a pulseout on one of the > regular I/O pins, does not work at all with timer 2 > controlling pin 25. Is this a function of the slow decay > time ? What servo are you using? I have been able to drive a servo using Timer2, but perhaps the particular servo I was using just happens to be more tolerant of variations in the input signal. Obviously it's not good for Timer2 to work with some servos and not others. > I'd appreciate any hints to make the servo work with the > timer 2 output. Timer 2, to my knowledge, is not being used > for any other function, ie Com3. OK, I'll see if we can reproduce the problem. -- Frank Manning -- NetMedia, Inc. |
|
Thanks for replying Frank. The servo I'm using is Hitec HS-805BB Mega Power, 1/4 Scale Servo. The puzzling thing is that it works with a pulseout on pin 19. Since this is a class project, there's no telling what a student may have done (so far I have about a dozen dead BasicX chips that students have fried). I'll try a pulseout on pin 25 and see if the pin is working properly. John Piccirillo From: "John Piccirillo" <jpicciri@r...> > Not too long ago Frank Manning posted some code to use > Timer 2 to control PWM on pin 25. I'm using Timer 1 to > control a motor at 14 kHz on pin 27 and would like to use > timer 2 to control at servo at 56 Hz. Using the code > supplied, pin 25 does indeed put out a pulse every approx > 18 msec. However, for a 1 ms wide pulse the falling edge > is not sharp but looks like a capacitor discharge curve. > This is with only a 10x scope probe on the pin (the same > scope output on pin 27 shows sharp rise and fall times). > > Two questions: > > 1) is the slow decay time normal for timer 2 or for timer > 2 at 56 Hz? If not what can I do to remedy the situation? No, it shouldn't be doing that. The on-board red LED is connected to pin 25, but that shouldn't be causing the problem. We'll have a look at it. > 2) The servo, which works with a pulseout on one of the > regular I/O pins, does not work at all with timer 2 > controlling pin 25. Is this a function of the slow decay > time ? What servo are you using? I have been able to drive a servo using Timer2, but perhaps the particular servo I was using just happens to be more tolerant of variations in the input signal. Obviously it's not good for Timer2 to work with some servos and not others. > I'd appreciate any hints to make the servo work with the > timer 2 output. Timer 2, to my knowledge, is not being used > for any other function, ie Com3. OK, I'll see if we can reproduce the problem. -- Frank Manning -- NetMedia, Inc. [Non-text portions of this message have been removed] |
|
From: "John Piccirillo" <> > Thanks for replying Frank. The servo I'm using is Hitec > HS-805BB Mega Power, 1/4 Scale Servo. The puzzling thing > is that it works with a pulseout on pin 19. Since this > is a class project, there's no telling what a student may > have done (so far I have about a dozen dead BasicX chips > that students have fried). I'll try a pulseout on pin 25 > and see if the pin is working properly. Yesterday I looked at the PWM output on pin 25. I was seeing rise times and fall times within about 200 ns. Is that what you were seeing? I also tested the pin with a Hitec HS-5645MG, which looked like it worked OK. I also tried a couple of other servos (Cirrus CS-50 and GWS S05/2BB) -- haven't been able to reproduce the problem. I'll see if we can round up a HS-805BB for testing. -- Frank Manning -- NetMedia, Inc. |