Shop OBEX P1 Docs P2 Docs Learn Events
Two-dimensional floating point arrays in BS2 — Parallax Forums

Two-dimensional floating point arrays in BS2

gnrgnr Posts: 2
edited 2007-10-17 20:34 in BASIC Stamp
Hello:

I am a new BS2-programmer. Can any one suggest me how to create·two-dimensional floating point arrays in BS2?

Thanks,

GN Reddy

Comments

  • allanlane5allanlane5 Posts: 3,815
    edited 2007-10-17 13:30
    1. The BS2 has 26 (count 'em, 26) bytes of ram. Total. That's a really really small 2 dimensional array.

    2. The BS2 PBasic does not support floating point.

    So, the conclusion is: Use another platform, the BS2 ain't gonna do it.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2007-10-17 14:11
    As Leonardo Da Vinci is reputed to have said, 'Small places discipline the mind.'

    The BS2 and PBasic also don't provide arrays, but a 2 dimensional array is possible to create through your own code. PBasic essentially supports integer math operations. So without a math coprocesser chip [noparse][[/noparse]which does exist], you are going to have to create floating point structures in PBasic code.

    If you really desire a tiny 2-D array, it might be possible. And, you certainly will learn a lot along the way. Like Leonardo was implying limitations have a way of really honing one's understanding of the principals involved.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "Everything in the world is purchased by labour; and our passions are the only causes of labor." -- David·Hume (1711-76)········
    ···················· Tropically,····· G. Herzog [noparse][[/noparse]·黃鶴 ]·in Taiwan
  • Andy FoxAndy Fox Posts: 46
    edited 2007-10-17 20:34
    I would suggest, 1) Getting the uFPU floating point math co-processor, and 2) storing your array of data in a 24LC32 (or similar) external EEPROM. You will have to manage your array storage yourself, but it can be done.

    Both the uFPU and EEPROM chips are available directly from Parallax.com.
Sign In or Register to comment.