Shop OBEX P1 Docs P2 Docs Learn Events
Sub Class question for SPIN — Parallax Forums

Sub Class question for SPIN

Hello All,
I am wondering if anyone knows how the below would work?:

I have a main class that uses my EEPROM class in spin, as well as an LCD Class that also uses the same EEPROM class. If I access the EEPROM Class from both my main class and my LCD class, does it have to be re-initialized, and will the variables within the EEPROM class stay the same from when it is called in the main class to when it is then called in the LCD class?

Thanks!

Comments

  • I am wondering if anyone knows how the below would work?:

    There are many of us who know how this works.

    Each object gets its own set of variables in the "VAR" section but variable declared in a "DAT" section are shared.

    Whether or not you need to initialize both objects depends on the specifics of the object being used.

    To make things a bit more complicated, some objects won't work well if called from a different cog than the one which initialized it.

    If you post your code as an archive, one of us could take a look at it and let you know if you should call a initialization method more than once.

    All this can seem very confusing but there are rules about when and how to do these sorts of things. These complications also make the Propeller very powerful and flexible.
Sign In or Register to comment.