Shop OBEX P1 Docs P2 Docs Learn Events
Read/Write Multiple Pins in Assembly — Parallax Forums

Read/Write Multiple Pins in Assembly

I'm having a hard time figuring out how to interface with chips using multiple data pins.

On the Propeller 1 I could use outa to set multiple I/O pins high or low at the same time.
                                or      outa, data  

I could read multiple pins by using moving the ina register to my data variable.
                                mov    data, ina  

How do I do this sort of think on the P2?

Comments

  • AribaAriba Posts: 2,690
    You can do exactly the same on P2.
    But there are also instructions to set or get a word, a byte or a nibble of porta for example.

    Andy
  • Ariba wrote: »
    You can do exactly the same on P2.

    I just realized I was attempting to find "ina" and "outa" in the P2 instruction list.

    I should have realized "ina" and "out" aren't instructions they're registers.

    Thanks for the help Andy.
  • If you're using Spin2, you'll definitely want to use pinread() and pinwrite(), not ina and outa.
  • JonnyMac wrote: »
    If you're using Spin2, you'll definitely want to use pinread() and pinwrite(), not ina and outa.

    Thanks Jon.

    Making the switch to the P2 has been more challenging than I had thought it would be. I'm confident the 1 megabyte of RAM, double the I/O pins and much faster speed will make the transition worthwhile but brain periodically turns to jelly as I attempt to understand the P2.

  • Cluso99Cluso99 Posts: 18,069
    Duane Degn wrote: »
    JonnyMac wrote: »
    If you're using Spin2, you'll definitely want to use pinread() and pinwrite(), not ina and outa.

    Thanks Jon.

    Making the switch to the P2 has been more challenging than I had thought it would be. I'm confident the 1 megabyte of RAM, double the I/O pins and much faster speed will make the transition worthwhile but brain periodically turns to jelly as I attempt to understand the P2.
    oooh! Can I have one of those P2's with 1MB. Mine only have 512KB :(

    There was an FPGA variant with 1MB IIRC, but don't expect to see a P2 variant with 1MB.
  • Cluso99 wrote: »
    oooh! Can I have one of those P2's with 1MB. Mine only have 512KB :(

    Way to spoil my delusion. I'll need to figure out why I was so sure there was 1 MB in the P2.

    I've run out of RAM in several P1 projects. Hopefully 512KB will be enough for the P2 projects I have planned.

  • Duane Degn wrote: »
    I'll need to figure out why I was so sure there was 1 MB in the P2.
    Cluso99 wrote: »
    There was an FPGA variant with 1MB

    I think I must of read the 1 MB from a document which included the FPGA variant. The active P2 document includes this:
    P2Memory.PNG

    I didn't see the HubRAM mentioned in the P2 Evaluation Board page. The P2 Edge includes this info in the specifications section.
    P2Memory2.PNG

    Thanks for setting me straight Ray.
    1185 x 543 - 49K
    846 x 181 - 21K
  • Duane Degn wrote: »
    JonnyMac wrote: »
    If you're using Spin2, you'll definitely want to use pinread() and pinwrite(), not ina and outa.

    Thanks Jon.

    Making the switch to the P2 has been more challenging than I had thought it would be. I'm confident the 1 megabyte of RAM, double the I/O pins and much faster speed will make the transition worthwhile but brain periodically turns to jelly as I attempt to understand the P2.

    It's a bit of effort, but totally worth it. If you can sit in on my Spin2 sessions, jump in and ask questions so that I or others can lend a hand.
Sign In or Register to comment.