PDA

View Full Version : Solved Accessing an object (F32) from multiple cogs. Can it be done?



J.R.P.
10-15-2011, 05:57 PM
Hello All,

I have been using the Prop for a while now and have have good success with simple projects, but I still do not fully understand how certain things work and I have a high level question. (Yes, I have spent much time searching the forums.....:smile:)

For example, when using an object that launches a new cog (such as F32 or Float32), is it possible to have more than one other cog simultaneously using the functions within F32 or Float32?

Hypothetical situation:
Main PUB starts F32 or Float32
Main PUB launches two other cogs, each doing floating point math operations for different purposes.
Main PUB uses PST to display results from each cog

What characteristics determine whether this is possible or not?

Thank you in advance for your time!

John

Mike G
10-15-2011, 06:05 PM
Yes, it's possible. First create an abstract memory structure in F32 which contains the INs, OUTs, and Execute Command. Invoke F32 and pass back the starting address (pointer) of the the abstract structure. Fill in the INs, Set the Execute Command var, read the OUTs. Create a memory locking scheme so you don't get dirty reads while multiple process try to use F32.

http://www.parallaxsemiconductor.com/an003

However, you might just be able to create several instances of F32. Only the VAR blocks are allocated in memory with each instance. But it depends on how F32 is built.

J.R.P.
10-15-2011, 10:26 PM
Thank you Mike!

Your answer is a bit over my head with my current knowledge level, but I think I understand the concept your are talking about. I will definitely study the app note.

Another takeaway is that it sounds like what I'm asking is not possible without modification of the F32 object. That is one of the key points I was after.

I appreciate your input and I consider this question closed.

Thanks again!

John