Shop OBEX P1 Docs P2 Docs Learn Events
Accessing an object (F32) from multiple cogs. Can it be done? — Parallax Forums

Accessing an object (F32) from multiple cogs. Can it be done?

J.R.P.J.R.P. Posts: 6
edited 2011-10-15 14:26 in Propeller 1
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

Comments

  • Mike GMike G Posts: 2,702
    edited 2011-10-15 10:05
    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.J.R.P. Posts: 6
    edited 2011-10-15 14:26
    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
Sign In or Register to comment.