Shop OBEX P1 Docs P2 Docs Learn Events
PAR Registers (such as DIRA) in ASM? — Parallax Forums

PAR Registers (such as DIRA) in ASM?

SteelSteel Posts: 313
edited 2007-07-11 19:52 in Propeller 1
I am learning how to setup the DIRA Register in ASM, but I don't see how you can access bits 18-22 ("CON")?

I have the following code that sets pins 31-23, 17-9, 8-0 using the MOVI, MOVS, and MOVD command.

How do you assign the direction of bits 18-22?

DAT
'
······· ORG·· 0
········
INITIALIZE
······· MOVI·· DIRA, # $1FF
······· MOVD·· DIRA, # $1FF
······· MOVS·· DIRA, # $1FF
TOGGLE·······
······· MOVS·· OUTA, #$1FF
······· MOVD·· OUTA, #$1FF
······· MOVI·· OUTA, #$1FF
·······
······· XOR··· OUTA, #$1FF
······· JMP········· #TOGGLE·
·

Comments

  • deSilvadeSilva Posts: 2,967
    edited 2007-07-11 19:24
    There is more than one way to do it - generally you define a LONG containing the (static) pattern. In case you compute the I/O port numbers you have them in a register anyhow.

    When you modify or change the setting, use OR (or maybe also AND and ANDN)

    DIRA is a PRIVATE register for every COG you need not be afraid to disturb another COG's settings. In case of conflicts, there is a good description in the manual, and you can find it out yourself by studying the main architecture sketch of the Prop, that gives you all ANDs and ORs between registers and I/O pins.

    Edit: When you start, all bits are zero. To set them all, do e.g.
    SUB DIRA, #1

    Be inventive smile.gif

    Post Edited (deSilva) : 7/11/2007 7:32:26 PM GMT
  • Graham StablerGraham Stabler Posts: 2,507
    edited 2007-07-11 19:52
    http://forums.parallax.com/forums/default.aspx?f=25&m=187621

    lesson two uses a variety of mask types that can be used on DIRA just as well as OUTA

    Graham
Sign In or Register to comment.