I'd spoken with a software engineer here who had mentioned that the timer pulse generation and measurement on non-timer pins was probably based on interrupt driven software programming using those pins. Its a technique called "bit-banging" in which a port pin is made to act like a timer pin through software, depending on the speed of the processor to generate or read pulses. It works, though can be a bit complicated to program in. It would simply require enough processor cycles to generate or read the pulses. The Mega128 probably has 16 MIPs to work with using a 16 MHz clock, the Servopod has 40 MIPs to work with if developing in DSP56F8xx assembly. Should be doable if there is a programmer available to generate the interrupt code needed to output and input pulses on GPIO pins as well as Timer pins.
As an alternative, perhaps using 2 IsoPods would be a solution. They are priced at $99 each, so would be the same price as a ServoPod, but you would then have 2 x 14 = 28 timer pins available. You would need some software to have the 2 communicate to each other. And I believe their size is such that the 2 boards sized 1.2" by 3" each should fit in the space occupied by the HiTec board. We have RC-Servo adapter boards for these, but that might go beyond the depth of the enclosure on the Robonova. Used as is, the signal wire from each servo could be routed to the appropriate timer pin, while the power lines for the servo are routed to a power board.
Sending a servo pulse on a timer pin is shown on our Download page :
http://www.newmicros.com/store/product_ ... nload.html on page 6 of the IO Glossary. The example is :
An RC servo requires a 50 Hz (20 msec) PWM waveform with an on time varying from 1 msec to 2 msec, on output pin PHASEA0 (TA0). We wish to control this with an integer parameter from 0 to 100.
The desired range of on-time corresponds to a duty cycle varying from 5% to 10%. 5% of 65535 decimal is 3277, and 10% is 6554. We need to add a fraction of 3277 to the base value of 3277. This is easily accomplished with the */ scaling operator:
DECIMAL
: SET-RC-SERVO ( n -- )
3277 100 */ ( scale 0-100 to 0-3277 )
3277 + ( add base value of 3277 )
TA0 PWM-OUT ( output that duty cycle, 5-10% of 65535 )
;
50000 TA0 PWM-PERIOD ( set period to 20 msec )
TA0 ACTIVE-HIGH
50 SET-RC-SERVO ( output 50% of range, 1.5 msec pulse width )
Similarly, reading a pulse can be accomplished as shown in later, or from one of our code examples for reading a sonar further down the download page :
: SRF05
TA0 OFF TA0 ON TA0 OFF ( PULSE OUT
TA0 ON ( MAKE HIGH TO BE INPUT
TA0 SET-PWM-IN ( READY TO READ PULSE WIDTH
BEGIN
CHK-PWM-IN ( CHK PULSE
?DUP ( DUP IF NON ZERO
UNTIL . ( STOP WAITING WHEN NON ZERO, PRINT
;
Accelerometers and Gyros usually have a variable voltage that could be read by the analog to digital pins available. Simple lines like
ADC0 ANALOGIN .
would provide the current reading of a device attached to the ADC0 pin.
Finally, to get 2 IsoPods to talk to each other, there is a CAN example on the Download page, that I believe was used in an interesting robot. It had 6 sections that each had a Pod board in, which drove a pair of motors for that given section.
As another example, there is code showing driving an 18 servo hexapod robot with inverse kinematics being calculated for each leg, to have appropriate placing of the robots foot depending on which direction it is being directed to travel. It does make use of PWM outputs, so would not read in pulses.
David Peterson
www.newmicros.com