Bob Axtell wrote: > Tony threw out his computer and everything engineering. He now gives > flying lessons. Yeah, I think I heard about that.. Shame nobody archived his site beforehand though - some of the stuff on there was pretty useful (like the comparison code generator). > I think he's doing better than we are. Probably... I've nearly got the battery charger going though - it's regulating current (badly), and the MOSFET driver works. Learned a few lessons too: 1) P-channel MOSFETs switch on when Vgs is negative. That means if Vs is at +5V, Vg needs to be grounded (assuming Vgs(th) <= 5V). 2) Check your MOSFET driver carefully - look at each bit separately and figure out what's going to happen when it gets a high input, then do the same for a low input. I managed to build a driver that switched on when Vin was low. The PIC realised Vout was going way too high, reduced the PWM time to zero, and ended up locking the MOSFET on instead. Oops. At least it didn't let out the magic smoke, but it did burn the solder flux residue a little... 3) Hooking up power to the opamp is a very good idea too. I spent 40 minutes trying to figure out why Vout was stuck at 0V, then noticed the opamp was plugged into the "V4" bus line, and that there was no link between "V3" (SMPS supply voltage) and "V4"... 4) Cheap breadboards are very good at developing loose connections. 5) I need to get some decent single- and double-cell battery holders. What fun! I'm going to hook up a 20MHz crystal in a bit and see if I can get it to update a bit faster. I might also try rewriting the code to do PSM instead of PWM and see if that makes it work any better. And I need to try and figure out what part of the SMPS driver is eating nearly 200mA, even when the PWM output is off (=0V)... A break sounds real good about now. -- Phil. | Kitsune: Acorn RiscPC SA202 64M+6G ViewFinder philpem@dsl.pipex.com | Cheetah: Athlon64 3200+ A8VDeluxeV2 512M+100G http://www.philpem.me.uk/ | Tiger: Toshiba SatPro4600 Celeron700 256M+40G -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist