apatco wrote:
Thanks for the replies...
I was considering using the Shift Register to control the servo motors on a robotic arm. Not sure if this would work, but thought I would give it a try. Will I have enough control over the pulse width?
It's still not clear what kind of servos you're talking about. Are they the model-aircraft type, or something quite different? If it's the former, how much resolution do you want on the timing? It might be good to use the SR in one of the one-shot modes, and set the latch value every time you want to change the pulse width.
Using the VIA's synchronous-serial port as a 9-level D/A converter is adequate for an analog output for something like DTMF or like toy-quality voice, but may not be nearly good enough for what you're talking about, if indeed you even wanted an analog voltage to work with. OTOH, if you want to send bytes out the port, it's an easy way to get
hundreds of bits of I/O while taking up only two or three pins of the VIA, as shown in the
6502 Primer's
potpourri page, particularly at the section titled "
Using the 6522's shift register for tons of output bits."
But if you want a given length of pulses on
lots of output pins (for lots of servos) and can't afford to have the computer doing nothing else useful while its counting out a pulse time, it might work well to do each pulse as a task in a multitasking arrangement with no multitasking OS. Three ways to do this are described in the 6502-oriented article, "
Simple methods for multitasking without a multitasking OS, for systems that lack the resources to implement a multitasking OS, or where hard realtime requirements would rule one out anyway." If you don't need pulses timed simultaneously, you might be able to have a single task take care of all of them, and it would know from its state variable which output bit (if any) it's supposed to be working on at the moment.