Continuing the "practicum," here's the scope output from the code in post #31 driving the circuit in post #29 (using 2x NEC2501, 2x 1K input divider, and 510R pull-downs on the outputs):
Hopefully all solutions work on the Stamp as well as the Prop. I listed this challenge in the Picaxe forum to draw off their knowledge base, since the Picaxe is somewhat Stamp-like.
This circuit can drive 2 analog servos independently.
One assumes the 1mS to 2mS PWM pulses are sequentially generated in software.
1. The lower servo is pulled high directly by the Prop Pin for the required PWM time. Then the Pin is set to input.
2. The upper servo is pulled high when the Prop Pin is pulled LOW for the required PWM time. Then the Pin is set to input.
Morphing #36, and tristate-port ideas, it can be done in ONE part - a HEF4017
Connect 4017,Qn to 4017.CLK to Prop IO and then the Prop can self-sync. Less dead time than #36, and no passives.
Prop Generates a CLK edge (which briefly overdrives the feeble 4017 Qn drive), then tri-states the IO pin to check if Qn is High yet.
Once it reads-back a Hi, it has sync.
Duane C. Johnson's post #9 provided the first schematic and a descrete 4 component solution.
jmg's #2 post suggested using a PUMD9 part number (referenced in post #28), but still no schematic. The PUMD9 from this location... www.nxp.com/documents/data_sheet/PEMD9_PUMD9.pdf
...has a descrete component count of 6 and as he said still would require an inverter for one of the servo channels.
Phil Pilgrim (PhiPi)'s post #29 although technically I said no IC's other than the processor, this soluition would require 6 descrete componets, but offers wider voltage operating range and a cleaner output signal
...And since the rules weren't stated clearly on an IC counting as a single component, jmg pulls it off with using a single 4017 decade/divider IC.
Note: I have not had a chance to test the solutions here, but I will leave that to the scrutiny of our peers.
jmg inspired me to order some 4017s, but I haven't had time to try them out.
I had an offbeat relay/plywood level concept using a center-tapped transformer which, coupled with two diodes, would yield two different pulses, but I needed an isolation transformer and $50 was too rich for my blood.
Comments
-Phil
-Phil
{{ ┌───────────────────────┐ 3.3v ┬─┬─┐│__ Q0├─   └┤MR Q1├─ ┌─┻─┻─┳┤DSA 74HC164 Q2├─ └─┐ └┤DSB Q3├─ PIN ────┻───┤CP Q4├─ │ Q5├─ │ Q6├─ │ Q7├─ └───────────────────────┘ C = 0.01µF vert. R = 270KΩ horiz. R = 10KΩ }} CON PIN = 0 PUB SetServos(s1, s2, s3, s4, s5, s6, s7, s8) | tmp {{ Parameters are times in uSec }} OUTA[PIN]~ DIRA[PIN]~~ s1 #>= 500 s2 #>= 500 s3 #>= 500 s4 #>= 500 s5 #>= 500 s6 #>= 500 s7 #>= 500 s8 #>= 500 s1 #<= 2200 s2 #<= 2200 s3 #<= 2200 s4 #<= 2200 s5 #<= 2200 s6 #<= 2200 s7 #<= 2200 s8 #<= 2200 tmp := clkfreq / 1_000_000 ' Microsecond s1 *= tmp s2 *= tmp s3 *= tmp s4 *= tmp s5 *= tmp s6 *= tmp s7 *= tmp s8 *= tmp tmp = cnt+(clkfreq/200) ' 5 milliseconds to charge up the cap and allow a logic high into the serial input. OUTA[PIN]~~ waitcnt(tmp) OUTA[PIN]~ tmp = cnt+s1 OUTA[PIN]~~ ' Load the first bit into the register, and begin timing for first servo waitcnt(tmp) OUTA[PIN]~ tmp = cnt+s2 OUTA[PIN]~~ ' Begin timing for second servo waitcnt(tmp) OUTA[PIN]~ tmp = cnt+s3 OUTA[PIN]~~ ' Begin timing for ... waitcnt(tmp) OUTA[PIN]~ tmp = cnt+s4 OUTA[PIN]~~ ' Begin timing for ... waitcnt(tmp) OUTA[PIN]~ tmp = cnt+s5 OUTA[PIN]~~ ' Begin timing for ... waitcnt(tmp) OUTA[PIN]~ tmp = cnt+s6 OUTA[PIN]~~ ' Begin timing for ... waitcnt(tmp) OUTA[PIN]~ tmp = cnt+s7 OUTA[PIN]~~ ' Begin timing for ... waitcnt(tmp) OUTA[PIN]~ tmp = cnt+s8 OUTA[PIN]~~ ' Begin timing for ... waitcnt(tmp) OUTA[PIN]~http://www.picaxeforum.co.uk/showthread.php?22991-Challenge-2-Servos-on-One-Pin
Total cost of additional parts might play a factor. Is that IC costing less than the transistors and resistors?
Connect 4017,Qn to 4017.CLK to Prop IO and then the Prop can self-sync. Less dead time than #36, and no passives.
Prop Generates a CLK edge (which briefly overdrives the feeble 4017 Qn drive), then tri-states the IO pin to check if Qn is High yet.
Once it reads-back a Hi, it has sync.
Is the court (Beau) pleased with this application?
Duane C. Johnson's post #9 provided the first schematic and a descrete 4 component solution.
jmg's #2 post suggested using a PUMD9 part number (referenced in post #28), but still no schematic. The PUMD9 from this location...
www.nxp.com/documents/data_sheet/PEMD9_PUMD9.pdf
...has a descrete component count of 6 and as he said still would require an inverter for one of the servo channels.
Phil Pilgrim (PhiPi)'s post #29 although technically I said no IC's other than the processor, this soluition would require 6 descrete componets, but offers wider voltage operating range and a cleaner output signal
...And since the rules weren't stated clearly on an IC counting as a single component, jmg pulls it off with using a single 4017 decade/divider IC.
Note: I have not had a chance to test the solutions here, but I will leave that to the scrutiny of our peers.
So, with that in mind, the Winners are:
Duane C. Johnson
jmg
Phil Pilgrim (PhiPi)
Thanks for playing!!!
jmg inspired me to order some 4017s, but I haven't had time to try them out.
I had an offbeat relay/plywood level concept using a center-tapped transformer which, coupled with two diodes, would yield two different pulses, but I needed an isolation transformer and $50 was too rich for my blood.