/* PORT_WR() performs a buffered write of the "mask"ed bits of "val" to
 * "port" (P1, P2, etc.) through the port's output latch register.  This
 * technique is especially useful to deal with any read-modify-write
 * issues a port may have.
 */
#define PORT_WR(port, val, mask) 
        (port = (port##_OLR ^= (port##_OLR ^ (val)) & (mask)))