Digital Outputs
[Libraries]

The Digital Out subsystem sends digital values out the 8 high current outputs - 1 (on) or 0 (off). More...


Functions

int DigitalOut_SetActive (int index, int state)
 Enable or disable a DigitalOut.
int DigitalOut_GetActive (int index)
 Read whether a DigitalOut is active.
int DigitalOut_SetValue (int index, int state)
 Turn a Digital Out on or off.
int DigitalOut_GetValue (int index)
 Read whether a DigitalOut is on or off.

Detailed Description

The Digital Out subsystem sends digital values out the 8 high current outputs - 1 (on) or 0 (off).

If you've previously used any of the other systems on the outputs (steppers, motors, etc.), you'll need to set them to inactive to unlock the IO lines and use the Digital Outs.

See the Digital Out section of the Application Board overview for more details.


Function Documentation

int DigitalOut_GetActive ( int  index  ) 

Read whether a DigitalOut is active.

Parameters:
index An integer specifying which Digital Out (0-7).
Returns:
Nonzero when active, 0 when inactive
Example
  if( DigitalOut_GetActive( 5 ) )
  {
    // DigitalOut 5 is active
  }
  else
  {
    // DigitalOut 5 is inactive
  }

Definition at line 140 of file digitalout.c.

int DigitalOut_GetValue ( int  index  ) 

Read whether a DigitalOut is on or off.

Parameters:
index An integer specifying which Digital Out (0-7).
Returns:
The value - on (1) or off (0).
Example
  if( DigitalOut_GetValue( 2 ) )
  {
    // DigitalOut 2 is high
  }
  else
  {
    // DigitalOut 2 is low
  }

Definition at line 197 of file digitalout.c.

int DigitalOut_SetActive ( int  index,
int  state 
)

Enable or disable a DigitalOut.

This is automatically called, setting the channel active, the first time DigitalOut_SetValue() is called. However, the channel must be explicitly set to inactive in order for any other devices to access the I/O lines.

Parameters:
index An integer specifying which Digital Out (0-7).
state An integer specifying the state - on (1) or off (0).
Returns:
Zero on success.
Example
  // Enable DigitalOut 6
  DigitalOut_SetActive( 6, 1 );

Definition at line 112 of file digitalout.c.

int DigitalOut_SetValue ( int  index,
int  state 
)

Turn a Digital Out on or off.

Parameters:
index An integer specifying which Digital Out (0-7).
state An integer specifying the state - on (1) or off (0).
Returns:
Zero on success.
Example
  // Turn digital out 2 on
  DigitalOut_SetValue( 2, 1 );

Definition at line 159 of file digitalout.c.