Listing 3

      /* clear bit 3 in the data direction register */
      /* to make line 3 (from device 1) in the general */
      /* purpose I/O register an input line. Just for */
      /* fun, do it four different, but equivalent, ways. */

#include "mfp_defs.h"         /* MFP address definitions */
#include "mfp_macs.h"         /* MFP macro definitions */

#define BIT3_MASK 0xf7  /* mask for clearing bit 3 */


dev_input()
{
      *(unsigned char *)DDR &= BIT3_MASK;

      REGVAL(DDR) &= BITOFF_MASK(DEVICE_1);

      CLR_BITS(DDR,BITOFF_MASK(DEVICE_1));

      BIT_CLR(DDR,DEVICE_1);
}