To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.legosOpen lugnet.robotics.rcx.legos in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / legOS / 2193
2192  |  2194
Subject: 
Driving R/C servos and interrupt latencies
Newsgroups: 
lugnet.robotics.rcx.legos
Date: 
Sun, 6 Jan 2002 00:34:09 GMT
Viewed: 
1724 times
  
Hi,
I finally succeeded in driving up to 7 R/C servos from the RCX using a shift
register and a re-triggerable monostable (for synchronization) all driven
from the FTOA output line (senor B, AC coupled into a transistor) .
This involved switching the legos systime handler to run from
OCRB to free up OCRA for use by the servohandler,
changing  the systime handler to add 500 to OCRB instead of
clearing the FRC using the OCLRA bit, and  clearing the OCFB flag using a
read-modify-write since the bclr instruction does not work on these
registers. By never clearing the FRC, OCRA and OCRB can be used as
completely independent timers. Unfortunately currently this prevents use of
servos and sensor B at the same time. I am going to look to see if
modifying
the sensor handling code so that the ADC conversions are triggered by the
servo handler can solve this problem.

I also tried driving the shift register from the motor B outputs, which has
the advantage of not interfering with Sensor B. However, interrupt latency
meant that driving the output directly from software generated too much
jitter. This was improved when I enabled interrupts in the systime handler
just after the system time had been updated. Unfortunately, the RCX would
lock up after a few minutes when I did this, so there must be at least one
unprotected critical section in the systime handler somewhere. If interrupts
could be enabled early on in the systimer, sensor and lnp handlers, it
should be possible to get adequate timing by having the servo interrupt fire
a few microseconds early and looping in the handler with interrupts
disabled,
waiting for the FRC to reach the desired value before flipping the output
bit.

In the process of getting this going I discovered that the pin out diagram
for FP-64A on page 16 of the H8/300 hardware manual  h33th014d2.pdf) is
wrong. The correct pins are listed in Table 1-2 for the FP-64A.


Regards,
Kit



1 Message in This Thread:

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

Custom Search

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