In SX Microcontrollers, SX/B Compiler and SX-Key Tool, Rsadeika wrote: I guess I need some of the asm experts help on this one. I am using an SX-Tech board, all standard issue from Parallax. The program below, when I do a 'Run', with the SX-Key pluged in, works as expected. The again loop waits for the IR signal, gets the signal, goes to the delay sub, does its thing, comes back, and waits for another IR signal. Everything works as expected. The next thing I did is 'Program', unpluged the power, unpluged the SX-Key, pluged in the 50MHz crystal, pluged in the power, and the LED goes on and stays on, not what is expected. I think that there is a problem with the way the compiler is handling the different IDE modes of 'Run', 'Program', ..., etc. I know that it is a bold accusation, but thats where the trail took me. I am really surprised that something like this has not occured to someone else. I am pretty certain that the equipment is OK because when I 'Program' other programs everything seems to work as expected, while it is done in the 'Run' mode. Now, if I can get a confirmation about this, then maybe I can work on something else. Any comments from anybody. Ray *****CODE ;;; ;; New28IR.src ;;; device sx28,stackx,turbo device oschs3 ;High speed crystal, 1MHz - 75MHz ;IRC_CAL IRC_FAST ;For use with external crystal/oscillator freq 50_000_000 ;Need this at 50MHz so delay works ~ 2.7 seconds reset Main ;; Variables org $08 Counter1 ds 1 Counter2 ds 1 Counter3 ds 1 IRpin = rc.0 ;IR detector LEDon = rb.0 ;LED org $0 Main ; mov w,#$1F ; mov m,w mov !rb,#%11111110 ;Set rb.0 for output again snb IRpin ;Waits for IR signal jmp again ; call delay ;Go do delay jmp again ;Comes back from delay ;goes to again and waits for IR signal ;;This is my delay loop, ~2.7 seconds @50MHz freq delay: clrb LEDon pause ;~ 1.35 seconds @50MHz freq decsz Counter1 jmp pause decsz Counter2 jmp pause decsz Counter3 jmp pause setb LEDon ;Turn the LED on ;pause1 ; decsz Counter1 ; jmp pause1 ; decsz Counter2 ; jmp pause1 ; decsz Counter3 ; jmp pause1 ; setb LEDon ;Turn the LED off ret ;Go back to where you were called at jmp $ end ;End of code ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=101673#m101831 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2005 (http://www.dotNetBB.com)