|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? If you use N-channel MOSFETs for the top of the bridge, you will need to have a way of switching their gate voltage above the positive rail. This is not too hard if you use optoes, but it's a little tricky. |a) 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? I know you said you'd like to avoid relays, but for your appli- cation I think it might be best to use one MOSFET to control speed and a relay to control direction. You may avoid abrupt changes of direction by only switching the relay when the MOS- fet duty cycle is at zero. For truly optimal results, you would want to measure the back EMF from the motor and regulate the train's speed based upon that, but that could be somewhat tricky and most likely isn't needed for this application. The one feature that you might want to add, though, would be a peak-current sensor: the peak current at the start of each PWM cycle will correlate pretty strongly with the speed of the locomotive (max==stopped). Using such a device could help avoid overheating the motor if it stalls.