Read/Write to GPIO!

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Read/Write to GPIO!

2,556 次查看
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 .
标签 (1)
0 项奖励
回复
2 回复数

625 次查看
ali_
Contributor I
I can see 20 views but no one bothered to answer;-) Not that fun.


ali
0 项奖励
回复

625 次查看
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 项奖励
回复