Can you use FDS4port from different cogs?
T Chap
Posts: 4,223
I have run out of cogs and have a free port on the 4port. It would be great if two different cogs could use the same 4port. Is something like this even possible? At the moment there are other problems to solve before I can even test the idea.
obj
ser : "FDS4port"
cog1 ser.str(0, string("Hello world"))
cog2 ser.str(1, string("Hello world"))
obj
ser : "FDS4port"
cog1 ser.str(0, string("Hello world"))
cog2 ser.str(1, string("Hello world"))
Comments
Thanks
FullDuplexSerial4port : first port is using parity on receive (10 bits) where the other 3 ports show 9 bits
Post Edited (Todd Chapman) : 12/6/2009 7:17:21 AM GMT
As long as ALL calls like
ser.str(0,...
ser.str(1,...
ser.tx(2,byte...
are in the ONE and SAME file you can do so.
You can't access methods or variables across *.spinfiles directly
If the calls are in DIFFERENT *.spin-files it will ONLY work with modifying the code
For explaining this in detail it would be good if you describe your application in detail
in which file is the FDS4-object started and in which *.spin-files do you want to use
calls to the FDS4-methods
best regards
Stefan
I would like to clarify this.
If you want to use an object in different *.spin-files each file has to have a codeline
As far as I understand it this means EVERY file where this codeline is defined
stores code in the HUB-RAM. So if the object is defined in two different files
all the code is stored two times in HUB-RAM and all the pointers like
of each instance point to different HUB-RAM adresses
Now what Timmoore is saying that the object is stored only ONCE in HUB-RAM and as all the pointers are in the DAT-section you can use this pointers across *.SPIN-files
Is this correct ?
best regards
Stefan
The FullDuplexSerial4Port did exactly what I was hoping.
Below is just an oversimplified example of what is really happening, all 4 ports working simultaneously. Port 3 is actually
an LCD, which will print from any of the other ports, including the new cog.
Post Edited (Todd Chapman) : 12/7/2009 5:09:48 AM GMT