BitsIO
 
Component BitsIO
General Multi-Bits Input/Output (1-8 bits)
Component Level: High
Typical Usage:
(Examples of a typical usage of the component in user code. For more information please see the page Component Code Typical Usage.)

Required component name is "Bits1". List of used pin from the port contents four items.
Examples of a typical usage of this component follow:

(1)
The direction of the component is set to input.

 MAIN.C

void main(void)
{
  /* Wait until "1010" is on the pins */
  while( Bits1_GetVal() != 10 );
    :
}

(2)
The direction of the component is set to output.

 MAIN.C

void main(void)
{
  Bits_PutVal(10);    // "1010" is on the pins
  for (;;) {
    Bits1_NegBit(3);  // Invert output level of fourth pin
  }
}

(3)
The direction of the component is set to input/output.

 MAIN.C

void main(void)
{
  Bits1_SetDir(FALSE);  // Set input mode

  /* Wait until "1111" is on the pins */
  while( Bits1_GetVal() != 15 );
  
  Bits1_SetDir(TRUE);   // Set output mode

  Bits_PutVal(0);       // Set "0000" on the pins
}