View Full Version : shared data

Don Pomplun
01-29-2007, 09:53 AM
I'm looking at 2 tasks. The first takes in data in bursts, and the second sends it out at a constant pace. So there will be a ring buffer between them to handle the asynchronicity. They are different compiled programs, each with its own tables in the DAT area. I assume those are properly handled, as neither task uses the other's DAT data. But what is the "recommended" means for defining and accessing my ring buffer? Since one is refenced as an OBJ by the other, it seems that CONs won't help.
-- Don

Paul Baker
01-29-2007, 10:15 AM
One method is to have the parent object define the storage and pass a pointer to it in the argument of the start method for each child object.

Paul Baker (mailto:pbaker@parallax.com)
Propeller Applications Engineer
[/url][url=http://www.parallax.com] (http://www.parallax.com)
Parallax, Inc. (http://www.parallax.com)

Mike Green
01-30-2007, 01:19 AM
Another technique is to have a method in the object that defines the storage area. This method just returns the address of the storage and is called from the other object.

You can also write methods in the object that defines the storage area which add items to and remove items from the ring buffer (GetItem/PutItem). There would also be an initialization method (or this could be included in an object start method). Look at the keyboard driver in the Propeller Tool's library (the one that gets installed with the Propeller Tool) for an example of this.