How to talk to GPIO pins in binary form, LPC824?

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

How to talk to GPIO pins in binary form, LPC824?

489 次查看
joren_joly
Contributor II

Hello,

I was wondering how to do the following: I'm using an LPC824 and I want to write to gpio_1 and to gpio_15 on the same time, what i can do is just use the Chip_GPIO_SetPinstate function and this works, but i would love to do this just binary.

So instead of:     Chip_GPIO_SetPinState(LPC_GPIO_PORT,0,15,true);

                           Chip_GPIO_SetPinState(LPC_GPIO_PORT,0,1,true);

something like:   *LPC_GPIO_PORT->B[0] = 0b1000000000000010;

But this seems to fail, but i cant figure out why...

Thanks in advance!

标记 (2)
0 项奖励
1 回复

423 次查看
Sabina_Bruce
NXP Employee
NXP Employee

Hello Joren,

Can you try to do the hex value for the binary for example LPC_GPIO_PORT->B[0] |= 0b8002;. Check to see if this results different.

Also instead of just using an equal sign, make sure you use |= or & ~(...) depending if you want to turn on or off certain bits so you do not modify any other configurations.

Let me know your results

Sabina

0 项奖励