Reply by John Tobias October 14, 20042004-10-14
Stephen,

Thanks for your input but I've done that before to disable the feedback loop
and it works fine with my program and my motor. But in my last attempt to
replace the potentiometer I've destroyed 2 of my servos for unknown reason
maybe I overheat the Iron to remove the soldered potentiometer in the
circuit to replace a resistors then damaged one of the parts of the circuit.
(My soldering experience is not good when it comes into a small parts of the
circuit so that's why I am little bit afraid to do it again in my 6 servos).

So I followed the instructions to these link
http://www.junun.org/MarkIII/Manual/Appendix.jsp#Servos
so no need to use soldering Iron to replace any parts of the circuit but I
have to calibrate the servo to stay in the middle when I feed 1.5ms. Then, I
could run the servo in either clockwise or counter clockwise if I will feed
it <1.5ms or >1.5ms pulse. But, my problem is I don't have experience,
proper education on hcs12, how to get the ms pulse...

Well, I'll do my effort to have a proper education, experience on the hcs12
controller. So I will not disturbing anybody especially some of the
conservatives in the list... :)

Thanks again,
-John

>From: "Stephen Trier" <>
>Reply-To:
>To:
>Subject: Re: [68HC12] Re: resolution for PWM driven servo on HCS12
>Date: Thu, 14 Oct 2004 12:14:39 -0400
>

_________________________________________________________________
Dont just search. Find. Check out the new MSN Search!
http://search.msn.click-url.com/go/onm00200636ave/direct/01/


Reply by Stephen Trier October 14, 20042004-10-14
John,

It sounds like you are using an RC servo in which the servo operation
has been defeated (by a modification) so that it can be used as a gear
motor for amateur robotics. Is that the case?

