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

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
Note because of the “wired-OR” nature of the I/O pins, no electrical contention between cogs
is possible, yet they can all still access I/O pins simultaneously. It is up to the application
developer to ensure that no two cogs cause logical contention on the same I/O pin during run
time. Since all cogs share all I/O pins, a cog could use
the pins that are in use by one or more other cogs.
Using INA
Read
was created elsewhere.
This example reads the states of all 32 I/O pins of Port A into
Using the optional Pin(s) field, the cog can read one I/O pin (one bit) at a time. For example:
The above line reads I/O pin 16 and stores its state (0 or 1) in the lowest bit of
bits of
In Spin, the
which allows you to read a group of I/O pins at once, without reading others outside the
specified range. To read multiple, contiguous I/O pins at once, use a range expression (like
x..y) in the Pin(s) field.
Here, the lowest four bits of
and 15, respectively, and all other bits of
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 from the previous example.
Here,
This is a powerful feature of range-expressions, but if care is not taken it can also cause
strange, unintentional results.
Temp := INA
Temp := INA[16]
Temp := INA[18..15]
Temp := INA[15..18]
INA
Temp
Temp
to get the state of I/O pins at that moment. The following example assumes
bits 3, 2, 1, and 0 are set to the states of I/O pins 15, 16, 17, and 18, respectively.
are cleared.
INA
register supports a special form of expression, called a range-expression,
Temp
(3, 2, 1, and 0) are set to the states of I/O pins 18, 17, 16,
4: Spin Language Reference –
'Get state of P0 through P31
'Get state of P16
'Get states of P18:P15
'Get states of P15:P18
Temp
are cleared to 0.
INA
to read pins it is using as well as
Temp
Propeller Manual v1.0 · Page 227
.
Temp
; all other
Temp

Related parts for 122-32000