Rusty on MOSFET control stuff (Seattle Robotics would be a good resource here again, http://www.seattlerobotics.org/ and look at links, those folks love H-bridges ) One post in their mailing list suggested the Zetex ZHB6718 H-Bridge (it's a PNP/NPN bridge, however.) I need more info (Might be a good way to do one project.) One quote from there mentions making sure you diode protect MOSFETs more than bi-polar transistors, as back EMF can peak pretty high (>>2x supply voltage.) Also suggested: .1 uF caps across the motors to damp transients (or even 3, 1 Hot-neutral, 1 hot-motor's case, 1 neutral-motor's case, to further reduce RF noise.) You might look at the SGS-Thompson L298. The "Mobile Robot" book is well-recommended, I need to buy one myself On protection from shorts, it's hard (from what I've seen of Sumo robots at least, where the startup currents "resemble" short circuit currents; You could do thermal limiting I suppose? Others here are better at this than I I'll suggest one trick in your code: I'd think about having a "velocity" number in the code, i.e. you have One and only One place you look to see what the desired speed of the train is; You need a second number for what the current speed setting is, as well. (Two 8-bit numbers should do.) If you get a "Go Forward", set the Desired speed to Full Speed Ahead, and increment the Current velocity every quarter second or so until they match; if a "Go Backwards", set Desired Speed to slower or to Stop, and slowly decrement the Current Velocity. (Maybe one Go Forward means speed up until you reach full speed, the first Go Back means slow down to a stop, a second Go Back would mean reverse once you've stopped.) And only enable one pair of MOSFETs if the -current velocity- number's "positive", or the other if it's "negative". And energize the MOSFETs to a proportional time to your "current velocity" number. Pretty simple then to not short circuit, if you debug the code somewhat, you initialize that number on startup/watchdog, and you only increment/decrement the "Current" number every 1/4 second or so (and watch it more often to control the PWM) You get inertia as a side benefit Happy to help if you want more, or to quiet down if I'm confusing Mark James Cameron wrote: > > I wish to have bi-directional PWM control over a small toy 9V DC motor, > from a PIC 12C509, so I guess I would set up a H-Bridge using four logic > level MOSFETs, but I have a few newbie questions; > > a) can I use MOSFETs of the same polarity top and bottom of the bridge? > > b) are there any simple tricks I can use to reduce damage in case the > prototype code manages to switch MOSFETs so as to short the supply? > > (This is another Technical Aid to the Disabled project. For a disabled > child so they can run their toy railroad. The control unit will receive > a UHF remote control signal as three TTL inputs, a valid transmission > line and two contact closure signals. One switch will mean go forward, > the other switch go backward, but I don't really want to use relays to > do it; the effect would be far too abrupt.) > > -- > James Cameron (cameron@stl.dec.com) > Digital Equipment Corporation (Australia) Pty. Ltd. A.C.N. 000 446 800