(An example of such a modification is
<URL: http://www.seattlerobotics.org/guide/servohack.html >.)

It might be worth noting that if the servo has been modified in such
a way, it's not a servo any more; it's just a gear motor. A servo, by
definition, is controlled by a feedback loop. The modification disables
that feedback loop.

Stephen

--
Stephen Trier
Technical Development Lab
Cleveland FES Center


Reply by Steve Auch-Schwelk October 13, 20042004-10-13

This question is more-or-less where this thread started. Read the
whole thread from the beginning again, in conjunction with the PWM
data sheet, and you should have the values that you need.

Steve

--- In , "John Tobias" <johnjohntobias@m...>
wrote:
> Mike,
>
> I don't know how to convert the 1.5ms and 0.9-2.2ms in the actual
value and
> which registers of PWM should I put that value to run in one
direction and
> other way around.
> Could you pls send me some instructions and how to get the relative
value of
> 1.5, 0.9-2.2ms pulse width.
>
> Thanks,
>
> John
>
> >From: "Mike" <mike@b...>
> >Reply-To:
> >To: <>
> >Subject: Re: [68HC12] Re: resolution for PWM driven servo on HCS12
> >Date: Tue, 12 Oct 2004 12:39:17 +0200
> >
>
> _________________________________________________________________
> Check out Election 2004 for up-to-date election news, plus voter
tools and
> more! http://special.msn.com/msn/election2004.armx >



Reply by Robert Rolf October 12, 20042004-10-12
This sounds like a homework project.
There are app notes and code example on using the PWM module
on the Freescale web site.
In other words, make SOME effort to find out what you
need to do before coming here.

Robert

John Tobias wrote:

> Mike,
>
> I don't know how to convert the 1.5ms and 0.9-2.2ms in the actual value and
> which registers of PWM should I put that value to run in one direction and
> other way around.
> Could you pls send me some instructions and how to get the relative value of
> 1.5, 0.9-2.2ms pulse width.
>
> Thanks,




Reply by Mike October 12, 20042004-10-12
John,
I don't use the PWM register to produce the servo signal. I use the Timer OC
feature because I think it is more simple.
The algorithm is very simple: I prescale the timer by 4 (on 8 mHz bus) so 1
ms is represented by 2000 counts.
on 1st OC set pin to high then set the next OC to the desired PWM: TC0+=
PWM (for pt0 pin...)
on 2nd OC set pin low then set next OC to TC0+@000-PWM (for the 20 ms
period)
then go back to the beginning.
Hope it helps
Mike

----- Original Message -----
From: "John Tobias" <>
To: <>
Sent: Tuesday, October 12, 2004 10:16 PM
Subject: Re: [68HC12] Re: resolution for PWM driven servo on HCS12 >
> Mike,
>
> I don't know how to convert the 1.5ms and 0.9-2.2ms in the actual value
and
> which registers of PWM should I put that value to run in one direction and
> other way around.
> Could you pls send me some instructions and how to get the relative value
of
> 1.5, 0.9-2.2ms pulse width.
>
> Thanks,
>
> John
>
> >From: "Mike" <>
> >Reply-To:
> >To: <>
> >Subject: Re: [68HC12] Re: resolution for PWM driven servo on HCS12
> >Date: Tue, 12 Oct 2004 12:39:17 +0200
> >
>
> _________________________________________________________________
> Check out Election 2004 for up-to-date election news, plus voter tools and
> more! http://special.msn.com/msn/election2004.armx > Yahoo! Groups Links >


Reply by John Tobias October 12, 20042004-10-12
Mike,

I don't know how to convert the 1.5ms and 0.9-2.2ms in the actual value and
which registers of PWM should I put that value to run in one direction and
other way around.
Could you pls send me some instructions and how to get the relative value of
1.5, 0.9-2.2ms pulse width.

Thanks,

John

>From: "Mike" <>
>Reply-To:
>To: <>
>Subject: Re: [68HC12] Re: resolution for PWM driven servo on HCS12
>Date: Tue, 12 Oct 2004 12:39:17 +0200
>

_________________________________________________________________
Check out Election 2004 for up-to-date election news, plus voter tools and
more! http://special.msn.com/msn/election2004.armx



Reply by Mike October 12, 20042004-10-12
RC servo works this way: The input is a PWM signal with period of 20 ms and
pulse width between 0.9-2.2 ms. At 1.5 ms pulse width the servo is centered,
0.9 ms it will go to one direction and 2.2 to the other. very simple and
efficient.
Mike

----- Original Message -----
From: "John Tobias" <>
To: <>
Sent: Tuesday, October 12, 2004 8:05 AM
Subject: Re: [68HC12] Re: resolution for PWM driven servo on HCS12 >
> How can you instruct the servo to run in two different direction (either
> clockwise or counter clockwise)?.
>
> >From: "Mike" <>
> >Reply-To:
> >To: <>
> >Subject: Re: [68HC12] Re: resolution for PWM driven servo on HCS12
> >Date: Tue, 12 Oct 2004 05:45:55 +0200
> >
>
> _________________________________________________________________
> Check out Election 2004 for up-to-date election news, plus voter tools and
> more! http://special.msn.com/msn/election2004.armx > Yahoo! Groups Links


Reply by John Tobias October 12, 20042004-10-12
How can you instruct the servo to run in two different direction (either
clockwise or counter clockwise)?.

>From: "Mike" <>
>Reply-To:
>To: <>
>Subject: Re: [68HC12] Re: resolution for PWM driven servo on HCS12
>Date: Tue, 12 Oct 2004 05:45:55 +0200
>

_________________________________________________________________
Check out Election 2004 for up-to-date election news, plus voter tools and
more! http://special.msn.com/msn/election2004.armx


Reply by Mike October 11, 20042004-10-11
Hi,
RC servo are very efficient and relatively low cost device and can be used
anywhere in applications where you need position control. The PWM driving
method is used even in MIL-STD servos. In Robotic applications RC servos are
very popular.
I brought the usage of the LM 4017 just to show how to save output pins.
Mike
----- Original Message -----
From: "SS" <>
To: <>
Sent: Tuesday, October 12, 2004 3:18 AM
Subject: Re: [68HC12] Re: resolution for PWM driven servo on HCS12 >
> Hi
>
> Could you maybe give an example of where to use 10 servos at a time - a
> model airplane maybe?
>
> ----- Original Message -----
> From: "Mike" <>
> To: <>
> Sent: Friday, October 08, 2004 8:59 PM
> Subject: Re: [68HC12] Re: resolution for PWM driven servo on HCS12 > >
> > Hi,
> > Jefferson Smith explained the usage of OC for driving RC Servos
perfectly.
> > To add to that, you can drive up to 10 servos from two OC output by
> chaining
> > the pulse and using a shift register chip like LM4017. One OC is set
for
> > the 20ms period and the other is the pulse chain.
> > Good luck
> > Mike
> > ----- Original Message -----
> > From: "Jefferson Smith" <>
> > To: <>
> > Sent: Saturday, October 09, 2004 1:12 AM
> > Subject: [68HC12] Re: resolution for PWM driven servo on HCS12
> >
> >
> > >
> > >
> > > Perhaps I could write a big picture of ECT (Enhanced Capture Timer
> > > module), having used it extensively for servos.
> > >
> > > Probably my biggest advantage to using the ECT is the number of servos
> > > increased. I don't use PWM for the servo because it would only drive
> > > one servo for every two PWM registers (practically). When I use an
> > > Output Compare (OC), I actually drive between 8 and 16 servos on a
> > > single output! The disadvantage is perhaps more code, and perhaps more
> > > processor time. Still, a worth-while advantage to use this hardware to
> > > accellerate and keep accurate. I don't even need an interrupt because
> > > the OC changes the output without waiting for software to service it.
> > >
> > > Following is an overall picture.
> > >
> > > Both Output Compare (OC) and Input Capture (IC) are based on the
> > > hardware time clock. That is, they look at the register TCNT to
> > > determine what "time" it is. TCNT is a 16-bit free-running counter
> > > with prescaler from the bus clock. That gives a steady count, not
> > > affected by any sort of software loop. Reading this value would give
> > > you a timestamp. You notice of course, this can't tell time of day
> > > because it would roll over to zero quite often during one day. An
> > > ideal use, however, is to time pulse widths withing a 20 mS cycle.
> > >
> > > The basic function of an OC is to tell the output exactly when it
> > > should change state. Example: Configure TC0 as an OC in toggle mode.
> > > Write TC0=0xe477. The hardware continously compares that value with
> > > TCNT. When TCNT arrives at 0xe477, it will immediately set the flag
> > > C0F and toggle the output pin PT0. Now to toggle again 500 uS from
> > > then, set TC0 = (0xe477 + 500). That assumes TCNT is scaled to 1 uS (1
> > > MHz). When TC0 compares with TCNT again, the output toggles again. The
> > > limitation the maximum time you could add because it's only a 16-bit
> > > timer.
> > >
> > > The basic function of IC is to capture when the state changed on the
> > > timer input pin. Say you had TC1 configured as IC, detecting rising
> > > edges. When bit C1F in TFLG1 is detected, read TC1 to find exactly
> > > what TCNT was when the change took place. Clear C1F and do something
> > > else while waiting. When C1F is detected again, read TC1 and subtract
> > > the previous captured value. That would tell the width of the pulse
> > > from an external source.
> > >
> > > To drive one servo with an Output Compare (OC), you could do something
> > > like below.
> > >
> > > variable Servo1 = desired servo pulse width (clock counts)
> > >
> > > ServoLoop:
> > > If C0F is not set, goto ServoLoop
> > > If PT0 is low, goto ServoLow
> > > configure output to go low
> > > TC0 = TC0 + Servo1
> > > goto ServoLoop
> > > ServoLow:
> > > configure output to go high
> > > TC0 = TC0 + (20000 - Servo1)
> > > goto ServoLoop
> > >
> > > Jeff Smith
> > > Robotronics, Inc.
> > >
> > > --- In , "Steve Auch-Schwelk" <steve_auch@y...>
> > > wrote:
> > > >
> > > >
> > > > Hi Mike,
> > > >
> > > > Thanks for your input.
> > > > I must admit that I have avoided the capture/compare functionality
> > > of
> > > > the hcs12 up until now becauase I don't fully understand it, and
> > > have
> > > > yet to find a consise functional description. I did read through
> > > the
> > > > provided block user guide, but found the descriptions too detailed,
> > > > and I could't see the "big picture". What can the capture/compare
> > > > timers do that a "normal" timer cannot? What would be an example of
> > > > an application?
> > > >
> > > > thanks
> > > >
> > > > Steve
> > > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > Yahoo! Groups Links
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> >
> >
> >
> >
> >
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> > Yahoo! Groups Links


Reply by SS October 11, 20042004-10-11
Hi

Could you maybe give an example of where to use 10 servos at a time - a
model airplane maybe?

----- Original Message -----
From: "Mike" <>
To: <>
Sent: Friday, October 08, 2004 8:59 PM
Subject: Re: [68HC12] Re: resolution for PWM driven servo on HCS12 >
> Hi,
> Jefferson Smith explained the usage of OC for driving RC Servos perfectly.
> To add to that, you can drive up to 10 servos from two OC output by
chaining
> the pulse and using a shift register chip like LM4017. One OC is set for
> the 20ms period and the other is the pulse chain.
> Good luck
> Mike
> ----- Original Message -----
> From: "Jefferson Smith" <>
> To: <>
> Sent: Saturday, October 09, 2004 1:12 AM
> Subject: [68HC12] Re: resolution for PWM driven servo on HCS12 > >
> >
> > Perhaps I could write a big picture of ECT (Enhanced Capture Timer
> > module), having used it extensively for servos.
> >
> > Probably my biggest advantage to using the ECT is the number of servos
> > increased. I don't use PWM for the servo because it would only drive
> > one servo for every two PWM registers (practically). When I use an
> > Output Compare (OC), I actually drive between 8 and 16 servos on a
> > single output! The disadvantage is perhaps more code, and perhaps more
> > processor time. Still, a worth-while advantage to use this hardware to
> > accellerate and keep accurate. I don't even need an interrupt because
> > the OC changes the output without waiting for software to service it.
> >
> > Following is an overall picture.
> >
> > Both Output Compare (OC) and Input Capture (IC) are based on the
> > hardware time clock. That is, they look at the register TCNT to
> > determine what "time" it is. TCNT is a 16-bit free-running counter
> > with prescaler from the bus clock. That gives a steady count, not
> > affected by any sort of software loop. Reading this value would give
> > you a timestamp. You notice of course, this can't tell time of day
> > because it would roll over to zero quite often during one day. An
> > ideal use, however, is to time pulse widths withing a 20 mS cycle.
> >
> > The basic function of an OC is to tell the output exactly when it
> > should change state. Example: Configure TC0 as an OC in toggle mode.
> > Write TC0=0xe477. The hardware continously compares that value with
> > TCNT. When TCNT arrives at 0xe477, it will immediately set the flag
> > C0F and toggle the output pin PT0. Now to toggle again 500 uS from
> > then, set TC0 = (0xe477 + 500). That assumes TCNT is scaled to 1 uS (1
> > MHz). When TC0 compares with TCNT again, the output toggles again. The
> > limitation the maximum time you could add because it's only a 16-bit
> > timer.
> >
> > The basic function of IC is to capture when the state changed on the
> > timer input pin. Say you had TC1 configured as IC, detecting rising
> > edges. When bit C1F in TFLG1 is detected, read TC1 to find exactly
> > what TCNT was when the change took place. Clear C1F and do something
> > else while waiting. When C1F is detected again, read TC1 and subtract
> > the previous captured value. That would tell the width of the pulse
> > from an external source.
> >
> > To drive one servo with an Output Compare (OC), you could do something
> > like below.
> >
> > variable Servo1 = desired servo pulse width (clock counts)
> >
> > ServoLoop:
> > If C0F is not set, goto ServoLoop
> > If PT0 is low, goto ServoLow
> > configure output to go low
> > TC0 = TC0 + Servo1
> > goto ServoLoop
> > ServoLow:
> > configure output to go high
> > TC0 = TC0 + (20000 - Servo1)
> > goto ServoLoop
> >
> > Jeff Smith
> > Robotronics, Inc.
> >
> > --- In , "Steve Auch-Schwelk" <steve_auch@y...>
> > wrote:
> > >
> > >
> > > Hi Mike,
> > >
> > > Thanks for your input.
> > > I must admit that I have avoided the capture/compare functionality
> > of
> > > the hcs12 up until now becauase I don't fully understand it, and
> > have
> > > yet to find a consise functional description. I did read through
> > the
> > > provided block user guide, but found the descriptions too detailed,
> > > and I could't see the "big picture". What can the capture/compare
> > > timers do that a "normal" timer cannot? What would be an example of
> > > an application?
> > >
> > > thanks
> > >
> > > Steve
> > >
> >
> >
> >
> >
> >
> >
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> >
> >
> >
> Yahoo! Groups Links >
>