Page 1 of 1
6522 Shift Register & Servos
Posted: Wed Jul 29, 2015 6:07 pm
by apatco
Has anyone on this board tried using the 6522 Shift register to control a servo?
Re: 6522 Shift Register & Servos
Posted: Wed Jul 29, 2015 7:42 pm
by GARTHWILSON
I have not, but it's an interesting idea. I've used PA or PB bits to control model-aircraft servos. The pulse width they need is 0.5 to 2.5ms IIRC, to span their range. Duty cycle didn't matter. It was the width of the pulse that mattered, not the space between pulses.
Re: 6522 Shift Register & Servos
Posted: Wed Jul 29, 2015 7:44 pm
by KC9UDX
Technically, yes: The speaker in a PET, assuming you mean servo motor, not a whole servo loop.
Re: 6522 Shift Register & Servos
Posted: Wed Jul 29, 2015 11:12 pm
by Dr Jefyll
What is it you have in mind, Gord -- a project of some kind?
I've used a VIA shift register to interface to a printer that used servos, but the shift register wasn't part of the servo
loop. Not what you were contemplating, I suspect...
The VIA shift register can be used as an unusual and very simple, 9-level DAC. Garth explains this
here (about 70% of the way down the page. Look for, "9-level D/A converter").
For normal digital I/O, the shift register is comparable to a parallel interface. AFAIK the only real difference is increased latency. The SR can be clocked at 50% of the Phase2 rate -- IOW 16 cycles per byte.
Re: 6522 Shift Register & Servos
Posted: Thu Jul 30, 2015 12:01 am
by floobydust
The Signetics 543 Servo Amplifier was based on a 1.5ms pulse width for center position and with proper 5K feedback potentiometer had a 100 degree rotation from 1ms to 2ms. The data sheet also states the positioning pulse occurs at 16ms intervals, or about 60 times per second.
Re: 6522 Shift Register & Servos
Posted: Thu Jul 30, 2015 2:41 am
by apatco
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?
Re: 6522 Shift Register & Servos
Posted: Thu Jul 30, 2015 3:09 am
by GARTHWILSON
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.
Re: 6522 Shift Register & Servos
Posted: Fri Jul 31, 2015 2:01 am
by JimDrew
The official servo servo pulse specification (derived from the PPM signal) is 750us to 2250us. However, most hobby servos only handle 850us to 2150us. The frame rate is typically 22ms, but can be as low as 10ms for analog servos, and special servos (typically digital) handle as low as 3ms frames. You generally can not have frames longer than about 35ms or the servo stops updating the position.