Shop OBEX P1 Docs P2 Docs Learn Events
Smart Pins Rev 5 — Parallax Forums

Smart Pins Rev 5

I may be miss reading this paragraph:

If you're familiar with the assembly-language input-output instructions for the Propeller-1 microcontroller you will recognize the following six instructions a Propeller-2 program also may use. These registers give you direct access to I/O pins:

Propeller 2 I/O-pin registers and I/O-pin Instructions
DIRA direction register pins P0..P31, 1= output, 0 = disable output
DIRB direction register pins P63-P32, 1= output, 0 = disable output
OUTA output register bits for pins P0..P31
OUTB output register bits for pins P32..P63
INA input register bits for pins P0..P31
INB input register bits for pins P32..P63

Can you actually use DIRA 0 and OUTA 0 as assembly instructions I can not seem to make this work.
Or does the paragraph actually say Propeller II uses these registers and these are not actually PASM code? When I use DIRA the Propeller tool prompts an error as:
"Expected Instruction,Directive,BYTE/WORD/LONG/END"
Regards and Thanks
Bob (WRD)

Comments

  • Cluso99Cluso99 Posts: 18,069

    In pasm you would use
    mov dira,#0
    mov reg1,ina
    mov outa,#1

  • @"Bob Drury" said:
    I may be miss reading this paragraph:

    If you're familiar with the assembly-language input-output instructions for the Propeller-1 microcontroller you will recognize the following six instructions a Propeller-2 program also may use. These registers give you direct access to I/O pins:

    Propeller 2 I/O-pin registers and I/O-pin Instructions
    DIRA direction register pins P0..P31, 1= output, 0 = disable output
    DIRB direction register pins P63-P32, 1= output, 0 = disable output
    OUTA output register bits for pins P0..P31
    OUTB output register bits for pins P32..P63
    INA input register bits for pins P0..P31
    INB input register bits for pins P32..P63

    Can you actually use DIRA 0 and OUTA 0 as assembly instructions I can not seem to make this work.
    Or does the paragraph actually say Propeller II uses these registers and these are not actually PASM code? When I use DIRA the Propeller tool prompts an error as:
    "Expected Instruction,Directive,BYTE/WORD/LONG/END"
    Regards and Thanks
    Bob (WRD)

    Yes, these are registers, not instructions. There are a number of instructions like DRVL, DRVH, FLTL, FLTH, etc that can operate on ranges of pins to do many of the things that you would have used these registers for on P1, but in a single instruction on the P2, versus multiple instructions on the P1.

    An example is DRVH which performs a combination of setting the relevant OUTx bit(s) for the pin(s) and setting the relevant DIRx bit(s) for output in a single instruction, all without requiring any additional masking to avoid disturbing unaffected bits.

    So, while these registers exist and can be used in ways as @Cluso99 has described, there may be neater ways to achieve what you are trying to do.

  • Thanks Cluso and AJL for response the multipin instruction with addpin pinfield makes sense just saw this interpertation confusion and wasn't sure.
    Regards
    Bob (WRD)

Sign In or Register to comment.