Shop OBEX P1 Docs P2 Docs Learn Events
OBJECTS in new COGS — Parallax Forums

OBJECTS in new COGS

PacoPaco Posts: 2
edited 2011-03-23 09:27 in Propeller 1
I am currently running many OBJECTS for my system that requires large amounts of memory; therefore, the tech support at Parallax suggested running the new objects in their own cogs. I am familiar with running PUBS in the own cogs, but not OBJECTS, or even how much memory in the VAR block to declare for the new cog for the object. Does anyone have any advice on how to do so. Here is an example of what I have tried to start an object in a new cog, but when I do it nothing works. Please help.....

OBJ

XB : "XBEE_OBJECT

VAR
long stack[100]

PUB init
cognew(XB,@stack[0])

Comments

  • Dave HeinDave Hein Posts: 6,347
    edited 2011-03-23 07:33
    Paco,

    A cognew must be done on a method within an object. You can't perform a cognew on an object Normally, you would start a method in another object by calling a "start" function in that object, such as XB.start. The start function in XB would then perform a cognew on a method within that object.

    Dave
  • Mike GreenMike Green Posts: 23,101
    edited 2011-03-23 07:54
    Paco,
    If you're trying to use many objects in your program, that's going to use a lot of memory no matter how many cogs are involved. How about starting by describing what you're trying to do and listing where all the objects are declared (main object references A and B, A references C and D, B references E, etc.)
  • StefanL38StefanL38 Posts: 2,292
    edited 2011-03-23 09:27
    objects are *.SPIN-files that contain SPIN methods and/or .PASM-code

    You can't start a complete object (=*.SPIN-file with several methods) as a whole thing

    There are two variants to start a new cog

    1.) start new cog with one SPIN-method
    2.) start a new cog with a PASM-code

    objects can contain SPIN methods and/or PASM-code

    for further details please ask more specific or read the propeller-manual and the PE-KIT fundamentals V1.1

    best regards

    Stefan
Sign In or Register to comment.