learning asm have a quick question
I'm trying to work with I/O ports in assembly and I've run into a problem.
I can set single pins with 'or outa, myregister' no problems, but I need to change the direction of P8-P15 to output, place a byte on those pins, then after a delay turn the direction back to input only on P8-15
What I tried to do was:
mov dira, dbusout 'make P8-P15 output
or outa, #$55
nop
mov dira, dbusin 'change pins back to input
dbusout long $FF<<8
dbusin long $00<<8
I'm totally missing something. Also, I've read a few of the "beginning asm for the propeller tutorials" but I'm looking for something that can explain controlling the ports a little better. I've been using the ATmega chips and defined 8 bit ports. I just need a little nudge in the right direction on this.
Vince
I can set single pins with 'or outa, myregister' no problems, but I need to change the direction of P8-P15 to output, place a byte on those pins, then after a delay turn the direction back to input only on P8-15
What I tried to do was:
mov dira, dbusout 'make P8-P15 output
or outa, #$55
nop
mov dira, dbusin 'change pins back to input
dbusout long $FF<<8
dbusin long $00<<8
I'm totally missing something. Also, I've read a few of the "beginning asm for the propeller tutorials" but I'm looking for something that can explain controlling the ports a little better. I've been using the ATmega chips and defined 8 bit ports. I just need a little nudge in the right direction on this.
Vince
Comments
Note that by using or and andn you do not upset other pins -- this is a good habit to get into as your programs become more complex.
BTW, you should use the [ code ] and [ /code ] tags (sans spaces) around code you want to post.
Also, take a look at the andn command. It will allow you to use the same mask for setting the pins to input as you used for setting them to output.
-Phil
I'm going to try the 'or' instead of the mov. I was changing direction on my other pins, duh. Great help guys. Let you know how it goes. Oh, I'm using a LA to see the results, so I can see ns results if I program the ports correctly.
Vince