Shop OBEX P1 Docs P2 Docs Learn Events
Downloaded new 2.0 version and now code going haywire — Parallax Forums

Downloaded new 2.0 version and now code going haywire

eagletalontimeagletalontim Posts: 1,399
edited 2009-02-28 22:58 in General Discussion
I have been using version 3.2.92h for a long time and have built a project that uses 2 chips that talk to each other. One reads sensors and does calculations, the other runs the LCD display and Reads / Writes to an EEprom. After downloading the 2.0 compiler, I programmed both chips again with the EXACT same code and now nothing loads from the EEprom and it appears as though sometimes the code jumps to random spots and runs them which throws garbage on the LCD. I just tried downloading the old version again, but apparently it has been upgraded as well with the new compiler. I cannot post my code because it is a major project I am working on to be able to sell in the future, but I may be able to post parts of it if needed. Please let me know what I should do!

Comments

  • JonnyMacJonnyMac Posts: 9,214
    edited 2009-02-28 15:38
    First: relax -- you could have "downgraded" back to 1.51.03 is less time than it took you to make your post. Just go to the get the 1.51.03 files (sticky post at the top of this forum) and unzip the files into the SXB folder; problem solved.

    What you don't seem to be clear on is that SX/B is called form the IDE; it's not part of it. This lets us upgrade/downgrade SX/B by simply changing the files in the SXB folder. I actually have batch files that allow me to go back and forth between 1.51.03 and 2.00.xx for situations like yours where the compiler changes affect the code; they're usually minor but we'll never know with your program as you can't post it.
  • eagletalontimeagletalontim Posts: 1,399
    edited 2009-02-28 15:42
    I was able to reinstall 3.2.3 completely and get it to work again. I was hoping to be able to use the STR command in the LCD chip, but it looks like that is not going to work [noparse]:([/noparse] I have run out of room on that chip and need to free up alot of space.
  • JonnyMacJonnyMac Posts: 9,214
    edited 2009-02-28 16:25
    So... start freeing up space. One way to do that is to create an array (which is in a different bank) and then aliases into the array. This works well for byte variables that are not used as an index into another array.
  • David BaylissDavid Bayliss Posts: 58
    edited 2009-02-28 17:27
    Well - first of all, which space have you run out of? Code space or variable space? It is nearly always possible to trade one for the other ...
  • eagletalontimeagletalontim Posts: 1,399
    edited 2009-02-28 17:29
    Code space. There is no more room for Data tables and I only have enough room for 1 more Byte variable.
  • David BaylissDavid Bayliss Posts: 58
    edited 2009-02-28 19:31
    So you have run out of space for code AND data - I guess trading off isn't going to help much ...
  • JonnyMacJonnyMac Posts: 9,214
    edited 2009-02-28 19:59
    Good point, David, and we can't really help as it's a commercial app that cannot be posted.

    @Tim: You could bump to the SX28 and get more code space and RAM. You might even find a clever way to use the counter/timers for you tach input.
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2009-02-28 20:10
    If you use a lot of multiplication and division math, creating
    a multiply and divide routine can save a lot of codespace.
    Also, putting SXB commands that generate lots of code
    (not just serin, serout and pause) in a seperate routine
    will help.
    Using manual banking can also save alot of codespace.
    Or move to the sx48 as Jon suggested (as you have
    ran out of variable space as well).

    regards peter
  • eagletalontimeagletalontim Posts: 1,399
    edited 2009-02-28 21:21
    I was thinking about moving to the 48, but I don't have the money right now to upgrade to the programmer and buying chips. I have a Smile load of SX28's laying around so I was hoping to work with what I have. I do have most of my repetitive code in functions to save as much space as I can. Most of the space is taken from DATA tables for a large menu system that I have created. There are 2 data tables with 15 entries each @ 16 characters long. Once one Data table is full, I have to move to the next one and alter the code to adapt as well.
  • JonnyMacJonnyMac Posts: 9,214
    edited 2009-02-28 22:00
    You've got an EEPROM in your project -- have you considered offloading your strings to it?
  • eagletalontimeagletalontim Posts: 1,399
    edited 2009-02-28 22:15
    what do you mean by that? Putting the Menu DATA tables onto the EEprom?
  • JonnyMacJonnyMac Posts: 9,214
    edited 2009-02-28 22:58
    If you DATA tables are mostly strings you could program then into the EEPROM and fetch the characters from there instead of the DATA tables -- this would free up code space for your program. What this means, though, is you'll have to write a little program to move your string data into the EEPROM before you're able to use it. Since the EEPROM is very big you can put your strings at even boundaries and fill the spaces between with zeroes; by using even boundaries (use a power of 2) you can simplify access.

    To get to the first character in a string you multiply your block size by the string number. You then read characters out of the EEPROM until you hit a zero.
Sign In or Register to comment.