Shop OBEX P1 Docs P2 Docs Learn Events
Propeller OS versions - what about DIRA/OUTA/INA commands for pin I/O? — Parallax Forums

Propeller OS versions - what about DIRA/OUTA/INA commands for pin I/O?

Cluso99Cluso99 Posts: 18,069
edited 2013-08-02 20:40 in Propeller 1
I have thought about adding the ability of simple setting and reading the propeller I/O pins using OS commands.

Firstly, has anyone done this?

What about the format?

I am thinking of using the DIRA, OUTA and INA commands with parameters...

What format should we use? For example...

SD:>DIRA [pin]=1
SD:>DIRA Pn=1
SD:>DIRA [pin]~
SD:>DIRA Pn~
SD:>DIRA [pin]:=1

Should we handle multiple pins on a line? If so, what format?
Use comma separated
Use spin syntax...
SD:>DIRA [1..3]~

OUTA would work exactly like DIRA.

INA would read all pins and extract only those required by the parameters. If no parameters, show all.
For a single pin a 1 or 0 would be fine.
For multiple pins, should we display Hex, Binary and Decimal on the same line? For example...
SD:>INA
$xxxxxxxx %bbbbbbbb_bbbbbbbb_bbbbbbbb_bbbbbbbb dddddddddd

Maybe we could also add WAITPEQ and WAITPNE ?

Any comments/ideas?

Comments

  • Bill HenningBill Henning Posts: 6,445
    edited 2013-08-02 18:22
    Sounds interesting.

    I assume the "shell" cog would maintain the dira/pina status and not need to fork a separate cog for it...
  • Cluso99Cluso99 Posts: 18,069
    edited 2013-08-02 19:12
    Sounds interesting.

    I assume the "shell" cog would maintain the dira/pina status and not need to fork a separate cog for it...

    No need for a separate cog to do this. In my OS, everything is a separate command file, so any command can be added simply. Also, leaves the most hub space free. So DIRA, OUTA and INA are actually separate files, as are DIR, COPY, REN (rename), DEL (delete), etc. makes it easy to customise, or add, any command required.
  • Mike GreenMike Green Posts: 23,101
    edited 2013-08-02 19:49
    FemtoBasic uses Spin syntax. With multiple output pins, I'd allow a binary, hex, or decimal constant. FemtoBasic's number scanner (getAnyNumber - around line 1260) can handle all of these as well as single quoted characters.
  • Cluso99Cluso99 Posts: 18,069
    edited 2013-08-02 20:40
    Thanks Mike. I will take a look. Silly to reinvent the wheel as it leaves more time to invent something not already done.
Sign In or Register to comment.