4.5 - EDigitalOut [U12 Datasheet] | LabJack
« Close

Datasheets and User Guides

App Notes

Software & Driver


4.5 - EDigitalOut [U12 Datasheet]

Easy function. This is a simplified version of DigitalIO that sets/clears the state of one digital output. Also configures the requested pin to output and leaves it that way.

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

Note that this is a simplified version of the lower level function DigitalIO, which operates on all 20 digital lines. The DLL (ljackuw) attempts to keep track of the current direction and output state of all lines, so that this easy function can operate on a single line without changing the others. When the DLL is first loaded, though, it does not know the direction and state of the lines and assumes all directions are input and output states are low.


long EDigitalOut (    long *idnum,
                      long demo,
                      long channel,
                      long writeD,
                      long state )

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

  • *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.
  • channel – Line to read. 0-3 for IO or 0-15 for D.
  • writeD – If >0, a D line is written as opposed to an IO line.
  • state – If >0, the line is set, otherwise the line is cleared.


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

LabJackPython Example

>>> import u12
>>> d = u12.U12()
>>> d.eDigitalOut(channel=0, state=1, writeD=0)
{'idnum': 12}



I am running an experiment through LabView (with a LabJack) and I got the following error: 

"The VI c:\ProgramFiles\NationalInstruments\LabView8.2\vi.lib\addons\LabJack\ljackuw.lib\EDigitalOut.vi can no longer be found on disk. It has been moved or deleted. Parts of the VI have not yet been loaded into memory. You may not be able to view the block diagram or front panel of this subVI. Saving the subVI will save an incomplete VI."

The thing is, when I go to the file location, the VI is there! The problem here is that it prevents my experiment from running. What gives?



Do other things work normally?  For example, LJtest.exe?

If you close and then re-open LabVIEW, and rather than opening your VI just open EDigitalOut.vi (which is inside ljackuw.lib), does it open and run properly?

Seems like a strange LabVIEW issue, so I would continue this topic on our LabVIEW forum, rather than here, or perhaps even on the LabVIEW forums at ni.com.

I'm trying to exercise the D0-D15 pins on a LabJackU12, using LabJackPython on Mac OS 10.7.4.

Communication with the U12 seems ok, but I get no textual output from:


  >>> import u12

  >>> d = u12.U12();


even though the manual examples show some response to this command coming from the U12. I do get sensible response from other commands, though.

Most importantly, my DVM doesn't show any change of state on the DB25 connector when I use commands such as

    d.eDigitalOut(0, 1)

or when I try to turn on other DIO pins. I read +5v across the DB25 pins 13 and 14, so I know I've identified the correct pin numbering.

Also, perhaps related, my DVM shows unexpectedly high values on the AO0 and AO1 terminals. For example,

   d.eAnalogOut(1.5, 1.5)

produces outputs of ~ +1.64v rather than +1.5v I expected.

Can you please suggest any explanation, sample code using the easy commands or diagnostics I can run?


The U12 examples were written when debugging was turned on by default, so that is why there is more textual output. It is now off by default. Change your U12 initializing call to "d = u12.U12(debug=True)" for the output.

As for eDigitalOut, you are setting IO0 to output-high since the writeD parameter defaults to 0. To set the D lines set the writeD parameter to 1. For example to set D0 to output-high use:

d.eDigitalOut(channel=0, state=1, writeD=1)

As for your analog outputs issue, I am not sure yet what the problem is. I tried your dAnalogOut call on a couple of my U12 test units and it worked fine. It set both AO0 and 1 to ~1.49 V. First, disconnect all connections on your U12. Then try setting the analog outputs and check the voltages. Also, try connecting your analog outputs to analog inputs on your U12 and check your voltage readings with eAnalogIn.

This was really helpful, and I now can turn on the DIO pins. It wasn't obvious from the online documentation which arguments (e.g. writeD) were needed with the e.DigitalOut() command, so may I suggest that you give examples that include all of the required arguments? I probably missed something in the doc that explains this, but it would help people like me if these easy commands had examples that didn't depend on a finer reading of the full doc. Maybe arguments that are optional could be called out in the doc..

Also, thanks for your comments on the output voltage levels. For the DIO pins, I'm getting (unloaded) values of ~ +5.5v. Perhaps it's a calibration issue, although the +5 reference value on pin 13 is +5.0v. I'll investigate and see if I can learn more.



-- Bill



I will have a Python person look at your comments to see if there is documentation to add.

Sounds like you are saying that +5V terminals (all are the same whether on the screw-terminals or the DB25 connector) are reading 5.0 volts, but you see 5.5 volts on a D line with nothing connected when set to output high?  Something is not right, because the voltage at the +5V terminals is the internal supply voltage and the same voltage that the D lines drive, so the D lines can't be higher unless something external is driving them higher.

Thank you for your comments on the examples and documentation. I'll look into updating the examples and demonstrating the usage of more parameters for clarification.

I've got a U12 and a RB16.

I'm trying to trigger a Grayhill 70M-ODC5 on slot U13/R13 on the RB16. And i can't seem to trigger it on and off. Its possible its my wiring

Would the proper code be?

lj.LabJack.EDigitalOut(-1, 0, 13, 1, 1) = off?

lj.LabJack.EDigitalOut(-1, 0, 13, 1, 0) = on?

I've currently got a 12v solenoid hooked up just to test w/ the neg of the Solenoid in 13+ and the Neg of the 12vdc in 13- of the screw terminals, and then i've got the pos's tied together by themselves. The solenoid clicks when it is on, but never stops clicking when i send the above off command. I believe the clicking is because i'm using an old wall wart to power the solenoid(this whole setup screams trouble i know!) but i'm just trying to test my understanding of the coding before i purchase the proper equipment i will be controlling. Thanks!

Yes, your setup sounds fine and your code looks fine.  Perhaps rather than the solenoid just use a resistor for the load.  Then you can use a DMM to measure the voltage across the resistor.  You should see about 0V across the resistor when the RB16 module is off and about 12V across the resistor when the RB16 module is on.