Shop OBEX P1 Docs P2 Docs Learn Events
H48C accelerometer code on ObEx, why run in new cog? — Parallax Forums

H48C accelerometer code on ObEx, why run in new cog?

bulkheadbulkhead Posts: 405
edited 2008-01-03 01:16 in Propeller 1
I'm just wondering why the code in the ObEx for the Parallax H48C tri-axis accelerometer needs to run in its own cog. Any particular reason for this? I'm just checking because I need to free up a cog and it seems like the acc has no real reason for needing its own cog.

If I did modify the object to not run in its own cog, could I simply remove the last "JMP #H48C" line so that the assembly portion doesn't loop infinitely but terminates and goes back to my main program (wherever I "called" that method)? To use the modified object, I would have some method like "refreshValues" that would call the assembly routine to execute just once to update all of the variables.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I'm new to the propeller!

Comments

  • deSilvadeSilva Posts: 2,967
    edited 2008-01-03 01:16
    You need a COG for the machine program to reside. Of course you can try to merge it with some of your own machine code, if it fits into the COG RAM...
Sign In or Register to comment.