First of all is the code working right? When you remove the loads does the program work right or does it work periodically? Could you remove the routine for the pushbuttons and just run the code first with a preset setting? Regards, John --- Russ Hensel wrote: > My 16f819 project to drive 2 steppers is making me > crazy!!! System boots > and runs fine sometimes. ( see below for Environment > ) but only sometimes. > > A slightly longer version of the story: > > I was just about done on this proto board project, > building a second > neater proto board. I could not get the new one to > work properly, it > would sometimes run correctly sometimes not. > Typically rebooting with > power off and then on quickly would get it to run a > stepper sequence, > once one sequence worked others would work as well > until power off. > > After power on with some programed blinking of led's > and response to > pushbuttons ( all correct ) the routine often breaks > down when I run a > several hundred motor steps subroutine for the > stepper. > > Sometimes some of the ports bits lock up ( steppers > all on portb ) > sometimes portA outputs are also affected. MClear > and a second try > sometimes will get it to run correctly, sometimes > not. As I say once it > runs right it keeps working correctly ( with its > minimal user interface > and calls to the stepper subroutine ) until power > off. Went back to old > proto board, found same problem, but again, just > sometimes. Problem > probably had always been there but I had not paid > great attention. > > Environment > > 16f819 on Prot oboard > > MPLab Assm > > Great Cow Basic compile to asm. > > Running on 5 volts > > Using internal ossc > > Full asm of shortest version of code at > http://home.comcast.net/~russ_hensel/StepBot3asm.txt > > > > Things I have tried that have not worked: > > > Improved PS decoupling, in lots of ways. > > Removed stepper loads and even the > output darlingtons. > > Shadowed Port B for output, which I had > not originally done. > > Removed pull down resistors on portb > outputs. > > In the Great Cow Basic, moved around the > routines and did > some inspection of the asm code. > > Reorganize the code in case problem was related to > banking or paging. > > Looked carefully for uninitialized variables. > > Slowed clock down to one half mega hertz. > > Turned off brown-out reset > > Looked on Piclist and Google for info. including > Gotchas which are great > but do not seem to be the problem. > > Tried a second 16F819 > > Made sure capture compare was off ( any other > peripherals on PORTB That > might be causing a problem? ) > > Reset pin is tied to V+ by 10 K and a .1 uF cap to > ground as per manual > ( have varied the cap to higher/lower to see if this > helped ) > > Used scope to make sure oscillator was running speed > was at least > vaguely right > > Made sure low voltage programming is off > > Watch dog timer is off. > > Tried on off switch between power supply and chip > for fast rise of power > supply. > > Have power on reset timer on. > > > Pretty much at my wits end, the few next steps that > I have are tedious: > > Pure assembler for the 819 > > Try with a 16F871 which I have on hand > > I could supply all code etc to this list, but hope > that a detailed > examination like that will not be required. Anyone > out there with a > great insight? I feel it is something simple that I > have missed. > > A plea for help from Russ. > > > > > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > ____________________________________________________________________________________ Don't get soaked. Take a quick peak at the forecast with the Yahoo! Search weather shortcut. http://tools.search.yahoo.com/shortcuts/#loc_weather -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist