Shop OBEX P1 Docs P2 Docs Learn Events
My SX52 stores less variables than my sx28, I know thats wrong, BUT — Parallax Forums

My SX52 stores less variables than my sx28, I know thats wrong, BUT

Capt. QuirkCapt. Quirk Posts: 872
edited 2007-03-24 01:22 in General Discussion
I recently purchased an SX52 board and I have been using it to DEBUG programs when there wasn't any other chips required. Now I am moving my SX 28 program over to the SX 52. As soon as I change the DEVICE settings to SX52, OSCHS2, BOR42, I get ERROR #3 "exceeding available ram".

When I switch it back to SX28 the error goes away. I have ran into this before with my SX28 and I know how to fix it, But why should I have to do that with the SX52?. The only·information I have been able to find that shows the SX52·has that's less than the SX28, was the statement in the Definitions portion of the help section that states: SX28 General 19, SX52 17, but program memory is supposed to be twice the size (I don't know what "general" represents, I understand the rest of the table info)·.


From Bean's RJ_value code, the variable [noparse][[/noparse]value···· VAR······ Word] is where the problem is and like I said, it goes away just as soon as it's changed back to SX28.

Thanks


Post Edited (Capt. Quirk) : 3/22/2007 5:18:56 AM GMT

Comments

  • JonnyMacJonnyMac Posts: 9,447
    edited 2007-03-22 17:01
    The problem is that you're trying to assign a word variable when there is just one byte of BANK 0 RAM left -- you can't do this. If the variables listed are all that you need then you can assign the words first, then the bytes and they should fit. This is was the PBASIC2 tokenizer does to optimize RAM. Another thing you can do is create an array and then alias the elements of that array for easy program use (but this only works for bytes).

    The reason you're running out of room is that the SX52 has two more ports and those live in BANK zero; on the SX28 these vars are available for general purpose use.
  • Capt. QuirkCapt. Quirk Posts: 872
    edited 2007-03-23 07:56
    Dang it!! I bought the SX52 expecting that I had more room for variables, not less.

    I understand what you are talking about and I am left with more questions.

    I looked at the .lst file and saw the array addressed to the top of Bank1, does that mean only Arrays can access the top 8 rows of Bank 1 & 2 ? or can I change the output of SX/B to address normal variables there instead?

    I have been kinda switching back and forth between Al William's book and Gunther's. I had decided to completely read Al's book all the way through first, until this. Gunther's book seems to cover this part a bit better, so time for a suit change and then back at it.

    Thanks
  • JonnyMacJonnyMac Posts: 9,447
    edited 2007-03-23 14:00
    There is more RAM in the SX52, just a few less bytes in the global space of BANK 0 due to the additional I/O ports. There are slight architecture differences between the SX28 and SX52 which allow the SX52 to have arrays of any size while the SX28 is limited to 16-byte arrays. You may want to stick with a chip then experiment with variable assignments to see exactly how things work; this is one of the cool things about SX/B: nothing is hidden as your code is placed in the list file.
  • Sparks-R-FunSparks-R-Fun Posts: 388
    edited 2007-03-23 19:47
    Capt. Quirk,

    It looks like you are having the same type of difficulty I am with large programs. It is easy in SX/B to use VAR BYTE statements when defining variables but unlike some other compliers these variables can not reside anyplace in RAM. They must reside in a few specific locations. When these locations are all occupied, you can not create any more new variables using VAR BYTE or VAR WORD statements even if you have free RAM. An alternative that often works is to create byte variables as part of an array. These variables work just fine with many (some say most) SX/B commands. (I am still trying to nail down exactly which commands will work and which ones will not.)

    You might want to consider placing several of your byte variables in an array for some of these larger programs. This is the approach I am presently taking.

    - Sparks
  • Capt. QuirkCapt. Quirk Posts: 872
    edited 2007-03-24 01:22
    I was thinking the same thing.
    Jonny Mac
    You may want to stick with a chip then experiment with variable assignments to see exactly
    ·how things work;
    Between the 2 threads, if you have large or many routines within the main program loop (or maybe a sub) that eats up a lot variable name space because of individual naming. I am better off declaring 1 variable name and give it (n) amount of subscript names. And I could always just use comments to keep track of these "subscript" variables.

    Using the idea of sticking with one chip, I tried 2 SX52·examples to see the pattern and I·incorporated the variables portion of the .LST file into each of the examples. Both compiled w/o errors before I put the uncommented .LST files into·each code page
Sign In or Register to comment.