Propeller Manual

Table Of Contents
INA, INB – Spin Language Reference
INA, INB
Register: Input Registers for 32-bit Ports A and B.
((PUB PRI))
INA [Pin(s)]
((PUB PRI))
INB [Pin(s)] (Reserved for future use)
Returns: Current state of I/O Pin(s) for Port A or B.
Pin(s) is an optional expression, or a range-expression, that specifies the I/O pin, or
pins, to access in Port A (0-31) or Port B (32-63). If given as a single expression,
only the pin specified is accessed. If given as a range-expression (two expressions in
a range format; x..y) the contiguous pins from the start to end expressions are
accessed.
Explanation
INA and INB are two of six registers (DIRA, DIRB, INA, INB, OUTA and OUTB) that directly affect
the I/O pins. The
INA register contains the current states for each of the 32 I/O pins in Port A;
bits 0 through 31 correspond to P0 through P31. The
INB register contains the current states
for each of the 32 I/O pins in Port B; bits 0 through 31 correspond to P32 through P63.
NOTE:
INB is reserved for future use; the Propeller P8X32A does not include Port B I/O pins
so only
INA is discussed below.
INA is read-only and is not really implemented as a register but rather is just an address that,
when accessed as a source item in an expression, reads the Port A I/O pins directly at that
moment. In the result, a low (0) bit indicates the corresponding I/O pin senses ground, and a
high (1) bit indicates the corresponding I/O pin senses VDD (3.3 volts). Since the Propeller
is a CMOS device, the I/O pins sense anything above ½ VDD to be high, so a high means the
pin senses approximately 1.65 volts or higher.
Each cog has access to all I/O pins at any given time. Essentially, all I/O pins are directly
connected to each cog so that there is no hub-related mutually exclusive access involved.
Each cog has its own
INA pseudo-register that gives it the ability to read the I/O pins states
(low or high) at any time. The actual I/O pins’ values are read, regardless of their designated
input or output direction.
Page 118 · Propeller Manual v1.1