122-32000 Parallax Inc, 122-32000 Datasheet - Page 234

MANUAL PROPELLER

122-32000

Manufacturer Part Number
122-32000
Description
MANUAL PROPELLER
Manufacturer
Parallax Inc
Datasheets

Specifications of 122-32000

Accessory Type
Manual
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
For Use With/related Products
Propeller Education (PE) Kit
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
LOCKSET
Set lock to true and get its previous state.
((PUB ┆ PRI))
Returns: Previous state of lock (
Explanation
LOCKSET
manage resources that are user-defined and deemed mutually-exclusive.
to
See About Locks, page 230, and Suggested Rules for Locks, page 231 for information on the
typical use of locks and the
The following assumes that a cog (either this one or another) has already checked out a lock
using
cog has an array of longs called
PUB ReadResource | Idx
PUB WriteResource | Idx
Both of these methods,
after accessing the resource. First, they wait indefinitely at the first repeat loop until it has
locked the resource; i.e.: it has successfully “set” the associated lock. If
the condition “until not lockset…” is false, meaning that some other cog is currently
accessing the resource, so that first repeat loop tries again. If
Page 234 · Propeller Manual v1.0
TRUE
LOCKSET
repeat until not lockset(SemID) 'wait until we lock the resource
repeat Idx from 0 to 9
lockclr(SemID)
repeat until not lockset(SemID) 'wait until we lock the resource
repeat Idx from 0 to 9
lockclr(SemID)
LocalData[Idx] := long[Idx]
long[Idx] := LocalData[Idx]
LOCKNEW
and retrieves the previous state of that lock (
ID
is one of four lock commands (
is the ID (0 – 7) of the lock to set to
( ID )
and shared the ID with this cog, which saved it as
– Spin Language Reference
ReadResource
LOCK
LocalData
xxx commands.
TRUE
or
and
FALSE
.
LOCKNEW
WriteResource
'read all 10 longs of resource
'unlock the resource
'write all 10 longs to resource
'unlock the resource
).
TRUE
,
.
TRUE
LOCKRET
or
, follow the same rules before and
FALSE
,
LOCKSET
).
SemID
LOCKSET
, and
. It also assumes this
LOCKSET
LOCKSET
returns
LOCKCLR
returns
sets lock ID
FALSE
) used to
TRUE
, the
,

Related parts for 122-32000