lpcware

Writing 8 bit data on port in fastest way

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by aamir ali on Mon Aug 12 04:48:46 MST 2013
What is the fastest way to write 8 bit data on continuous port pins.

Can't I write in one go. I didn't find data register for that.Only way I can find faster is use RMW.

 temp = PIN& 0x000000ff;
temp = temp | (data & 0x000000ff);
PIN= data;


2. Also there is strct for GPIO in LPC13uxx.h  Now if I redine PIN[2] as

union
{
__IO uint32_t PIN[2];

struct
{
__IO uint8_t PIN_byte[8];           /* get it in 8 byte format */
};
};



Now write like:
PIN_byte[0] = (uint8_t)data;


I am not sure if PIN register can be accessed in 8 bits. Is it correct way.



Outcomes