Read/Write to GPIO!

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Read/Write to GPIO!

2,341 Views
ali_
Contributor I
Folks! any thoughts for incrementing the value on GPIO_B_DR register? I want to increment the GPIO_B_DR value with factor of tow after every iteration but no luck so far;-) I'm getting the '0' value every time.

Any pointros to freescale usenet community/archive will be great help as people here don't seem that much participating for simple questions;-)

register po;

asm(move #$0002 , X:GPIO_B_DR);
po = 0;

while(1)
{
asm(move X:GPIO_B_DR , X0);
asm(move X0 , po);

po = po + 2;

asm(move X0 , po);
asm(move X:GPIO_B_DR , X0);

}

Let me put elaborate my question again. I want to write some value to GPIO b port and then i want o read that value do something (say increment or decrement) before updating (writing back) the B port again.

Thanks for your time.
ali

The chip i'm using is 56f801 .
Labels (1)
0 Kudos
2 Replies

410 Views
ali_
Contributor I
I can see 20 views but no one bothered to answer;-) Not that fun.


ali
0 Kudos

410 Views
J2MEJediMaster
Specialist I
Not much here to go on.

1) Are you configuring the register for read and write operations prior to accessing it? Can you see that you read the contents of the register successfully?

2) If indeed you are incrementing the value by a factor of two, you'd probably want to perform a shift on register X0's contents, rather than use an add instruction?

---Tom
0 Kudos