Shop OBEX P1 Docs P2 Docs Learn Events
SX/B code page/Addresses — Parallax Forums

SX/B code page/Addresses

DunnseptDunnsept Posts: 115
edited 2006-07-07 02:33 in General Discussion
I am finally putting together the complete code for my project and now am getting
"Address 259 is not within lower half of memory page"
"Address 257 is not within lower half of memory page"
"Error 30, Pass 2 overwriting same program counter location"

In reading the docs, it says "Note that as of version 1.2, it is not (sic) longer necessary for the programmer to manually set code page addresses."

so,.... how do I get around these errors? I tried setting the address manually anyway as per the online help, but
that didn't change anything. A search on the forums only turned up a couple references saying "well, you have to setup your
code so your subroutines are in the lower half" but the entries were for ASM and not SX/B.

I had working code and all I did was put in my ISR code. I sure hope this is a simple fix as I dont have anywhere
near complete code yet.. I still have to add in all of my PID routines and error checking.

paul...

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
stand back! I have a slide rule and I know how to use it!

Comments

  • BeanBean Posts: 8,129
    edited 2006-07-05 14:01
    Paul,
    Don't set the address manually.
    What is happening (probably, you didn't post your code) is that your interrupt code is pushing down your SUBs out of the 1st half of the code page.
    Do this...

    '
    INTERRUPT
    GOTO IntHandler

    MySub1 SUB
    MySub2 SUB

    PROGRAM Start

    IntHandler:
    ' Interrupt code
    RETURNINT

    Start:
    ' Program code
    END
    '

    Bean

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheap 4-digit LED display with driver IC·www.hc4led.com

    Low power SD Data Logger www.sddatalogger.com

    "I'm a man, but I can change, if I have to, I guess" The Red Green Show
    ·
  • DunnseptDunnsept Posts: 115
    edited 2006-07-05 14:23
    nope.. I didn't.. and yes. if I cut the ISR out, it compiles just fine.. I just thought there has to be a way of handling this easily. thanks!
    and I still have to put in all of the PID routines and tons more code.. hope I don't run into this again.


    thanks!
    paul...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    stand back! I have a slide rule and I know how to use it!
  • DunnseptDunnsept Posts: 115
    edited 2006-07-05 15:08
    ok.. that fixed it.. for a short time.. I've added in some of the rest of my subs (the PID routines) and now I get the same error message when I assemble the code.
    I've attached the code this time.. it is getting close to being complete, but is still missing all of the work in the middle, PLUS I still need to add the code to drive the
    SSR with pwm. So, even if I remove the stuff from main: about prompting for times, I still have lots of code to put in it's place.
    is there some method to organize the subs to get around this or do I have to keep "playing" around to get them to fit properly?

    this is going to keep coming back to bite me as the first time I had to remove portions of my ISR to get it to compile happily. That portion removed
    was something I really didn't want to.
    any advice appreciated.. maybe there are portions I could 'optimize' to make smaller so it would all fit in .

    thanks!
    paul...

    what all of the above means is that once the address issue is resolved, this code may still not compile properly. It's beyond work in progress wink.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    stand back! I have a slide rule and I know how to use it!

    Post Edited (Dunnsept) : 7/5/2006 3:16:12 PM GMT
  • BeanBean Posts: 8,129
    edited 2006-07-05 16:05
    Paul,
    You MUST declare the SUBs AFTER the interrupt GOTO "IntHandler" and BEFORE your interrupt code.

    Here is the reason... The INTERRUPT keyword must be the first keyword that generate code. Because the interrupt code MUST start at address $000. The SUB declarations must be in the first 256 code words, because the CALL address is only 8 bits.

    Even with SUB moved up, you have run out of code space. That is what the "Overwriting same program counter location" error is telling you.

    You need to put the 1-wire commands into subroutines. That will save a bunch of code space. Oh and the PULSOUT command too.

    Your trying to do quite a lot with only 2K of code space. If you have much more to add, you may want to consider switching to the SX48 protoboard. The SX48 has 4K of code space.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheap 4-digit LED display with driver IC·www.hc4led.com

    Low power SD Data Logger www.sddatalogger.com

    "I'm a man, but I can change, if I have to, I guess" The Red Green Show


    Post Edited (Bean (Hitt Consulting)) : 7/5/2006 4:12:08 PM GMT
  • DunnseptDunnsept Posts: 115
    edited 2006-07-05 16:17
    I have the 1 wire stuff in subs.. there are two of them there.. one called GET_CJ and one called CHECK_TEMP.. 90% of my code is sub-routine.
    thanks, I'll move the sub declaration and put in the rest of my code and see what happens.. I was planning on running this on the sx48 protoboard anyway, it's just easier to do the prototype work on the sx tech board with the solderless breadboard in place

    thanks again

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    stand back! I have a slide rule and I know how to use it!
  • SawmillerSawmiller Posts: 276
    edited 2006-07-07 02:33
    as a sidenote, for the 9.95 sx48 protoboards..

    i soldered female sip's around the proto area where the pinouts and power were, then glued a breadbosrd in the middle... makes a good test bed that way.

    dan
Sign In or Register to comment.