In SX Microcontrollers, SX/B Compiler and SX-Key Tool, kmonsx wrote: Call me crazy. I've attached two versions of my program, version1, which runs fine. And version2 that sleeps (aka shows SLEEPING within the top status window when debugging). The only difference is exactly one line of code, which does not get executed before the SLEEPING occurs. The one line of code that changes is: [code] DOACMD: PAUSE 100 'SENDUSB 89 'goto repeat [/code] The second line in the DOACMD routine, "SENDUSB 89" goes from getting commented out in version1, and uncommented in version2. The actual sleeping happens in the SENDFRAM routine, on the line "JNZ loopz." I swear I'm exceeding some size limitation here. An extra line of code seems to break the whole thing. I've run into this before, and weird enough, changing the logic of the code around seems to fix things. Like using a JZ instead of a JNZ or whatever. I know I pointed this out above, but just to reiterate, the added line of code NEVER EXECUTES prior to the SLEEPING happening. Hardware wise, I'm using the SX28 Tech Board, Parallax power adapter, and the only thing besides the SX that requires power is a FRAM memory chip which draws 5.5mA maximum. Also attached is Parallax USB2SER(powered from PC) and a floppy drive (separate 5/12v power) While this particular case is reproducible, I've seen several other related SLEEPING issues that have spontaneously disappeared. I've seen it sleep in more than one place, so the SLEEPING as far as I know isn't tied directly to the code that is currently executing. I ran SXCheck on the assembly --- it reports some MOV constant errors, which I have since fixed(not reflected in the attached files) but it doesn't change the outcome. Also, note this code doesn't require any specific input lines to be in any certain state, any required input from the user, etc. The sleeping occurs right after my ports get setup, variables initialized, etc. Last thing: Both the SENDUSB routine and the SENDFRAM routines work reliably for me, even if they are ugly. What am I doing wrong? Thanks. Keith ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=156073 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2006 (http://www.dotNetBB.com)