Shop OBEX P1 Docs P2 Docs Learn Events
Multi-dimensional array — Parallax Forums

Multi-dimensional array

tfallingtfalling Posts: 6
edited 2010-02-15 03:59 in BASIC Stamp
Does PBASIC support multi-dimensinonal arrays?

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2010-01-09 23:30
    No

    You can always simulate multidimensional arrays using single dimensional arrays, but keep in mind that the Stamps have only 26 bytes of variable space available.
  • tfallingtfalling Posts: 6
    edited 2010-01-09 23:47
    What about the propeller, will it allow for multi-dimensional arrays?
  • Mike GreenMike Green Posts: 23,101
    edited 2010-01-10 00:06
    That depends on which Spin compiler you use or whether you use the Catalina C compiler. There are two 3rd party Spin compilers and one of them (Homespun) supports multidimensional arrays. The others (Parallax's Propeller Tool and BST) do not. They support only single dimensional arrays. The Propeller is fast enough and has enough RAM (32K) so simulating multidimensional arrays using single dimensional arrays is practical. As far as I know, Catalina supports multidimensional arrays. ImageCraft also has an excellent C compiler, but, although it's very inexpensive, it's not free like Catalina.
  • filip911filip911 Posts: 17
    edited 2010-01-12 07:46
    thx to everyone
  • achilles03achilles03 Posts: 247
    edited 2010-01-13 15:32
    filip911 said...
    thx to everyone

    Why don't you describe what you're trying to do, and we'll see if it can be implemented on a BS2?

    Dave
  • tfallingtfalling Posts: 6
    edited 2010-02-15 03:47
    Bi-liner interpolation is the objective. More specifialy I would like to use a look-up table to calculate a pulsewidth, based off of a couple measured perimeters (say RPM and throdle postion).
  • Mike GreenMike Green Posts: 23,101
    edited 2010-02-15 03:59
    Lookup tables on a Stamp are fairly easy. The table is kept in EEPROM where it's usually loaded with the program using DATA statements and accessed using READ statements. Typically the parameter tables are separate. You'd lookup the RPM and the throttle position in each of their tables and use their indices to compute an address in the pulsewidth table. Since you'd have the original RPM and throttle values as well as the parameter values at the found indices, you'd be able to do the interpolation on the pulsewidth.
Sign In or Register to comment.