Shop OBEX P1 Docs P2 Docs Learn Events
Question on using Objects — Parallax Forums

Question on using Objects

joeldjoeld Posts: 49
edited 2008-02-22 18:46 in Propeller 1
I have a basic Object question. Each time I include an Object in my project how much memory am I eating up? Does it matter that much or is only the code used in each Object added at compile time?

For a specific example. I have a project that uses the floatstring object to format numbers to output to a display. I was wanting to add an xbee module to transmit information. The xbee object uses the numbers object. Should I go back and recode my top object to use the numbers object instead of float string? Or am I really not eating up that much more memory by using similar objects?

Joel

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-02-22 18:21
    Every time you include the object, there's a copy of the VAR area added. No matter how many times you include the object, there's only one copy of any DAT sections and only one copy of the interpretive code (the methods).

    Why don't you see how much memory your project uses? If there's lots of memory available, choose convenience and use both the numbers object and the float string object. If you're tight on space, you may be able to save room by using one of those objects and converting the code to just use that one.
  • joeldjoeld Posts: 49
    edited 2008-02-22 18:39
    Space isn't that critical on this project. It's really just a project to learn the propeller. I'm about 1/3 through the available memory where the program stands. I don't want to start off learning the wrong way and get too sloppy. It looks like just referencing all the objects required for the xbee object used up another 700 longs. That's with no code calling any of the routines yet.

    I like the uOLED prop, the only draw back is I'm pretty much out of pins already. Not enough pins for the sensirion, xbee and one button unless I start multi-tasking pins.
  • Mike GreenMike Green Posts: 23,101
    edited 2008-02-22 18:46
    Although it requires changes in programming, adding one or more I2C I/O Expanders to the uOLED-96-Prop is very easy and can get you a whole bunch of I/O pins. You can attach an xBee to the programming port (pins 30 and 31). BoeBotBasic has routines in Spin to attach an HM55B compass via an NXP PCF9554 I/O Expander attached to the EEPROM port on a Protoboard. You'd have to do some fine soldering to do the same thing on the uOLED-96-Prop, but you could also attach it to another pair of Prop I/O pins.
Sign In or Register to comment.