Driving two motors with L293D using only two Picaxe outputs and tri-stating
If you are running out of input/output pins of your Picaxe here's something that might help you: Picaxe's configurable input/output pins can be used in three different states so instead of two output states (high/low) you can get three states (high/low/"tri-state" or hi-z). The third state is set by configuring the pin you are using as an input. When configured as an input the pin will have high impedance. That state is called "tri-state" or hi-z.
Having a high impedance means that the pin is "invisible" to the rest of the circuit or putting it another way around: High impedance pin does not affect the rest of the circuit at all. To use hi-z state of a pin you have to build a circuit that makes a difference between the "visible" (output) and "invisible" (input) states of the pin. After a couple of days playing with different schematics here's what I came up with:
Here's the idea of the upper part of the circuit above (Picaxe output 1, Q1, Q2 and L293D's enable 1, input 1 and input 2):
The lower part works just like the upper one.
Here's a picture of the whole thing on breadboard and 28x1 is driving it:
And a close up on breadboard:
There's also embedded video of the thing working at the top of the page if you happened to miss it. I hope this was helpful. Comments and corrections are welcome :-)
The code running motors on the video is this (also attached):
Update Feb 24 2010: Schematic was missing pull down resistors. Now the schematic above should be ok. The reason why it was working on my tests with 28x1 was because I was using axe020 project board and it has pull down resistors on digital inputs (port c). It got me a bit worried when I first tried the circuit on 08 project board and it wasn't working. But it's running just fine now.
Update Feb 24 2010 (part 2): Added another video just for fun. This works with 08M too. I attached code for 08M too although it's almost identical to 28x1 code.