DIRA, DIRB

Register: Direction registers for 32-bit ports A and B.

DAT
LabelCondition > Instruction DIRASrcOperand Effects >


DAT
Label > Condition Instruction DestOperandDIRA Effects >


DAT
Label > Condition > Instruction DIRBSrcOperand Effects > (Reserved for future use)


DAT
Label > Condition > Instruction DestOperandDIRB Effects > (Reserved for future use)


Result: Optionally, the direction register is updated.

  • Label is an optional statement label. See Common Syntax Elements.
  • Condition is an optional execution condition. See Common Syntax Elements.
  • Instruction is the desired assembly instruction. DIRA or DIRB may be used in either the assembly instruction's DestOperand or SrcOperand fields.
  • SrcOperand is a constant expression used by Instruction to operate on, and optionally write to, the DIRA or DIRB register in DestOperand.
  • DestOperand is a constant expression indicating the register that is operated on, and optionally written to, using the value of DIRA or DIRB in SrcOperand.

Explanation

DIRA and DIRB are one of six special purpose registers (DIRADIRBINAINBOUTA and OUTB) that directly affect the I/O pins. The DIRA and DIRB register's bits indicate the direction states for each of the 32 I/O pins in Port A and Port B, respectively. DIRB is reserved for future use; the Propeller P8X32A does not include Port B I/O pins so only DIRA is discussed below.

DIRA is a read/write register and can be used in either the DestOperand or SrcOperand fields of an assembly instruction. A low (0) bit sets the corresponding I/O pin to an input direction, and a high (1) bit sets it to an output direction. The following code sets I/O pins P0 through P3 to outputs.

mov    dira,    #$0F 

See Registers, and the Spin language DIRA, DIRB section, for more information. Keep in mind that in Propeller Assembly, unlike in Spin, all 32 bits of DIRA are accessed at once unless the MUXx instructions are used.

Unless otherwise noted, content on this site is licensed under the
Creative Commons Attribution-ShareAlike 4.0 International License.