Shop OBEX P1 Docs P2 Docs Learn Events
Interesting error with BS2px... — Parallax Forums

Interesting error with BS2px...

jcpolejcpole Posts: 92
edited 2006-02-09 23:35 in BASIC Stamp
Hi...

I'm trying to run Chris Savage's DS1302 demo program on my BS2px (on a PDB).

Whenever I attempt to run (or check the syntax of) the program, I get an error message saying "Data Occupies Same Location as Program".· I want to believe that error is telling me that the program is too big to fit into the BS2px's memory, but I'm not sure.

I have attached the program I'm trying to run, but it is Chris' program without modification.

Thanks...

Jamie


▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
--
Jamie C. Pole
Principal Consultant
J.C. Pole & Associates, Inc.
http://www.jcpa.com/

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-02-09 23:08
    Yes, that program just barely fits into the BS2 space.· What you can do to free up a few tokens is to condense back-to-back SEROUT and DEBUG lines.· Fore example:

    · SEROUT LCD, Baud, [noparse][[/noparse]"Parallax, Inc.", LcdCR]
    ··SEROUT LCD, Baud,·[noparse][[/noparse]"DS1302 RTC Demo"]

    can be changed to:

    · SEROUT LCD, Baud, [noparse][[/noparse]"Parallax, Inc.", LcdCR,
    ···················· "DS1302 RTC Demo"]

    You can do the same thing with DEBUG.· This may free up enough space to get it to fit into the BS2sx.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • jcpolejcpole Posts: 92
    edited 2006-02-09 23:10
    I'm glad that I was interpreting the error correctly.

    I will try your suggestion. There are some other places where I can (cringe) replace variables with hard-coded values. wink.gif

    Thanks Jon...

    Jamie

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    --
    Jamie C. Pole
    Principal Consultant
    J.C. Pole & Associates, Inc.
    http://www.jcpa.com/
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-02-09 23:11
    Jamie,

    ·· Sorry about that...I was trying to be as clear as possible without being too verbose in the text.· All those text SEROUT and DEBUG statements take up a lot of space.· 98% of that code is not needed to use the DS1302, it's merely a front-end demo with a lot of text overhead.· Definately take Jon's advice and remove some non-essential DEBUG statements to use the LCD and don't forget to change the baud rate constant for the LCD, since I was bad and didn't use Jon's conditional compilation code.· =)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • jcpolejcpole Posts: 92
    edited 2006-02-09 23:20
    The baud rate constant was the only change that I made to your original program - I made that mistake when I first switched from the parallel LCD to the serial LCD. Jon was nice enough to provide a new conditional compilation block that had constants for the BS2px.

    Thanks for the info.

    Jamie

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    --
    Jamie C. Pole
    Principal Consultant
    J.C. Pole & Associates, Inc.
    http://www.jcpa.com/
  • jcpolejcpole Posts: 92
    edited 2006-02-09 23:24
    After collapsing some of the DEBUG statements, the program works great - thanks Jon & Chris.

    Jamie



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    --
    Jamie C. Pole
    Principal Consultant
    J.C. Pole & Associates, Inc.
    http://www.jcpa.com/
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-02-09 23:35
    Jamie,

    ·· No attempt was made to compact that code.· In fact, if you look at the comments you'll see there are a plenty.· My reason for this?· There is plenty of working DS1302 code in several areas, but we still were getting a lot of calls from people not understanding just what was happening, especially when it came to accessing RAM locations.

    ·· My hope was to make it really simple to see what was happening in each subroutine, yet in testing to make it verbose enough so it was easy to use and hard to make a mistake.· The necessary parts of the code can be broken down into:

    1) Constants & Variables
    2) Initialization Code
    3) Subroutines to access the DS1302

    Your main code will use these three items.· Everything else in that code is mere wrapping.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
Sign In or Register to comment.