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

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
The
allows you to affect a group of I/O pins at once, without affecting others outside the specified
range. To affect multiple, contiguous I/O pins at once, use a range expression (like x..y) in
the Pin(s) field.
This sets P5, P4 and P3 to outputs; all other bits of
another example:
The above example sets
other bits in their previous state. Consequently, P5 and P4 are now outputs and P3 is an
input.
IMPORTANT: The order of the values in a range-expression affects how it is used. For
example, the following swaps the order of the range-expression of the previous example.
Here,
and P5 an input.
This is a powerful feature of range-expressions, but if care is not taken, it can also cause
strange, unintentional results.
Normally
directions. The following assumes
The above sets
equal to
Page 214 · Propeller Manual v1.0
DIRA[5..3]~~
DIRA[5..3] := %110
DIRA[3..5] := %110
Temp := DIRA[7..4]
DIRA
DIRA
DIRA7:4
DIRA
register supports a special form of expression, called a range-expression, which
bits 3, 4 and 5 are set equal to 1, 1, and 0, respectively, making P3 and P4 outputs
is only written to but it can also be read from to retrieve the current I/O pin
Temp
and the other bits of
– Spin Language Reference
equal to
DIRA
DIRA
bits 5, 4 and 3 equal to 1, 1, and 0, respectively, leaving all
'Set DIRA bits 5 through 3 (P5-P3 to output)
'Set P5 and P4 to output, P3 to input
'Set P3 and P4 to output, P5 to input
'Get direction of P7 through P4
Temp
bits 7, 6, 5, and 4; i.e.: the lower 4 bits of
Temp
is a variable created elsewhere:
are cleared to zero.
DIRA
remain in their previous state. Here’s
Temp
are now

Related parts for 122-32000