OBJECTS in new COGS
Paco
Posts: 2
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])
OBJ
XB : "XBEE_OBJECT
VAR
long stack[100]
PUB init
cognew(XB,@stack[0])
Comments
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
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.)
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