Taqoz Reloaded v2.8 - Exploring Locks
The P2 has 16 locks that are useful for protecting data or code from race conditions ( two or more cogs competing for the same resource leading to an indeterminate program state) Here's some code to explore the use of locks ( the assembler P2ASM needs to be loaded before loading the attached code ).
Running DEMO1 shows two cogs setting and releasing a lock each by running the .LOCKS debug word on a third cog.
Running DEMO2 shows two cogs acquiring and releasing one lock to prevent a race condition between them.
Both demos require an ANSI terminal like tera term for Windows and are stopped by pressing any key.