Guys,
Firstly may I say that I admire both DT and Steve's skills in programming, and want to thank you both for staying with this. - I'm feeling way out of my depth here, and all I can do is test the code you offer, and report back.
Ok power supply:
240v primary - 12-0-12 secondry 500mA transformer. Rectified using 4 x 1N4004 diodes, regulated via 7812, 7912 1A regulators, with 1000uf capacitors to give smoothed +12 and -12v supply. Then a 7805 is used off the +12v to give +5 line. 0v taken from the centre tap. Actual voltages measured are +4.94v, +11.84 and -11.86.
+5v used for the PIC, +12v used for the motor supply - 0v commoned to both
Code.
I compiled Darrels code, and no matter what I tried I couldn't replicate the latching or drop out (ie the loco would just stop and not respond) when advancing and retarding the 10K lin pot in quick succession. However even with a 4 Mhz xtal the whine from the motor was loud
Compiling Steves code I got the low growl rather than a whine, but it was a lot less noticable than DT's original code. But advancing and retarding the pot as before still caused the lock up / drop outs.
Voltage measurements:
When advancing and retarding the pot quickly between min and max the voltage drop on the +5v line to the pic was less than 0.03v (4.94 - 4.93 was read), so its not enough to cause the PIC to stop running. The drop on the +12v line was a little more, but not drastic, with the lowest reading being 10.56, so the peak drop of around 1.4v.
To varify that it is the PIC that is locking up and not the output stage, I placed an LED on the output of the PIC, and this would stay illuminated when a lock up occured, even when the loco was removed. I also removed the connection between the PIC and the base of the NPN tranny to see if the LED would go out and it had no affect, so it would appear that the driver side isn't causing the issue.
Hope this feedback helps.
Bookmarks