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

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

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

424 Views
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!

Tags (2)
0 Kudos
1 Reply

358 Views
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 Kudos