Demultiplexer/Decoder question

M

Mark Haase

Guest
Hey all--

I know more about software than hardware, but I'm designing a
demonstration application for the JStamp, an embedded java processor.
The application is a quad servo controller. (I'm referring to the hobby
servo's that are used in robotics and modeling.) The JStamp has two
dedicated circuits for generating PWM signals continually varying duty
cycles.

My plan is to use one of these to drive 4 servos (and theoretically more
than that) at once. Each servo requires a +5V pulse train with a 20 ms
period and a duty cycle ranging from 5-10%. Therefore, I figure I can
output 4 pulses every 20 ms instead of just one, and simply direct one
of each of the pulses to each of the 4 servos in turn.

Now like I said, I'm not an EE, so I don't know exactly how to do this.
My sense is that I need a demultiplexer. I looked at the data sheet for
one that is stocked in my school's lab, and it seems to do what I want,
except that it uses active low outputs. So I suppose I would need to use
an inverter to get my signal flipped back around the way I need it. Are
there demultiplexer chips which preserve the polarity of the original
signal? Fewer ICs is better, I wanted to build this on a real small
protoboard.

Also, the other issue is how to select an output line from the 4
available on the demux. I could use two output pins from the JStamp to
select this line manually, but doing this in software seems cumbersome.
I think a cleaner idea would be to use the PWM output to drive a
counter. On each negative edge, the counter would increment, and the
counter's output would be configured as the address select for the
demux. The counter would reset when it got to 4. Is this a clean way to
do this?

I'm trying to take propagation times into account to decide if I'm
making a blunder here. The demux I'm looking at (an LS155, btw)
propagates signals in anywhere from 30-50 ns...definitely fast enough.
But I'm worried that if I have to wire up an inverter on my breadboard,
that is going to slow things down into the range of a few microseconds,
and I'm don't have the experience to know if that is too much delay.

--
|\/| /| |2 |<
mehaase(at)sas(dot)upenn(dot)edu
 
On Wed, 09 Feb 2005 16:09:21 -0500, Mark Haase <mehaase@earthlink.net>
wrote:

Hey all--

I know more about software than hardware, but I'm designing a
demonstration application for the JStamp, an embedded java processor.
The application is a quad servo controller. (I'm referring to the hobby
servo's that are used in robotics and modeling.) The JStamp has two
dedicated circuits for generating PWM signals continually varying duty
cycles.

My plan is to use one of these to drive 4 servos (and theoretically more
than that) at once. Each servo requires a +5V pulse train with a 20 ms
period and a duty cycle ranging from 5-10%. Therefore, I figure I can
output 4 pulses every 20 ms instead of just one, and simply direct one
of each of the pulses to each of the 4 servos in turn.

Now like I said, I'm not an EE, so I don't know exactly how to do this.
My sense is that I need a demultiplexer. I looked at the data sheet for
one that is stocked in my school's lab, and it seems to do what I want,
except that it uses active low outputs. So I suppose I would need to use
an inverter to get my signal flipped back around the way I need it. Are
there demultiplexer chips which preserve the polarity of the original
signal? Fewer ICs is better, I wanted to build this on a real small
protoboard.

Also, the other issue is how to select an output line from the 4
available on the demux. I could use two output pins from the JStamp to
select this line manually, but doing this in software seems cumbersome.
I think a cleaner idea would be to use the PWM output to drive a
counter. On each negative edge, the counter would increment, and the
counter's output would be configured as the address select for the
demux. The counter would reset when it got to 4. Is this a clean way to
do this?

I'm trying to take propagation times into account to decide if I'm
making a blunder here. The demux I'm looking at (an LS155, btw)
propagates signals in anywhere from 30-50 ns...definitely fast enough.
But I'm worried that if I have to wire up an inverter on my breadboard,
that is going to slow things down into the range of a few microseconds,
and I'm don't have the experience to know if that is too much delay.
---
From your explanation of the 5% duty cycle servo pulse it seems it
should look something like this:


-->| |<--1ms
|<----------------20ms------------------>|
_ _
TMIN__| |______________________________________| |_____


and the 10% pulse, something like this:

-->| |<--2ms
|<----------------20ms------------------>|
___ ___
TMAX-_| |____________________________________| |_____



Looking at worst case for the demux, (four, 2ms pulses) if we space
them 5ms apart we'll get this:

| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |

___ ___
T1 _| |____________________________________| |________________

___ ___
T2 __________| |_____________________________________| |_____

___
T3 _____________________| |_____________________________________

___
T4 ________________________________| |___________________________


Which means that each address change needs to be accompanied by a
pulse into the input of the demux which will be steered to the output
corresponding to that address. That, in turn, means that you have to
have a pulse source which can output a pulse with a width of from one
to two milliseconds, depending on which demux address is selected.

In order to keep from having to invert the outputs, I'd use a '238,
and that way all it seems you'd have to do is use two IOs from your
ľC for the address inputs, tie two of the 238's ENABLEs low and strobe
the other one with your PWM signal for the length of time that you
wanted that channel's pulse to be high. Serendipetously, if you use
the 238 you can control up to 8 channels with that single chip. Also,
it would probably be a pretty good idea if you kept the PWM output low
for a little while (a microsecond or so?) after you asserted a new
address, just to make sure you knew when that edge was going high and
to keep from maybe confusing the servo.


Vcc HC238
| +-------+
+--|A2 |
A1>-------|A1 |
A0>-------|A0 |
| |
PWM-------|E3 Y3|---->CH4
+-O|E2- Y2|---->CH3
| | Y1|---->CH2
+-O|E1- Y0|---->CH1
| +-------+
GND










--
John Fields
 
Mark Haase wrote:
Hey all--



My plan is to use one of these to drive 4 servos (and theoretically more
than that) at once. Each servo requires a +5V pulse train with a 20 ms
period and a duty cycle ranging from 5-10%. Therefore, I figure I can
output 4 pulses every 20 ms instead of just one, and simply direct one
of each of the pulses to each of the 4 servos in turn.

Now like I said, I'm not an EE, so I don't know exactly how to do this.
My sense is that I need a demultiplexer. I looked at the data sheet for
one that is stocked in my school's lab, and it seems to do what I want,
except that it uses active low outputs. So I suppose I would need to use
an inverter to get my signal flipped back around the way I need it. Are
there demultiplexer chips which preserve the polarity of the original
signal? Fewer ICs is better, I wanted to build this on a real small
protoboard.
You may not want to use the high output of the circuit to drive the
servos, your output device may not be able to provide the current your
servos want without loading the output signal.

Active low is there for a reason, to let the output device sink instead
of source. Connect the voltage source to your servo, then let the output
device go low to start motion.
--
Fins
 
On Wed, 09 Feb 2005 16:09:21 -0500, Mark Haase <mehaase@earthlink.net>
wrote:


Also, the other issue is how to select an output line from the 4
available on the demux. I could use two output pins from the JStamp to
select this line manually, but doing this in software seems cumbersome.
I think a cleaner idea would be to use the PWM output to drive a
counter. On each negative edge, the counter would increment, and the
counter's output would be configured as the address select for the
demux. The counter would reset when it got to 4. Is this a clean way to
do this?
---
There are two problems there, as I see it. The first is that you've
got to use an extra chip, and the second is that if the counter ever
gets out of sync you'd be in real trouble, with no way to get back in
sync if the servos are running .

If the thing is going to run continuously, ISTM that all you have to
do is increment a register in the micro, (once for each loop) then
output the two LSBs to use to drive the muxer's address lines and then
the PWM signal which corresponds to that count.
---

--
John Fields
 

Welcome to EDABoard.com

Sponsor

Back
Top