Shop OBEX P1 Docs P2 Docs Learn Events
this program works with PAUSE, but does not compile with DELAY_MS...why? — Parallax Forums

this program works with PAUSE, but does not compile with DELAY_MS...why?

basicstampedebasicstampede Posts: 214
edited 2008-09-06 17:51 in General Discussion
I'm experimenting with 2 versions of a program.·
One version has PAUSE 200 in main program.· The program works.
Then I commented that statement out and replaced it with DELAY_MS 200.· The program does not compile.

DELAY_MS works in a different program and works well (i.e. bug free).· (I'm borrowing it from JonnyMac).

So I don't understand why·replacing a PAUSE statement·with·a bug-free SUB would cause the program to not compile.

The two programs are attached.

Any insight would be appreciated.

Comments

  • basicstampedebasicstampede Posts: 214
    edited 2008-09-06 14:48
    oops.· and here is the version that compiles (uses PAUSE)
  • ZootZoot Posts: 2,227
    edited 2008-09-06 15:12
    These both appear to be the same (with the ISRflag based delay sub commented out).

    When you say "won't compile" what happens? What error gets thrown?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST

    1uffakind.com/robots/povBitMapBuilder.php
    1uffakind.com/robots/resistorLadder.php
  • basicstampedebasicstampede Posts: 214
    edited 2008-09-06 15:17
    Zoot,

    The error message is:· Unable to assemble due to errors in source code.

    The differences between the 2 files is in Main program, not ISR.·
    In·one version, I use PAUSE 200 for timing of main LED blinking on & off.
    In the other version, I use DELAY_MS 200.

    Thanks.
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2008-09-06 16:29
    I just uncommented the DELAY_MS 200 and commented the PAUSE 200 and COMPILED (Ctrl-A) it ok with no errors. I did not PROGRAM (Ctrl-P) to an SX chip.

    Have you tried to just COMPILE with out PROGRAMing the SX chip? This worked fine for me.
  • Shawn LoweShawn Lowe Posts: 635
    edited 2008-09-06 16:39
    Jon helped me with one of my programs and used a delay_ms subroutine that had SX 2.0 code. I think you have some of that code. Try this:


    ' Use: DELAY_MS duration
    ' -- replaces PAUSE

    SUB DELAY_MS
    \ SB __PARAMCNT.1
    \ CLR __WPARAM12_MSB
    PAUSE __WPARAM12
    ENDSUB

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Shawn Lowe


    When all else fails.....procrastinate!
  • basicstampedebasicstampede Posts: 214
    edited 2008-09-06 17:21
    T&E engineer,
    Yes, I tried just Compile. It does not compile. It gives error message.

    Shawn,
    I used that DELAY_MS you listed above. It still does not compile.

    Thanks for your suggestions.
  • basicstampedebasicstampede Posts: 214
    edited 2008-09-06 17:37
    The error message is "Address 275 is not within lower half of memory page"

    Is my ISR too long?
  • BeanBean Posts: 8,129
    edited 2008-09-06 17:51
    Yes, your ISR code is pushing the address of the SUB down.

    You can do two things:
    · 1) Just put "ADDRESS $400" AFTER the PROGRAM line.
    · 2) Use a jump to get to your ISR code.
    "INTERRUPT 1000"
    "GOTO Mark_ISR"
    then the SUB declarations
    then the ISR code starting with the "Mark_ISR:" line.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    "A government big enough to give you everything you want, is big enough to take away everything you·have."·· Thomas Jefferson

    "It is our choices, Harry, that show what we truly are, far more than our abilities."·Dumbledore from Harry Potter

    www.iElectronicDesigns.com

    ·
Sign In or Register to comment.