Shop OBEX P1 Docs P2 Docs Learn Events
Quick question concerning Variables and arrays — Parallax Forums

Quick question concerning Variables and arrays

kingspudkingspud Posts: 128
edited 2006-06-21 17:43 in BASIC Stamp
Hello all,

I have a quick questions concerning variable and arrays!

I need an array that will total 60 cells and take a number of either 0 or 1

and I need an array that will by 11 cells and take a number from 1 to 10!

Can some one please write out the correct format, ie;·

number··· var··· nib(30)

thanks

Also, I keep running out of space due to large variables so does anyone know how many byte arrays can be used in the BS2px24 chip?

Joe

Comments

  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-06-20 22:58
    Joe -

    In direct answer to your question the first array would look like this:

    Arrray1 VAR BIT(60) '60 bit (one bit per cell) array referenced 0-59

    The second array would look like this:

    Array2 VAR NIB(11) '11 nib (4-bits per cell) array referenced 0-10

    The BS2-P24 (there is no BS-2PX24 to my knowledge) has 26 BYTES of RAM and 128 BYTES of scratchpad RAM. You can use that RAM any way you choose: BITS, NIBS, BYTES or WORDS. If you meant the BS-2PX, the answer is the same as the BS-2P24.

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
  • kingspudkingspud Posts: 128
    edited 2006-06-21 06:41
    Hi Bruce,

    Actually there is a BS2px24...

    BASIC Stamp 2px 24-Pin Module
    <!-- unit price -->http://www.parallax.com/detail.asp?product_id=BS2PX24

    This is the one I was talking about...·

    Thanks for the info concerning the arrays, it clears things up!!

    Joe
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-06-21 08:34
    Joe -

    That will teach me to beleive what I read here on the forum smile.gif

    That's the only PBASIC Stamp model that I don't own, thus I'd never actaully looked at the ordering page. Glad the information was helpful.

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-06-21 15:47
    As was already pointed out, the BS2p series (Including the BS2px) has 126 bytes of ScratchPad RAM (SPRAM) which could be used for what you need without taking up any variable space at all, and could be addressed by an indexed method using GET and PUT.· I myself would probably do this if I had those requirements.· I hope this information helps you.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • kingspudkingspud Posts: 128
    edited 2006-06-21 17:43
    Hello all,

    I have just posted a the WIP - project dealing with the variable concerns and maybe someone can take a look at it and figure out what I am doing wrong!

    The new post is: Need help in completing this project and streamlining the code! 10 LED bargraph mulitstate settings··in the basic stamp forum!

    thanks for all your help

    Joe
Sign In or Register to comment.