Shop OBEX P1 Docs P2 Docs Learn Events
Can you read and write a subset of portA pins in assembly language ? — Parallax Forums

Can you read and write a subset of portA pins in assembly language ?

Bill BairdBill Baird Posts: 23
edited 2006-07-14 18:54 in Propeller 1
I would like to permanently dedicate 24bits of portA to high speed output (Max 20 MHz) and permanantly dedicate the remaining 8 bits as input for high speed input reads (>50 KBs). So I need assembly routines I believe.

The [noparse][[/noparse]pins] modifier only exists in Spin, and mov can only write all 32 bits to OUTA as best I can see.

The new full manual says something about using the MUXC and a mask, but MUXC only sets the masked bits in a destination to the value of the C flag as best as I can decifer it.

Comments

  • Paul BakerPaul Baker Posts: 6,351
    edited 2006-07-11 23:12
    If you have a portion dedicated to input and a portion dedicated to output, setting the direction will provide the mask for you, anything written to the port will only affect those pins defined as output.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Life is one giant teacup ride.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2006-07-11 23:20
    Bill,

    When you write to OUTA, only those bits set to ones in DIRA will be changed. The other bits are treated as inputs. This is assuming you want to write all 24 bits at once. If you want to change a subset of the output bits, you can read OUTA into a register, AND it with a mask to zero the bits you want to change, OR the result with the changed bits, and write the register back to OUTA. If that takes too many clocks, the other option is to arrange things so that changes can occur in groups of nine bits. Then you can use MOVI, MOVD, or MOVS with OUTA as the destination location.

    -Phil
  • Bill BairdBill Baird Posts: 23
    edited 2006-07-12 02:07
    That's great guys - thanks.

    The DIRA provides the mask. Very straightforward it seems if I want to keep the direction mask constant in DIRA.

    Looks like I doubled this question because at first I couldn't see my post show up in my browser, so I rewrote it.
    Damn ! I don't know how to delete it either. I guess the administrator will catch it.
  • Paul BakerPaul Baker Posts: 6,351
    edited 2006-07-12 02:52
    click the X in the upper right of the message.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Life is one giant teacup ride.
  • Bill BairdBill Baird Posts: 23
    edited 2006-07-13 06:49
    I don't see an X in the upper right of my posted message - at the top here. There are X's in my own reply window but nothing I can see to kill my duplicate post - below this post.
  • Paul BakerPaul Baker Posts: 6,351
    edited 2006-07-14 16:07
    first delete your reply, after all replies are gone (you're they only poster to that thread), you can delete the original post.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Life is one giant teacup ride.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-07-14 17:08
    Paul is correct.· Once there are replies you cannot delete the original message.· I will remove it if it has not been removed yet.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Bill BairdBill Baird Posts: 23
    edited 2006-07-14 18:54
    Thank you - you got there ahead of me - but now I know.
Sign In or Register to comment.