Required component name is "Bit1".
Examples of a typical usage of this component follow:
(1)
Required component settings:
- Name: Bit1
- Direction: input
MAIN.C
void main(void)
{
...
/* Wait until logical "1" is on the pin */
while( !Bit1_GetVal() );
...
}
(2)
Required component settings:
- Name: Bit1
- Direction: output
MAIN.C
void main(void)
{
...
for (;;) {
Bit1_NegVal(); // Invert output level on the pin
}
...
}
(3)
This example emulates an open drain output pin. The direction of the component is set to input/output
and the safe mode is disabled. External pull-up resistor should be connected to the pin.
Required component settings:
- Name: Bit1
- Direction: input/output
- Safe mode: disabled
- pull-up: no pull resistor
MAIN.C
void main(void)
{
...
/* Set input mode. */
Bit1_SetDir(FALSE);
/* Logical "1" is on the pin */
...
/* Set output mode */
Bit1_SetDir(TRUE);
/* Set output value to "0" */
Bit1_ClrVal();
/* Logical "0" is on the pin */
...
}
(4)
This example shows how the value written to the component when it is set to the input direction is
written to the output after the direction is switched to output.
The safe mode is enabled and an external pull-up resistor should be connected to the pin.
Required component settings:
- Name: Bit1
- Direction: input/output
- Safe mode: enabled
- Pull-up: no pull resistor
MAIN.C
void main(void)
{
...
/* Set input mode */
Bit1_SetDir(FALSE);
/* Logical "1" is on the pin */
/* Set output value to "0", which will be
applied when the component will be set to output mode */
Bit1_ClrVal();
/* Set output mode */
Bit1_SetDir(TRUE);
/* Logical "0" is on the pin */
...
}