Listing 4

  /* set bits 0,3, and 7 in the data direction register */
  /* to make those lines (connected to devices 2,1, and 3, */
  /* respectively) output lines in the general purpose I/O */
  /* register */


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

#define BIT_MASK 0x89     /* mask for setting bits 0,3, and 7 */


devs_out()
{
      /* set them one at a time */
  BIT_SET(DDR,DEVICE_1);
  BIT_SET(DDR,DEVICE_2);
  BIT_SET(DDR,DEVICE_3);

      /* set all three at once */
  SET_BITS(DDR,BIT_MASK);
}