Sign in

username:

password:



Not a member?

Search hc11



Search tips

Subscribe to hc11



Ads

Discussion Groups

Discussion Groups | M68HC11 | using MicroCore11 instead of Remote Control to Scorpion(motor controller)

Technical discussions about Freescale Microcontrollers: M68HC11. (Freescale Semiconductor is a Subsidiary of Motorola).

using MicroCore11 instead of Remote Control to Scorpion(motor controller) - senglee88 - Dec 1 9:22:00 2004


Recently i am using MicroCore11(68HC11) instead of remote control to
generate PWM(pulse wide modulation) to Scorpion(a motor controller
from robot-power) to control the motors. However i am unable to
generate the correct pulse (but instead i have square waves),and the
motor can't move.

When i use function generator to generate pulse to the Scorpion, the
motor can move.

I am no using assemble language.

Any kind soul can give advice or relevant program to use.

Thanks :)

ivy





(You need to be a member of hc11 -- send a blank email to hc11-subscribe@yahoogroups.com )


Re: using MicroCore11 instead of Remote Control to Scorpion(motor controller) - Jean St-Pierre - Dec 3 23:42:00 2004

This is a recall of a previous answer to a similar question, I hope it can
help.

Here it goes:
I bet you are trying to control a Hobby type servo motor's position.
It is relatively easy to generate pulses with the HC11 . Please find
below the assembly routine to have OC2, OC3, OC4 and OC5 generate pulses
continuously. You run the routine once, and the OCx will take care of
the pulse generation indefinitely. If you want a pulse duration to change,
simply change the TOCx value.
This is great ! Your MPU could spend more time on your control
algorithm.
The following duration table below also show the TOCx values for servo
position from -90 degrees to + 90 degrees, according to my experience. But
this can change with different servo manufacturers.

Serinit
ldx #REGBASE ; X points to the registers base (= $1000 ?)
ldaa #%10101010 ;OMx =1, OLx=0
staa TCTL1,x ;Initiate TCTL1 to clear OC2, OC3, OC4, OC5 pins on succesfull
compare (Pink Book p10-31)
clr TCTL2,x ;Clear TCTL2
ldaa #%01111000 ;OC1M6..OC1M3=1
staa OC1M,x ;Initiate mask OC1Mx to enable portA pins 6 to 3. (pink Book
p10-33)
staa OC1D,x ;Initiate data OC1Dx
ldd #$A00 ;Center position of each servos (Futaba s148,s132).
std TOC2,x ; servo S1 on Botboard +
std TOC3,x ; S2
std TOC4,x ; S3
std TOC5,x ; S4

TOCx duration table with 8Mhz cristal, E = 2Mhz:
$1200= 4608, -90 degrees, T= 2.304ms
$E00 = 3584, -45 degrees, T= 1.792ms
$A00 = 2560, center position, T= 1.28ms
$600 = 1536, +45 degrees, T= 0.768ms
$200 = 512, +90 degrees, T= 0.256ms

The pulse period is equal to the free running counter roll over period =
65,536 x 0,5 usec = 32,765 usec or 32.7 msec. This should be short enough to
keep your servo awakened.
If you want to connect your Radio Control receiver to the HC11, it is
possible to use the Input Capture channels to measure the incoming pulse
width. I use this to move my robot when it gets stuck in a corner. This is
done using interrupt capability of the IC, but this is a different story.
if you want to know how, e-mail personaly. No interrupt service routines are
needed to control servos with Output Compare channels.

I hope this helps

Kind regards

Jean ----- Original Message -----
From: "senglee88" <>
To: <>
Sent: Wednesday, December 01, 2004 9:22 AM
Subject: [m68HC11] using MicroCore11 instead of Remote Control to
Scorpion(motor controller) >
>
> Recently i am using MicroCore11(68HC11) instead of remote control to
> generate PWM(pulse wide modulation) to Scorpion(a motor controller
> from robot-power) to control the motors. However i am unable to
> generate the correct pulse (but instead i have square waves),and the
> motor can't move.
>
> When i use function generator to generate pulse to the Scorpion, the
> motor can move.
>
> I am no using assemble language.
>
> Any kind soul can give advice or relevant program to use.
>
> Thanks :)
>
> ivy >
> Yahoo! Groups Links





(You need to be a member of hc11 -- send a blank email to hc11-subscribe@yahoogroups.com )