Support and Documentation
Breadcrumbs

4.17 - DigitalIO [U12 Datasheet]

Reads and writes to all 20 digital I/O. The order of execution within the U12 is:

  1. Set D states

  2. Set D directions

  3. Set IO states

  4. Set IO directions

  5. Read D states

  6. Read IO states

Even more detail of the execution order with the approximate time between each step:

  1. Set D7-D0 states

  2. 1 µs

  3. Set D12-D8 states

  4. 2 µs

  5. Set D15-D13 states

  6. 0.5 µs

  7. Set D7-D0 directions

  8. 1 µs

  9. Set D12-D8 directions

  10. 1 µs

  11. Set D15-D13 directions

  12. 16 µs

  13. Set IO states

  14. 16 µs

  15. Set IO directions

  16. 2 µs

  17. Read D7-D0 states

  18. 0.3 µs

  19. Read D12-D8 states

  20. 0.7 µs

  21. Read D15-D13 states

  22. 10 µs

  23. Read IO states

Execution time for this function is 20 milliseconds or less (typically 16 milliseconds in Windows).

Declaration:

long DigitalIO ( long *idnum,
long demo,
long *trisD,
long trisIO,
long *stateD,
long *stateIO,
long updateDigital,
long *outputD )

Parameter Description:
Returns: LabJack errorcodes or 0 for no error.
Inputs:

  • *idnum – Local ID, serial number, or -1 for first found.

  • demo – Send 0 for normal operation, >0 for demo mode. Demo mode allows this function to be called without a LabJack.

  • *trisD – Directions for D0-D15. 0=Input, 1=Output.

  • trisIO – Directions for IO0-IO3. 0=Input, 1=Output.

  • *stateD – Output states for D0-D15.

  • *stateIO – Output states for IO0-IO3.

  • updateDigital – If >0, tris and state values will be written. Otherwise, just a read is performed.

Outputs:

  • *idnum – Returns the local ID or –1 if no LabJack is found.

  • *trisD – Returns a read of the direction registers for D0-D15.

  • *stateD – States of D0-D15.

  • *stateIO – States of IO0-IO3.

  • *outputD – Returns a read of the output registers for D0-D15.