To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.roboticsOpen lugnet.robotics in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / 6476
6475  |  6477
Subject: 
Re: r/c servos and firmware
Newsgroups: 
lugnet.robotics
Date: 
Fri, 20 Aug 1999 23:23:40 GMT
Viewed: 
897 times
  
Ralph Hempel <rhempel@bmts.com> wrote:
What about this...

1. "Wedge" a custom OC1A interrupt service routine into the existing
   slot - remember TSR programming on PCs?
2. Every 3 times (3 msec) turn on a motor output.
3. The next time, set OC1B to expire at a sub 1msec interval.
4. When OC1B interrupts, turn off the motor.

Total elapsed time is about 5 msec, multiply by three for 3 motors
and you have 15 msec, and about 60Hz!

Almost exactly how I'd do it.

The problem is what if OCIB must be set to a small value, and the FRT has
already passed this value when the OCIA handler sets up OCIB in step 3?

This problem is solvable.

If the total interval is closer to 1 ms, use OCIA to setup OCIB to turn on
the motor a short time before the next OCIA; two OCIA interrupts later,
turn off the motor output.

If the sub 1ms interval is closer to 2 ms, use OCIA to turn on the motor,
one OCIA later, setup OCIB to turn off the motor output.

This solution is not perfect, but will at least behave reasonably in the
case I mentioned.

If you replace the OCIA handler in the ROM, you will break a number of
other ROM features (you are using the ROM, aren't you?); fortunately, the
motor control code is at the beginning of OCIA, and you can roll your own
motor controller and jump into the default OCIA to do the remaining stuff.
Good motor control code was posted to some list a while back, so you can
improve motor control at the same time as you add servo control if you
like.  If you do not replace the ROM OCIA handler but simply invoke it from
your OCIA replacement handler, be careful about the fact that the ROM OCIA
handler unconditionally sets the motor state according to the contents of
efce.  In either case, be sure to check out the disasm/pseudocode for the
default OCIA handler, 36ba.

-Kekoa



Message has 1 Reply:
  RE: r/c servos and firmware
 
(...) Whew! I'm glad I got that much right :-) (...) We could check OC1B and if it's "close" just turn off the motor...as far as the long timer goes, OC1A should always force the output off...on the other hand, the OC1B could be set NO GREATER than (...) (25 years ago, 21-Aug-99, to lugnet.robotics)

Message is in Reply To:
  RE: r/c servos and firmware
 
(...) OhOh, I've piqued my own interest. I've looked at the H8 hardware manual and the RCX internals. The OC1A triggers every msec, except the stupid routine clears the Free Running Timer every time!!!! So much for using the OC1B, maybe. The minimal (...) (25 years ago, 20-Aug-99, to lugnet.robotics)

4 Messages in This Thread:

Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    
Active threads in Robotics

 
Verified and Trusted Team of Hackers
9 hours ago
Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR