Content originally posted in LPCWare by PhilYoung on Fri May 25 15:18:19 MST 2012
I've been using a simple macro for this for a long time with no problems.
#define SET_GPIO(Port,Bits)(Port->MASKED_ACCESS[(Bits)] = (Bits))
#define CLR_GPIO(Port,Bits)(Port->MASKED_ACCESS[(Bits)] = (0))
this agrees with wouters code above, so if things aren't changing I suggest checking first the pin configuration and then the PCB for shorts.
technically
#define SET_GPIO(Port,Bits)(Port->MASKED_ACCESS[(Bits)] = (0xffff))
would also produce the same results, since it is a masked write, but the first may be more efficient as the compiler usually loads (Bits) into a register anyway
a more generic code would be
#define SET_GPIO(Port,Bits,Val)(Port->MASKED_ACCESS[(Bits)] = (Val))