方法1: (軟體AND/OR)
#define _BitMASK 0x000000ff //8bit mask
uint8_t u8Data; //8bit data
while(1)
{
PA->DOUT = (PA->DOUT & ~_BitMASK) | u8Data;
}
方法2: (硬件遮罩)
uint8_t u8Data; //8bit data
PA->DMASK = 0x0000ff00; //Port data output write mask (bit0~7 can be updated, bit8~15 protected)
while(1)
{
PA->DOUT = u8Data;
} |