PAR Registers (such as DIRA) in ASM?
Steel
Posts: 313
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·
·
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
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
Post Edited (deSilva) : 7/11/2007 7:32:26 PM GMT
lesson two uses a variety of mask types that can be used on DIRA just as well as OUTA
Graham