EmbeddedRelated.com
Forums

Servo pulse using Timer1

Started by kg4pid October 28, 2004


I'm just starting a small project using
a 12F675 and would like to use Timer1
to time the PWM signal going to a remote
controlled servo. The typical 1ms to 2ms
pulse with 1.5ms being centred. I've
done a few small projects but I've never
used Timer1 before. Looks like I sould
feed the signal in on GP4/T1G(not) to
be the gate. I plan on using a 4Mhz clock.
When using this input as a gate can it
still be read as an input? I'm trying to
figure out how to tell when to read the
counter and clear it for the next pulse.
Do I need to tie it to another input pin
and use that pin to tell if the pulse
has ended or not? Thanks, Max




Just to clairify my orginal post, I'm trying to read a pulse width
with Timer1, not generate a pulse.
Max

--- In , "kg4pid" <kg4pid@y...> wrote:
>
>
> I'm just starting a small project using
> a 12F675 and would like to use Timer1
> to time the PWM signal going to a remote
> controlled servo. The typical 1ms to 2ms
> pulse with 1.5ms being centred. I've
> done a few small projects but I've never
> used Timer1 before. Looks like I sould
> feed the signal in on GP4/T1G(not) to
> be the gate. I plan on using a 4Mhz clock.
> When using this input as a gate can it
> still be read as an input? I'm trying to
> figure out how to tell when to read the
> counter and clear it for the next pulse.
> Do I need to tie it to another input pin
> and use that pin to tell if the pulse
> has ended or not? Thanks, Max




Correct. The way I see it, if configured properly(CLKOUT disabled and
Analog disabled) TMR1 should count while T1G is low.

Looking at the schematic of the GP4 pin, not only can you read the
input, but it looks like interrupt on change should also work.

Good luck,
Chad
--- kg4pid <> wrote:

>
> Just to clairify my orginal post, I'm trying to read a pulse width
> with Timer1, not generate a pulse.
> Max
>
> --- In , "kg4pid" <kg4pid@y...> wrote:
> >
> >
> > I'm just starting a small project using
> > a 12F675 and would like to use Timer1
> > to time the PWM signal going to a remote
> > controlled servo. The typical 1ms to 2ms
> > pulse with 1.5ms being centred. I've
> > done a few small projects but I've never
> > used Timer1 before. Looks like I sould
> > feed the signal in on GP4/T1G(not) to
> > be the gate. I plan on using a 4Mhz clock.
> > When using this input as a gate can it
> > still be read as an input? I'm trying to
> > figure out how to tell when to read the
> > counter and clear it for the next pulse.
> > Do I need to tie it to another input pin
> > and use that pin to tell if the pulse
> > has ended or not? Thanks, Max >
>


=====
My software has no bugs, only undocumented features.
__________________________________