Home
LabJack UE9 User's Guide
Contents
1. 120 5 3 16 SPI Control command sends and receives serial data using SPI synchronous communication Command OxF8 4 NumSPIWords Ox3A Checksum16 LSB Checksum16 MSB SPIOptions Bit 7 AutoCS Bit 6 DisableDirConfig Bits 1 0 SPIMode 0 A 1 B 2 C 3 D 7 SPIClockFactor 8 Reserved 9 CSPinNum 10 CLKPinNum 11 MISOPinNum 12 MOSIPinNum 13 NumSPI BytesToTransfer 14 SPIByte0 byte 0 Checksum8 1 2 3 4 5 6 W oo msn ok 9 Checksum8 OxF8 1 NumSPIWords Ox3A Checksum16 LSB Checksum16 MSB Errorcode NumSPIBytesTransferred SPIByteO e NumSPlWords This is the number of SPI bytes divided by 2 If the number of SPI bytes is odd round up and add an extra zero to the packet e SPlOptions If AutoCS is true the CS line is automatically driven low during the SPI communication and brought back high when done If DisableDirConfig is true this function does not set the direction of the lines whereas if it is false the lines are configured as CS output CLK output MISO input and MOSI output SPlMode specifies the standard SPI mode as discussed below e SPiClockFactor Sets the frequency of the SPI clock according the following approximate formula Frequency 1000000 8 10 256 SPIClockFactor where passing a value of O corresponds to a factor of 256 and thus a maximum frequency of about 125 kHz e CS CLK MISO MOSI PinNum Assigns which digital I O line is used for each SPI line Value passed is 0 2
2. 4 2 2 OpenLabJack Call OpenLabJack before communicating with a device This function can be called multiple times however once a LabJack is open it remains open until your application ends or the DLL is unloaded If OpenLabJack is called repeatedly with the same parameters thus requesting the same type of connection to the same LabJack the driver will simply return the same LJ_HANDLE every time Internally nothing else happens This includes when the device is reset or disconnected Once the device is reconnected the driver will maintain the same handle If an open call is made for USB and then Ethernet a different handle will be returned for each connection type and both connections will be open OpenLabJackS is a special version of open where DeviceType and ConnectionType are strings rather than longs This is useful for passing string constants in languages that cannot include the header file The strings should contain the constant name as indicated in the header file such as LJ_dtUE9 and LJ_ctUSB The declaration for the S version of open is the same as below except for const char pDeviceType const char pConnectionType Declaration LJ_ERROR _stdcall OpenLabJack long DeviceType long ConnectionType const char pAddress long FirstFound LJ_HANDLE pHandle Parameter Description Returns LabJack errorcodes or 0 for no error Inputs e DeviceType The type of LabJack to open Constants a
3. Declaration LJ ERROR _stdcall eGet LJ HANDLE Handle long Channel long State 65 Parameter Description Returns LabJack errorcodes or 0 for no error Inputs e Handle Handle returned by OpenLabJack e Channel The channel to write to 0 22 corresponds to FIOO MIO2 e State The state to write to the digital output O False Low and 1 True High 4 2 21 eTCConfig An easy function that configures and initializes all the timers and counters This is a simple alternative to the very flexible OType based method normally used by this driver When needed this function automatically configures the needed lines as digital Declaration LJ ERROR _stdcall eGet LJ HANDLE Handle long aEnableTimers long aEnableCounters long TCPinOffset long TimerClockBaselndex long TimerClockDivisor long aTimerModes double aTimerValues long Reserved1 long Reserved2 Parameter Description Returns LabJack errorcodes or 0 for no error Inputs e Handle Handle returned by OpenLabJack e aEnableTimers An array where each element specifies whether that timer is enabled Timers must be enabled in order starting from 0 so for instance TimerO and Timer2 cannot be enabled without enabling Timer1 also A nonzero value for an array element specifies to enable that timer For the UE9 this array must always have at least 6 elements e aEnableCounters An array where each element specifies whether that
4. If the box is known to be electrically isolated from the LabJack the box ground can simply be connected to LabJack GND An example would be if the box was plastic powered by an internal battery and does not have any wires besides the signal and ground which are connected to AINx and GND on the LabJack Such a case is obviously isolated and easy to keep isolated In practical applications though signals thought to be isolated are often not at all or perhaps are isolated at some time but the isolation is easily lost at another time If the box ground is known to be the same as the LabJack GND then perhaps only the one signal wire needs to be connected to the LabJack but it generally does not hurt to go ahead and connect the ground wire to LabJack GND with a 100 resistor You definitely do not want to connect the grounds without a resistor If little is known about the box ground a DMM can be used to measure the voltage of box ground compared to LabJack GND As long as an extreme voltage is not measured it is generally OK to connect the box ground to LabJack GND but it is a good idea to put in a 100 Q series resistor to prevent large currents from flowing on the ground Use a small wattage 22 resistor typically 1 8 or 1 4 watt so that it blows if too much current does flow The only current that should flow on the ground is the return of the analog input bias current which is on the order of nanoamps for the UE9 The SGND terminal
5. A pointer to the result value px1 A pointer to the x1 parameter of this item in the list pUserData A pointer to data that is simply passed along with the request and returned unmodified Can be used to store any sort of information with the request to allow a generic parser to determine what should be done when the results are received 4 2 10 DoubleToStringAddress Some special channels of the config OType pass IP address and others in a double This function is used to convert the double into a string in normal decimal dot or hex dot notation Declaration LJ ERROR _stdcall DoubleToStringAddress double Number char pString long HexDot Parameter Description Returns LabJack errorcodes or 0 for no error Inputs e Number Double precision number to be converted e pString Must pass a buffer for the string of at least 24 bytes e HexDot If not equal to zero the string will be in hex dot notation rather than decimal dot Outputs e pString A pointer to the string representation 4 2 11 StringToDoubleAddress Some special channels of the config lO Type pass IP address and others in a double This function is used to convert a string in normal decimal dot or hex dot notation into a double 61 Declaration LJ_ERROR _stdcall StringToDoubleAddress const char pString double pNumber long HexDot Parameter Description Returns LabJack errorcodes or 0 for no error Inputs e pString
6. 13 Period input 16 bit falling edges OMONDOOARWBNH O All timers use the same timer clock which affects modes 0 1 2 3 4 7 12 and 13 The timer clock is determined by dividing the base clock by the clock divisor The divisor has a range of 0 255 where 0 corresponds to a division of 256 There are 2 choices for the timer base clock TimerBaseClock 0 750 kHz 1 48 MHz System The low level TimerCounter function has a bit called UpdateConfig that must be set to change the timer clock timer modes or number of timers counters enabled When this bit is set all timers and counters are re initialized The LabJackUD driver automatically sets this bit if any write requests are executed related to mode enabling disabling or clock configuration The low level TimerCounter function has UpdateReset bits for each timer that must be set to change the timer value The LabJackUD driver automatically sets the appropriate bit when a 35 value write is executed The low level TimerCounter function has Reset bits for each counter that must be set to reset the counter to zero The LabJackUD automatically sets the appropriate bit when a reset request is executed 2 10 1 Timer Mode Descriptions 2 10 1 1 PWM Output 16 Bit Mode 0 Outputs a pulse width modulated rectangular wave output Value passed should be 0 65535 and determines what portion of the total time is spent low out of 65536 total increments That means the duty cycle can
7. 66 A 2 22 BTOV AMOS iii A aia cme 67 4 3 Example PSeudocode occoccccccccccconccnnncnonononononcnonononononnnnnnnnnnnnonnnonnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnos 68 ASA ODS Mt il dida 68 43 2 Configuration aeee ae it titi 68 AS SAMO ES as ds Beads an de vente AAA A AAA A td 69 4 3 4 Analog Outputs sce inienn rasara ke drvu iak kiesto tee davakar HENNAR ENAT Eda PENA KE NTETE TATEEK EGE iotr ea 70 ASSO DIe ON 70 4 3 6 Timers amp COUIMEIS cocccococccocccocccocnnocn cnn 71 43A Stream Mod A evi ee Matis ete ts a etd ener 74 4 3 8 Raw Output In put cece cece cece cece anA E E a E a AE EEA ENAERE EE EAEE 78 ARO Easy FUNCIONS ti a a AEA Stee E A E 78 4 3 10 SPI Serial Communication oooccocccinonococococoncccn cnn cnn nn 79 4 3 11 C Serial CoMMunication A ee ct ok 8 fl ek A 80 4 3 12 Asynchronous Serial Communication 2 cccceeeeeeeeeedeeneeeeeeeeenessennneeeemeneesnensons 82 A SENS NWN AVGNOOG TSU O 83 4 3 14 Miscellaneous iia atl Avie vie reliant AA eeee 84 AA AOLO EE A dore 86 5 Low Level Function Reference ccoiicocicinicinnccccccccnnccnnnrn nr 89 5 1 General Protocol sarae ee are e rea e e an E A a aea e e aaea a aaia at d a aaa 89 5 2 Comm FUNCION ranas is atan 92 52N COMME o as 92 5 22 UR ees 94 5 2 9 Discovery UDP as 95 5 3 CONtrol FUNCION S ccs cecsespetesccissdcecadescastccacncatatesiadeatahcases cid alcoi ica asias 96 5 31 BadCheckSU a AAAA E idad 96 93 2 CONntrol OMB gis See saint ae wheels nal ah ta an
8. AIN1190 7 NO7 NOO 9 AIN112 AIN117 NOS NO3 AIN115 g INH ADDA 7 V ADDB 0 g GND ADDC g MAX4051A Figure 2 2 Typical External Multiplexer Connections To make use of external multiplexers the user must be comfortable reading a simple schematic such as Figure 2 2 and making basic connections on a solderless breadboard such as the EB37 Initially it is recommended to test the basic operation of the multiplexers without the MIO lines connected Simply connect different voltages to NOO and NO1 connect ADDA ADDB ADDC to GND and the NOO voltage should appear on COM Then connect ADDA to VS and the NO1 voltage should appear on COM If any of the AIN channel numbers passed to a UEQ function are in the range 16 127 extended channels the MIO lines will automatically be set to output and the correct state while sampling that channel For instance a channel number of 28 will cause the MIO to be set to b100 and the ADC will sample AIN1 Channel number besides 16 127 will have no affect on the MIO The extended channel number mapping is shown in Table 2 2 In command response mode after sampling an extended channel the MIO lines remain in that same condition until commanded differently by another extended channel or another function When streaming with any extended channels the MIO lines are all set to output low for any non extended analog channels For special channels digital timers counters the MIO are driven to unsp
9. If the number of bytes is odd round up and add an extra zero to the packet This parameter is actually just to specify the size of this packet as the Numl2CbytesToSend parameter below actually specifies how many bytes will be sent I2COptions If ResetAtStart is true an 12C bus reset will be done before communicating e SpeedAdjust Allows the communication frequency to be reduced 0 is the maximum speed of about 150 kHz 20 is a speed of about 70 kHz 255 is the minimum speed of about 10 kHz e SDAP SCLP PinNum Assigns which digital I O line is used for each 12C line Value passed is 0 22 corresponding to the normal digital I O numbers as specified in Section 2 9 Note that the screw terminals labeled SDA and SCL are not used for I2C Note that 126 the 12C bus generally requires pull up resistors of perhaps 4 7 kQ from SDA to Vs and SCL to Vs Address This is the first byte of data sent on the 12C bus The upper 7 bits are the address of the slave chip and bit 0 is the read write bit Note that the read write bit is controlled automatically by the LabJack and thus bit O is ignored Numl2CBytesToSend Specifies how many 12C bytes will be sent 0 240 Numl2CBytesToReceive Specifies how many 12C bytes will be read 0 240 I2Cbyte In the command these are the bytes to send In the response these are the bytes read Numl2CWordsReceive This is the number of 12C bytes to receive divided by 2 If the number of bytes is odd the value i
10. TimerClockBase TimerClockDivisor divided by 2 The following table shows the range of available PWM frequencies based on timer clock settings PWM68 Frequency Ranges TimerBaseClock Divisor 1 Divisor 256 0 750 kHz 2929 69 11 44 750000 1 48 MHz System 187500 00 732 42 48000000 The same clock applies to all timers so all 8 bit PWM channels will have the same frequency and will have their falling edges at the same time PWM output starts by setting the digital line to output low for the specified amount of time The output does not necessarily start instantly but rather waits for the internal clock to roll For example if the PWM frequency is 100 Hz that means the period is 10 milliseconds and thus 36 after the command is received by the device it could be anywhere from 0 to 10 milliseconds before the start of the PWM output 2 10 1 3 Period Measurement 32 Bit Modes 2 amp 3 Mode 2 On every rising edge seen by the external pin this mode records the number of clock cycles clock frequency determined by TimerClockBase TimerClockDivisor between this rising edge and the previous rising edge The value is updated on every rising edge so a read returns the time between the most recent pair of rising edges In this 32 bit mode the Control processor must jump to an interrupt service routine to record the time so small errors can occur if another interrupt is already in progress The possible error sources are e Other edge inte
11. all channels except 129 135 and 137 143 have the same calibration for a given input range 19 The readings from channel numbers 14 128 and 15 136 Vref and GND come through the normal input signal conditioning and thus the binary to voltage calculation is the same as AINO AIN13 The other internal readings 129 135 and 137 143 have a signal path outside the normal multiplexers and thus have different calibration constants Table 2 4 shows where the various calibration values are stored in the Mem area Generally when communication is initiated with the UE9 three calls will be made to the ReadMem function to retrieve the first 3 blocks of memory This information can then be used to convert all analog input readings to voltages The high level Windows DLL does this automatically Starting Block Byte Normal ADC Nominal Value 0 0 Slope Unipolar G 1 7 7503E 05 volts bit 0 8 Offset Unipolar G 1 1 2000E 02 volts 0 16 Slope Unipolar G 2 3 8736E 05 volts bit 0 24 Offset Unipolar G 2 1 2000E 02 volts 0 32 Slope Unipolar G 4 1 9353E 05 volts bit 0 40 Offset Unipolar G 4 1 2000E 02 volts 0 48 Slope Unipolar G 8 9 6764E 06 volts bit 0 56 Offset Unipolar G 8 1 2000E 02 volts 1 0 Slope Bipolar G 1 1 5629E 04 volts bit 1 8 Offset Bipolar G 1 5 1760E 00 volts Starting Block Byte Miscellaneous Nominal Value 2 0 Slope DACO 8 4259E 02 bits volt 2 8 Offset DACO 0 0000E 00 bits 2 16 Slope DAC1 8 4259E 02 bits volt 2 24 O
12. and in particular no error checking is shown The language used for the pseudocode is C 4 3 1 Open The initial step is to open the LabJack and get a handle that the driver uses for further interaction The DeviceType for the UE9 is LJ_dtuE9 There are two choices for ConnectionType for the UE9 LJ_ctUSB LJ_ctETHERNET Following is example pseudocode to open a UE9 over USB Open the first found LabJack UE9 over USB OpenLabJack LJ_dtUE9 LJ_ctUSB 1 1 amp lngHandle Following is example pseudocode to open a UE9 over Ethernet Open a specified LabJack UE9 over Ethernet OpenLabJack LJ_dAtUE9 LJ_ctETHERNET 192 168 1 209 0 amp lingHandle The reason for the quotes around the address is because the address parameter is a string in the OpenLabJack function The ampersand amp in front of IngHandle is a C notation that means we are passing the address of that variable rather than the value of that variable In the definition of the OpenLabJack function the handle parameter is defined with an asterisk in front meaning that the function expects a pointer i e an address In general a function parameter is passed as a pointer address rather than a value when the parameter might need to output something The parameter value passed to a function in C cannot be modified in the function but the parameter can be an address that points to a value that can be changed Pointers are also used when passing a
13. bit O set are counted Assume this mode is enabled with a value of 1 meaning that the debounce period is 87 ms and negative edges will be counted When the input detects a negative edge it increments the count by 1 and then waits 87 ms before re arming the edge detector Any negative edges within the 87 ms debounce period are ignored This is good behavior for a normally high signal where the switch closure causes a brief low signal Figure 2 9 The debounce period can be set long enough so that bouncing on both the switch closure and switch open is ignored When only updating and not configuring writing a value of zero to the timer performs a reset After reset a read of the timer value will return zero until a new edge is detected If a timer is reset and read in the same function call the read returns the value just before the reset 2 10 1 7 Frequency Output Mode 7 Outputs a square wave at a frequency determined by TimerClockBase TimerClockDivisor divided by 2 Timer Value The Value passed should be between 0 255 where 0 is a divisor of 256 By changing the clock configuration and timer value a wide range of frequencies can be output The maximum frequency is 48000000 2 24 MHz The minimum frequency is 750000 256 2 256 5 7 Hz The frequency output has a 3 dB frequency of about 10 MHz on the FIO lines Accordingly at high frequencies the output waveform will get less square and the amplitude will decrease 38 The outpu
14. function or a channel is passed that was not in the request list LabJack not found at the given id or address Unable to send or receive the correct number of bytes The first two tables list errors which are specific to a request For example LJE_INVALID_ CHANNEL_ NUMBER If this error occurs other requests are not affected The last table lists errors which cause all pending requests for a particular Go to fail with the same error If this type of error is received the state of any of the request is not known For example if requests are executed with a single Go to set the AIN range and read an AIN and the read fails with an LJE_COMM_FAILURE it is not known whether the AIN range was set to the new value or whether it is still set at the old value 88 5 Low Level Function Reference This section describes the low level functions of the UE9 These are commands sent over Ethernet or USB directly to the processors on the UE9 The Ethernet commands can all be sent using TCP except for DiscoveryUDP All commands except stream related commands can also be sent using UDP The majority of Windows users will use the high level UD driver rather than these low level functions 5 1 General Protocol Following is a description of the general UE9 low level communication protocol There are two types of commands Normal 1 command word plus 0 7 data words Extended 3 command words plus 0 125 data words Normal commands have a s
15. which is no problem for the UE9 The series resistor should be 22 kQ or less to make sure the voltage on the I O line when low is pulled below 0 8 volts 30 The other possible consideration with the basic push pull signal is the ground connection If the signal is known to already have a common ground with the UE9 then no additional ground connection is used If the signal is known to not have a common ground with the UEQ then the signal ground can simply be connected to UE9 GND If there is uncertainty about the relationship between signal ground and UE9 ground e g possible common ground through AC mains then a ground connection with a 100 series resistor is generally recommended see Section 2 7 3 4 Push Pull 5 Digital Signal Input Ec Rground A GND or round SGND Figure 2 9 Driven Signal Connection To Digital Input Figure 2 9 shows typical connections Rground is typically 0 100 Rseries is typically 0 Q short circuit for 3 3 5 volt logic or 22 kQ max for high voltage logic Note that an individual ground connection is often not needed for every signal Any signals powered by the same external supply or otherwise referred to the same external ground should share a single ground connection to the UES9 if possible When dealing with a new sensor a push pull signal is often incorrectly assumed when in fact the sensor provides an open collector signal as described next 2 9 1 2 Input Open Collector Signals Open
16. 0 0 0 0 AddRequest lngHandle LJ_ioADD_STREAM_ CHANNEL 2 0 0 0 AddRequest lngHandle LJ_ioADD_STREAM_ CHANNEL 3 0 0 0 Execute the requests GoOne IngHandle Next start the stream Start the stream eGet lIngHandle LJ_ioSTART_STREAM 0 dblValue 0 The actual scan rate is dependent on how the desired scan rate divides into the LabJack clock The actual scan rate is returned in the value parameter from the start stream command actualScanRate dblValue actualSampleRate 2 dblValue Once a stream is started the data must be retrieved periodically to prevent the buffer from overflowing To retrieve data add a request with IOType 17 _ioceET_STREAM_DATA The Channel parameter should be 17_chaLL_CHANNELS Or a specific channel number ignored for a single channel stream The Value parameter should be the number of scans all channels or samples single channel to retrieve The x1 parameter should be a pointer to an array that has been initialized to a sufficient size Keep in mind that the required number of elements if retrieving all channels is number of scans number of channels Data is stored interleaved across all streaming channels In other words if two channels are streaming O and 1 and 1 7_chaLL_cHANNELS is the channel number for the read request the data will be returned as Channel0 Channel1 Channel0 Channel1 etc Once the data is read it is removed from the
17. A pointer to the string representation e HexDot If not equal to zero the passed string should be in hex dot notation rather than decimal dot Outputs e pNumber A pointer to the double precision representation 4 2 12 StringToConstant Converts the given string to the appropriate constant number Used internally by the S functions but could be useful to the end user when using the GetFirst Next functions without the ability to include the header file In this case a comparison could be done on the return values such as if IO Type StringToConstant LJ_ioANALOG_INPUT This function returns LJ_INVALID_CONSTANT if the string is not recognized Declaration long _stdcall StringToConstant const char pString Parameter Description Returns Constant number of the passed string Inputs e pString A pointer to the string representation of the constant Outputs e None 4 2 13 ErrorToString Outputs a string describing the given error code or an empty string if not found Declaration void _stdcall ErrorToString LJ_ERROR ErrorCode char pString Parameter Description Returns LabJack errorcodes or 0 for no error Inputs e ErrorCode LabJack errorcode e pString Must pass a buffer for the string of at least 256 bytes Outputs e pString A pointer to the string representation of the errorcode 62 4 2 14 GetDriverVersion Returns the version number of this Windows LabJack driver Decla
18. At 6 5 volts there is a 1 mV offset noticed on other channels increasing to a 5 mV offset at 15 0 volts 3 This is the steady state input bias current and impedance When the analog input multiplexer changes from one channel to another at a different voltage more current is briefly required to change the charge on the input amplifier The steady state input bias current is very flat across the common mode voltage range except for voltages of about 4 5 or higher where the bias current shifts to typically 250 nA 4 To meet specifications the impedance of the source signal should be kept at or below the specified value With a higher source impedance noticable static errors can occur due to the bias current flowing through the source impedance There are also dynamic errors that can become noticable as the source impedance can degrade the ability of the internal multiplexer to settle quickly when changing between channels with different voltages 5 Divide by the number of channels to determine the maximum scan rate Assumes an Ethernet or USB high high connection Other USB connections might not be able to maintain 50 ksamples s See Section 3 2 for more information 6 When scanning more than 1 channel in a stream this is the time between each sample within a scan 132 Parameter S Conditions Min Typical Max Units Analog Outputs Nominal Output Range 1 Resolution Absolute Accuracy 2 Integral Linearity Error D
19. Certain low power USB ports can be limited to 100 milliamps and some power modes of the UE9 use more than 100 milliamps A USB hub with a power supply self powered will always provide 500 milliamps for each port 12 USB ground is connected to the UE9 ground and USB ground is generally the same as the ground of the PC chassis and AC mains In this case the UEQ is not electrically isolated when the USB cable is connected The details of the UE9 USB interface are handled by the high level drivers Windows LabJackUD DLL so the following information is really only needed when developing low level drivers The LabJack vendor ID is OxOCD5 The product ID for the U3 is 0x0009 The USB interface consists of the normal bidirectional control endpoint 0 and two bidirectional bulk endpoints Endpoint 1 and Endpoint 2 Endpoint 1 consists of a 16 byte OUT endpoint address 0x01 and a 16 byte IN endpoint address 0x81 Endpoint 2 consists of a 64 byte OUT endpoint address 0x02 and a 64 byte IN endpoint address 0x82 Commands can be sent on either endpoint and the response will be sent on the same endpoint except that stream data is always transferred on IN Endpoint 2 regardless of whether the stream start command was sent on OUT Endpoint 1 or 2 Commands can be sent on both endpoints at the same time but as with any connection on the UE9 do not send a second command on an endpoint until after receiving the response to the first com
20. Gaede cde dete 29 Figure 2 9 Driven Signal Connection To Digital Input eee eee ects eeeetneeeeeeeeeeeetetteeeeeeeeeeees 31 Figure 2 10 Open Collector NPN Connection To Digital Input eee eect eeeeeeeeeeeeeeeeeees 31 Figure 2 11 Basic Mechanical Switch Connection To Digital Input 0 ce eeeeeeeeeeeeeeeees 32 Figure 2 12 Passive Hardware Debounce 22 2 ccceceeeeeeeeeeeeceeeetee sees seeeeeeeedeeeseesseeceneneneeness 33 Figure 2 13 Relay Connections Sinking Control High Side Load Switching 33 Table 3 1 Typical Feedback Function Execution Times ooooocccconccononcconccnnonononnnnnnnnccnnncnnnnnnnnns 44 Table 3 2 Typical SinglelO Function Execution Times For Analog Input UE9 Pro 45 Table 3 3 Typical TimerCounter Function Execution Times oooonocononccccnnccocononcnaannnncnnncnnnnnnnnns 45 Table 3 4 Recommended Maximum Stream Data Rates ooocconccoconcccccccccnononannnnncnnnnncnanannnns 46 Table 3 5 Actual Maximum Stream Data Rates Resoluti0N 12 eee eee eeeeeeeeeeneee 46 Table 3 6 Special Stream Channels oooooccccnnccnncconncnnncnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnninnnnss 48 Table 4 1 Request Level Error Codes Part 1 cccs cecesnceeeeeeeeeeeeeeeeeeeeeeeseeseneneeeeeeeeeenensees 86 Table 4 2 Request Level Error Codes Part 2 cccccccsecececcceereeeeneseeneeeeeeeeeeeesdeeessneneeeeeedeeeees 87 Table 4
21. IOType Channel Value x1 ingErrorcode eGet lngHandle LJ_ioGET_AIN 3 amp dblValue 0 In the case of the UES9 the first example using add go get handles both the DAC command and AIN read in a single low level call while in the second example using ePut eGet two low level commands are used Examples in the following documentation will use both the add go get method and the ePut eGet method and they are generally interchangeable See Section 4 3 for more pseudocode examples All the request and result functions always have 4 common parameters and some of the functions have 2 extra parameters e Handle This is an input to all request result functions that tells the function what LabJack it is talking to The handle is obtained from the OpenLabJack function e lOType This is an input to all request result functions that specifies what type of action is being done e Channel This is an input to all request result functions that generally specifies which channel of I O is being written read although with the config OTypes special constants are passed for channel to specify what is being configured e Value This is an input or output to all request result functions that is used to write or read the value for the item being operated on e x1 This parameter is only used in some of the request result functions and is used when extra information is needed for certain lOTypes e UserData This parameter is only used in
22. Output Ranges The typical output range of the DACs is about 0 02 to 4 86 volts For other unipolar ranges an op amp in the non inverting configuration Figure 2 3 can be used to provide the desired gain For example to increase the maximum output from 4 86 volts to 10 0 volts a gain of 2 06 is required If R2 in Figure 2 3 is chosen as 100 kQ then an R1 of 93 1 kQ is the closest 1 resistor that provides a gain greater than 2 06 The V supply for the op amp would have to be greater than 10 volts 28 For bipolar output ranges such as 10 volts a similar op amp circuit can be used to provide gain and offset but of course the op amp must be powered with supplies greater than the desired output range depending on the ability of the op amp to drive it s outputs close to the power rails For example the EB37 experiment board provides power supplies that are typically 9 5 volts If these supplies are used to power the LT1490A op amp linear com which has rail to rail capabilities the outputs could be driven very close to 9 5 volts If 12 or 15 volt supplies are available then the op amp might not need rail to rail capabilities to achieve the desired output range A reference voltage is also required to provide the offset In the following circuit DAC1 is used to provide a reference voltage The actual value of DAC1 can be adjusted such that the circuit output is 0 volts at the DACO mid scale voltage and the value of R1 can be adjust
23. a 16 bit parameter where each bit corresponds to AINO AIN15 Ifa bit is 1 that channel will be acquired 90 The digital I O masks such as FlOMask specify that the passed value for direction and state are updated if a bit 1 If a bit of the mask is O only a read is performed on that bit of I O Resolution All analog input functions have a Resolution parameter This allows you to choose between speed or resolution See Sections 3 1 and 3 2 for timing information SettlingTime Some analog input functions have a SettlingTime parameter This parameter adds extra settling time before each sample of about SettlingTime 5 microseconds Binary Encoded Parameters Many parameters in the following functions use specific bits within a single integer parameter to write read specific information In particular most digital I O parameters contain the information for each bit of I O in one integer where each bit of I O corresponds to the same bit in the parameter e g the direction of FIOO is set in bit O of parameter FIODir For instance in the function ControlConfig the parameter FIODir is a single byte 8 bits that writes reads the direction of each of the 8 FIO lines if FIODir is O all FIO lines are input if FlODir is 1 2 FIOO is output FIO1 FIO7 are input if FIODir is 5 2 2 FIOO and FIO2 are output all other FIO lines are input if FIODir is 255 2 2 FIOO FIO7 are output 91 5 2 Comm Func
24. are special channels used with the get put config OTypes to configure a parameter that applies to all timers counters LJ_ChNUMBER_TIMERS_ENABLED UpdateConfig will be set if writing LJ_chTIMER_CLOCK_BASE UpdateConfig will be set if writing LJ_chTIMER_CLOCK_DIVISOR UpdateConfig will be set if writing With the clock base special channel above the following constants are passed in the value parameter to select the frequency LJ_tc750KHZ Fixed 750 kHz clock base LJ_tcSYS System clock 48 MHz Following is example pseudocode for configuring various timers and a hardware counter First an add go get block to configure the timers and counters Enable all 6 timers Timer0 Timer5 will appear on FIOO FIO5 AddRequest lngHandle LJ_ioPUT_CONFIG LJ_chNUMBER_TIMERS_ENABLED 6 0 0 Enable Counter0 It will use the next available line FIO6 AddRequest lngHandle LJ_ioPUT_COUNTER_ENABLE 0 1 0 0 A11 output timers use the same timer clock which is determined by the base clock divided by the clock divisor Set the timer clock base to 48 MHz AddRequest lngHandle LJ_ioPUT_CONFIG LJ_chTIMER_CLOCK_BASE LJ_tcSYS 0 0 Set the timer clock divisor to 48 creating a 1 MHz timer clock AddRequest lngHandle LJ_ioPUT_CONFIG LJ_chTIMER_CLOCK_DIVISOR 48 0 0 Configure Timer0 as 8 bit PWM It will have a frequency of 1M 256 3906 25 Hz AddRequest IngHandle LJ_ioPUT_TIMER_MODE 0 LJ_tm
25. be varied from 100 0 out of 65536 are low to 0 0015 65535 out of 65536 are low The overall frequency of the PWM output is the clock frequency specified by TimerClockBase TimerClockDivisor divided by 2 The following table shows the range of available PWM frequencies based on timer clock settings PWM16 Frequency Ranges TimerBaseClock Divisor 1 Divisor 256 0 750 kHz 11 44 0 04 750000 1 48 MHz System 732 42 2 86 48000000 The same clock applies to all timers so all 16 bit PWM channels will have the same frequency and will have their falling edges at the same time PWM output starts by setting the digital line to output low for the specified amount of time The output does not necessarily start instantly but rather waits for the internal clock to roll For example if the PWM frequency is 100 Hz that means the period is 10 milliseconds and thus after the command is received by the device it could be anywhere from 0 to 10 milliseconds before the start of the PWM output 2 10 1 2 PWM Output 8 Bit Mode 1 Outputs a pulse width modulated rectangular wave output Value passed should be 0 65535 and determines what portion of the total time is spent low out of 65536 total increments The lower byte is actually ignored since this is 8 bit PWM That means the duty cycle can be varied from 100 0 out of 65536 are low to 0 4 65280 out of 65536 are low The overall frequency of the PWM output is the clock frequency specified by
26. both DACs Typical usage of the watchdog is to configure the reset defaults as desired and then use the watchdog simply to reset the device on timeout Note that some USB hubs do not like to have any USB device repeatedly reset With such hubs the operating system will quit reenumerating the device on reset and the computer will have to be rebooted so avoid excessive resets with hubs that seem to have this problem If the watchdog is accidentally configured to reset the Comm processor with a very low timeout period such as 1 second it could be difficult to establish any communication with the device In such a case the reset to default jumper can be used to turn off the watchdog Power up the U3 with a short from FIO2 lt gt SCL then remove the jumper and power cycle the device again This resets all power up settings to factory default values There is one lOType used to configure and control the watchdog LJ_ioSWDT_CONFIG Channel is enable or disable constant The watchdog settings are stored in non volatile flash memory and reloaded at reset so every request with this IO Type causes a flash erase write The flash has a rated endurance of at least 20000 writes which is plenty for reasonable operation but if this IO Type is called in a high speed loop the flash could be damaged The following are special channels used with the watchdog config OType above LJ_chSWDT_ENABLE Value is timeout in seconds 1 65535 LJ_chSWD
27. buffer is to continue reading data after StreamStop until there is no more the read times out This should not require a long timeout as the data is not being acquired but simply waiting to be retrieved from the UE9 FIFO buffer Another option is to follow the StreamStop command with a FlushBuffer command Then just try to read the last 128 bytes that could still be in the USB buffer A third option is to do a StreamStop and a FlushBuffer if desired and then do not attempt to empty the USB buffer but always discard the first two StreamData packets after StreamStart 13 2 2 Ethernet The UE9 has a 10Base T Ethernet connection This connection only provides communication so power must be provided by an external power supply or USB connection The Ethernet connection on the UE9 has 1500 volts of galvanic isolation As long as the USB cable is not connected the overall isolation level of the UE9 will be determined by the power supply All power supplies shipped by LabJack Corporation with the UE9 have at least 500 volts of isolation See a note about power over Ethernet POE in Section 2 3 The UE9 has a 10Base T Ethernet connection This connection only provides communication so power must be provided by an external power supply or USB connection The UE9 ships with an Ethernet patch cable that would normally be used to connect to a hub or switch A direct connection from the UE9 to a computer might require a crossover cable not in
28. buffer on the host is controlled by 17_chsTREAM_BUFFER_sIZE The application software on the host must read data out of the UD stream buffer fast enough to prevent overflow After each read use LJ_chSTREAM_BACKLOG_uD to determine how many samples are left in the buffer In stream mode the LabJack acquires inputs at a fixed interval controlled by the hardware clock on the device itself and stores the data in a buffer The LabJackUD driver automatically reads data from the hardware buffer and stores it in a PC RAM buffer until requested The general procedure for streaming is Update configuration parameters Build the scan list Start the stream Periodically retrieve stream data in a loop Stop the stream Following is example pseudocode to configure a 2 channel stream In addition to the stream parameters configured below some applications might also need to configure analog input settings such as range and resolution Set the scan rate AddRequest lngHandle LJ_ioPUT_CONFIG LJ_chSTREAM_SCAN_FREQUENCY scanRate 0 0 75 Give the UD driver a 5 second buffer scanRate 2 channels 5 seconds AddRequest lngHandle LJ_ioPUT_CONFIG LJ_chSTREAM_BUFFER_SIZE scanRate 2 5 0 0 Configure reads to wait and retrieve the desired amount of data AddRequest lngHandle LJ_ioPUT_CONFIG LJ_chSTREAM_WAIT_MODE LJ_swSLEEP 0 0 Define the scan list as AIN2 then AIN3 AddRequest lngHandle LJ_ioCLEAR STREAM _ CHANNELS
29. but the time per loop iteration will be pretty consistent Since the LabJack clock could be faster than the PC clock it is recommended to request more scans than are expected each time so that the application does not get behind e LJ _swSLEEP This makes the Go command a blocking call The Go command will loop until the requested amount of is retrieved or no new data arrives from the device before timeout In this mode the hardware dictates the timing of the application The time per loop iteration will vary but the number of samples read per loop will be the same every time A Get command should be called to determine whether all the data was retrieved or a timeout condition occurred and none of the data was retrieved e LJ swALL_OR_NONE If available the Go call will retrieve the amount of data requested otherwise it will retrieve no data A Get command should be called to determine whether all the data was returned or none This could be a good mode if hardware timed execution is desirable but without the application continuously waiting in SLEEP mode The following pseudocode reads data continuously in SLEEP mode as configured above Read data until done while done Must set the number of scans to read each iteration as the read returns the actual number read numScans 1000 Read the data Note that the array passed must be sized to hold enough SAMPLES and the Value passed specifies the number of SCANS to re
30. called repeatedly to repeat the current list of requests Go does not clear the list of requests Rather after a call to Go the first subsequent AddRequest call to a particular device will clear the previous list of requests on that particular device only 58 Note that for a single Go or GoOne call the order of execution of the request list cannot be predicted Since the driver does internal optimization it is quite likely not the same as the order of AddRequest function calls One thing that is known is that configuration settings like ranges stream settings and such will be done before the actual acquisition or setting of outputs Declaration LJ_ERROR _stdcall Go Parameter Description Returns LabJack errorcodes or 0 for no error Inputs e None Outputs e None 4 2 7 GoOne After using AddRequest to make an internal list of requests to perform call GoOne to actually perform the requests This function causes all requests on one particular LabJack to be performed After calling GoOne call GetResult or similar to retrieve any returned data or errors GoOne can be called repeatedly to repeat the current list of requests GoOne does not clear the list of requests Rather after a particular device has performed a GoOne the first subsequent AddRequest call to that device will clear the previous list of requests on that particular device only Note that for a single Go or GoOne call
31. can be used instead of GND for externally powered signals A series resistor is not needed as SGND is fused to prevent overcurrent but a resistor will eliminate confusion that can be caused if the fuse is tripping and resetting In general if there is uncertainty a good approach is to use a DMM to measure the voltage on each signal ground wire without any connections to the UE9 If no large voltages are noted connect the ground to UE9 SGND with a 100 series resistor Then again use the DMM to measure the voltage of each signal wire before connecting to the UE9 Another good general rule is to use the minimum number of ground connections For instance if connecting 8 sensors powered by the same external supply or otherwise referred to the same external ground only a single ground connection is needed to the UE9 Perhaps the ground leads from the 8 sensors would be twisted together and then a single wire would be connected to a 100 Q resistor which is connected to UE9 ground 2 7 3 5 Amplifying small signal voltages The best results are generally obtained when a signal voltage spans the full analog input range of the LabJack If the signal is too small it can be amplified before connecting to the LabJack One good way to handle low level signals such as thermocouples is the LJTick InAmp which is a 2 channel instrumentation amplifier module that plugs into the UE9 screw terminals Go to labjack com for more information For a do it yoursel
32. internal buffer and the next read will give new data If multiple channels are being streamed data can be retrieved one channel at a time by passing a specific channel number in the request In this case the data is not removed from the internal buffer until the last channel in the scan is requested Reading the data from the last channel not necessarily all channels is the trigger that causes the block of data to be removed from the buffer This means that if three channels are streaming 0 1 and 2 in that order in the scan list and data is requested from channel 0 then channel 1 then channel 0 again the request for channel 0 the second time will return the same data as the first request New data will not be retrieved until after channel 2 is read since channel 2 is last in the scan list If the first get stream data request is for 10 samples from channel 1 the reads from channels 0 and 2 also must be for 10 samples Note that when reading stream data one channel at a time not using L J_ChALL_CHANNELS the scan list cannot have duplicate channel numbers There are three basic wait modes for retrieving the data e LJ swNONE The Go call will retrieve whatever data is available at the time of the call up to the requested amount of data A Get command should be called to determine how 76 many scans were retrieved This is generally used with a software timed read interval The number of samples read per loop iteration will vary
33. not reset the watchdog If the watchdog timer is not reset before 117 it counts up to TimeoutPeriod the actions specified by WatchdogOptions will occur The watchdog timer has a clock rate of about 1 Hz so a TimeoutPeriod range of 1 65535 corresponds to about 1 to 65535 seconds DIOConfig Determines which digital I O is affected by the watchdog and the state it is set to The digital I O is a value from 0 22 according to the following 0 7 FIOO FIO7 8 15 EIOO EIO7 16 19 CIO0 CIO3 20 22 MIOO MIO2 DAC Specifies values for the DACs on watchdog timeout The UE9 has 12 bit analog outputs so pass an output value between 0 and 4095 plus set bit 7 of the high byte accordingly If Bit7 is set on either DAC then both are enabled To disable the DACs set to high impedance bit 7 must be O for both DACs 118 5 3 14 WatchdogRead Reads the current watchdog settings Command o Byt 0 1 2 3 4 5 Response W Soma ono oO t 8 9 11 12 13 14 15 Checksum8 OxF8 0x00 0x09 Checksum16 LSB Checksum16 MSB Checksum8 OxF8 0x05 0x09 Checksum16 LSB Checksum16 MSB Errorcode WatchdogOptions TimeoutPeriod DIOConfigA DIOConfigB DACO DAC1 119 5 3 15 Reset Control command causes a soft or hard reset Affects both processors Command Byte 0 Checksum8 1 0x99 2 ResetOptions Bit 1 Hard Reset Bit 0 Soft Reset 3 0x00 Response Byte 0 Checksum8 1 0x99 2 0x00 3 Errorcode
34. of the command and Vs might dip slightly while increasing a command due to the increased current draw of the UE9 thus this reading might be slightly lower than a comparative reading from an external DMM which averages over a longer time The channels with the same names are identical For instance channel 133 or 141 both read the same internal temperature sensor See Section 2 7 4 for information about the internal temperature sensor The DB37 connector has 3 MIO lines designed to address expansion multiplexer ICs integrated circuits allowing for up to 112 total external analog inputs The MAX4051A maxim ic com is a recommended multiplexer and a convenient 5 8 volt power supply is available so the multiplexers can pass bipolar signals see Vm Vm discussion in Section 2 12 Note that the EB37 experiment board accessory is a convenient way to connect up to 7 MAX4051A multiplexer chips but the UE9s 5 8 volt supply should still be used to power the chips as the 10 volt supply on the EB37 is beyond the rating of the MAX4051A Figure 2 2 shows the typical connections for a pair of multiplexers 17 NO4 V AIN124 1 16 AIN126 NOS NO2 0 AIN122 AIN13 300M NO1 8 AIN121 e MIO2 AIN12 AIN1278 NO7 NOO 7 AIN120 e MIO1 GND e AIN1250 NO5 NO3 78 AIN123 e MIOO e g MH ADDA 4 o e VM z7 V ADDB 50 e e VM g GND ADDC g MAX4051A anios No4 EY ve i AIN11805 NO6 NO2 q5 AIN114 z CM NO17 AIN113
35. or read various stream values LJ_chSTREAM_SCAN_FREQUENCY LJ_chSTREAM_BUFFER_SIZE UD driver stream buffer size in samples LJ_chSTREAM_CLOCK_OUTPUT True False S Section 3 2 1 LJ_chSTREAM_EXTERNAL TRIGGER True False S Section 3 2 1 LJ_chSTREAM_WAIT_MODE LJ_chSTREAM_BACKLOG_COMM Read only 0 0 and 128 100 LJ_chSTREAM_BACKLOG_CONTROL Read only Number of samples LJ_chSTREAM_BACKLOG_UD Read only Number of samples LJ_chSTREAM_SAMPLES_PER_PACKET Read only Always 16 LJ_chSTREAM_READS_PER_SECOND Default 25 With the wait mode special channel above the following constants are passed in the value parameter to select the behavior when reading data LJ_swNONE No wait Immediately return available data LJ_swALL_OR_NONE No wait Immediately return requested amount or none LJ_swPUMP Advance message pump wait mode 74 LJ_swSLEEP Wait until requested amount available The backlog special channels return information about how much data is left in the hardware stream buffers on the UE9 These parameters are updated whenever a stream packet is read by the driver and thus might not exactly reflect the current state of the buffers but can be useful to detect problems When streaming the Control processor acquires data at precise intervals and transfers it to the Comm processor which has a large data buffer The Control processor has a small data buffer 256 samples for data waiting to be trans
36. power up default for a line is changed to a different voltage or disabled there is a delay of about 100 ms at power up where the DACs are in the factory default condition The analog outputs can withstand a continuous short circuit to ground even when set at maximum output Voltage should never be applied to the analog outputs as they are voltage sources themselves In the event that a voltage is accidentally applied to either analog output they do have protection against transient events such as ESD electrostatic discharge and continuous overvoltage or undervoltage of a few volts There is an accessory available from LabJack called the LJTick DAC that provides a pair of 14 bit analog outputs with a range of 10 volts The LJTick DAC plugs into any digital I O block and thus up to 10 of these can be used per UE9 to add 20 analog outputs 2 8 1 Typical Analog Output Connections 2 8 1 1 High Current Output The DACs on the UE9 can output quite a bit of current but have 50 of source impedance that will cause voltage drop To avoid this voltage drop an op amp can be used to buffer the output such as the non inverting configuration shown in Figure 2 2 A simple RC filter can be added between the DAC output and the amp input for further noise reduction Note that the ability of the amp to source sink current near the power rails must still be considered A possible op amp choice would be the TLV246x family ti com 2 8 1 2 Different
37. receives data 56 4 2 4 eAddGoGet This function passes multiple requests via arrays then executes a GoOne and returns all the results via the same arrays The parameters that start with a are arrays and all must be initialized with at least a number of elements equal to NumRequests Declaration LJ_ERROR _stdcall e AddGoGet LJ HANDLE Handle long NumRequests long alOTypes long aChannels double aValues long ax1s long aRequestErrors long GoError long aResultErrors Parameter Description Returns LabJack errorcodes or 0 for no error Inputs e Handle Handle returned by OpenLabJack e NumRequests This is the number of requests that will be made and thus the number of results that will be returned All the arrays must be initialized with at least this many elements alOTypes An array which is the list of IOTypes aChannels An array which is the list of Channels aValues An array which is the list of Values to write ax1s An array which is the list of x1s Outputs aValues An array which is the list of Values read e aRequestErrors An array which is the list of errorcodes from each AddRequest e GoError The errorcode returned by the GoOne call e aResultErrors An array which is the list of errorcodes from each GetResult 4 2 5 AddRequest Adds an item to the list of requests to be performed on the next call to Go or GoOne When AddReq
38. resistor values 2 9 1 4 Output Controlling Relays All the digital I O lines have series resistance that restricts the amount of current they can sink or source but solid state relays SSRs can usually be controlled directly by the digital I O The SSR is connected as shown in the following diagram where VS 5 volts connects to the positive control input and the digital I O line connects to the negative control input sinking configuration Solid State Relay e VS Ext Load Control Supply Load e Digital I O Figure 2 13 Relay Connections Sinking Control High Side Load Switching When the digital line is set to output low control current flows and the relay turns on When the digital line is set to input control current does not flow and the relay turns off When the digital line is set to output high some current flows but whether the relay is on or off depends on the specifications of a particular relay It is recommended to only use output low and input For example the Series 1 D12 D24 or Series T TD12 TD24 relays from Crydom specify a max turn on of 3 0 volts a min turn off of 1 0 volts and a nominal input impedance of 1500 Q e When the digital line is set to output low it is the equivalent of a ground connection with 180 Q ElO CIO MIO or 550 FIO in series When using an EIO CIO MIO line the resulting voltage across the control inputs of the relay will be about 5 1500 1500 180 4 5 volts the
39. the list of requests Use GetFirstResult and GetNextResult to step through the list of results in order When either function returns LJE_NO_MORE_DATA_AVAILABLE there are no more items in the list of results Items can be read more than once by calling GetFirstResult to move back to the beginning of the list UserData is provided for tracking information or whatever else the user might need None of the Get functions clear results from the list The first AddRequest call subsequent to a Go call will clear the internal lists of requests and results for a particular device When processing raw in out or stream data requests the call to a Get function does not actually cause the data arrays to be filled The arrays are filled during the Go call if data is available and the Get call is used to find out many elements were placed in the array 60 It is acceptable to pass NULL or 0 for any pointer that is not required The parameter lists are the same for the GetFirstResult and GetNextResult declarations Declaration LJ ERROR _stdcall GetFirstResult _LJ_ HANDLE Handle long plOType long pChannel double pValue long px1 double pUserData Parameter Description Returns LabJack errorcodes or 0 for no error Inputs e Handle Handle returned by OpenLabJack Outputs plOType A pointer to the OType of this item in the list pChannel A pointer to the channel number of this item in the list pValue
40. the maximum current and how much voltage drop can be tolerated across the shunt For instance if the maximum current is 1 0 amp and 2 5 volts of drop is the most that can be tolerated without affecting the load a 2 4 Q resistor could be used That equates to 2 4 watts though which would require a special high wattage resistor A better solution would be to use a 0 1 Q shunt and then use an amplifier to increase the small voltage produced by that shunt If the maximum current to measure is too high e g 100 amps it will be difficult to find a small enough resistor and a hall effect sensor should be considered instead of a shunt The following figure shows typical connections for a 3 wire 4 20 mA sensor A typical value for the shunt would be 240 Q which results in 0 96 to 4 80 volts 3 wire 4 20 mA Sensor Vs Signal Supply Common 4 20mA AINx Current Ext y Shunt Supply a 0 100 SGND Figure 2 7 Current Measurement With 3 Wire 4 20 mA Sourcing Sensor The sensor shown in Figure 2 7 is a sourcing type where the signal sources the 4 20 mA current which is then sent through the shunt resistor and sunk into ground Another type of 3 wire sensor is the sinking type where the 4 20 mA current is sourced from the positive supply sent through the shunt resistor and then sunk into the signal wire If sensor ground is connected to UE9 ground the sinking type of sensor presents a couple of problems as the voltage across the sh
41. the version number of the Comm firmware A firmware upgrade will generally cause this parameter to change The lower byte is the integer portion of the version and the higher byte is the fractional portion of the version 93 5 2 2 FlushBuffer Resets the pointers to the stream buffer to make it empty Often called before a stream after a stream or both Command Byte 0 0x08 1 0x08 Response Byte 0 0x08 1 0x08 94 5 2 3 DiscoveryUDP This is a special function only used over Ethernet UDP Send the 6 byte command below to port 52362 using the broadcast IP of 255 255 255 255 The command will try to go to every device on the subnet and every Ethernet LabJack should send back the specified 38 byte response The response is similar to the response from the CommConfig function See Section 5 2 1 for additional documentation DiscoveryUDP and the standard Ping function are useful for finding Ethernet connected UE9s and testing basic communication Command D Byt 0 1 2 3 4 5 Response U oonoason gt olg o 0x22 0x78 0x00 OxA9 0x00 0x00 Checksum8 0x78 0x10 OxA9 Checksum16 LSB Checksum16 MSB 0x00 0x00 LocallD PowerLevel IPAddress Gateway Subnet PortA PortB DHCPConfig ProductID MACAddress HWVersion CommFWVersion 95 5 3 Control Functions These are functions that are handled by the Control processor and thus the packet destination bit is 1 for remote Most functio
42. then passed on to other functions to identify the opened LabJack long signed 32 bit integer To maintain compatibility with as many languages as possible every attempt has been made to keep the parameter types very basic Also many functions have multiple prototypes The declarations that follow are written in C To help those unfamiliar with strings in C these functions expect null terminated 8 bit ASCII strings How this translates to a particular development environment is beyond the scope of this documentation A const char is a pointer to a string that won t be changed by the driver Usually this means it can simply be a constant such as this is a string A char is a pointer to a string that will be changed Enough bytes must be preallocated to hold the possible strings that will be returned Functions with char in their declaration will have the required length of the buffer documented below Pointers must be initialized in general although null 0 can be passed for unused or unneeded values The pointers for GetStreamData and RawIn RawOut requests are not optional Arrays and char type strings must be initialized to the proper size before passing to the DLL 4 2 1 ListAll Returns all the devices found of a given DeviceType and ConnectionType Searching over Ethernet relies on the DiscoveryUDP function Section 5 2 3 which might not work on certain network configurations ListAlIS is a special version where D
43. to record the edge times This limits the times to 16 bit values but is accurate to the resolution of the clock and not subject to any errors due to firmware processing delays Note that the minimum measurable period is limited by the edge rate limit discussed in Section 2 10 2 39 2 10 2 Timer Operation Performance Notes Note that the specified timer clock frequency is the same for all timers That is TimerClockBase and TimerClockDivisor are singular values that apply to all timers Modes 0 1 2 3 4 7 12 and 13 all are affected by the clock frequency and thus the simultaneous use of these modes has limited flexibility This is often not an issue for modes 2 and 3 since they use 32 bit registers The output timer modes 0 1 and 7 are handled totally by hardware Once started no processing resources are used and other UE9 operations do not affect the output The major exception to this is if the TimerCounter UpdateConfig bit is set as described earlier as that will cause all output timers to stop and restart The edge detecting timer input modes do require UE9 processing resources as an interrupt is required to handle each edge Timer modes 2 3 5 9 12 and 13 must process every applicable edge rising or falling Timer modes 4 and 8 must process every edge rising and falling To avoid missing counts keep the total number of processed edges all timers less than 100 000 per second That means that in the case of a singl
44. to that range so if Vs is 4 8 volts your signal range will be 0 4 8 volts If this is a concern use the external wall wart to supply power to the UEQ as it typically keeps Vs around 5 2 volts The EB37 experiment board is handy for building these circuits The information above also applies to resistance measurement A common way to measure resistance is to build a voltage divider as shown in Figure 2 4 where one of the resistors is known and the other is the unknown If Vin is known and Vout is measured the voltage divider equation can be rearranged to solve for the unknown resistance 2 7 3 7 Measuring current including 4 20 mA with a resistive shunt The following figure shows a typical method to measure the current through a load or to measure the 4 20 mA signal produced by a 2 wire loop powered current loop sensor The current shunt shown in the figure is simply a resistor 25 Load or 2 wire 4 20 mA Sensor e AINx Ext Shunt Supply _ Current Flow 0 100 gt e SGND Figure 2 6 Current Measurement With Arbitrary Load or 2 Wire 4 20 mA Sensor When measuring a 4 20 mA signal a typical value for the shunt would be 240 O This results in a 0 96 to 4 80 volt signal corresponding to 4 20 mA The external supply must provide enough voltage for the sensor and the shunt so if the sensor requires 5 volts the supply must provide at least 9 8 volts For applications besides 4 20 mA the shunt is chosen based on
45. use the auxiliary high resolution converter 24 bit sigma delta on the UE9 Pro This is done with the SinglelO low level function not the Feedback function The UD driver will automatically use the SinglelO low level function when resolution is set to 18 on the UE9 Pro and if there are requests for multiple samples the driver will make multiple SinglelO calls Resolution Ethernet USB high high USB other Index AIN milliseconds milliseconds milliseconds 18 1 125 125 125 125 ms per sample Table 3 2 Typical SinglelO Function Execution Times For Analog Input UE9 Pro The low level TimerCounter function is used to configure update reset or read timer When using the LabJackUD driver any timer counter related requests will cause a call to the low level TimerCounter function The following tables show typical measured execution times for the TimerCounter function The execution time depends very little on what is being done and how many timers counters are being configured or read These were measured by calling the function 1000 times and dividing the total time by 1000 and thus include everything Windows latency communication time UE9 processing time etc Ethernet USB high high USB other milliseconds milliseconds milliseconds TimerCounter 1 2 1 2 4 0 Table 3 3 Typical TimerCounter Function Execution Times 3 2 Stream Mode The highest data rates are obtained in stream mode Stream is a continuous hardware timed
46. uses Counter1 internally and thus Counter1 is not available for counting while streaming Additionally if clock output or external triggering is enabled the normal Counter1 FIO line will be claimed which is the next FIO available after all other enabled timers counters If no other timers counters are enabled FIOO will be used for stream clock output or input When using external stream clock output or input the timer counter configuration should not be changed after starting the stream as that could cause a glitch or could even cause the Counter1 FIO pin number to change Enabling clock output causes the FIO line to be set to output when the configuration command is executed but the clock output will not actually begin until the stream is started Enabling 47 clock input causes the FIO line to be set to input when the configuration command is executed but interrupts will not occur until the stream is started Note that external triggering causes 1 scan per trigger pulse It is not used where a single pulse starts a continuous stream or a burst of multiple scans as that type of trigger is better handled in software In software an arbitrarily complex set of trigger conditions can be watched for in continuous stream data and when the trigger occurs the software can keep a specified number of scans keep all scans while the trigger is true or whatever other behavior is desired In addition the software can maintain a histo
47. values passed become the default values meaning they are written to flash and used at reset Regardless of the mask bit this function has no effect on the current settings These defaults are only used if bit 8 of MIODirState is clear The return value of this parameter is a read of the power up defaults DAC 0 If the WriteMask bit 2 is set the values passed become the default values meaning they are written to flash and used at reset Regardless of the mask bit this function has no effect on the current settings The return value of this parameter is a read of the power up defaults ControlFWVersion Fixed parameter specifies the version number of the Control firmware A firmware upgrade will generally cause this parameter to change 98 5 3 3 Feedback and FeedbackaAlt A very useful function that writes reads almost every I O on the LabJack UE9 Feedback Command Byte OANDARWN OO 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 Checksum8 OxF8 Ox0E 0x00 Checksum16 LSB Checksum16 MSB FlOMask FlODir FlOState ElOMask ElODir ElOState ClOMask ClODirState Bits 7 4 Direction Bits 3 0 State MIOMask MIODirState Bits 6 4 Direction Bits 2 0 State DACO LSB DACO Bit 7 Enabled Bit 6 Update Bits 3 0 Upper 4 bits of output DAC1 LSB DAC1 Bit 7 Enabled Bit 6 Update Bits 3 0 Upper 4 bits of output AINMask AIN14ChannelNumber AIN15ChannelNumb
48. 0 Checksum8 1 0xB1 2 Errorcode 3 0x00 112 5 3 10 ReadMem Reads 1 block 128 bytes from the Control non volatile memory The Mem area is arranged in 16 blocks of 128 bytes each Blocks 0 7 are used by LabJack Corporation to store calibration data and blocks 8 15 are available to the user Command Byte Response 00 Ex 99 dl NOOR WBN O U Noanenaok oO Checksum8 OxF8 0x01 0x2A Checksum16 LSB Checksum16 MSB 0x00 BlockNum Checksum8 OxF8 0x41 0x2A Checksum16 LSB Checksum16 MSB 0x00 BlockNum Data 113 5 3 11 WriteMem Writes 1 block 128 bytes to the Control non volatile memory The Mem area must be erased before writing The Mem area is arranged in 16 blocks of 128 bytes each Blocks 0 7 are used by LabJack Corporation to store calibration data and blocks 8 15 are available to the user Command Byte 0 Checksum8 1 OxF8 2 0x41 3 0x28 4 Checksum16 LSB 5 Checksum16 MSB 6 0x00 7 BlockNum 8 135 Data Response Byte 0 Checksum8 1 OxF8 2 0x01 3 0x28 4 Checksum16 LSB 5 Checksum16 MSB 6 Errorcode 7 0x00 114 5 3 12 EraseMem The UE9 uses flash memory so you must erase it before writing The non volatile Mem area is arranged in 16 blocks of 128 bytes each Blocks 0 7 are used by LabJack Corporation to store calibration data and blocks 8 15 are available to the user The EraseMem function erases 1 kByte at a time blocks 0 7 or blocks 8 15 There i
49. 0 ohm source impedance and are designed to provide 1 mA or less This is the same voltage supply used internally by the UE9 to bias the analog input amplifier and multiplexers If this supply is loaded more than 1 mA the voltage can droop to the point that the maximum analog input range is reduced If this supply is severely overloaded e g short circuited then damage could eventually occur PIN2 PIN20 TX0 RX0O currently bring out the UART transmit and receive lines but in the future will likely be used as current sources 2 12 1 CB37 Terminal Board The CB37 terminal board from LabJack connects to the UE9 s DB37 connector and provides convenient screw terminal access to all lines The CB37 is designed to connect directly to the UE9 but can also connect via a 37 line 1 1 male female cable When using the analog connections on the CB37 the effect of ground currents should be considered particularly when a cable is used and substantial current is sourced sunk through the CB37 terminals For instance a test was done with a 6 foot cable between the CB37 and UE9 and a 100 ohm load placed from Vs to GND on the CB37 50 mA load A measurement of CB37 GND compared to UE9 GND showed 5 9 mV If a signal was connected to AINO on the CB37 and referred to GND on the CB37 the UE9 reading would be offset by 5 9 mV The same test with the CB37 direct connected to the UE9 no cable resulted in an offset of only 0 2 mV In both cases cable or no cab
50. 04 Response Byte 0 Checksum8 1 OxF8 2 0x11 3 0x18 4 Checksum16 LSB 5 Checksum16 MSB 6 Errorcode 7 EnableStatus 8 11 TimerO 12 15 Timer1 16 19 Timer2 20 23 Timer3 24 27 Timer4 28 31 Timerd 32 35 CounterO 36 39 Counter e EnableMask If the UpdateConfig bit is 0 this parameter and the TimerClock parameters do nothing If the UpdateConfig bit is 1 then the timers and counters are enabled and disabled as specified by the other bits The lower 3 bits specify the number of timers enabled 0 6 Bits 3 and 4 are set to enable a counter or cleared to disable a counter Any enabled timers and counters will take over FIO lines in order starting with FIOO Counter1 is used internally by stream mode but in such a case only uses an FIO line if master or slave stream mode is used The counters are reset when enabled or disabled e EnableStatus Returns which timers and counters are enabled Bit locations are the same as the UpdateReset byte e TimerClockBase The determines the timer base clock which is used by all output mode timers The choices are a fixed 750 kHz clock source or the system clock The UE9 is by default in high power mode which means the system clock is fixed at 48 MHz The UpdateConfig bit must be set to change this parameter e TimerClockDivisor The timer clock is divided by this value or divided by 256 if this value is 0 The UpdateConfig bit must be set to change this parameter e UpdateReset Each bit of th
51. 1 released September 18 2008 Section 2 14 New Section about optional pin header connectors for OEMs Section 3 2 Updated Table 3 5 for Comm Control firmware V1 40 1 84 Section 4 3 7 More detail about stream buffers Section 4 3 11 More information about pin numbers and pull up resistors Section 5 3 12 Clarified EraseArea bytes Section 5 5 New Section about Modbus V1 12 released March 9 2009 Sections 2 7 2 5 3 3 8 5 3 4 Clarified that binary AIN values are always unsigned Section 2 10 1 9 Corrected description of stop timer value read Section 5 2 1 Documented how to calculate serial number Table Of Contents 1 Installation ON WINdOWS ooocccccnnccnninnnnnennnnnnnennnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnniiinins 8 1 1 Control Panel Application LUControlPanel ooooccconnnoconoconoconoccnonononanannannccnncnnnnnnnn nn nccnnnnn 9 1 2 Self Upgrade Application LJSelfUpgrade oooooooocccccnccccccconocoocccnccccnnananannnccnnnnnncnnnnnncnnnnos 11 2 Hardware DescriptiON occccccccccncccnnccnnnononennnononononnnnnnnonnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnninnnnnninines 12 PAA ON S LE E AETR EEE cat A ct heb teal oetsterit nits Caractere S hotacanti nae arent te baainl 12 ZA or AA A Maher dieses A 14 2 3 Vext Screw Terminals and Power Jack ooooonnncccnnnnncccnnnnnnocoonccncccnnnnnnnanncnnnnnnnnnnnnnnnnnnnnos 14 2 4 Comm and Control LEDS ooooooccccccnncc
52. 14 17 Gateway 18 21 Subnet 22 23 PortA 24 25 PortB 26 DHCPEnabled 27 ProductiD 28 33 MACAddress 34 35 HWWersion 36 37 CommFWWersion e WriteMask See general protocol description in Section 5 1 e LocallD 1 Used by higher level functions to identify a specific LabJack e PowerLevel 0 Not implemented e IPAddress 192 168 1 209 The value returned by this parameter is the current IPAddress If you write a new IPAddress it will not take effect until after a reset so you will not immediately read back the new address Gateway 192 168 1 1 Reset required for a change to take effect Subnet 255 255 255 0 Reset required for a change to take effect PortA 52360 Normal TCP UDP port Reset required for a change to take effect Note that bit 5 of WriteMask affects PortA and PortB PortB 52361 Secondary TCP port Reset required for a change to take effect Only used to send stream data from the UE9 to the host DHCPEnabled 0 A value of 1 means that DHCP is enabled Reset required for a change to take effect ProductID 9 Fixed parameter identifies this LabJack as a UE9 MACAddress Fixed parameter To determine the 4 byte serial number add hex 10 0 0 0 to the lower 3 bytes of the MAC HWVersion Fixed parameter specifies the version number of the electronics hardware The lower byte is the integer portion of the version and the higher byte is the fractional portion of the version CommFWVersion Fixed parameter specifies
53. 16 and sum into a U16 accumulator can t overflow Then do the following for the 8 bit extended checksum Get the subarray consisting of bytes 1 through 5 Convert bytes to U16 and sum into a U16 accumulator Divide by 2 and sum the quotient and remainder Divide by 2 and sum the quotient and remainder Destination bit This bit specifies whether the command is destined for the local or remote target Generally local means the packet should be handled by the Comm processor while remote means the Comm processor should pass the packet on Multi byte parameters In the following function definitions there are various multi byte parameters The least significant byte of the parameter will always be found at the lowest byte number For instance bytes 10 through 13 of CommConfig are the IP address which is 4 bytes long Byte 10 is the least significant byte LSB and byte 13 is the most significant byte MSB Masks Some functions have mask parameters The WriteMask found in some functions specifies which parameters are to be written In the following documentation parameters affected by the WriteMask have a next to their name which specifies which bit in the WriteMask goes with which parameter If a bit is 1 that parameter will be updated with the new passed value If a bit is O the parameter is not changed and only a read is performed The AINMask found in some functions specifies which analog inputs are acquired This is
54. 2 corresponding to the normal digital l O numbers as specified in Section 2 9 e NumSPlBytesToTransfer Specifies how many SPI bytes will be transferred 1 240 The initial state of SCK is set properly CPOL by this function before CS chip select is brought low final state is also set properly before CS is brought high again If CS is being handled manually outside of this function care must be taken to make sure SCK is initially set to CPOL before asserting CS All standard SPI modes supported A B C and D Mode A CPHA 1 CPOL 1 Mode B CPHA 1 CPOL 0 Mode C CPHA 0 CPOL 1 Mode D CPHA 0 CPOL 0 If Clock Phase CPHA is 1 data is valid on the edge going to CPOL If CPHA is 0 data is valid on the edge going away from CPOL Clock Polarity CPOL determines the idle state of SCK Up to 240 bytes can be written read Communication is full duplex so 1 byte is read at the same time each byte is written 122 5 3 17 AsynchConfig Control command configures the UE9 UART for asynchronous communication Currently the UART connects to the PIN2 PIN20 TX0 RX0 pins on the DB37 connector On a future UE9 hardware revision it is expected that the UART will appear on FIO EIO lines after any timers and counters Communication is in the common 8 n 1 format Similar to RS232 except that the logic is normal CMOS TTL Connection to an RS232 device will require a converter chip such as the MAX233 which inverts the logic and shifts th
55. 2361 Comm 1 390 TCP 192 168 1 163 IP Address Controk 1 780 U3 320014232 fisz fies fo fiss Heia a USB 1 ae Bootloader 1 120 Not Found 25 fas 255 fo Gateway 192 168 fi aL saa Power Level DHCP Enabled D High 4 A newer Comm and Control firmware version is available online To upgrade please close LJControlPanel and run LJSelfUpgrade Find Devices F3 Exit F4 Config 10 Detauts FM Reset Found 2 USB 1 UDP 0 specified Figure 1 1 LJControlPanel Main Window Figure 1 1 shows the results from a typical search The application found one UE9 connected by USB and Ethernet It also found a second UE9 that is accessible only by Ethernet The USB connection has been selected in Figure 1 1 bringing up the configuration window on the right side Refresh Reload the window using values read from the device e Write to Device Write the values from the window to the device Depending on the values that have been changed the application might prompt for a device reset Reset Click to reset the selected device e Test Opens the window shown in Figure 1 2 This window continuously writes to and reads from the selected LabJack FAN UES Test Panel Analog Inputs Digital Direction Peale Gain Voltage Voltage FIO CIA ABI ni 5v 1 202414 E 00 00 01 02 03 04 05 06 07 Uni Sv 2 957341 nis 2 0 0 ElO ni 5v 1 183847 X 3 o0 a lo a HE 00 01 02 03 04 05 06 07 ni 5y 0 718888 iS 0 0
56. 246 e NumAsynchBytesInRXBuffer Returns how many bytes are currently in the RX buffer 124 5 3 19 AsynchRX Control command reads the oldest 32 bytes from the UE9 UART RX buffer The buffer holds 256 bytes Command E NOOR WBN O Response U ononon gt olg o WO oO e Flush Empties the entire 256 byte RX buffer If there is more than 32 bytes in the Checksum8 OxF8 0x01 0x16 Checksum16 LSB Checksum16 MSB 0x00 Flush Checksum8 OxF8 0x11 0x16 Checksum16 LSB Checksum16 MSB Errorcode NumAsynchBytesInRXBuffer AsynchByteO AsynchByte31 buffer that data is lost e NumAsynchBytesInRXBuffer Returns the number of bytes in the buffer before this read e AsynchByte Returns the 32 oldest bytes from the RX buffer 125 5 3 20 12C Control command sends and receives serial data using 12C synchronous communication OxF8 4 Numl2CWordsSend 0x3B Checksum16 LSB Checksum16 MSB I2COptions Bit 1 ResetAtStart Bit 0 Reserved 7 SpeedAdjust 8 SDAPinNum 9 SCLPinNum 10 AddressByte 11 Reserved 12 Numl2CBytesToSend 13 Numl2CBytesToReceive byte 0 Checksum8 1 2 3 4 5 6 14 I2CByteO Response Byte 0 Checksum8 1 OxF8 2 3 NumIl2CWordsReceive 3 0x3B 4 Checksum16 LSB 5 Checksum16 MSB 6 Errorcode 7 Reserved 8 AckArray0 9 AckArray1 10 AckArray2 11 AckArray3 12 12CByte0 e Numl2CWordsSend This is the number of I2C bytes to send divided by 2
57. 3 Group Level Error CodeS cocccncccnncnoncnnncnnnnnnnnnnnnnnnnnnnnnnnnnnnonnnnnnnnnnnnnnnnnnnnnnnnneneneniness 88 1 Installation on Windows The LJUD driver requires a PC running Windows 98 ME 2000 XP or Vista For other operating systems go to labjack com for available support Software will be installed to the LabJack directory which defaults to c Program Files LabJack Install the software first Install the software using the CD or by downloading the latest UD installer from labjack com Although all necessary software is available at labjack com do not discard the CD as it includes a fully licensed copy of DAQFactory Express which is not available by download Connect the USB cable See Section 2 2 for Ethernet installation tips The USB cable provides data and power After the UD software installation is complete connect the hardware and Windows should prompt with Found New Hardware and shortly after the Found New Hardware Wizard will open When the Wizard appears allow Windows to install automatically by accepting all defaults Run LJControlPanel From the Windows Start Menu go to the LabJack group and run LJControlPanel Click the Find Devices button and an entry should appear for the connected UE9 showing the serial number Click on the USB 1 entry below the serial number to bring up the UE9 configuration panel Click on Test in the configuration panel to bring up the test panel where you can
58. 4 201 224 would get the LSW of Timer0 the MSW of Timer0 the LSW of Timer1 and the MSW of Timer1 A scan list of 200 201 224 would get the LSW of Timer0 the LSW of Timer1 and the MSW of Timer1 MSW of Timer is lost Adding these special channels to the stream scan list does not configure those inputs If any of the FIO or ElO lines have been configured as outputs they will need to be reconfigured as inputs to provide proper reads The timers counters must be configured before streaming using normal timer counter configuration commands The timing for these special channels is the same as for normal analog channels For instance a stream of the scan list 0 1 200 224 201 224 counts as 6 channels and the maximum scan 48 rate is determined by taking the maximum sample rate at the specified resolution and dividing by 6 Special care must be taken when streaming timers configured in mode 2 or 3 32 bit period measurement It is possible for the LSW to roll but the MSW be captured before it is incremented If this is an unacceptable situation then only the LSW or MSW should be used but not both Mode 11 the upper 32 bits of the system timer is not available for stream reads Note that when streaming with the internal scan trigger the timing is known anyway elapsed time scan rate scan number and it does not make sense to stream the system timer modes 10 or 11 With external triggering there might be reasons to stream the avai
59. 9 State AINM For a digital bit read this is a read of the input state For a digital port read this is multiple bits returning a read of the input state for each line For digital writes this is just an echo For an analog input this is the middle 8 bits of the 24 bit conversion value or more typically considered the lowest 8 bits of the 16 bit conversion value AINH For an analog input this is the high 8 bits of the 24 bit conversion value or more typically considered the high 8 bits of the 16 bit conversion value Binary readings are always unsigned integers 103 5 3 5 TimerCounter Enables configures and reads the counters and timers Command W Noan n ok o 10 11 12 14 15 16 17 18 19 20 21 23 24 25 26 27 28 29 Checksum8 OxF8 Ox0C 0x18 Checksum16 LSB Checksum16 MSB TimerClockDivisor 0 256 EnableMask Bit 7 UpdateConfig Bit 4 Enable Counter Bit 3 Enable CounterO Bits 2 0 Number of timers enabled TimerClockBase 0x00 750 kHz 0x01 System Clock 0x02 Reserved 0x03 Reserved 0x04 Reserved UpdateReset Bit 7 Reset Counter Bit 6 Reset CounterO Bit 5 UpdateReset Timer5 Bit 4 UpdateReset Timer4 Bit 3 UpdateReset Timer3 Bit 2 UpdateReset Timer2 Bit 1 UpdateReset Timer1 Bit 0 UpdateReset TimerO TimerOMode Timer0Value Timer1 Mode Timer1Value Timer2Mode Timer2Value Timer3Mode Timer3Value Timer4Mode Timer4Value Timer5Mode Timer5Value CounterOMode Counter1 Mode 1
60. Backlog e TimeStamp Reserved PacketCounter An 8 bit 0 255 counter that is incremented by one for each packet of data Useful to make sure packets are in order and no packets are missing e Sample Stream data is placed in a FIFO first in first out buffer so Sample0 is the oldest data read from the buffer and Sample15 is the 16 oldest sample This stream data packet always returns 16 samples regardless of the number of channels in the scan list e ControlBacklog When streaming the Control processor acquires data at precise intervals and transfers it to the Comm processor which has a large data buffer The 110 Control processor has a small data buffer 256 samples for data waiting to be transferred to the Comm processor and this ControlBacklog parameter specifies the number of samples remaining in the Control buffer If this parameter is nonzero and growing it suggests that the Control processor is too busy CommBacklog The Comm processor holds stream data in a 4 Mbit FIFO buffer 512 kBytes 11397 StreamData packets 182361 samples until it can be sent to the host The lower 7 bits of CommBacklog specifies how much data is left in the buffer in increments of 4096 bytes The MSb of CommBacklog is set on buffer overflow but in such a case the lower 7 bits still specify the amount of valid data before overflow in the buffer 111 5 3 9 StreamStop Not supported over UDP Command Byte 0 OxBO 1 OxBO Response Byte
61. D_ OFFSET LJE_FEEDBACK_IOTYPE_NOT_VALID LJE_SHT_CRC LJE_SHT_MEASREADY LJE_SHT_ACK LJE_SHT_SERIAL_RESET LJE_SHT_COMMUNICATION LJE_AIN_WHILE_STREAMING LJE_STREAM_TIMEOUT LJE_STREAM_SCAN_OVERLAP LJE_FIRMWARE_VERSION_IOTYPE LJE_FIRMWARE_VERSION_CHANNEL LJE_FIRMWARE_VERSION_VALUE LJE_HARDWARE_VERSION_IOTYPE LJE_HARDWARE_VERSION_CHANNEL LJE_HARDWARE_VERSION_VALUE Table 4 2 Request Level Error Codes Part 2 Description AIN not available to command response functions while the UE9 is streaming New scan started before the previous scan completed Scan rate is too high lOType not supported with this firmware Channel not supported with this firmware Value not supported with this firmware lOType not supported with this hardware Channel not supported with this hardware Value not supported with this hardware 87 70 LJE_TC_PIN_OFFSET_MUST_BE_4 TO_8 Errorcode Name 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 LJE_MIN_GROUP_ERROR LJE_UNKNOWN_ERROR LJE_INVALID_DEVICE_TYPE LJE_INVALID_HANDLE LJE_DEVICE_NOT_OPEN LJE_NO_DATA_AVAILABLE LJE_NO_MORE_DATA AVAILABLE LJE LABJACK_NOT_FOUND LJE_COMM_FAILURE LJE_CHECKSUM_ERROR LJE_DEVICE_ALREADY_OPEN LJE_COMM_TIMEOUT Table 4 3 Group Level Error Codes Description Errors above this number stop all requests Unrecognized error that is caught AddRequest called even though Open failed GetResult called without calling a Go
62. E9 over Ethernet ingErrorcode OpenLabJack LJ_dtUE9 LJ_ctETHERNET 192 168 1 209 0 1ngHandle Set DACI to 2 5 volts The general form of the AddRequest function is AddRequest Handle IOType Channel Value x1 UserData IngErrorcode AddRequest IngHandle LJ_ioPUT_DAC 1 2 50 0 0 Request a read from AIN3 ingErrorcode AddRequest IngHandle LJ_ioGET_AIN 3 0 0 0 Execute the requests ingErrorcode GoOne lngHandle Get the result of the DAC1 request just to check for an errorcode The general form of the GetResult function is GetResult Handle IOType Channel Value ingErrorcode GetResult IngHandle LJ_ioPUT_DAC 1 0 Get the AIN3 voltage ingErrorcode GetResult IngHandle LJ_ioGET_AIN 3 amp dblValue 50 The AddRequest Go GetResult method is often the most efficient As shown above multiple requests can be executed with a single Go or GoOne call and the driver might be able to optimize the requests into fewer low level calls The other option is to use the eGet or ePut functions which combine the AddRequest Go GetResult into one call The above code would then look like assuming the UE9 is already open Set DAC to 2 5 volts The general form of the ePut function is ePut Handle IOType Channel Value x1 ingErrorcode ePut lngHandle LJ_ioPUT_DAC 1 2 50 0 Read AIN3 The general form of the eGet function is eGet Handle
63. EAM_CHECKSUM_ERROR LJE_STREAM_COMMAND_ERROR LJE_STREAM_ORDER_ERROR LJE_AD_PIN CONFIGURATION ERROR LJE_ REQUEST _NOT PROCESSED LJE_ SCRATCH ERROR LJE_DATA_BUFFER_OVERFLOW LJE_ADCO BUFFER OVERFLOW LJE_FUNCTION_INVALID LJE_SWDT_TIME_INVALID LJE_FLASH ERROR LJE_STREAM_IS_ ACTIVE LJE_STREAM_TABLE_INVALID LJE_STREAM_CONFIG_INVALID LJE_STREAM_BAD_TRIGGER_SOURCE LJE_STREAM_INVALID_TRIGGER LJE_STREAM_ADCO_BUFFER_OVERFLOW LJE_STREAM_SAMPLE_NUM_INVALID LJE_STREAM_BIPOLAR_GAIN_INVALID LJE_STREAM_SCAN_RATE_INVALID Table 4 1 Request Level Error Codes Part 1 Description Warning Defaults used instead Warning Defaults used instead Channel that does not exist e g DAC2 ona UE9 or data from stream is requested on a channel that is not in the scan list Overrun of the UD stream buffer Stream packet received out of sequence Analog request on a digital pin or vice versa Previous request had an error 86 Errorcode Name 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 60 61 62 63 64 65 66 LJE_TIMER_INVALID_MODE LJE_TIMER_QUADRATURE_AB_ERROR LJE_TIMER_QUAD PULSE _SEQUENCE LJE_TIMER_BAD_CLOCK_SOURCE LJE_TIMER_STREAM_ACTIVE LJE_TIMER_PWMSTOP_MODULE_ERROR LJE_TIMER_SEQUENCE_ERROR LJE_TIMER_SHARING_ERROR LJE_TIMER_LINE_SEQUENCE_ERROR LJE_EXT_OSC_NOT_STABLE LJE_INVALID_POWER_SETTING LJE_PLL_NOT_LOCKED LJE_INVALID_PIN LJE_IOTYPE_SYNCH_ERROR LJE_INVALI
64. I O bits 20 22 by the Windows driver The MIO hardware electrical specifications is the same as the ElO CIO hardware All the digital I O include an internal series resistor that provides overvoltage short circuit protection These series resistors also limit the ability of these lines to sink or source current Refer to the specifications in Appendix A All digital I O on the UE9 have 3 possible states input output high or output low Each bit of I O can be configured individually When configured as an input a bit has a 100 KQ pull up resistor to 3 3 volts all digital I O are 5 volt tolerant When configured as output high a bit is connected to the internal 3 3 volt supply through a series resistor When configured as output low a bit is connected to GND through a series resistor The power up condition of the digital I O can be configured by the user From the factory all digital I O are configured to power up as inputs Note that even if the power up default for a line is changed to output high or output low there is a delay of about 100 ms at power up where all digital I O are in the factory default condition The low level Feedback function Section 5 3 3 writes and reads all digital l O See Section 3 1 for timing information For information about using the digital I O under the Windows LabJackUD driver see Section 4 3 5 Many function parameters contain specific bits within a single integer parameter to write read speci
65. IN3 for 5 volt range AddRequest lngHandle LJ_ioPUT_AIN_RANGE 3 LJ_rgBIP5V 0 0 Request a read from AIN2 AddRequest lngHandle LJ_ioGET_AIN 2 0 0 0 Request a read from AIN3 AddRequest lngHandle LJ_ioGET_AIN 3 0 0 0 Execute the requests GoOne IngHandle Get the AIN2 voltage GetResult lngHandle LJ_ioGET_AIN 2 amp dblValue Get the AIN3 voltage GetResult lngHandle LJ_ioGET_AIN 3 amp dblValue 4 3 4 Analog Outputs The lOType to set the voltage on an analog output is LJ_ioPUT_DAC The following are OTypes used to write read the enable bit for each DAC Note that although there is an enable bit for each DAC on the UE9 both DACs are enabled or disabled at the same time LJ_ioPUT_DAC_ENABLE Applies to both DACs Channel ignored LJ_ioGET_DAC_ENABLE Applies to both DACs Channel ignored The following is a special channel used with the get put config OTypes to configure a parameter that applies to both DACs LJ_chDAC_BINARY Following is example pseudocode to set DAC1 to 2 5 volts Set DAC to 2 5 volts ePut lIngHandle LJ_ioPUT_DAC 1 2 50 0 4 3 5 Digital I O There are eight IOTypes used to write or read digital I O information LJI_ioGET_DIGITAL_BIT Also sets direction to input 70 LJ_ioGET_DIGITAL_BIT_DIR LJ_ioGET_DIGITAL_BIT_STATE LJI_ioGET_DIGITAL_PORT Also sets directions to input xl is number of bits L
66. J_ioGET_DIGITAL_PORT_DIR X1 is number of bits LJ_ioGET_DIGITAL_PORT_STATE X1 is number of bits LJ_ioPUT_DIGITAL_BIT Also sets direction to output LJ_ioPUT_DIGITAL_PORT Also sets directions to output x1 is number of bits When a request is done with one of the port lOTypes the Channel parameter is used to specify the starting bit number and the x1 parameter is used to specify the number of applicable bits The bit numbers corresponding to different I O are 0 7 FIOO FIO7 8 15 ElO0 ElO7 16 19 CIO0 CIO3 20 22 MIOO MIO2 Note that the GetResult function does not have an x1 parameter That means that if two or more port requests are added with the same lOType and Channel but different x1 the result retrieved by GetResult would be undefined The GetFirstResult GetNextResult commands do have the x1 parameter and thus can handle retrieving responses from multiple port requests with the same lOType and Channel Following is example pseudocode for various digital I O operations Request a read from FIO2 AddRequest lngHandle LJ_ioGET_DIGITAL_BIT 2 0 0 0 Request a read from EIOO CIO1 10 bits starting from digital channel 8 AddRequest lngHandle LJ_ioGET_DIGITAL PORT 8 0 10 0 Set FIO3 to output high AddRequest lngHandle LJ_ioPUT_DIGITAL_BIT 3 1 0 0 Set CIO2 MIO2 5 bits starting from digital channel 18 to b10100 d20 That is CIO2 0 CIO3 0 MIOO 1 MIO1 0 and MIO2 1 AddReq
67. Lab Jack LabJack UE9 User s Guide Also Covers UE9 Pro Revision 1 12 March 10 2009 LabJack Corporation www labjack com support labjack com For the latest version of this and other documents go to www labjack com LabJack designs and manufactures measurement and automation peripherals that enable the connection of a PC to the real world Although LabJacks have various redundant protection mechanisms it is possible in the case of improper and or unreasonable use to damage the LabJack and even the PC to which it is connected LabJack Corporation will not be liable for any such damage Except as specified herein LabJack Corporation makes no warranties express or implied including but not limited to any implied warranty or merchantability or fitness for a particular purpose LabJack Corporation shall not be liable for any special indirect incidental or consequential damages or losses including loss of data arising from any cause or theory LabJacks and associated products are not designed to be a critical component in life support or systems where malfunction can reasonably be expected to result in personal injury Customers using these products in such applications do so at their own risk and agree to fully indemnify LabJack Corporation for any damages resulting from such applications LabJack assumes no liability for applications assistance or customer product design Customers are responsible for their applications usi
68. OS TTL Connection to an RS232 device will require a converter chip such as the MAX233 which inverts the logic and shifts the voltage levels This serial link is not an alternative to the USB connection Rather the host application will write read data to from the UE9 over USB and the USB communicates with some other device using the serial protocol Using this serial protocol is considered an advanced topic A good knowledge of the protocol is recommended and a logic analyzer or oscilloscope might be needed for troubleshooting There is one lOType used to write read asynchronous data LJ_ioASYNCH_COMMUNICATION The following are special channels used with the asynch lOType above LJI_ChASYNCH_ENABLE Enables UART to begin buffering rx data LJ_chASYNCH_RX Value returns pre read buffer size x1l array LJ_chASYNCH_TX Value number to send 0 56 number in rx buffer x1 array LJ_chASYNCH_FLUSH Flushes the rx buffer All data discarded Value ignored When using 1 _chasyNcH_rx the Value parameter returns the size of the Asynch buffer before the read If the size is 32 bytes or less that is how many bytes were read If the size is more than 32 bytes then the call read 32 this time and there are still bytes left in the buffer When using 17 _chasyNcH_Tx specify the number of bytes to send in the Value parameter The Value parameter returns the size of the Asynch read buffer The following is a special channel used wi
69. OType 0 Digital Bit Read 1 Digtial Bit Write 2 Digital Port Read 3 Digital Port Write 4 Analog In 5 Analog Out e Channel Specifies which channel of lOType to write or read For the digital port lOTypes 2 amp 3 use the following table Digital Port Channel o FIO ElO ClO MIO wW N gt e Dir BipGain DACL For a digital bit write this is O for input and 1 for output For a digital port write this is multiple bits specifying input or output for each line Ignored for 102 digital reads For an analog input this is the BipGain parameter see Feedback For an analog output this is the low byte of the binary output value State Resolution DACH For a digital bit write this is the output state For a digital port write this is multiple bits specifying the output state for each line Ignored for digital reads For an analog input this is the Resolution parameter 12 18 For an analog output this is the most significant 4 bits of the binary output value and the upper 4 bits are ignored as the output is always updated and lO Type 5 causes both DACs to be enabled SettlingTime Only applies to analog inputs see Feedback Dir AINL For a digital bit read this reads O for input and 1 for output For a digital port read this is multiple bits returning input or output for each line For digital writes this is just an echo For an analog input this is the lowest 8 bits of the 24 bit conversion value generally ignored on the UE
70. PWM8 0 0 Initialize the 8 bit PWM with a 50 duty cycle AddRequest IngHandle LJ_ioPUT_TIMER VALUE 0 32768 0 0 Configure Timerl as frequency output 72 AddRequest IngHandle LJ_ioPUT_TIMER_MODE 1 LJ_tmFREQOUT 0 0 Initialize frequency output at 1M 2 5 100 kHz AddRequest lngHandle LJ_ioPUT_TIMER_VALUE 1 5 0 0 Configure Timer2 as a firmware counter with debounce AddRequest IngHandle LJ_ioPUT_TIMER_MODE 2 LJ_tmFIRMCOUNTERDEBOUNCE 0 0 Configure Timer2 for negative edges bit 8 of value clear with a debounce period of 87 ms AddRequest IngHandle LJ_ioPUT_TIMER_ VALUE 2 1 0 0 Configure Timer3 as duty cycle input AddRequest lngHandle LJ_ioPUT_TIMER_MODE 3 LJ_tmDUTYCYCLE 0 0 Configure Timers 4 5 as quadrature input Two timers are needed for phases A amp B AddRequest lngHandle LJ_ioPUT_TIMER_MODE 4 LJ_tmQUAD 0 0 AddRequest lngHandle LJ_ioPUT_TIMER_MODE 5 LJ_tmQUAD 0 0 Execute the requests GoOne IngHandle The LabJackUD driver uses the low level TimerCounter function That function has a single UpdateConfig bit that must be set to change modes clock configuration or enabled disabled status When the UpdateConfig bit is set all timers and counters are re initialized The following pseudocode demonstrates reading input timers counters and updating the values of output timers which does not cause the UpdateConfig bit to be set
71. R_CONFIG 0 0 0 Mode A CPHA 1 CPOL 1 AddRequest IngHandle LJ_ioPUT_CONFIG LJ_chSPI_MODE 0 0 0 Maximum clock rate 100kHz AddRequest lngHandle LJ_ioPUT_CONFIG LJ_chSPI_CLOCK_FACTOR 0 0 0 Set MOSI to FIO2 AddRequest lngHandle LJ_ioPUT_CONFIG LJ_chSPI_MOSI_PIN_NUM 2 0 0 Set MISO to FIO3 AddRequest IngHandle LJ_ioPUT_CONFIG LJ_chSPI_MISO_PIN_NUM 3 0 0 Set CLK to FIOO AddRequest IngHandle LJ_ioPUT_CONFIG LJ_chSPI_CLK_PIN_NUM 0 0 0 Set CS to FIO1 AddRequest IngHandle LJ_ioPUT_CONFIG LJ_chSPI_CS_PIN_NUM 1 0 0 Execute the configuration requests GoOne lngHandle Following is pseudocode to do the actual SPI communication Transfer the data eGet lngHandle LJ_ioSPI_COMMUNICATION 0 amp numBytesToTransfer array 4 3 11 IC Serial Communication The UE9 supports Inter Integrated Circuit IC or 12C communication as the master only 1 C is a synchronous serial protocol typically used to communicate with chips that support I C as slave 80 devices Any 2 digital I O lines are used for SDA and SCL Note that the I C bus generally requires pull up resistors of perhaps 4 7 kQ from SDA to Vs and SCL to Vs and also note that the screw terminals labeled SDA and SCL if present are not used for 1 C This serial link is not an alternative to the USB connection Rather the host application will write read data to from the UE9 over USB and the USB communicates with s
72. SB 5 Checksum16 MSB 6 NumChannels 7 Resolution 8 SettlingTime 9 ScanConfig Bit 7 Enable scan pulse output Bit 6 Enable external scan trigger Minimum Min With Bits 4 3 Internal stream clock frequency Scan Freq Divisor b00 4 MHz 61 1 0 239 b01 48 MHz 733 2 87 b10 750 kHz 11 5 0 045 b11 24 MHz 367 1 44 Bit 1 Divide Clock by 256 10 11 Scan Interval 1 65535 12 ChannelNumber 13 ChannelOptions Bits 3 0 BipGain Repeat 12 13 for each channel Response Byte 0 Checksum8 1 OxF8 2 0x01 3 0x11 4 Checksum16 LSB 5 Checksum16 MSB 6 Errorcode 7 0x00 e NumChannels This is the number of channels you will sample per scan 1 128 e Resolution Determines the resolution setting for all analog inputs 12 16 See Section 3 2 This function does not support the high resolution converter on the UE9 Pro e ScanConfig If you enable the scan pulse output Counter1 will pulse low just before each scan master mode If you enable the external scan trigger the UE9 scans the 107 table each time it detects a falling edge on Counter1 slave mode Valid combinations for bits 6 and 7 are b00 b01 or b10 You cannot pass b11 Counter1 is automatically enabled and disabled by the stream functions To provide the highest timing resolution the scan clock is generally set to the highest setting possible Scaninterval 1 65535 This value divided by the clock frequency defined in the ScanConfig parameter gives the interval in second
73. Sod a Rta tet dn tre Gen dl al Neda ie 97 5 3 3 Feedback and FeedbackAll acc ic citcccnees civis eee suede enced dat date n need canshevneavenenwedeadslaawsticntee 99 5 3 4 Ml Dai dens seen oda Ganka A dde 102 5 3 5 TIMO iaa 104 DO SISMO tdo cia depen 107 A A Fagen dekcicgsdeecadnccnagaeaceoezacan inhcude Goatees AA lait 109 9 3 0 SUCAMD ALAR ccvesceatces dace arco 110 5 39 SUWEAMSTOD NO 112 5 39 10 REAUMOM iccica llar laa e 113 53 11 Write Me tica alii A CARA Aida 114 59 12 TA 115 MER NCO GOT A eera ected ad tarred canes dae teh neve eta Ratan td t caneed ge a AEEA e Gata 116 5 9 14 WAlCNGOGR GAG ia e shine sence dat 119 53 TOROS RN 120 DIO A E E 121 5 3 17 ASYNCNCONMNG meridia 123 A EA eee tes codes eds Sax enced leans tacetanattadadenatctentechates tuner daeceiaduethdcntinedenntagutaee 124 D319 FAV IGT O 125 816 A0 NN 126 5321 O 128 54 LoWw Le vel ETTOrCOdeS tt 129 5 5 IMSS ido Meaty tad 130 Av Specifications idee eee e a a E OE OE EEEa EEE a VeRO E Eeeh TAREE EEEE EEE REEERE 131 B Noise amp Resolution Tables cid 134 C Enclosure amp PCB Dra OS acrilico 135 C Enclosure amp PCB Drawings 20 iii 136 Table Of Tables Figures Figure 1 1 LJControlPanel Main WindoW ocommiooooccconnnncnccononncccncccnonnnnnnnencncnnnnnnnnn anne 9 Figure 1 2 LJControlPanel Test Window ccceceeeeeeeceecneeeeeeeeeeeseneeneeeeeereneeseceeceenaeeeeeee 10 Figure 1 3 LJControlPanel Settings Window ooooooo
74. T_DISABLE The following are special channels used with the put config OType to configure watchdog options These parameters cause settings to be updated in the driver only The settings are not actually sent to the hardware until the 17_ioswor_conrre OType above is used 83 LJ_chSWDT_RESET_DEVICE LJ_chSWDT_RESET_COMM LJ_chSWDT_RESET_CONTROL LJ_chSWDT_UDPATE_DIOA LJ_chSWDT_UPDATE_DIOB LJ_chSWDT_DIOA_CHANNEL LJ_chSWDT_DIOA_STATE LJ_chSWDT_DIOB_CHANNEL LJ_chSWDT_DIOB_STATE LJ_chSWDT_UPDATE_DACO LJ_chSWDT_UPDATE_DAC1 LJ_chSWDT_DACO LJ_chSWDT_DAC LJ_chSWDT_DAC_ENABLE Following is example pseudocode to configure and enable the watchdog Initialize EIO2 to output low which also forces the direction to output Tt would probably be better to do this by configuring the power up defaults AddRequest lngHandle LJ_ioPUT_DIGITAL_BIT 10 0 0 0 Specify that the Comm processor should be reset on timeout AddRequest lngHandle LJ_ioPUT_CONFIG LJ_chSWDT_RESET_COMM 1 0 0 Specify that the Control processor should be reset on timeout AddRequest lngHandle LJ_ioPUT_CONFIG LJ_chSWDT_RESET_CONTROL 1 0 0 Specify that the state of digital line A should be updated on timeout AddRequest lngHandle LJ_ioPUT_CONFIG LJ_chSWDT_UDPATE_DIOA 1 0 0 Specify that EIO2 is the desired digital line A AddRequest IngHandle LJ_ioPUT_CONFIG LJ_chSWDT_DIOA_ CHANNEL 10 0 0 Specify that the digit
75. The e functions are used in the following pseudocode but some applications might combine the following calls into a single add go get block so that a single low level call is used Change Timer0 PWM duty cycle to 25 ePut IngHandle LJ_ioPUT_TIMER_ VALUE 0 49152 0 Change Timerl frequency output to 1M 2 50 10 kHz ePut lngHandle LJ_ioPUT_TIMER_ VALUE 1 50 0 Read count from Timer2 This is an unsigned 32 bit value eGet lngHandle LJ_ioGET_TIMER 2 dblValue 0 Read duty cycle from Timer3 eGet IngHandle LJ_ioGET_TIMER 3 dblValue 0 The duty cycle read returns a 32 bit value where the least significant word LSW represents the high time and the most significant word MSW represents the low time The times returned are the number of cycles of the timer clock In this case the timer clock was set to 1 MHz so each cycle is 1 microsecond dblHighCycles double unsigned long dblValue 65536 dblLowCycles double unsigned long dblValue 65536 dblDutyCycle 100 dblHighCycles dblHighCycles dblLowCycles dblHighTime 0 000001 dblHighCycles dblLowTime 0 000001 dblLowCycles Read the quadrature count from Timer4 Timer5 would return the same value This is a signed 32 bit value eGet IlngHandle LJ_ioGET_TIMER 4 dblValue 0 Read the count from Counter0 This is an unsigned 32 bit value eGet lngHandle LJ_ioGET_COUNTER 0 amp db
76. a const char which is a string A string can then be passed with the name of the desired constant Functions with a double SS replace both the OType and Channel with strings OpenLabJackS replaces both DeviceType and ConnectionType with strings since both take constants For example In C where the LabJackUD h file can be included and the constants used directly AddRequest Handle LJ_ioGET_CONFIG LJ_ioHARDWARE_VERSION 0 0 0 The bad way hard to read when LabJackUD h cannot be included AddRequest Handle 1001 10 0 0 0 The better way when LabJackUD h cannot be included is to pass strings AddRequestSS Handle LJ_ioGET_CONFIG LJ_ioHARDWARE_VERSION 0 0 0 Continuing on this vein the function StringToConstant is useful for error handling routines or with the GetFirst Next functions which do not take strings The StringToConstant function takes a string and returns the numeric constant So for example LJ_ERROR err rr AddRequestSS Handle LJ_ioGETCONFIG LJ_ioHARDWARE_VERSION 0 0 0 if err StringToConstant LJE_INVALID_DEVICE_TYPE do some error handling Once again this is much clearer than if err 2 4 1 2 Multi Threaded Operation This driver is completely thread safe With some very minor exceptions all these functions can be called from multiple threads at the same time and the driver will keep everything straight Because of this Add Go and G
77. ad eGet lngHandle LJ_ioGET_STREAM_DATA LJ_chALL CHANNELS amp numScans array actualNumberRead numScans When all channels are retrieved in a single read the data is interleaved in a 1 dimensional array The following lines get the first sample from each channel channelA array 0 J channelB array 1 Retrieve the current Comm backlog The UD driver retrieves stream data from the UE9 in the background but if the computer is too slow for some reason the driver might not be able to read the data as fast as the UE9 is acquiring it and thus there will be data left over in the UE9 buffer eGet lngHandle LJ_ioGET_CONFIG LJI_chSTREAM_BACKLOG_COMM amp dblCommBacklog 0 Retrieve the current UD driver backlog If this is growing then the application software is not pulling data from the UD driver fast enough eGet lngHandle LJ_ioGET_CONFIG LJ_chSTREAM BACKLOG_UD amp dblUDBacklog 0 Finally stop the stream Stop the stream errorcode ePut Handle LJ_ioSTOP_STREAM 0 0 0 17 4 3 8 Raw Output Input There are two OTypes used to write or read raw data These can be used to make low level function calls Section 5 through the UD driver The only time these generally might be used is to access some low level device functionality not available in the UD driver LJ_ioRAW_OUT LJ_ioRAW_IN When using these lOTypes channel specifies the desired communicatio
78. al line should be set high AddRequest lngHandle LJ_ioPUT_CONFIG LJ_chSWDT_DIOA_ STATE 1 0 0 Specify that DACO should be updated on timeout AddRequest lngHandle LJ_ioPUT_CONFIG LJ_chSWDT_UPDATE_DAC0O 1 0 0 Specify that DACO should be set to 4 1 volts on timeout AddRequest IngHandle LJ_ioPUT_CONFIG LJ_chSWDT_DACO 4 1 0 0 Enable the watchdog with a 60 second timeout AddRequest IngHandle LJ_ioSWDT_CONFIG LJ_chSWDT_ENABLE 60 0 0 Execute the requests GoOne 1ngHandle Following is pseudocode to disable the watchdog Disable the watchdog ePut lngHandle LJ_ioSWDT_CONFIG LJ_chSWDT_DISABLE 0 0 4 3 14 Miscellaneous The following are special channels used with the get put config OTypes to read write the calibration memory and user memory LJ_chCAL_CONSTANTS LJ_chUSER_MEM 84 For more information see the low level descriptions in Sections 5 3 10 5 3 12 and see the Memory example in the VC6_LJUD archive 85 4 4 Errorcodes All functions return an LJ_ERROR errorcode as listed in the following tables Errorcode Name 2 1 LJE_UNABLE_TO_ READ CALDATA LJE_DEVICE_NOT_CALIBRATED LJE_NOERROR LJE_INVALID_CHANNEL_NUMBER LJE_INVALID_RAW_INOUT_PARAMETER LJE UNABLE_TO_START_STREAM LJE_UNABLE_TO STOP_STREAM LJE_NOTHING_TO STREAM LJE_UNABLE_TO CONFIG_STREAM LJE_BUFFER_OVERRUN LJE_STREAM_NOT_RUNNING LJE_INVALID_PARAMETER LJE_INVALID_STREAM_FREQUENCY LJE_INVALID_AIN_RANGE LJE_STR
79. are stored in non volatile flash memory so every call to this function where settings are changed causes a flash erase write The Control flash has a rated endurance of at least 20000 writes which is plenty for reasonable operation but if this function is called in a high speed loop the flash could be damaged 116 Command Byte NOOI0AG0Na OoO 8 9 10 11 12 13 14 15 Response U somo n oR o Checksum8 OxF8 0x05 0x09 Checksum16 LSB Checksum16 MSB 0x00 WatchdogOptions Bit 7 Reserved 0 Bit 6 Reset Comm on Timeout Bit 5 Reset Control on Timeout Bit 4 Update Digital I O B on Timeout Bit 3 Update Digital I O A on Timeout Bit 1 Update DAC1 on Timeout Bit 0 Update DACO on Timeout TimeoutPeriod DIOConfigA Bit 7 State Bit 4 0 Digital lO DIOConfigB Bit 7 State Bit 4 0 Digital lO DACO LSB DACO Bit 7 Enabled Bits 3 0 Upper 4 bits of output DAC1 LSB DAC1 Bit 7 Enabled Bits 3 0 Upper 4 bits of output Checksum8 OxF8 0x01 0x09 Checksum16 LSB Checksum16 MSB Errorcode WatchdogOptions e WatchdogOptions The watchdog is enabled when this byte is nonzero Set the appropriate bit to reset either or both processors update the state of 1 or 2 digital I O or update 1 or both DACs e TimeoutPeriod The watchdog timer is reset to zero on any incoming Control communication Note that most functions consist of a write and read but StreamData is outgoing only and does
80. ary humidity reading CRC Returns the CRC values from the sensor 128 5 4 Low Level Errorcodes Following is a list of the low level function errorcodes Code SCRATCH_WRT_FAIL SCRATCH_ERASE FAIL DATA BUFFER_OVERFLOW ADCO_BUFFER_OVERFLOW FUNCTION_INVALID SWDT_TIME_INVALID FLASH_WRITE_FAIL FLASH_ERASE FAIL FLASH_JMP_FAIL FLASH_PSP_TIMEOUT FLASH_ABORT_RECEIVED FLASH_PAGE_MISMATCH FLASH_BLOCK_MISMATCH FLASH_PAGE_NOT_IN_CODE_AREA MEM_ILLEGAL_ADDRESS FLASH_LOCKED INVALID_BLOCK FLASH_ILLEGAL_PAGE STREAM_IS_ACTIVE STREAM_TABLE_ INVALID STREAM_CONFIG_INVALID STREAM_BAD_TRIGGER_SOURCE STREAM_NOT_RUNNING STREAM_INVALID_TRIGGER STREAM_CONTROL_BUFFER_OVERFLOW STREAM_SCAN_OVERLAP STREAM_SAMPLE_NUM_INVALID STREAM_BIPOLAR_GAIN_INVALID STREAM_SCAN_RATE_ INVALID TIMER_INVALID_ MODE TIMER_QUADRATURE_AB_ERROR TIMER_QUAD PULSE SEQUENCE TIMER_BAD_CLOCK_SOURCE TIMER_STREAM_ACTIVE TIMER_PWMSTOP_MODULE_ERROR EXT_OSC_NOT_ STABLE INVALID POWER_SETTING PLL_NOT_LOCKED 129 5 5 Modbus Modbus is an industry standard command response protocol for data acquisition and control equipment Go to http en wikipedia org wiki Modbus for general information The UE9 supports Modbus TCP in hardware so any software that supports Modbus TCP can talk to the UE9 with no further software drivers required Not all functionality e g streaming is supported over Modbus See the following web page for more information http www labjack c
81. can be configured individually When configured as an input a bit has a 100 KQ pull up resistor to 3 3 volts When configured as output high a bit is connected to the internal 3 3 volt supply through a series resistor When configured as output low a bit is connected to GND through a series resistor DB15 Pinouts 1 Vs 9 CIOO 2 ClO1 10 ClO2 3 ClO3 11 GND 4 ElOO 12 ElO1 5 ElO2 13 ElO3 6 ElO4 14 ElO5 7 ElO6 15 ElO7 8 GND 2 13 1 CB15 Terminal Board The CB15 terminal board connects to the LabJack UE9 s DB15 connector It provides convenient screw terminal access to the 12 digital I O available on the DB15 connector The CB 15 is designed to connect directly to the LabJack or can connect via a standard 15 line 1 1 male female DB15 cable 2 13 2 RB12 Relay Board The RB12 provides a convenient interface for the UE9 to industry standard digital I O modules allowing electricians engineers and other qualified individuals to interface a LabJack with high voltages currents The RB12 relay board connects to the DB15 connector on the LabJack using the 12 ElO CIO lines to control up to 12 I O modules Output or input types of digital I O modules can be used The RB12 is designed to accept G4 series digital I O modules from Opto22 and compatible modules from other manufacturers such as the G5 series from Grayhill Output modules are available with voltage ratings up to 200 VDC or 280 VAC and current ratings up to 3 5 amps 2 14 OEM Conne
82. cccccnnnoncconaonccnncnnncnnnnnnnn no ncncnnnnnnnnnnn nr nccnnnnnnns 10 Figure 1 4 Self Upgrade Application oooooooccooncconcconcconcnoncnoncnoncnnonononnnnnnnonnnonnnonnnnnnnnnnononos 11 Figure 2 1 Lab ack UEO ncocereco distinta rmubeb hh caintat es 12 Table 2 1 Intemal Channel Scsi tai A deauankiee 17 Figure 2 2 Typical External Multiplexer CONNECtIONS oooooccoocccccccccccccnnnnnonnncncnccncnnnnnnnncccnnnnnnnns 18 Table 2 2 Expanded Channel MappinQ cccccccccnncccnicnnccinnnonnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnninnness 19 Table 2 3 Nominal Analog Input Voltage Ranges cooooocooccccnnccconccconancccncnnnnononnnnanonnnnnnncnnnnnnnns 19 Table 2 4 Calibration Constant Memory Locations ooooooconccccnnnnoncccoconccccnnnnonononnnnnnnnncnnnnnnnnnnnnns 20 Table 2 5 Fixed Point Conversion Examples ooccccccccccnnccnnccnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnninnniss 21 Figure 2 3 Non Inverting Op Amp Configuration cooocccncccononcconnncncnononnnnonnncnnnccnnnnnnnn nn nncnnnnnnns 23 Figure 2 4 Voltage Divider Circula ion a aaa eo 24 Figure 2 5 Buffered Voltage Divider Circult 2 ccccceeeeeseeeeeeceeeeneeeeseeneeeeceeeeeneeseseeeenseanenenes 25 Figure 2 6 Current Measurement With Arbitrary Load or 2 Wire 4 20 mA Sensor 045 26 Figure 2 7 Current Measurement With 3 Wire 4 20 mA Sourcing Sensor eeeeeees 26 Figure 2 8 10 Volt DAC Output CirCUlicinaina lcd o bce cena
83. cluded but often the network interface card NIC on modern computers is capable of automatically detecting the signal orientation and will work with either cable type patch or crossover The LEDs on a switch hub NIC can be used to determine if you have an electrically valid connection An orange LED is often used to indicate a good 10Base T connection but consult the manual for the switch nub NIC to be sure In the case of a direct connection between PC and UES9 if Windows says A network cable is unplugged or similar it suggests that the UE9 is not powered or the wrong type of cable is connected Complex networks might require the assistance of your network administrator to use the UEQ but the following information is often sufficient for basic networks One basic requirement for TCP communication is that the UE9 s IP address must be part of the subnet and not already used Open a command prompt window and type ipconfig to see a listing of the IP address and subnet mask for a particular PC If the PC shows a subnet mask of 255 255 255 0 that means it can only talk to devices with the same first 3 bytes of the IP address The default IP address of the UE9 is 192 168 1 209 which will generally work on a network using the 192 168 1 subnet unless another device is already using the 209 address If the IP address of the UE9 needs to be changed the easiest way is via USB with the LJControlPanel application LJControlPanel and P
84. collector also called open drain or NPN is a very common type of digital signal Rather than providing 5 volts and ground like the push pull signal an open collector signal provides ground and high impedance This type of signal can be thought of as a switch connected to ground Since the UES digital inputs have a 100 KQ internal pull up resistor an open collector signal can generally be connected directly to the input When the signal is inactive it is not driving any voltage and the pull up resistor pulls the digital input to logic high When the signal is active it drives 0 volts which overpowers the pull up and pulls the digital input to logic low Sometimes an external pull up e g 4 7 KQ from Vs to digital input will be installed to increase the strength and speed of the logic high condition ee e VS Open Collector e A te Digital Signal Input Rground Signal mine Mis SGND Figure 2 10 Open Collector NPN Connection To Digital Input 31 Figure 2 10 shows typical connections Rground is typically 0 100 Q Rseries is typically 0 Q and the external pull up resistor is generally not required If there is some uncertainty about whether the signal is really open collector or could drive a voltage beyond 5 8 volts use an Rseries of 22 kQ as discussed in Section 2 9 1 1 and the input should be compatible with an open collector signal or a driven signal up to at least 48 volts Note that an individual ground connectio
85. counter is enabled Counters do not have to be enabled in order starting from 0 so Counter1 can be enabled when Counter0 is disabled A nonzero value for an array element specifies to enable that counter For the UES9 this array must always have at least 2 elements e TCPinOffset Ignored with the UE9 e TimerClockBaselndex Pass a constant to set the timer base clock The default is LU_tc750KHZ e TimerClockDivisor Pass a divisor from 0 255 where 0 is a divisor of 256 e aTimerModes An array where each element is a constant specifying the mode for that timer For the UES9 this array must always have at least 6 elements e aTimerValues An array where each element is specifies the initial value for that timer For the UE9 this array must always have at least 6 elements e Reserved 1 amp 2 Pass 0 66 4 2 22 eTCValues An easy function that updates and reads all the timers and counters This is a simple alternative to the very flexible OType based method normally used by this driver Declaration LJ_ERROR_stdcall eGet LJ HANDLE Handle long aReadTimers long aUpdateResetTimers long aReadCounters long aResetCounters double aTimerValues double aCounterValues long Reserved long Reserved2 Parameter Description Returns LabJack errorcodes or 0 for no error Inputs e Handle Handle returned by OpenLabJack e aReadTimers An array where each element specifies whether to read t
86. cribed in Section 2 3 The Vs connections are outputs not inputs Do not connect a power source to Vs All Vs terminals are the same 2 7 AIN The LabJack UE9 has 14 user accessible analog inputs built in All the analog inputs are available on the DB37 connector and the first 4 are also available on the built in screw terminals The analog inputs have variable resolution where the time required per sample increases with increasing resolution The value passed for resolution is from 0 17 where 0 12 all correspond to 12 bit resolution and 17 still results in 16 bit resolution but with minimum noise The UE9 Pro has an additional resolution setting of 18 that causes acquisitions to use the alternate high resolution converter 24 bit sigma delta Resolution is configured on a device basis not for each channel The analog inputs are connected to a high impedance input buffer The inputs are not pulled to 0 0 volts as that would reduce the input impedance so readings obtained from floating channels will generally not be 0 0 volts The readings from floating channels depend on adjacent channels and sample rate See Section 2 7 3 8 When scanning multiple channels the nominal channel to channel delay is specified in Appendix A and includes enough settling time to meet the specified performance Some signal sources could benefit from increased settling so a settling time parameter is available that adds extra delay between configuring the mul
87. ctor Options As of this writing the UE9 is only produced in the normal form factor with screw terminals and DB connectors but the PCB does have alternate holes available for 0 1 pin header installation Connectors J2 and J3 provide pin header alternatives to the DB15 and DB37 connectors 42 GND ClOO ClO2 GND ElO1 ElO3 ElO5 ElO7 GND PIN2 FIO5 FIO2 MIOO GND Vm DACO AIN12 AIN9 AING AIN3 AINO GND onBNM 10 12 14 16 VS clo1 ClO3 ElOO ElO2 ElO4 ElO6 GND GND FIO7 FIO4 FIO1 MIO1 Vs GND GND AIN11 AIN8 AIN5 AIN2 GND 3 PIN20 6 FIO6 9 FIO3 12 FIOO 15 MIO2 18 Vm 21 DAC1 24 AIN13 27 AIN10 30 AIN7 33 AIN4 36 AIN1 39 GND 43 3 Operation 3 1 Command Response Everything besides streaming is done in command response mode meaning that all communication is initiated by a command from the host which is followed by a response from the UE9 For everything besides timers and counters the low level Feedback function is the primary function used as it writes and reads virtually all I O on the UE9 The Windows LabJackUD driver uses the Feedback function under the hood to handle most requests A single call to the Feedback function writes and reads all 23 digital I O updates the analog outputs and reads up to 16 analog inputs The following tables show typical measured execution times for the Feedback function The time varies with the number of analog inputs requested and the resol
88. ditional parameters added to specify channel numbers for all 16 analog input reads making it useful when using extended channels or more than 2 internal channels The command for FeedbackAlt is the same as Feedback except that AINxChannelNumber parameters are added for channels 0 13 new bytes 34 47 The command number byte 3 changes to 0x01 and the number of data words byte 2 changes to 0x15 The response for FeedbackAlt is the same as Feedback except that the counter timer reads are removed and thus the response is 44 bytes long The command number byte 3 changes to 0x01 and the number of data words byte 2 changes to 0x13 The order of execution in hardware for either function is Write digital I O Read digital I O Write analog outputs Read analog inputs Read timers and counters skipped in FeedbackaAlt ON ONT 101 5 3 4 SinglelO An alternative to Feedback is this function which writes or reads a single output or input Command Byte 0 Checksum8 1 OxA3 2 lOType 3 Channel 4 Dir BipGain DACL 5 State Resolution DACH 6 SettlingTime 7 Reserved Response Byte 0 Checksum8 1 OxA3 2 lOType 3 Channel 4 Dir AINL 5 State AINM 6 AINH 7 Reserved e lOType Specifies the I O to write or read The digital read types are used to read the state and direction of digital I O The digital write types are used to configure digital I O to one of three states input output low or output high l
89. dl ee MIO clo A is sis mimm a 0 0 4 979058 00 01 02 00 01 02 03 0 0 Degrees C Checked Output 0 0 Temp 17 666135 Digital State 0 0 of AINs FIO h ul High Resolution Crrrrrrr and Counters 00 01 02 03 04 05 06 07 Value Reset Value Reset ElO Timero M CountO fE KEEEMEN 00 01 02 03 04 05 06 07 Timert Count1 ps MIO clo Timer2 f FEF VRRP Timer3 f z 00 01 02 00 01 02 03 Timer4 f Timer5 Analog Outputs DACO Figure 1 2 LJControlPanel Test Window Selecting Options gt Settings from the main LJControlPanel menu brings up the window shown in Figure 1 3 This window allows some features to of the LJControlPanel application to be customized Al Settings Search or LabJack IP Search for USB devices Addresses Search for Ethernet devices using UDP broadcast packet Search for Ethernet devices using specified IP addresses 192 J168 jfi 137 Add IP Figure 1 3 LJControlPanel Settings Window 10 e Search for USB devices If selected LJControlPanel will include USB when searching for devices e Search for Ethernet devices using UDP broadcast packet Normally Ethernet connected devices are found using a broadcast of the DiscoveryUDP command documented in Section 5 2 3 On some networks however it might not be desirable to broadcast these UDP packets There are also situations where a network might have proper TCP communication between the PC and LabJack but the broadcast UDP packet does
90. e high time low time registers are set to 65535 0 Thus if no edges occur before the next read it is possible to tell if the duty cycle is 0 or 100 2 10 1 5 Firmware Counter Input Mode 5 On every rising edge seen by the external pin this mode increments a 32 bit register Unlike the pure hardware counters these timer counters require that the firmware jump to an interrupt service routine on each edge Writing a value of zero to the timer performs a reset After reset a read of the timer value will return zero until a new edge is detected If a timer is reset and read in the same function call the read returns the value just before the reset 2 10 1 6 Firmware Counter Input With Debounce Mode 6 Intended for frequencies less than 10 Hz this mode adds a debounce feature to the firmware counter which is particularly useful for signals from mechanical switches On every applicable edge seen by the external pin this mode increments a 32 bit register Unlike the pure hardware counters these timer counters require that the firmware jump to an interrupt service routine on each edge When configuring only UpdateConfig 1 the low byte of the timer value is a number from 0 255 that specifies a debounce period in 87 ms increments plus an extra 0 87 ms of variability Debounce Period 0 87 ms TimerValue 87 ms In the high byte bits 8 16 of the timer value bit O determines whether negative edges bit O clear or positive edges
91. e timer there should be no more than 1 edge per 10 us For multiple timers all can process an edge simultaneously but if for instance 6 timers get an edge at the same time 60 us should be allowed before any further edges are applied If streaming is occurring at the same time the maximum edge rate will be less 25 000 per second and since each edge requires processing time the sustainable stream rates can also be reduced 2 11 SCL and SDA or SCA Reserved for factory use Note that the IC functionality of the UE9 does not use these terminals 2 12 DB37 The DB37 connector brings out analog inputs analog outputs FIO and other signals Some signals appear on both the DB37 connector and screw terminals so care must be taken to avoid a short circuit DB37 Pinouts 1 GND 14 AIN9 27 Vs 2 PIN2 15 AIN7 28 Vm 3 FIO6 16 AIN5 29 DAC1 4 FIO4 17 AIN3 30 GND 5 FIO2 18 AIN1 31 AIN12 6 FIOO 19 GND 32 AIN10 7 MIO1 20 PIN20 33 AIN8 8 GND 21 FIO7 34 AING 9 Vm 22 FIO5 35 AIN4 10 GND 23 FIO3 36 AIN2 11 DACO 24 FIO1 37 AINO 12 AIN13 25 MIOO 13 AIN11 26 MIO2 Ground Vs AIN DAC FIO and MIO are all described earlier 40 Vm Vm are bipolar power supplies intended to power external multiplexer ICs such as the MAX4051A maxim ic com The multiplexers can only pass signals within their power supply range so Vm Vm can be used to pass bipolar signals Nominal voltage is 5 8 volts at no load and 5 6 volts at 1 mA Both lines have a 10
92. e voltage levels Command Byte 0 Checksum8 1 OxF8 2 0x02 3 0x14 4 Checksum16 LSB 5 Checksum16 MSB 6 0x00 7 AsynchOptions Bit 7 Update Bit 6 UARTEnable Bit 5 Reserved 8 9 BaudFactor16 Response Byte 0 Checksum8 1 OxF8 2 0x02 3 0x14 4 Checksum16 LSB 5 Checksum16 MSB 6 Errorcode 7 AsynchOptions 8 9 BaudFactor16 e AsynchOptions If Update is true the new parameters are written otherwise just a read is done If UARTEnable is true the UART is enabled and the RX line will start buffering any incoming bytes e BaudFactor16 A 16 bit value that sets the baud rate according the following formula BaudFactor 2 16 3000000 Desired Baud For example use a BaudFactor of 65224 to get a baud rate of 9615 bps compatible with 9600 bps 123 5 3 18 AsynchTX Control command sends bytes to the UE9 UART which will be sent asynchronously on the PIN2 TX0 pin on the DB37 connector Command Byte ONOOaRWBN O Response U oonoason OB 9 Checksum8 OxF8 1 NumAsynchWords 0x15 Checksum16 LSB Checksum16 MSB 0x00 NumAsynchBytesToSend AsynchByteO Checksum8 OxF8 0x02 0x15 Checksum16 LSB Checksum16 MSB Errorcode NumAsynchBytesSent NumAsynchBytesInRXBuffer 0x00 e NumAsynchWords This is the number of asynch data bytes divided by 2 If the number of bytes is odd round up and add an extra zero to the packet NumAsynchBytesToSend Specifies how many bytes will be sent 0
93. ecified states Note that the StopStream can occur during any sample within a scan so the MIO lines will wind up configured for any of the extended channels in the scan If a stream does not have any extended channels the MIO lines are not affected 18 UE9 MIO Multiplexed Channel Channels 0 16 23 1 24 31 2 32 39 3 40 47 4 48 55 5 56 63 6 64 71 7 72 79 8 80 87 9 88 95 10 96 103 11 104 111 12 112 119 13 120 127 14 128 135 15 136 143 Table 2 2 Expanded Channel Mapping 2 7 2 Converting Binary Readings to Voltages Following are the nominal input voltage ranges for the analog inputs Gain Max V Min V Unipolar 1 5 07 0 01 Unipolar 2 2 53 0 01 Unipolar 4 1 26 0 01 Unipolar 8 0 62 0 01 Bipolar 1 5 07 5 18 Table 2 3 Nominal Analog Input Voltage Ranges The readings returned by the analog inputs are raw binary values low level functions An approximate voltage conversion can be performed as Volts uncalibrated Bits 65536 Span Where span is the maximum voltage minus the minimum voltage from the table above Fora proper voltage conversion though use the calibration values Slope and Offset stored in the internal flash on the Control processor Volts Slope Bits Offset In both cases Bits is always aligned to 16 bits so if the raw binary value is 24 bit data it must be divided by 256 before converting to voltage Binary readings are always unsigned integers Since the UE9 uses multiplexers
94. ed to get the desired gain A fixed reference such as 2 5 volts could also be used instead of DAC1 V gt 10V o DACO H Ope Amp e e 10 Volt Output o V lt 10V R2 100k R1 30k DAC1 3 1V e Figure 2 8 10 Volt DAC Output Circuit A two point calibration should be done to determine the exact input output relationship of this circuit Refer to application note SLOA097 from ti com for further information about gain and offset design with op amps 2 9 Digital O The LabJack UE9 has 23 digital I O The LabJackUD driver uses the following bit numbers to specify all the digital lines 0 7 FIOO FIO7 8 15 ElO0 ElO7 16 19 CIO0 CIO3 20 22 MIOO MIO2 The UEQ has 8 FIO flexible digital I O The first 4 lines FIOO FIO3 appear both on the screw terminals and on the DB37 connector These connections are electrically the same and the user must exercise caution only to use one connection or the other and not create a short circuit The upper 4 lines appear only on the DB37 connector By default the FIO lines are digital I O but they can also be configured as up to 6 timers and 2 counters see Timers Counters Section of this User s Guide 29 The 8 ElO and 4 CIO lines appear only on the DB15 connector See the DB15 Section of this User s Guide for more information MIO are standard digital I O that also have a special multiplexer control function described in Section 2 7 above AIN The MIO are addressed as digital
95. epresenting the number of clock ticks during the high signal and the second two bytes most significant word or MSW are a 16 bit value representing the number of clock ticks during the low signal The clock frequency is determined by TimerClockBase TimerClockDivisor The appropriate value is updated on every edge so a read returns the most recent high low times Note that a duty cycle of 0 or 100 does not have any edges To select a clock frequency consider the longest expected high or low time and set the clock frequency such that the 16 bit registers will not overflow Note that the minimum measurable high low time is limited by the edge rate limit discussed in Section 2 10 2 When using the LabJackUD driver the value returned is the entire 32 bit value To determine the high and low time this value should be split into a high and low word One way to do this is to do a modulus divide by 2 to determine the LSW and a normal divide by 2 keep the quotient and discard the remainder to determine the MSW 37 Writing a value of zero to the timer performs a reset After reset a read of the timer value will return zero until a new edge is detected If a timer is reset and read in the same function call the read returns the value just before the reset The duty cycle reset is special in that if the signal is low at the time of reset the high time low time registers are set to 0 65535 but if the signal is high at the time of reset th
96. er Resolution SettlingTime AIN1_0 BipGain AIN3_2 BipGain AIN5 4 BipGain AIN7_6_BipGain AIN9 8 BipGain AIN11_10_BipGain AIN13_12 BipGain AIN15_14 BipGain 99 Response Byte 0 Checksum8 1 OxF8 2 0x1D 3 0x00 4 Checksum16 LSB 5 Checksum16 MSB 6 FlODir 7 FlOState 8 ElODir 9 ElOState 10 ClODirState 11 MIODirState 12 13 AINO 14 15 AIN1 16 17 AIN2 18 19 AIN3 20 21 AIN4 22 23 AIN5 24 25 AING 26 27 AIN7 28 29 AIN8 30 31 AIN9 32 33 AIN10 34 35 AIN11 36 37 AIN12 38 39 AIN13 40 41 AIN14 42 43 AIN15 44 47 CounterO 48 51 Counter1 52 55 TimerA 56 59 TimerB 60 63 TimerC l OMask Mask each bit of digital I O individually If a bit is 1 then the new direction and state values will be written to that bit of I O If a bit is O only a read of state and direction will be done IODir O is input and 1 is output lOState As a write parameter only has an effect if a line is set to output For each bit 0 is output low and 1 is output high As a read parameter it returns the current input state of each line where 0 is low and 1 is high DAC The UE9 has 12 bit analog outputs so pass an output value between 0 and 4095 plus set bits 6 and 7 of the high byte accordingly Bit 6 specifies whether the given DAC will be updated with the new value If Bit7 is set on either DAC then both are enabled To disable the DACs set to high impedance bit 7 must be O for both DACs AINMask If a bit is O the co
97. er connections at all and no software running both LEDs will start blinking The Comm LED will blink a few times and then turn off The Control LED will continue to blink continuously 2 5 GND and SGND The GND connections available at the screw terminals and DB connectors provide a common ground for all LabJack functions This ground is the same as the ground line on the USB connection which is often the same as ground on the PC chassis and therefore AC mains ground This ground is also the same as the ground on either Vext connections wall wart power jack or minus screw terminals but if an isolated supply is used such as the one included with the UE9 there is no common connection to AC mains ground SGND is located near the upper left of the device This terminal has a self resetting thermal fuse in series with GND This is often a good terminal to use when connecting the ground from another separately powered system that could unknowingly already share a common ground with the UE9 The UE9 has separate ground planes on the PCB for analog and digital but the planes are shorted together so the user only has to consider one common ground GND See the AIN DAC and Digital I O Sections for more information about grounding 15 2 6 Vs The Vs terminals are designed as outputs for the internal supply voltage nominally 5 volts This will be the voltage provided from the USB connection Vusb or an external power supply Vext as des
98. et must be called from the same thread for a particular set of requests results Internally the list of requests and results are split by thread This allows multiple threads to be used to make requests without accidentally getting data from one thread into another If requests are added and then results return LJE_ NO DATA_AVAILABLE or a similar error chances are the requests and results are in different threads The driver tracks which thread a request is made in by the thread ID If a thread is killed and then a new one is created it is possible for the new thread to have the same ID Its not really a problem if Add is called first but if Get is called on a new thread results could be returned from the thread that already ended As mentioned the list of requests and results is kept on a thread by thread basis Since the driver cannot tell when a thread has ended the results are kept in memory for that thread regardless This is not a problem in general as the driver will clean it all up when unloaded When it can be a problem is in situations where threads are created and destroyed continuously This will result in the slow consumption of memory as requests on old threads are 52 left behind Since each request only uses 44 bytes and as mentioned the ID s will eventually get recycled it will not be a huge memory loss In general even without this issue it is strongly recommended to not create and destroy a lot of threads It is terribly sl
99. eviceType and ConnectionType are strings rather than longs This is useful for passing string constants in languages that cannot include the header file The strings should contain the constant name as indicated in the header file such as LJ_dtUE9 and LJ_ctUSB The declaration for the S version of open is the same as below except for const char pDeviceType const char pConnectionType Declaration LJ_ERROR _stdcall ListAll long DeviceType long ConnectionType long pNumFound long pSerialNumbers long pIDs double pAddresses Parameter Description Returns LabJack errorcodes or 0 for no error Inputs e DeviceType The type of LabJack to search for Constants are in the labjackud h file 54 e ConnectionType Enter the constant for the type of connection to use in the search e pSerialNumbers Must pass a pointer to a buffer with at least 128 elements e plDs Must pass a pointer to a buffer with at least 128 elements e pAddresses Must pass a pointer to a buffer with at least 128 elements Outputs e pNumFound Returns the number of devices found and thus the number of valid elements in the return arrays e pSerialNumbers Array contains serial numbers of any found devices e plDs Array contains local IDs of any found devices e pAddresses Array contains IP addresses of any found devices The function DoubleToStringAddress is useful to convert these to string notation
100. f solution the following figure shows an operational amplifier op amp configured as non inverting V Vin e Op Amp AINX e V o R2 R1 GND Figure 2 3 Non Inverting Op Amp Configuration The gain of this configuration is Vout Vin 1 R2 R1 100 kQ is a typical value for R2 Note that if R2 0 short circuit and R1 inf not installed a simple buffer with a gain equal to 1 is the result 23 There are numerous criteria used to choose an op amp from the thousands that are available One of the main criteria is that the op amp can handle the input and output signal range Often a single supply rail to rail input and output RIRO is used as it can be powered from Vs and GND and pass signals within the range 0 Vs The OPA344 from Texas Instruments ti com is good for many 5 volt applications The max supply rating for the OPA344 is 5 5 volts so for applications using Vm Vm 12 volts or using the 10 volt supply on the EB37 the LT1490A from Linear Technologies linear com might be a good option The op amp is used to amplify and buffer a signal that is referred to the same ground as the LabJack single ended If instead the signal is differential i e there is a positive and negative signal both of which are different than ground an instrumentation amplifier in amp should be used An in amp converts a differential signal to single ended and generally has a simple method to set gain The EB37 exper
101. f the Vs terminals The UE9 has internal overcurrent protection that will turn the UE9 off if the total current draw exceeds 490 mA 131 Parameter S Conditions Min Typical Max Units Analog Inputs Unipolar Input Range 1 Bipolar Input Range 1 Maximum AIN Voltage 2 Input Bias Current 3 Input Impedance 3 Source Impedance 4 Temperature Drift Absolute Accuracy Peak to Peak Noise Integral Linearity Error Differential Linearity Error Stream Data Buffer Size C R Acquisition Time Stream Speed 5 Channel to Channel Delay 6 1 For actual nominal input ranges see Section 2 7 of the UE9 User s Guide AINx to GND AINx to GND AINx to GND 1 volt G 1 Res 12 17 UE9 Pro Res 18 See Appendix B G 1 G 8 UE9 Pro Res 18 12 bit 16 bit UE9 Pro Res 18 See Section 3 1 12 bit stream 13 bit stream 14 bit stream 15 bit stream 16 bit stream 12 bit stream 13 bit stream 14 bit stream 15 bit stream 16 bit stream gt 10 10 0 025 0 005 0 02 0 03 0 0001 1 4 1 182361 nA MO kQ ppm C FS FS FS FS FS counts counts counts samples ms samples s samples s samples s samples s samples s us us us us us 2 Maximum voltage to avoid damage to the device Protection level is the same whether the device is powered or not When the voltage on any analog input exceeds 6 0 volts all other analog inputs are also affected until the overvoltage is removed
102. ferred to the Comm processor and the LJ_chSTREAM_BACKLOG_CONTROL special channel specifies the number of samples remaining in the Control buffer If this parameter is nonzero and growing it suggests that the Control processor is too busy Because the Control buffer is so small overflows very quickly and generally only overflows if sampling faster than the specified rates this parameter is not often used The Comm processor holds stream data in a 4 Mbit FIFO buffer 512 kBytes 11397 StreamData packets 182361 samples until it can be sent to the host The lower 7 bits of the LJ_chSTREAM_BACKLOG_comM special channel specify how much data is left in the Comm buffer in increments of 4096 bytes A value of O means the buffer is empty and a value of 128 or higher means the buffer has overflowed The UD driver retrieves stream data from the UES9 in the background but if the computer or communication link is too slow for some reason the driver might not be able to read the data as fast as the UE9 is acquiring it and thus there will be data left over in the UE9 buffer To obtain the maximum stream rates documented in Section 3 2 the data must be transferred between host and UE9 in large chunks The amount of data transferred per low level packet is controlled by 17_chsTREAM_SAMPLES_PER_PACKET The driver will use the parameter LJ_chSTREAM_READS_PER_SECOND to determine how many low level packets to retrieve per read The size of the UD stream
103. ffset DAC1 0 0000E 00 bits 2 32 Slope Temp 133 141 1 2968E 02 degK bit 2 48 Slope Temp 133 141 Low 1 2968E 02 degK bit 2 64 Cal Temp 2 9815E 02 degK 2 72 Vref 2 4300E 00 volts 2 80 Reserved 2 88 Vref 2 129 137 1 2150E 00 volts 2 96 Slope Vs 132 140 9 2720E 05 volts bit Starting Block Byte Hi Res ADC UE9 Pro Nominal Value 3 0 Slope Unipolar G 1 7 7503E 05 volts bit 3 8 Offset Unipolar G 1 1 2000E 02 volts 4 0 Slope Bipolar G 1 1 5629E 04 volts bit 4 8 Offset Bipolar G 1 5 1760E 00 volts Table 2 4 Calibration Constant Memory Locations Each value in Table 2 4 is stored in 64 bit fixed point format signed 32 32 little endian 2 s complement Following are some examples of fixed point byte arrays and the associated floating point double values 20 Fixed Point Byte Array LSB MSB Floating Point Double 0 0 0 0 0 0 0 0 0 0000000000 0 0 0 0 1 0 0 0 1 0000000000 0 0 0 0 255 255 255 255 1 0000000000 51 51 51 51 0 0 0 0 0 2000000000 205 204 204 204 255 255 255 255 0 2000000000 73 20 5 0 0 0 0 0 0 0000775030 225 122 20 110 2 0 0 0 2 4300000000 102 102 102 38 42 1 0 0 298 1500000000 Table 2 5 Fixed Point Conversion Examples 2 7 3 Typical Analog Input Connections A common question is can this sensor signal be measured with the UE9 Unless the signal has a voltage referred to UE9 ground beyond the limits in Appendix A it can be connected without damaging the UE9 but more tho
104. fic information In particular most digital I O parameters contain the information for each bit of I O in one integer where each bit of I O corresponds to the same bit in the parameter e g the direction of FIOO is set in bit O of parameter FIODir For instance in the function ControlConfig the parameter FlODir is a single byte 8 bits that writes reads the power up direction of each of the 8 FIO lines if FIODir is O all FIO lines are input if FlODir is 1 2 FIOO is output FIO1 FIO7 are input if FIODir is 5 2 2 FIOO and FIO2 are output all other FIO lines are input if FIODir is 255 2 2 FIOO FIO7 are output 2 9 1 Typical Digital I O Connections 2 9 1 1 Input Driven Signals The most basic connection to a UE9 digital input is a driven signal often called push pull With a push pull signal the source is typically providing a high voltage for logic high and zero volts for logic low This signal is generally connected directly to the UE9 digital input considering the voltage specifications in Appendix A If the signal is over 5 volts it can still be connected with a series resistor The digital inputs have protective devices that clamp the voltage at GND and VS so the series resistor is used to limit the current through these protective devices For instance if a 24 volt signal is connected through a 22 kQ series resistor about 19 volts will be dropped across the resistor resulting in a current of 1 1 mA
105. hat timer A nonzero value for an array element specifies to read that timer For the UEQ this array must always have at least 6 elements e aUpdateResetTimers An array where each element specifies whether to update reset that timer A nonzero value for an array element specifies to update reset that timer For the UE9 this array must always have at least 6 elements e aReadCounters An array where each element specifies whether to read that counter A nonzero value for an array element specifies to read that counter For the UEQ this array must always have at least 2 elements e aResetCounters An array where each element specifies whether to reset that counter A nonzero value for an array element specifies to reset that counter For the UEQ this array must always have at least 2 elements e aTimerValues An array where each element is the new value for that timer Each value is only updated if the appropriate element is set in the aUpdateResetTimers array For the UEQ this array must always have at least 6 elements e Reserved 1 amp 2 Pass 0 Outputs e aTimerValues An array where each element is the value read from that timer if the appropriate element is set in the aReadTimers array e aCounterValues An array where each element is the value read from that counter if the appropriate element is set in the aReadCounters array 67 4 3 Example Pseudocode The following pseudocode examples are simplified for clarity
106. hen speed is critical with multi channel reads These functions use one low level function per operation whereas using the normal Add Go Get method with IO Types many operations can be combined into a single low level call With single channel operations however there will be little difference between using an easy function or Add Go Get The last two functions handle almost all functionality related to timers and counters and will usually be as efficient as any other method These easy functions are recommended for most timer counter applications Following is example pseudocode Take a measurement from AIN3 using 0 5 volt range and 12 bit resolution eAIN Handle ChannelP ChannelN Voltage Range Resolution Settling Binary Reservedl Reserved2 78 LL eAIN 1ngHandle 3 0 amp dbiVoltage LJ_rgUNI5V 12 0 0 0 0 printf AIN3 value 3f n dblVoltage Set DACO to 3 1 volts eDAC Handle Channel Voltage Binary Reservedl Reserved2 eDAC lngHandle 0 3 1 0 0 0 Read state of FIO2 eDI Handle Channel State EL eDI 1ngHandle 2 amp ingState printf FIO2 state 0f 1n 1ngState Set FIO3 to output high eDO Handle Channel State LT eDO lngHandle 3 1 Enable and configure 1 output timer and 1 input timer and enable Countero0 Fill the arrays with the desired values then make the call alngEnableTimers 1 1 0 0 0 0 Enable Timer0 Timerl a
107. her valid data will be collected or an error will occur For information about streaming under Windows using the LabJackUD driver see Section 3 3 6 In general a low level not using the LabJackUD driver Ethernet stream is done as follows e Open TCP connection on port number PORTA e Call FlushBuffer 46 Open TCP connection on port number PORTB e Call StreamConfig on PORTA to set the scan rate and load the scan table list of channels to be sampled each scan Call StreamStart on PORTA to start the stream The UE9 will begin sending StreamData packets to the host using PORTB e Call StreamStop on PORTA to stop the stream 3 2 1 External Triggering The internal scan clock normally initiates each scan in stream mode Optionally an external pulse falling edge on the Counter1 FIO line can initiate each scan In the low level StreamConfig function this is enabled by setting bit 6 of byte 9 In the LabJackUD Windows driver this is controlled with the put_config special channel LJ chSTREAM_EXTERNAL_TRIGGER One application of external triggering is for synchronized streaming from multiple devices In such a case set bit 7 of byte 9 on the main unit to enable scan pulse output In the LabJackUD Windows driver this is controlled with the put_config special channel LJ_chSTREAM_CLOCK_OUTPUT The main unit will then use the internal scan clock to initiate each scan and output a pulse per scan on the Counter1 FIO line The output is normall
108. ically enables the specified analog output Declaration 64 LJ ERROR _stdcall eGet LJ HANDLE Handle long Channel double Voltage long Binary long Reserved long Reserved2 Parameter Description Returns LabJack errorcodes or 0 for no error Inputs Handle Handle returned by OpenLabJack Channel The analog output channel to write to Voltage The voltage to write to the analog output Binary If this is nonzero True the value passed for Voltage should be binary Reserved 1 amp 2 Pass 0 4 2 19 eDI An easy function that reads the state of one digital input This is a simple alternative to the very flexible OType based method normally used by this driver When needed this function automatically configures the specified channel as a digital input Declaration LJ ERROR _stdcall eDI LJ HANDLE Handle long Channel long State Parameter Description Returns LabJack errorcodes or 0 for no error Inputs e Handle Handle returned by OpenLabJack e Channel The channel to read 0 22 corresponds to FIOO MIO2 Outputs e State Returns the state of the digital input O False Low and 1 True High 4 2 20 eDO An easy function that writes the state of one digital output This is a simple alternative to the very flexible IO Type based method normally used by this driver When needed this function automatically configures the specified channel as a digital output
109. ifferential Linearity Error Error Due To Loading Source Impedance Short Circuit Current Slew Rate Digital I O Low Level Input Voltage High Level Input Voltage Maximum Input Voltage 3 Input Leakage Current Output Low Voltage 4 FIO ElO CIO MIO ElO CIO MIO Output High Voltage 4 FIO ElO CIO MIO ElO CIO MIO Short Circuit Current 4 Output Impedance 4 Counter Input Frequency 5 Input Timer Total Edge Rate 6 No Load 2 5 mA 5 to 95 FS 100 uA 1mA Max to GND FIO ElO CIO MIO No Load Sinking 1 mA Sinking 1 mA Sinking 5 mA No Load Sourcing 1 mA Sourcing 1 mA Sourcing 5 mA FIO EIO CIO MIO FIO EIO CIO MIO Control High Control Low No Stream While Streaming volts volts bits FS counts counts 3 MHz 1 MHz 100000 edges s 25000 edges s 1 Maximum and minimum analog output voltage is limited by the supply voltages Vs and GND The specifications assume Vs is 5 0 volts Also the ability of the DAC output buffer to drive voltages close to the power rails decreases with increasing output current but in most applications the output is not sinking sourcing much current as the output voltage approaches GND nalog output accuracy is specified from 5 to o Of full scale output 2 Anal t i ified f 5 to 95 of full 3 Maximum voltage to avoid damage to the device Protection works whether the device is powered or not but continuous voltages over 5 8 volts or less tha
110. ile and is generally used with all IOTypes except put get config The string should contain the constant name as indicated in the header file such as LJ_ioANALOG_INPUT The declarations for the S versions are the same as the normal versions except for const char plOType eGetSS and ePutSS are special versions of these functions where OType and Channel are strings rather than longs This is useful for passing string constants in languages that cannot include the header file and is generally only used with the put get config OTypes The strings should contain the constant name as indicated in the header file such as LJ_ioPUT_CONFIG and LJ_chLOCALID The declaration for the SS versions are the same as the normal versions except for const char plOType const char pChannel The declaration for ePut is the same as eGet except that Value is not a pointer double Value and thus is an input only Declaration LJ ERROR _stdcall eGet LJ HANDLE Handle long lOType long Channel double pValue long x1 Parameter Description Returns LabJack errorcodes or 0 for no error Inputs e Handle Handle returned by OpenLabJack e lOType The type of request See Section 4 3 e Channel The channel number of the particular OType e pValue Pointer to Value sends and receives data e x1 Optional parameter used by some lOTypes Outputs e pValue Pointer to Value sends and
111. iment board is handy for building these circuits 2 7 3 6 Signal voltages beyond 5 volts and resistance measurement The nominal maximum analog input voltage range for the UE9 is 5 volts The easiest way to handle larger voltages is often by using the LJTick Divider which is a two channel buffered divider module that plugs into the UE9 screw terminals More information is available at labjack com The basic way to handle higher voltages is with a resistive voltage divider The following figure shows the resistive voltage divider assuming that the source voltage Vin is referred to the same ground as the UE9 GND R1 Vin e VUE mx R2 e GND Figure 2 4 Voltage Divider Circuit The attenuation of this circuit is determined by the equation Vout Vin R2 R1 R2 This divider is easily implemented by putting a resistor R1 in series with the signal wire and placing a second resistor R2 from the AIN terminal to a GND terminal To maintain specified analog input performance R1 should not exceed 10 KQ so R1 can generally be fixed at 10 KQ and R2 can be adjusted for the desired attenuation For instance R1 R2 10 kQ provides a divide by 2 so a 10 volt input will be scaled to 5 volts and a 0 10 volt input will be scaled to 0 5 volts The divide by 2 configuration where R1 R2 10 kQ presents a 20 kQ load to the source meaning that a 10 volt signal will have to be able to source sink up to 500 pA Some signal s
112. ing open a command prompt window and type ping 192 168 1 209 are useful utilities for testing basic Ethernet communication It is a good idea to attempt to Ping the desired IP address before connecting the UEQ to see if anything is already using that address A more extensive Ethernet troubleshooting utility called UE9ethertest is available at www labjack com files utilities See the file readme txt in the UEYethertest zip archive 2 3 Vext Screw Terminals and Power Jack There are two connections for an external power supply Vext a two pole screw terminal or a 2 1 mm center positive power jack These connections are electrically the same so generally only one is used at a time The nominal power supply voltage for the UE9 is 5 volts Power can be provided from the USB connection Vusb or an external power supply Vext The UE9 has an internal semiconductor switch that automatically selects between Vusb and Vext Both power sources can be connected at the same time and either can be connected disconnected at any time As long as 14 one supply remains valid the UE9 will operate normally If both Vusb and Vext are connected and valid the internal switch will select Vext The UE9 power supply requirement is nominally 5 volts at lt 200 mA see Appendix A This is generally provided by a wall wart or wall transformer type of supply A supply capable of 500 mA is recommended The power jack connector is 2 1 x 5 5 mm center posit
113. input mode where a list of channels is scanned at a specified scan rate The scan rate specifies the interval between the beginning of each scan The samples within each scan are acquired as fast as possible given the specified resolution and extra settling time if any As samples are collected they are placed in a 4 Mbit FIFO buffer on the UE9 until retrieved by the host This 4 Mbit buffer can hold over 180 000 samples Each data packet has various measures to ensure the integrity and completeness of the data received by the host The table below shows the maximum streaming data rates for the UE9 versus analog input resolution assumes no extra settling time These rates have been tested using Ethernet and various USB configurations but some systems might require a USB high high configuration or Ethernet to obtain these speeds A USB high high configuration means the UE9 is connected to a high speed USB2 hub which is then connected to a high speed USB2 host Even though the UEQ is not a high speed USB device such a configuration does often provide improved 45 performance For all USB configurations the worst case continuous stream rate seen in testing is 30 ksamples s Stream data rates over USB and Ethernet can also be limited by other factors such as speed of the PC and quality of the network General techniques for robust continuous streaming include increasing the priority of the stream process and designing an application to auto
114. instance are very fast and will increment on all the bounces Some solutions to this issue are e Software Debounce If it is known that a real closure cannot occur more than once per some interval then software can be used to limit the number of counts to that rate Firmware Debounce See section 2 10 1 for information about timer mode 6 e Active Hardware Debounce Integrated circuits are available to debounce switch signals This is the most reliable hardware solution See the MAX6816 maxim ic com or EDE2008 elabinc com e Passive Hardware Debounce A combination of resistors and capacitors can be used to debounce a signal This is not foolproof but works fine in most applications 32 e VS ak Digital Ld e Input e GND Figure 2 12 Passive Hardware Debounce Figure 2 12 shows one possible configuration for passive hardware debounce First consider the case where the 1 KQ resistor is replaced by a short circuit When the switch closes it immediately charges the capacitor and the digital input sees logic low but when the switch opens the capacitor slowly discharges through the 22 KQ resistor with a time constant of 22 ms By the time the capacitor has discharged enough for the digital input to see logic high the mechanical bouncing is done The main purpose of the 1 kQ resistor is to limit the current surge when the switch is close 1 KQ limits the maximum current to about 5 mA but better results might be obtained with smaller
115. ions are a discrete transistor e g 2N2222 a specific chip e g ULN2003 or an op amp Note that the UE9 DACs can source enough current to control almost any SSR and even some mechanical relays and thus can be a convenient way to control 1 or 2 relays The RB12 relay board is a useful accessory available from LabJack This board connects to the DB15 connector on the UE9 and accepts up to 12 industry standard I O modules designed for Opto22 G4 modules and similar Another accessory available from LabJack is the LJTick RelayDriver This is a two channel module that plugs into the UE9 screw terminals and allows two digital lines to each hold off up to 50 volts and sink up to 200 mA This allows control of virtually any solid state or mechanical relay 2 10 Timers Counters The UE9 has 6 timers Timer0 Timer5 and 2 counters Counter0 Counter1 When any of these timers or counters are enabled they take over an FIO line in sequence TimerO Timer 1 Timer5 Counter0 Counter If any one of the 8 timers counters is enabled it will take over FIOO If any 2 are enabled they will take over FIOO and FIO1 If all 8 are enabled they will take over all 8 FIO lines Some examples 1 Timer enabled CounterO disabled Counter1 disabled FIO0 TimerO 1 Timer enabled Counter0 disabled Counter1 enabled FIOO Timer0 FIO1 Counter1 6 Timers enabled CounterO enabled Counter1 enabled FIO0 FIO5 Timer0 Timer5 FIO6 CounterO 34 F
116. is configured as output One place where this might be useful is for stepper motors allowing control over a certain number of steps Once this timer reaches the specified stop count value and stops the adjacent timer the timers must be reconfigured UpdateConfig bit is set to restart the adjacent timer or the timer can be restarted by rewriting the value to the stop timer When the adjacent timer is stopped it is still enabled but just not outputting anything Thus rather than returning to whatever previous digital I O state it had it goes to input which has a 100 kQ pull up That means the best results are obtained if the adjacent timer was initially configured as input factory default rather than output high or output low The MSW of the read from this timer mode returns the number of edges counted but does not increment past the stop count value The LSW of the read returns edges waiting for 2 10 1 10 System Timer Low High Read Modes 10 amp 11 The LabJack UE9 has a free running internal 64 bit system timer with a frequency of 750 kHz Timer modes 10 amp 11 return the lower or upper 32 bits of this timer An FIO line is allocated for these modes like normal even though they are internal readings and do not require any external connections 2 10 1 11 Period Measurement 16 Bit Modes 12 amp 13 Similar to the 32 bit edge to edge timing modes described above modes 2 amp 3 except that hardware capture registers are used
117. is parameter determines whether that timer or counter is set to a new value or reset Reads are performed before reset 105 e Timer Mode These values are only updated if the UpdateConfig bit is set Following are the values to pass to configure how a timer operates Timer Modes 0 16 bit PWM output 1 8 bit PWM output 2 Period input 32 bit rising edges 3 Period input 32 bit falling edges 4 Duty cycle input 5 Firmware counter input 6 Firmware counter input with debounce 7 Frequency output 8 Quadrature input 9 Timer stop input odd timers only 10 System timer low read 11 System timer high read 12 Period input 16 bit rising edges 13 Period input 16 bit falling edges Timer Value These values are only updated if the UpdateConfig or associated UpdateReset bit is 1 The meaning of this parameter varies with the timer mode See Section 2 10 for further information Counter Mode Pass 0 Timer Returns the values from the timer modules This is the value before reset if reset was done Counter Returns the current count from the counters if enabled This is the value before reset if reset was done 106 5 3 6 StreamConfig Not supported over UDP Stream mode operates on a table of channels that are scanned at the specified scan rate Before starting a stream you need to call this function to configure the table and scan clock Command Byte 0 Checksum8 1 OxF8 2 NumChannels 3 3 0x11 4 Checksum16 L
118. ive A linear regulated or switching supply is acceptable Switching supplies are generally noisier than linears but the UE9 is not particularly sensitive to power supply noise and most users will not notice any difference Another interesting option is a power over Ethernet POE adapter The UE9 does not support POE itself but there are POE adapters that split out the data and power in such a manner that is acceptable for the UE9 These adapters consist of an injector and splitter and a single Ethernet cable carries data and power between the two LabJack Corporation has done testing with the WAPPOE unit from Linksys which is an off the shelf POE adapter with the proper connections for a UE9 2 4 Comm and Control LEDs There is a yellow LED associated with the Comm communication processor and a green LED associated with the Control processor The Comm LED flashes on reset and USB enumeration and then only turns on when there is communication USB Ethernet traffic This LED then turns off if there is no communication for about 200 ms The Control LED normally blinks continuously at about 2 5 Hz In flash programming mode it blinks at about 8 Hz If the LED is blinking at about 0 5 Hz that signifies the depreciated no longer supported low power mode Those blink rates apply when the UES9 is idle as this LED also flashes on Control processor activity Normal Power Up LED Behavior When the USB cable is connected to the UE9 no oth
119. l for passing string constants in languages that cannot include the header file and is generally used with all OTypes except put get config The string should contain the constant name as indicated in the header file such as LU_ioANALOG_INPUT The declaration for the S version of Get is the same as below except for const char plOType GetResultSS is a special version of the Get function where lOType and Channel are strings rather than longs This is useful for passing string constants in languages that cannot include the header file and is generally only used with the put get config IO Types The strings should contain the constant name as indicated in the header file such as LJ_ oPUT_CONFIG and LJ_chLOCALID The declaration for the SS version of Get is the same as below except for const char plOType const char pChannel It is acceptable to pass NULL or 0 for any pointer that is not required Declaration LJ_ERROR _stdcall GetResult LJ_HANDLE Handle long lOType long Chamnel double pValue Parameter Description Returns LabJack errorcodes or 0 for no error Inputs e Handle Handle returned by OpenLabJack e lOType The type of request See Section 4 3 e Channel The channel number of the particular IOType Outputs e pValue A pointer to the result value 4 2 9 GetFirstResult and GetNextResult Calling either Go function creates a list of results that matches
120. lO7 Counter 1 Timers and counters can appear on various pins but other I O lines never move For example Counter1 can appear anywhere from FIOO to FIO7 depending on how many timers are enabled and whether Counter0 is enabled Applicable digital l O are automatically configured as input or output as needed when timers and counters are enabled and stay that way when the timers counters are disabled See Section 2 9 1 for information about signal connections Each counter Counter0 or Counter1 consists of a 32 bit register that accumulates the number of falling edges detected on the external pin If a counter is reset and read in the same function call the read returns the value just before the reset Counter1 is used internally by stream mode but in such a case only uses an FIO line if clock output or external triggering is used If any timers counters are being used while starting stopping a stream the possible interaction between timer counter configuration and starting stopping a stream needs to be considered The timers Timer0 Timer5 have various modes available Timer Modes 16 bit PWM output 8 bit PWM output Period input 32 bit rising edges Period input 32 bit falling edges Duty cycle input Firmware counter input Firmware counter input with debounce Frequency output Quadrature input Timer stop input odd timers only 10 System timer low read 11 System timer high read 12 Period input 16 bit rising edges
121. lValue 0 73 Following is pseudocode to reset the input timers and the counter Reset the firmware counter Timer2 to zero by writing a value of zero ePut lngHandle LJ_ioPUT_TIMER_VALUE 2 0 0 Reset the duty cycle measurement Timer3 to zero by writing a value of zero The duty cycle measurement is continuously updated so a reset is normally not needed but one reason to reset to zero is to detect whether there has been a new measurement or not ePut 1ngHandle LJ_ioPUT_TIMER_VALUE 3 0 0 Reset the quadrature counters Timer4 amp Timer5 to zero by writing a value of zero to either on ePut 1ngHandle LJ_ioPUT_TIMER_VALUE 4 0 0 Reset Counter0 to zero ePut lIngHandle LJ_ioPUT_COUNTER_RESET 0 1 0 Note that if a timer counter is read and reset at the same time in the same Add Go Get block the read will return the value just before reset 4 3 7 Stream Mode There are five OTypes used to control streaming LJ_ioCLEAR_STREAM_ CHANNELS LJ_ioADD_STREAM_CHANNEL LJ_ioSTART_STREAM Value returns actual scan rate LJ_ioSTOP_ STREAM LJ_ioGET_STREAM_DATA The following constant is passed in the Channel parameter with the get stream data lOType to specify a read returning all scanned channels rather than retrieving each scanned channel separately LJ_chALL_CHANNELS The following are special channels used with the get put config IOTypes to write
122. lable timer mode 10 49 4 LabJackUD High Level Driver The low level UE9 functions are described in Section 5 but most Windows applications will use the LabJackUD driver instead The driver requires a PC running Windows 98 ME 2000 or XP It is recommended to install the software before making a USB connection to a LabJack The download version of the installer consists of a single executable This installer places the driver LabJackUD dll in the Windows System directory along with a support DLL LabJackUSB dll Generally this is c Windows System on Windows 98 ME and c Windows System32 on Windows 2000 XP Other files including the header and Visual C library file are installed to the LabJack drivers directory which defaults to c Program Files LabJack drivers 4 1 Overview The general operation of the LabJackUD functions is as follows Open a LabJack Build a list of requests to perform Add Execute the list Go Read the result of each request Get For example to write an analog output and read an analog input Use one of the following lines to open the first found LabJack UE9 over USB or Ethernet and get a handle to the device The general form of the open function is OpenLabJack DeviceType ConnectionType Address FirstFound Handle Open the first found LabJack UE9 over USB ingErrorcode OpenLabJack LJ_dtUE9 LJ_ctUSB 1 1 IngHandle or open a specified LabJack U
123. le the voltage measured between CB37 AGND and UE9 GND was 0 0 mV When any sizeable cable lengths are involved a good practice is to separate current carrying ground from ADC reference ground An easy way to do this on the CB37 is to use GND as the current source sink and use AGND as the reference ground This works well for passive sensors no power supply such as a thermocouple where the only ground current is the return of the input bias current of the analog input 2 12 2 EB37 Experiment Board The EB37 experiment board connects to the LabJack UE9 s DB37 connector and provides convenient screw terminal access Also provided is a solderless breadboard and useful power supplies The EB37 is designed to connect directly to the LabJack but can also connect via a 37 line 1 1 male female cable 2 13 DB15 The DB15 connector brings out 12 additional digital I O It has the potential to be used as an expansion bus where the 8 EIO are data lines and the 4 CIO are control lines In the Windows driver the ElO are addressed as digital I O bits 8 through 15 and the CIO are addressed as bits 16 19 These 12 channels include an internal series resistor that provides overvoltage short circuit protection These series resistors also limit the ability of these lines to sink or source current Refer to the specifications in Appendix A 41 All digital I O on the UE9 have 3 possible states input output high or output low Each bit of I O
124. lngTimerModes LJ_tmPWM8 LJ_tmRISINGEDGES32 0 0 0 0 Set timer modes adblTimerValues 16384 0 0 0 0 0 Set PWM8 duty cycle to 75 alngEnableCounters 1 0 Enable Counter0 eTCConfig Handle aEnableTimers aEnableCounters TCPinOffset TimerClockBaseIndex TimerClockDivisor aTimerModes LS aTimerValues Reservedl Reserved2 eTCConfig IngHandle alngEnableTimers alngEnableCounters 0 LJ_tc750KHZ 3 alngTimerModes adblTimerValues 0 0 Read and reset the input timer Timerl read and reset Counter0 and update the value duty cycle of the output timer Timer0 Fill the arrays with the desired values then make the call alngReadTimers 0 1 0 0 0 0 Read Timerl alngUpdateResetTimers 1 1 0 0 0 0 Update Timer0 and reset Timerl alngReadCounters 1 0 Read Counter0O alngResetCounters 1 0 Reset Counter0 adblTimerValues 32768 0 0 0 0 0 Change Timer0 duty cycle to 50 eTCValues Handle aReadTimers aUpdateResetTimers aReadCounters aResetCounters aTimerValues aCounterValues Reservedl Reserved2 LL eTCValues IngHandle alngReadTimers alngUpdateResetTimers alngReadCounters alngResetCounters adblTimerValues adblCounterValues 0 0 printf Timerl value 0f n adblTimerValues 1 printf Counter0 value 0f n adblCounterValues 0 IL oe 4 3 10 SPI Serial Communication The UE9 supports Se
125. lution 18 UE9 Pro Peak To Peak Noise Free Noise Free RMS Effective Effective Range Noise Resolution Resolution Noise Resolution Resolution 5 110 17 2 0 000066 20 19 7 0 000012 0 5 90 17 5 0 000027 17 19 9 0 000005 135 C Enclosure 8 PCB Drawings The UE9 enclosure base has a pair of slotted holes towards the communication end left in below drawing and another pair of mounting holes at the opposite end right in below drawing The square holes shown below are for DIN rail mounting adapters Tyco part FTKAD Units are inches LABJACK UE9 MECHANICAL CONNECTIONS DIMENSIONS IN INCHES DIN RAIL MOUNT 5 00 j TYCO p n TKAD SCREW MOUNT 8 SCREWS S 0 17 136 LABJACK UE9 ELECTRICAL CONNECTIONS DB15 DIGITAL I O DB37 MIXED I O SCREW POWER JACK 5 VDC TERMINALS SCREW TERMINAL POWER 5 VDC ETHERNET 10Base T USB TYPE B CONTROL LED GREEN COMM LED YELLOW 137 PCB MOUNTING HOLE DIMENSIONS DIMENSIONS IN INCHES 9009 0000 9 POO 0000 0000 0000 5 85 2PLCS PCB AND CONNECTOR FOOTPRINT DIMENSIONS IN INCHES 138
126. maller packet size and can be faster in some situations Extended commands provide more commands better error detection and a larger maximum data payload Normal command format Byte 0 Checksume Includes bytes 1 15 1 Command Byte DOCCCCWWW Bit 7 Destination bit O Local 1 Remote Bits 6 3 Normal command number 0 14 Bits 2 0 Number of data words 2 15 Data words Extended command format Byte 0 Checksum Includes bytes 1 5 1 Command Byte D1111CCC Bit 7 Destination bit O Local 1 Remote Bits 6 3 1111 specifies that this is an extended command Bits 2 0 Used with some commands 2 Number of data words 3 Extended command number 4 Checksum16 LSB 5 Checksum16 MSB 6 255 Data words 89 Checksum calculations All checksums are a 1 s complement checksum Both the 8 bit and 16 bit checksum are unsigned Sum all applicable bytes in an accumulator 1 at a time Each time another byte is added check for overflow carry bit and if true add one to the accumulator In a high level language do the following for the 8 bit normal command checksum Get the subarray consisting of bytes 1 and up Convert bytes to U16 and sum into a U16 accumulator Divide by 2 and sum the quotient and remainder Divide by 2 and sum the quotient and remainder In a high level language do the following for an extended command 16 bit checksum Get the subarray consisting of bytes 6 and up Convert bytes to U
127. mand Except for reading stream data always write and read the actual number of bytes in the command and response If the size is not an even multiple of the endpoint size a short packet will be transferred In general small transfers will be faster on Endpoint 1 and large transfers will be faster on Endpoint 2 but the time differences are small if any and it is normal to do all communication besides reading stream data on Endpoint 1 The main reason for the different endpoints is to simplify calling command response functions while a stream is in progress USB stream data is a special case where each 46 byte data packet is padded with 2 zeros on the end not part of the protocol and then 4 of these 48 byte blocks are grouped together and sent in 3 transfers over the 64 byte endpoint The host will generally read stream data over USB in multiples of 192 bytes 64 samples This means that at low scan rates there could be a long time between reads and latency will be high but this can be improved by oversampling The USB transceiver on the UE9 has a 128 byte hardware buffer on Endpoint 2 If the UE9 stream data buffer has one or more StreamData packets available they are moved to the USB buffer to await a read by the host Once placed in this USB buffer the data cannot be removed e g by a FlushBuffer command To avoid confusion on future communication on Endpoint 2 this buffer should always be emptied after streaming One way to empty this
128. matically restart the stream if needed Max Stream Index Resolution Samples s 0 12 12 50000 13 13 16000 14 14 4000 15 15 1000 16 16 250 Table 3 4 Recommended Maximum Stream Data Rates A sample is defined as a single conversion of a single channel while a scan is defined as a single conversion of all channels being acquired That means that according to Table 3 4 the maximum scan rate for a stream of five 12 bit channels is 50k 5 10 kscans second The time between each sample within each scan without any extra settling time is a little less than one over the max stream rate specified in the above table The values in Table 3 4 are generally worst case conservative values This is particularly true for the 12 bit value The following table shows the actual measured limits for 12 bit streaming Comm firmware V1 40 Control firmware V1 84 reflecting the fact that stream mode is more efficient with more channels Note again that Table 3 5 shows sample rates not scan rates Divide by the number of channels to determine the scan rate Max Stream Max Stream Samples s Samples s Channels USB high high Ethernet 1 57000 57000 2 66000 66000 4 68000 74000 8 68000 78000 16 68000 80000 Table 3 5 Actual Maximum Stream Data Rates Resolution 12 When the limits in Table 3 5 are exceeded an error will occur Probably scan overlap or buffer overflow The UE9 will not return bad data so these max data rates can be attempted and eit
129. n 0 3 volts are not recommened when the UE9 is unpowered as the voltage will attempt to supply operating power to the UE9 possibly causing poor start up behavior 4 These specifications provide the answer to the common question How much current can the digital I O sink or source For instance if EIOO configured as output high and shorted to ground the current sourced by ElOO into ground will be about 18 mA 3 3 180 If connected to a load that draws 5 mA ElOO can provide that current but the voltage will droop to about 2 4 volts instead of the nominal 3 3 volts If connected to a 180 ohm load to ground the resulting voltage and current will be about 1 65 volts 9 mA 5 Hardware counters 0 to 3 3 volt square wave Default power level is High 6 To avoid missing edges keep the total number of applicable edges on all applicable timers below this limit See Section 2 10 for more information B Noise Resolution Tables The following tables provide typical noise levels of the UE9 under ideal conditions The resulting voltage resolution is then calculated based on the noise levels Also see the LJTick InAmp datasheet which provides similar tables with the instrumentation amplifier installed Measurements were taken with AINO connected to GND with a short jumper wire or from internal ground channel 15 Similar results were obtained with other quiet signals such as a 2 048 reference REF191 from Analog Devices a 1 5 v
130. n is often not needed for every signal Any signals powered by the same external supply or otherwise referred to the same external ground should share a single ground connection to the UES9 if possible 2 9 1 3 Input Mechanical Switch Closure To detect whether a mechanical switch is open or closed connect one side of the switch to UE9 ground and the other side to a digital input The behavior is very similar to the open collector described above a Digital Input e GND Figure 2 11 Basic Mechanical Switch Connection To Digital Input When the switch is open the internal 100 KQ pull up resistor will pull the digital input to about 3 3 volts logic high When the switch is closed the ground connection will overpower the pull up resistor and pull the digital input to O volts logic low Since the mechanical switch does not have any electrical connections besides to the LabJack it can safely be connected directly to GND without using a series resistor or SGND When the mechanical switch is closed and even perhaps when opened it will bounce briefly and produce multiple electrical edges rather than a single high low transition For many basic digital input applications this is not a problem as the software can simply poll the input a few times in succession to make sure the measured state is the steady state and not a bounce For applications using timers or counters however this usually is a problem The hardware counters for
131. n pipe For the UE9 0 is the normal pipe while 1 is the streaming pipe The number of bytes to write read is specified in value 1 512 and x1 is a pointer to a byte array for the data When retrieving the result the value returned is the number of bytes actually read written Following is example pseudocode to write and read the simple low level echo command This is the simplest UE9 command and consists simply of a write of 2 bytes 0x70 0x70 and a read of the same two bytes writeArray 2 0x70 0x70 numBytesToWrite 2 numBytesToRead 2 Raw Out This command writes the bytes to the device eGet 1ngHandle LJ_ioRAW_OUT 0 amp numBytesToWrite pwriteArray Raw In This command reads the bytes from the device eGet lngHandle LJ_ioRAW_IN 0 amp numBytesToRead preadArray 4 3 9 Easy Functions The easy functions are simple alternatives to the very flexible OType based method normally used by this driver There are 6 functions available eAIN Read 1 analog input eDAC Write to 1 analog output eDI Read 1 digital input eDO Write to 1 digital output eTCConfig Configure all timers and counters eTCValues Update reset and read all timers and counters In addition to the basic operations these functions also automatically handle configuration as needed For example eDO sets the specified line to output if previously configured as input The first 4 functions should not be used w
132. ng LabJack products To minimize the risks associated with customer applications customers should provide adequate design and operating safeguards Reproduction of products or written or electronic information from LabJack Corporation is prohibited without permission Reproduction of any of these with alteration is an unfair and deceptive business practice Copyright O 2008 LabJack Corporation Declaration of Conformity Manufacturers Name LabJack Corporation Manufacturers Address 3232 S Vance St STE 100 Lakewood CO 80227 USA Declares that the product Product Name LabJack UE9 Model Number LJUE9 conforms to the following Product Specifications EMC Directive 89 336 EEC EN 55011 Class A EN 61326 1 General Requirements and is marked with CE Warranty The LabJack UE9 comes with a 1 year limited warranty from LabJack Corporation covering this product and parts against defects in material or workmanship The LabJack can be damaged by misconnection such as connecting 120 VAC to any of the screw terminals and this warranty does not cover damage obviously caused by the customer If you have a problem contact support labjack com for return authorization In the case of warranty repairs the customer is responsible for shipping to LabJack Corporation and LabJack Corporation will pay for the return shipping LabJack UE9 User s Guide Revision History V1 10 released Feb 12 2008 Major changes to entire document V1 1
133. nnccnnncnoncnoncnonononnnoncnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnos 15 220 A A E 15 A O OO 16 BT O 16 2 7 Channel NUMBETS iii A AAA A A AA A laa 16 2 7 2 Converting Binary Readings to Voltages coooooooccccnnnnnccccononcccnononnnnnnnanononnnnnnnnnnnnnnnns 19 2 7 3 Typical Analog Input Connections cui tea ism aisteatiesbiagens 21 2 7 4 Internal Temperature Sensor ccececeeeeeeee eee eeeee cece cece cece ceeeeeeeeeeeeeeeeeneeeeeeeneeeeeeeess 27 Za PNG ay che aa o Sedna sata stants a si n 27 2 8 1 Typical Analog Output Connections ceccceceeneceeeeeteeeneneeeeneeeeeeeeeedeneeneneeeeneeteeeeene 28 ZO SGA OO eae te Sada cha dtc phe at te Moen ira Sena se Gen st laa te E anal stat a than ace 29 2 9 1 Typical Digital O Connections ecos 30 2 10 AASIN n ee E AE A EEATT E A E 34 2 10 1 Timer Mode Descriptions oooocoocncnnnnicncococcccocccccccnnncn cnn nn 36 2 10 2 Timer Operation Performance Notes eeeeeeee cece ects eect eeeeeeeeseeeeeeeeeeeeeeeeeneeeees 40 241 SCLANG SDA OR SCA Jti octane A naked eae Aan uae teatea eae 40 2 12 DB PP O 40 2 12 1 CB37 Terminal Board s iien een neesi erae ea E aaa EEE AEE EEE A aeaa 41 2 12 2 EB37 Experiment Board coooccicccococococococccccnccn cnn 41 a 41 2 13 1 CB15 Terminal Board iii a A A AA 42 Z2 13 2 RB12 Relay BORO os a A AAA AA ia 42 2 14 OEM Connector Options oococccccccncccnnccnnncnoncnnncnonononnnnnnnnnnnnnnnnonnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
134. not work e Search for Ethernet devices using specified IP addresses When this option is selected LJControlPanel will specifically search over TCP using each address in the list On some networks this might be preferred over the UDP broadcast search 1 2 Self Upgrade Application LJISelfUpgrade Both processors in the UE9 have field upgradeable flash memory The self upgrade application shown in Figure 1 4 programs the latest firmware onto either processor First put valid values in the Connect by box If USB select first found or specify a local ID If Ethernet specify the IP Address These values will be used for programming and everything else Click on Get Version Numbers to find out the current firmware versions on the device Then use the provided Internet link to go to labjack com and check for more recent firmware Download firmware files to the LabJack LJUSelfUpgrade upgradefiles directory Click the Browse button and select the upgrade file to program Based on the file name the application will determine whether the Comm or Control processor is to be programmed Click the Program button to begin the self upgrade process FAN LJSelfUpgrade 1 06e File Browse Status Press Program to begin Pogan Driver 2 260 Version Check for the latest firmware upgrade files at www labjack com files firmware Download any desired upgrades and save them in 4LJSelflpgrade upgradefiles Target process
135. ns can be transferred by USB Ethernet TCP or Ethernet UDP The exception is steam commands which are not supported over UDP 5 3 1 BadChecksum If the Control processor detects a bad checksum in any command the following 2 byte normal response will be sent and nothing further will be done Response Byte 0 0xB8 1 OxB8 96 5 3 2 ControlConfig Configures various parameters associated with the Control processor Although this function appears to have many of the same digital l O and DAC parameters as other functions most parameters in this case are affecting the power up values not the current values If WriteMask is nonzero some or all default values are written to flash The Control flash has a rated endurance of at least 20000 writes which is plenty for reasonable operation but if this function is called in a high speed loop with a nonzero WriteMask the flash could be damaged There is a hardware method to restore parameters to the default values described below in parentheses Power up the UE9 with a short from FIO2 lt gt SCL then remove the jumper and power cycle the device again This also returns Comm Section 5 2 1 and Watchdog Section 5 3 13 settings to factory defaults Command U DOAG0ON OoO 9 t Checksum8 OxF8 0x06 0x08 Checksum16 LSB Checksum16 MSB WriteMask Bit 2 Update DAC defaults Bit 1 Update digital defaults Bit 0 Update power level default 7 PowerLevel 0 0x00 Fixed high sys
136. olt D cell battery and a temperature sensor LM34CAZ from National Semiconductor All counts data are aligned as 24 bit values To equate to counts at a particular resolution Res use the formula counts 2 24 Res For instance with the UE9 set to 12 bit resolution and the 0 5 volt range there are 8192 counts of noise when looking at 24 bit values To equate this to 12 bit data we take 8192 2 12 which equals 2 counts of noise when looking at 12 bit values Noise free data is determined by taking 128 readings and subtracting the minimum value from the maximum value RMS and Effective data are determined from the standard deviation of 128 readings In other words the RMS data represents most readings whereas noise free data represents all readings Resolution 0 12 Peak To Peak Noise Free Noise Free RMS Effective Range Noise Resolution Noise Resolution Resolution 5 12 8 12 8 12 0 11 1 Resolution 14 Peak To Peak Noise Free Noise Free RMS Effective Range Noise Resolution Resolution Resolution 5 12 5 14 9 12 5 14 9 11 8 14 1 11 0 13 3 10 0 134 Peak To Peak Noise Free Noise Free RMS Effective Effective Range Noise Resolution Resolution 5 14 5 0 000432 16 9 14 5 0 000216 16 9 13 8 0 000175 16 2 12 9 0 000164 15 4 0 000165 Peak To Peak Noise Free Noise Free RMS Effective Effective Range Noise Resolution Resolution 5 15 5 75 17 8 15 5 75 17 8 14 7 17 1 14 0 16 3 13 0 Reso
137. om wiki UE9 Modbus Support 130 A Specifications Specifications at 25 degrees C and Vusb Vext 5 0V except where noted Parameter Conditions Min Typical Max Units General USB Cable Length meters Ethernet Cable Length 1 meters Supply Voltage i volts Typical Supply Current 2 Control Low mA Control High mA Operating Temperature C Clock Error 25 C 10 to 60 C 40 to 85 C Typ Command Execution Time 3 Ethernet USB high high USB other Vs Outputs Typical Voltage USB 4 Self Powered Typical Voltage Wall Wart Maximum Current 5 Vm Vm Outputs Typical Voltage No load imA Maximum Current 1 Expected max Ethernet cable length is at least 100 meters by design but we have only tested 33 meter cables Customer feedback on longer cables is welcome 2 Typical current drawn by the UE9 itself not including any user connections Minimum value is the typical current when the device is idle Maximum value is the typical current when the device is very busy 3 Total typical time to execute a single Feedback function with no analog inputs Measured by timing a Windows application that performs 1000 calls to the Feedback function See Section 3 1 for more timing information 4 Self powered would apply to USB hubs with a power supply all known desktop computer USB hosts and some notebook computer USB hosts 5 This is the maximum current that should be sourced through the UE9 and out o
138. ome other device using the serial protocol Using this serial protocol is considered an advanced topic A good knowledge of the protocol is recommended and a logic analyzer or oscilloscope might be needed for troubleshooting There is one OType used to write read 1 C data LJ_ioI2C_COMMUNICATION The following are special channels used with the 1 C OType above LJ_chI2C_READ Value number of bytes 0 240 x1 array LJ_chI2C_WRITE Value number of bytes 0 240 x1 array LJ_chI2C_GET_ACKS The following are special channels used with the get put config OTypes to configure various parameters related to the I C bus See the low level function description in Section 5 3 20 for more information about these parameters LJ_chI2C_ADDRESS_BYTE LJ_chI2C_SCL_PIN_NUM 0 22 Pull up resistor usually required LJ_chI2C_SDA_PIN_NUM 0 22 Pull up resistor usually required LJ_chI2C_OPTIONS LJ_chI2C_SPEED_ADJUST The LJTick DAC is an accessory from LabJack with an 1 C 24C01C EEPROM chip Following is example pseudocode to configure IC to talk to that chip The AddressByte of the EEPROM on the LJTick DAC is 0xA0 or decimal 160 AddRequest IngHandle LJ_ioPUT_CONFIG LJ_chI2C_ADDRESS_BYTE 160 0 0 SCL is FIOO AddRequest lngHandle LJ_ioPUT_CONFIG LJ_chI2C_SCL_PIN_NUM 0 0 0 SDA is FIO1 AddRequest IngHandle LJ_ioPUT_CONFIG LJ_chI2C_SDA_PIN_NUM 1 0 0 See description of low level I2C function AddRe
139. or 5 Get Version Numbers Connect by Getting UES version numbers le DLE UES Comm Version 1 370 LocalID Ez V Use first found UES Control Version 1 510 ms ES UES Bootloader Version 1 120 C Ethernet IP Address 192 168 JE 209 Figure 1 4 Self Upgrade Application 11 2 Hardware Description The UE9 has 3 different I O areas e Communication Edge e Screw Terminal Edge e DB Edge The communication edge has a USB type B connector with black cable connected in Figure 2 1 a 10Base T Ethernet connector with yellow cable connected in Figure 2 1 and two entry points for external power screw terminals or power jack The screw terminal edge has convenient connections for 4 analog inputs both analog outputs and 4 flexible digital I O FIO The screw terminals are arranged in blocks of 4 with each block consisting of Vs GND and two I O Also on this edge are two LEDs associated with the two processors in the UEQ The DB Edge has 2 D sub type connectors a DB37 and DB15 The DB37 has some digital I O and all the analog I O The DB15 has 12 additional digital I O Figure 2 1 LabJack UE9 2 1 USB For information about USB installation see Section 1 The UE9 has a full speed USB connection compatible with USB version 1 1 or 2 0 This connection can provide communication and power Vusb but it is possible that some USB ports will not be able to provide enough power to run the UES9 at all speeds
140. os 42 De PON AU Ol P ss vast TEE AEAEE EE A ELTETT 44 3 1 Command RESPOnse ccccccccccecccceeecececeeeceeeeeeeceeeeececeeceeeeeeeceeeceneeeseeeaseseaeesaeeeaeeeaeeaaes 44 AE A neds vtudtae Pace Woae wa cadehen Sluda dian Westnet E E 45 B22 1s External TDI asics de it A Ao Ane Na ieee at 47 3 2 2 Streaming Digital Inputs Timers and CounterQ oooooooococcconcconccnnncnoncnoncnoncnoncnnnnnnnnnns 48 4 LabJackUD High Level Driver 0oooomomiocrcin seras 50 Ay SOV GIVIOW AR E EEE E AA EAT E T Sad 50 4 Al Funcion RISA aa ir ci EEE 51 4 1 2 Multi Threaded Operation ooooocncocncinocccocccoccccccccc nn cn cnn 52 4 2 Eunction Referenes muse Men 54 42 Ts Diao dt 54 4 2 2 OpenLablack siii des 55 4 23 SS ANG SPUU ist dit iii ie 56 424 A O 57 42 9 AUR Quesito A 57 ALO O ir ri a ds acted ace A TT EA AAA lene EA A da 58 AAN cased vdcele nd riaa Enbe se Ta aati sauedesb ugandan eae 59 42 8 GetResUll ina bora 59 4 2 9 GetFirstResult and GetNextResult o ooooooonononcccnnnnccccccononcccncnnnnnnnnnnnnnnnnnnnnnnnnnnnnnns 60 4 2 10 DoubleToStringAddress silla a ni 61 4 2 11 StringToDoubleAddress cisco ii tit 61 4212 String TOCONS Mai A io 62 AZ 1S Eror POO ul ING trat islas 62 42 14 CODE VEIA tn 63 42 15 TCVoltsTOT emp iii ad 63 42 16 Resetlablack isis 63 A O O 64 AZ NOSCDAGC tii 64 A219 e D a aes arte aA ahi aad eel eee teats 65 4 2 20 6 DO at ea ie A eee Oe 65 4 2 21 CV CCONTIG ieai e Soa gnats i
141. other 0 5 volts is dropped across the internal resistance of the 33 EIO CIO MIO line With an FIO line the voltage across the inputs of the relay will be about 5 1500 1500 550 3 7 volts the other 1 3 volts are dropped across the internal resistance of the FIO line Both of these are well above the 3 0 volt threshold for the relay so it will turn on e When the digital line is set to input it is the equivalent of a 3 3 volt connection with 100 kQ in series The resulting voltage across the control inputs of the relay will be close to zero as virtually all of the 1 7 volt difference between VS and 3 3 is dropped across the internal 100 kQ resistance This is well below the 1 0 volt threshold for the relay so it will turn off e When the digital line is set to output high it is the equivalent of a 3 3 volt connection with 180 Q ElO CIO MIO or 550 FIO in series When using an EIO CIO MIO line the resulting voltage across the control inputs of the relay will be about 1 7 1500 1500 180 1 5 volts With an FIO line the voltage across the inputs of the relay will be about 1 7 1500 1500 550 1 2 volts Both of these in the 1 0 3 0 volt region that is not defined for these example relays so the resulting state is unknown Mechanical relays require more control current than SSRs and cannot be controlled directly by the digital I O on the UE9 To control higher currents with the digital I O some sort of buffer is used Some opt
142. ources might require a load with higher resistance in which case a buffer should be used The 24 following figure shows a resistive voltage divider followed by an op amp configured as non inverting unity gain i e a buffer R1 o Vin e Op Amp AINx R2 E e GND Figure 2 5 Buffered Voltage Divider Circuit The op amp is chosen to have low input bias currents so that large resistors can be used in the voltage divider The LT1490A from Linear Technologies linear com is a good choice for dual supply applications The LT1490A only draws 40 pA of supply current thus many of these amps can be powered from the Vm Vm supply on the UE9 and can pass signals in the 5 volt range Since the input bias current is only 1 nA large divider resistors such as R1 R2 470 KQ will only cause an offset of about 470 uV and yet present a load to the source of about 1 megaohm For 0 5 volt applications where the amp will be powered from Vs and GND the LT1490A is not the best choice When the amplifier input voltage is within 800 mV of the positive supply the bias current jumps from 1 nA to 25 nA which with R1 470 kQ will cause the offset to change from 470 uV to 12 mV A better choice in this case would be the OPA344 from Texas Instruments ti com The OPA344 has a very small bias current that changes little across the entire voltage range Note that when powering the amp from Vs and GND the input and output to the op amp is limited
143. ow and inefficient Use thread pools and other techniques to keep new thread creation to a minimum That is what is done internally The one big exception to the thread safety of this driver is in the use of the Windows TerminateThread function As is warned in the MSDN documentation using TerminateThread will kill the thread without releasing any resources and more importantly releasing any synchronization objects If TerminateThread is used on a thread that is currently in the middle of a call to this driver more than likely a synchronization object will be left open on the particular device and access to the device will be impossible until the application is restarted On some devices it can be worse On devices that have interprocess synchronization such as the U12 calling TerminateThread may kill all access to the device through this driver no matter which process is using it and even if the application is restarted Avoid using TerminateThread All device calls have a timeout which defaults to 1 second but can be changed Make sure to wait at least as long as the timeout for the driver to finish 53 4 2 Function Reference The LabJack driver file is named LabJackUD dll and contains the functions described in this section Some parameters are common to many functions e LJ ERROR A LabJack specific numeric error code O means no error long signed 32 bit integer e LJ HANDLE This value is returned by OpenLabJack and
144. passing string constants in languages that cannot include the header file and is generally only used with the put get config IO Types The strings should contain the constant name as indicated in the header file such as LJ_ oPUT_CONFIG and LJ_chLOCALID The declaration for the SS version of Add is the same as below except for const char plOType const char pChannel Declaration LJ_ERROR _stdcall AddRequest LJ_HANDLE Handle long lOType long Channel double Value long x1 double UserData Parameter Description Returns LabJack errorcodes or 0 for no error Inputs Handle Handle returned by OpenLabJack lOType The type of request See Section 4 3 Channel The channel number of the particular OType Value Value passed for output channels x1 Optional parameter used by some lOTypes UserData Data that is simply passed along with the request and returned unmodified by GetFirstResult or GetNextResult Can be used to store any sort of information with the request to allow a generic parser to determine what should be done when the results are received Outputs e None 4 2 6 Go After using AddRequest to make an internal list of requests to perform call Go to actually perform the requests This function causes all requests on all open LabJacks to be performed After calling Go call GetResult or similar to retrieve any returned data or errors Go can be
145. quest IngHandle LJ_ioPUT_CONFIG LJ_chI2C_OPTIONS 0 0 0 See description of low level I2C function 0 is max speed of about 150 kHz AddRequest IngHandle LJ_ioPUT_CONFIG LJ_chI2C_SPEED_ADJUST 0 0 0 Execute the configuration requests GoOne lngHandle Following is pseudocode to read 4 bytes from the EEPROM Initial read of EEPROM bytes 0 3 in the user memory area We need a single I2C transmission that writes the address and then reads the data That is there needs to be an ack after writing the address not a stop condition To accomplish this we use Add Go Get to combine the write and read into a single low level call numWrite 1 array 0 0 Memory address User area is 0 63 81 AddRequest IngHandle LJ_ioI2C_COMMUNICATION LJ_chI2C_WRITE numWrite array 0 numRead 4 AddRequest lngHandle LJ_ioI2C_COMMUNICATION LJ_chI2C_READ numRead array 0 Execute the requests GoOne lngHandle For more example code see the I2C cpp example in the VC6_LJUD archive 4 3 12 Asynchronous Serial Communication The UE9 has a UART available that supports asynchronous serial communication Currently the UART connects to the PIN2 PIN20 TX0 RX0 pins on the DB37 connector On a future UE9 hardware revision it is expected that the UART will appear on FIO EIO lines after any timers and counters Communication is in the common 8 n 1 format Similar to RS232 except that the logic is normal CM
146. ration double _stdcall GetDriverVersion Parameter Description Returns Driver version Inputs e None Outputs e None 4 2 15 TCVoltsToTemp A utility function to convert thermocouple voltage readings to temperature Declaration LJ ERROR _stdcall TCVoltsToTemp long TCType double TCVolts double CUTempk double pTCTempk Parameter Description Returns LabJack errorcodes or 0 for no error Inputs e TCType A constant that specifies the thermocouple type such as LJ_ttK e TCVolts The thermocouple voltage e CJTempK The temperature of the cold junction in degrees K Outputs e pTCTempK Returns the calculated thermocouple temperature 4 2 16 ResetLabJack Sends a reset command to the LabJack hardware Resetting the LabJack does not invalidate the handle thus the device does not have to be opened again after a reset but a Go call is likely to fail for a couple seconds after until the LabJack is ready In a future driver release this function might be given an additional parameter that determines the type of reset Declaration LJ ERROR _stdcall ResetLabJack LJ HANDLE Handle Parameter Description Returns LabJack errorcodes or 0 for no error Inputs e Handle Handle returned by OpenLabJack 63 Outputs e None 4 2 17 eAIN An easy function that returns a reading from one analog input This is a simple alternative to the very flexible IOType based method normally used b
147. re in the labjackud h file e ConnectionType Enter the constant for the type of connection USB or Ethernet e pAddress For USB pass the local ID or serial number of the desired LabJack For Ethernet pass the IP address of the desired LabJack If FirstFound is true Address is ignored e FirstFound If true then the Address and ConnectionType parameters are ignored and the driver opens the first LabJack found with the specified DeviceType Generally only recommended when a single LabJack is connected Currently only supported with USB If a USB device is not found it will try Ethernet but with the given Address 55 Outputs e pHandle A pointer to a handle for a LabJack 4 2 3 eGet and ePut The eGet and ePut functions do AddRequest Go and GetResult in one step The eGet versions are designed for inputs or retrieving parameters as they take a pointer to a double where the result is placed but can be used for outputs if pValue is preset to the desired value This is also useful for things like StreamRead where a value is input and output number of scans requested and number of scans returned The ePut versions are designed for outputs or setting configuration parameters and will not return anything except the error code eGetS and ePutS are special versions of these functions where lOType is a string rather than along This is useful for passing string constants in languages that cannot include the header f
148. rial Peripheral Interface SPI communication as the master only SPI is a synchronous serial protocol typically used to communicate with chips that support SPI as slave devices This serial link is not an alternative to the USB connection Rather the host application will write read data to from the UE9 over USB and the USB communicates with some other device 79 using the serial protocol Using this serial protocol is considered an advanced topic A good knowledge of the protocol is recommended and a logic analyzer or oscilloscope might be needed for troubleshooting There is one lOType used to write read data over the SPI bus LJ_ioSPI_COMMUNICATION Value number of bytes 1 240 x1 array The following are special channels used with the get put config OTypes to configure various parameters related to the SPI bus See the low level function description in Section 5 3 16 for more information about these parameters LJ_chSPI_AUTO_CS LJ_chSPI_DISABLE_DIR_CONFIG LJ_chSPI_MODE LJ_chSPI_CLOCK_FACTOR LJ_chSPI_MOSI_PIN_NUM LJ_chSPI_MISO_PIN_NUM LJ_chSPI_CLK_PIN_NUM LJ_chSPI_CS_PIN_NUM Following is example pseudocode to configure SPI communication First configure the SPI communication Enable automatic chip select control AddRequest lngHandle LJ_ioPUT_CONFIG LJ_chSPI_AUTO_CS 1 0 0 Do not disable automatic digital i o direction configuration AddRequest IngHandle LJ_ioPUT_CONFIG LJ_chSPI_DISABLE_DI
149. rrays as rather than actually passing the array an address to the first element in the array is passed 4 3 2 Configuration There are two OTypes used to write or read UE9 configuration parameters LJ_ioPUT_CONFIG LJ_i0GET_CONFIG The following constants are then used in the channel parameter of the config function call to specify what is being written or read LJ_chLOCALID LJ_chHARDWARE_VERSION LJ_chSERIAL NUMBER LJ_chCOMM_POWER_LEVEL LJ_chIP_ADDRESS LJ_chGATEWAY 68 LJ_chSUBNET LJ_chPORTA LJ_chPORTB LJ_chDHCP LJ_chPRODUCTID LJ_chMACADDRESS LJ_chCOMM_FTRMWARE_VERSION LJ_chCONTROL_POWER_LEVEL LJ_chCONTROL_FIRMWARE_VERSION LJ_chCONTROL_BOOTLOADER_VERSION LJ_chCONTROL_RESET_SOURCE More information about these parameters can be found in documentation for the low level CommConfig and ControlConfig functions Following is example pseudocode to write and read the IP address Convert an address string in dot notation to a double The general form of the StringToDoubleAddress function is StringToDoubleAddress String Number HexDot StringToDoubleAddress 192 168 1 210 amp dblAddress 0 Write a new IP address Like all Ethernet parameters this will not take effect until the UE9 is reset ePut 1ngHandle LJ_ioPUT_CONFIG LJ_chIP_ ADDRESS dblAddress 0 Read the current IP address eGet lngHandle LJ_ioGET_CONFIG LJ_chIP_ADDRESS amp dblAddress 0 Convert a double to an addres
150. rresponding channel will not be acquired saving time and will return O as a reading AIN14 15ChannelNumber Generally used to choose one of the internal channels but any channel can be used 100 e Resolution Determines the resolution setting for all analog inputs 12 17 See Sections 2 7 3 1 and 3 2 This function does not support the high resolution converter on the UE9 Pro e SettlingTime Adds extra settling time before acquiring each channel The extra delay is this value multiplied by about 5 microseconds e BipGain Contains the bipolar setting and gain options for two analog input channels The high nibble controls the higher channel number The high bit of each nibble is the bipolar option and the lower 3 bits of each nibble are the gain index Following are the nibble values for various gains Gain Unipolar Bipolar q 0x00 0x08 2 0x01 NA 4 0x02 NA 8 0x03 NA e AIN Returns raw analog input conversions Regardless of Resolution the value returned is 0 65520 where 0 is the minimum unsigned not 2 s complement e Counter Returns the current count from the counters if enabled Use the function TimerCounter to enable and configure the counters e Timer Returns the values from the first 3 enabled timer modules Use the function TimerCounter to enable and configure the timer modules The LabJackUD driver for Windows uses a modified version of the Feedback function called FeedbackAlt This modified function has ad
151. rrupt timer modes 2 3 4 5 8 9 12 13 If an interrupt is already being handled due to an edge on another timer delays of a couple microseconds per timer are possible That means if five other edge detecting timers are enabled it is possible but not likely to have about 10 microseconds of delay e Ifa stream is in progress every sample is acquired in a high priority interrupt These interrupts could cause delays of up to 10 microseconds e The always active UE9 system timer causes an interrupt 11 4 times per second If this interrupt happens to be in progress when the edge occurs a delay of about 1 microsecond is possible If the software watchdog is enabled the system timer interrupt takes longer to execute and a delay of a few microseconds is possible Note that the minimum measurable period is limited by the edge rate limit discussed in Section 2 10 2 Writing a value of zero to the timer performs a reset After reset a read of the timer value will return zero until a new edge is detected If a timer is reset and read in the same function call the read returns the value just before the reset Mode 3 is the same except that falling edges are used instead of rising edges 2 10 1 4 Duty Cycle Measurement Mode 4 Records the high and low time of a signal on the external pin which provides the duty cycle pulse width and period of the signal Returns 4 bytes where the first two bytes least significant word or LSW are a 16 bit value r
152. ry buffer and keep a specified number of scans before the trigger pre trigger scans Since stream data can consist of analog digital and timer counter inputs the trigger conditions can use any or all of those 3 2 2 Streaming Digital Inputs Timers and Counter0 There are special channel numbers that allow digital inputs timers and Counter0 to be streamed in with analog input data Channel 193 ElO_FIO 194 MIO_CIO 200 TimerO 201 Timer 202 Timer2 203 Timer3 204 Timer4 205 Timer5 210 CounterO 224 TC_Capture Table 3 6 Special Stream Channels Channel number 193 returns the input states of 16 bits of digital I O FIO is the lower 8 bits and EIO is the upper 8 bits This channel is generally used to acquire digital input data in stream mode Channel 194 is the same thing for the CIO and MIO lines Control firmware V1 69 or higher The CIO are in the lower byte and the MIO are in the upper byte Channels 200 205 and 210 retrieve the least significant word LSW lower 2 bytes of the specified timer counter At the same time that any one of these is sampled the most significant word MSW upper 2 bytes of that particular timer counter is stored in an internal capture register TC_Capture so that the proper value can be sampled later in the scan For any timer counter where the MSW is wanted channel number 224 must be sampled after that channel and before any other timer counter channel For example a scan list of 200 22
153. s between scans ChannelNumber 0 143 for analog input channels or 193 224 for digital timer counter channels ChannelOptions Contains the bipolar setting and gain options for the channel Following are the nibble values for various gains Gain Unipolar Bipolar 4 0x00 0x08 2 0x01 NA 4 0x02 NA 8 0x03 NA 108 5 3 7 StreamStart Not supported over UDP Once the stream settings are configured this function is called to start the stream Command Byte 0 OxA8 1 OxA8 Response Byte 0 Checksum8 1 OxA9 2 Errorcode 3 0x00 109 5 3 8 StreamData Not supported over UDP After starting the stream the data will be sent as available in the following format Data is sent 16 samples at a time in a 46 byte packet Reads oldest data from buffer Note that USB stream data is a special case where each 46 byte data packet is padded with 2 zeros on the end not part of the protocol and then 4 of these 48 byte blocks are grouped together and sent in 3 transfers over the 64 byte endpoint See the USB Section for more information Response Byte 0 Checksum8 1 OxF9 2 0x14 3 OxCO 4 Checksum16 LSB 5 Checksum16 MSB 6 9 TimeStamp 10 PacketCounter 11 Errorcode 12 13 Sampled 14 15 Sample1 16 17 Sample2 18 19 Sample3 20 21 Sample4 22 23 Sampled 24 25 Sample6 26 27 Sample7 28 29 Samples 30 31 Sample9 32 33 Sample10 34 35 Sample11 36 37 Sample12 38 39 Sample13 40 41 Sample14 42 43 Sample15 44 ControlBacklog 45 Comm
154. s no way to erase only a smaller area Command Byte OouaRhWN O Response U Noanenaok oO Checksum8 OxF8 0x01 0x29 Checksum16 LSB Checksum16 MSB EraseArea LSB 0x00 Blocks 8 15 0x4C Blocks 0 7 EraseArea MSB 0x00 Blocks 8 15 0x4A Blocks 0 7 Checksum8 OxF8 0x01 0x29 Checksum16 LSB Checksum16 MSB Errorcode 0x00 115 5 3 13 WatchdogConfig Controls a firmware based watchdog timer Unattended systems requiring maximum up time might use this capability to reset the UE9 or the entire system When any of the options are enabled an internal timer is enabled which resets on any incoming Control communication If this timer reaches the defined TimeoutPeriod before being reset the specified actions will occur Note that while streaming data is only going out of the Control processor so some other Control command will have to be called periodically to reset the watchdog timer If the watchdog is accidentally configured to reset the processors with a very low timeout period such as 1 second it could be difficult to establish any communication with the device In such a case the reset to default jumper can be used to turn off the watchdog sets bytes 7 10 to 0 Power up the UE9 with a short from FIO2 lt gt SCL then remove the jumper and power cycle the device again This also returns Comm Section 5 2 1 and Control Section 5 3 2 settings to factory defaults The watchdog settings bytes 7 10
155. s probe is put in contact with something engine block pipe that is connected to ground or some other external voltage care needs to be taken to insure valid measurements and prevent damage 2 7 3 3 Signal powered by the LabJack A typical example of this type of signal is a 3 wire temperature sensor The sensor has a power and ground wire that connect to Vs and GND on the LabJack and then has a signal wire that simply connects to an AINx terminal Another variation is a 4 wire sensor where there are two signal wires positive and negative rather than one If the negative signal is the same as power ground or can be shorted ground then the positive signal can be connected to AINx and a measurement can be made A typical example where this does not work is a bridge type sensor such as pressure sensor providing the raw bridge output and no amplifier In this case the signal voltage is the difference between the positive and negative signal and the negative signal cannot be shorted to ground An instrumentation amplifier is required to convert the differential signal to signal ended and probably also to amplify the signal 2 7 3 4 Signal powered externally An example is a box with a wire coming out that is defined as a 0 5 volt analog signal and a second wire labeled as ground The signal is known to have 0 5 volts compared to the ground wire but the complication is what is the voltage of the box ground compared to the LabJack ground
156. s rounded up and an extra zero is added to the packet This parameter is actually just to specify the size of this packet as the Numl2CbytesToReceive parameter above actually specifies how many bytes to read AckArray Represents a 32 bit value where bits are set if the corresponding 12C write byte was ack ed Useful for debugging up to the first 32 write bytes of communication Bit O corresponas to the last data byte bit 1 corresponds to the second to last data byte and so on up to the address byte So if nis the number of data bytes the ACKs value should be 24 n 1 1 127 5 3 21 SHT1X Control command reads temperature and humidity from a Sensirion SHT1X sensor which is used by the El 1050 For more information see the El 1050 datasheet from labjack com and the SHT1X datasheet from sensirion com Command Byte 0 Checksum8 1 OxF8 2 0x02 3 0x39 4 Checksum16 LSB 5 Checksum16 MSB 6 DataPinNum 0 22 7 ClockPinNum 0 22 8 Reserved 9 Reserved Response Byte 0 Checksum8 1 OxF8 2 0x05 3 0x39 4 Checksum16 LSB 5 Checksum16 MSB 6 Errorcode 7 0x00 8 StatusReg 9 StatusRegCRC 10 11 Temperature 12 TemperatureCRC 13 14 Humidity 15 HumidityCRC Data Clock PinNum Assigns which digital I O line is used for each SPI line Value passed is 0 7 corresponding to FIOO FIO7 StatusReg Returns a read of the SHT1X status register Temperature Returns the raw binary temperature reading Humidity Returns the raw bin
157. s string in dot notation The general form of the DoubleToStringAddress function is DoubleToStringAddress Number String HexDot DoubleToStringAddress dblAddress strIPAddress 0 4 3 3 Analog Inputs The lOType to retrieve a command response analog input reading is LJ_ioGET_AIN The following are OTypes used to configure or read the input range of a particular analog input channel LJ_ioPUT_AIN_RANGE LJ_ioGET_AIN_RANGE In addition to specifying the channel number the following range constants are passed in the value parameter when doing a request with the AIN range lOType LJ_rgUNI5V 0 5 V LabJackUD Default LJ_rgUNI2P5V 0 2 5 V not supported on UE9 Pro LJ_rgUNI1P25V 0 1 25 V not supported on UE9 Pro LJ_rgUNIP625V 0 0 625 V not supported on UE9 Pro LJ_rgBIP5V Jf tp DV The following are special channels used with the get put config OTypes to configure parameters that apply to all analog inputs LJ_chAIN_RESOLUTION LJ_chAIN_SETTLING_TIME 69 LJ_chAIN_BINARY Following is example pseudocode to configure and read two analog inputs Configure all analog inputs for 14 bit resolution Like most settings this will apply to all further measurements until the parameter is changed or the DLL unloaded AddRequest lngHandle LJ_ioPUT_CONFIG LJ_chAIN_RESOLUTION 14 0 0 Configure AIN2 for 5 volt range AddRequest lngHandle LJ_ioPUT_AIN_RANGE 2 LJ_rgBIP5V 0 0 Configure A
158. solution of 0 1 degrees C this configuration would not be sufficient Accuracy will also need to be considered Appendix A places some boundaries on expected accuracy but an in system calibration can generally be done to provide absolute accuracy down to the INL limits of the UE9 Speed How fast does the signal need to be sampled For instance if the signal is a waveform what information is needed peak average RMS shape frequency Answers to these questions will help decide how many points are needed per waveform cycle and thus what sampling rate is required In the case of multiple channels the scan rate is also considered See Sections 3 1 and 3 2 2 7 3 1 Signal from the LabJack Each analog input on the UE9 measures the difference in voltage between that input and ground GND Since all I O on the UE9 share a common ground the voltage on a digital output 21 or analog output can be measured by simply connecting a single wire from that terminal to an AINx terminal 2 7 3 2 Unpowered isolated signal An example of an unpowered isolated signal would be a thermocouple or photocell where the sensor leads are not shorted to any external voltages Such a sensor typically has two leads The positive lead connects to an AINx terminal and the negative lead connects to a GND terminal An exception might be a thermocouple housed in a metal probe where the negative lead of the thermocouple is shorted to the metal probe housing If thi
159. some of the request result functions and is data that is simply passed along with the request and returned unmodified by the result Can be used to store any sort of information with the request to allow a generic parser to determine what should be done when the results are received 4 1 1 Function Flexibility The driver is designed to be flexible so that it can work with various different LabJacks with different capabilities It is also designed to work with different development platforms with different capabilities For this reason many of the functions are repeated with different forms of parameters although their internal functionality remains mostly the same In this documentation a group of functions will often be referred to by their shortest name For example a reference to Add or AddRequest most likely refers to any of the three variations AddRequest AddRequestS or AddRequestSS 51 In the sample code alternate functions S or SS versions can generally be substituted as desired changing the parameter types accordingly All samples here are written in pseudo C Functions with an S or SS appended are provided for programming languages that can t include the LabJackUD h file and therefore can t use the constants included It is generally poor programming form to hardcode numbers into function calls if for no other reason than it is hard to read Functions with a single S replace the IOType parameter with
160. t does not necessarily start instantly but rather waits for the internal clock to roll For example if the output frequency is 100 Hz that means the period is 10 milliseconds and thus after the command is received by the device it could be anywhere from 0 to 10 milliseconds before the start of the frequency output 2 10 1 8 Quadrature Input Mode 8 Requires 2 timer channels used in adjacent pairs 0 1 2 3 or 4 5 Even timers will be quadrature channel A and odd timers will be quadrature channel B Timer Value passed has no effect The UE9 does 4x quadrature counting and returns the current count as a signed 32 bit integer 2 s complement The same current count is returned on both even and odd timer value parameters Writing a value of zero to either or both timers performs a reset of both After reset a read of either timer value will return zero until a new quadrature count is detected If a timer is reset and read in the same function call the read returns the value just before the reset 2 10 1 9 Timer Stop Input Mode 9 This mode should only be assigned to odd numbered timers 1 3 or 5 On every rising edge seen by the external pin this mode increments a 16 bit register When that register matches the specified timer value stop count value the adjacent even timer is stopped 0 1 2 3 or 4 5 The range for the stop count value is 1 65535 Generally the signal applied to this timer is from the adjacent even timer which
161. tem clock 48 MHz 0x01 Fixed low system clock 6 MHz 8 FIODir 9 FlOState 10 ElODir 11 ElOState 12 ClODirState Bits 7 4 Direction Bits 3 0 State 13 MlODirState Bit 7 Do not load digital I O defaults Bits 6 4 Direction Bits 2 0 State 14 DACO LSB 15 DACO Bit 7 Enabled Bits 3 0 Upper 4 bits of output 16 DAC1 LSB 17 DAC1 Bit 7 Enabled Bits 3 0 Upper 4 bits of output 97 Response OO ou oa ok 9 P o Checksum8 OxF8 0x09 0x08 Checksum16 LSB Checksum16 MSB Errorcode PowerLevel ResetSource ControlFWVersion 11 12 ControlBLVersion 13 14 16 17 18 19 20 21 22 23 HiRes Flag Bit 0 FlODir FlOState ElODir ElOState ClODirState Bits 7 4 Direction Bits 3 0 State MlODirState Bits 6 4 Direction Bits 2 0 State DACO LSB DACO Bit 7 Enabled Bits 3 0 Upper 4 bits of output DAC1 LSB DAC1 Bit 7 Enabled Bits 3 0 Upper 4 bits of output PowerLevel 0 Specifies different system clock speeds for the Control processor Streaming does not work at fixed low speed The WriteMask behaves differently for this parameter The value passed for PowerLevel always becomes the current operating condition If the WriteMask bit O is set the value passed becomes the current value and the default value meaning it is written to flash and used at reset The return value of this parameter is a read of the power up default FIO EIO CIO MIO 0 If the WriteMask bit 1 is set the
162. th the get put config OTypes to specify the baud rate for the asynchronous communication LJ_chASYNCH_BAUDFACTOR Value 2 16 3000000 bps For example use a BaudFactor of 65224 to get a baud rate of 9615 bps compatible with 9600 bps Following is example pseudocode for asynchronous communication 82 Set data rate for 9600 bps communication ePut 1ngHandle LJ_ioPUT_CONFIG LJ_chASYNCH_BAUDFACTOR 65224 0 Enable UART ePut lngHandle LJ_10ASYNCH_COMMUNICATION LJ_chASYNCH_ENABLE 1 0 Write data eGet lngHandle LJ_10ASYNCH_COMMUNICATION LJ_chASYNCH_TX amp numBytes array Read data Always initialize array to 32 bytes eGet lngHandle LJ_10ASYNCH_COMMUNICATION LJ_chASYNCH_RX amp numBytes array 4 3 13 Watchdog Timer The UE9 has firmware based watchdog capability Unattended systems requiring maximum up time might use this capability to reset the UE9 or the entire system When any of the options are enabled an internal timer is enabled which resets on any incoming USB communication If this timer reaches the defined TimeoutPeriod before being reset the specified actions will occur Note that while streaming data is only going out so some other command will have to be called periodically to reset the watchdog timer Timeout of the watchdog on the UE9 can be specified to reset either both processors update the state of 1 or 2 digital I O must be configured as output by user and update either
163. the order of execution of the request list cannot be predicted Since the driver does internal optimization it is quite likely not the same as the order of AddRequest function calls One thing that is known is that configuration settings like ranges stream settings and such will be done before the actual acquisition or setting of outputs Declaration LJ ERROR _stdcall GoOne LJ_HANDLE Handle Parameter Description Returns LabJack errorcodes or 0 for no error Inputs e Handle Handle returned by OpenLabJack Outputs e None 4 2 8 GetResult Calling either Go function creates a list of results that matches the list of requests Use GetResult to read the result and errorcode for a particular OType and Channel Normally this function is called for each associated AddRequest item Even if the request was an output the errorcode should be evaluated 59 None of the Get functions will clear results from the list The first AddRequest call subsequent to a Go call will clear the internal lists of requests and results for a particular device When processing raw in out or stream data requests the call to a Get function does not actually cause the data arrays to be filled The arrays are filled during the Go call if data is available and the Get call is used to find out many elements were placed in the array GetResultS is a special version of the Get function where lOType is a string rather than a long This is usefu
164. tions These are functions which are handled by the Comm processor only and thus the packet destination bit is O for local All functions can be transferred by USB Ethernet TCP or Ethernet UDP 5 2 1 CommConfig Writes and reads various configuration settings associated with the Comm processor If WriteMask is nonzero some or all default values are written to flash The Comm flash has a rated endurance of at least 20000 writes which is plenty for reasonable operation but if this function is called in a high speed loop with a nonzero WriteMask the flash could eventually be damaged There is a hardware method to restore parameters to the default values described below in parentheses Power up the UE9 with a short from FIO2 lt gt SCL then remove the jumper and power cycle the device again This also returns Control settings to factory defaults Sections 5 3 2 and 5 3 13 Command Byte Checksum8 0x78 0x10 0x01 Checksum16 LSB Checksum16 MSB WriteMask Reserved LocallD 0 PowerLevel 1 0x00 Normal 0x01 Reserved 0x02 Reserved 10 13 IPAddress 2 14 17 Gateway 3 18 21 Subnet 4 OMONDOARWBNH O 22 23 PortA 5 24 25 PortB 5 26 DHCPEnabled 6 27 0x00 28 33 0x00 34 35 0x00 36 37 0x00 denotes WriteMask bit number association 92 Byte 0 Checksum8 1 0x78 2 0x10 3 0x01 4 Checksum16 LSB 5 Checksum16 MSB 6 WriteMask 7 Reserved 8 LocallD 9 PowerLevel 10 13 IPAddress
165. tiplexers and acquiring a sample The passed settling time value is multiplied by 5 microseconds to get the approximate extra delay This extra delay will impact the maximum possible data rates 2 7 1 Channel Numbers The LabJack UE9 has 16 total built in analog inputs Two of these are connected internally AIN14 AIN 15 leaving 14 user accessible analog inputs AINO AIN13 The first 4 analog inputs AINO AIN3 appear both on the screw terminals and on the DB37 connector These connections are electrically the same and the user must exercise caution only to use one connection or the other and not create a short circuit Following is a table showing the channel number to pass to acquire different readings from the internal channels AIN14 15 16 Channel 14 Vref 2 43 V 128 Vref 2 43 V 132 Vsupply 133 Temp Sensor 15 GND 136 GND 140 Vsupply 141 Temp Sensor Table 2 1 Internal Channels GND and Vref connect 0 0 volts and about 2 43 volts to the internal channels These signals come through the same input path as channels 0 13 and thus can be used to test various things Vsupply connects the 5 volt supply voltage Vs directly to the analog to digital converter through a voltage divider that attenuates it by 40 The attenuation of this voltage divider is not measured during the UE9 factory calibration but the accuracy should typically be within 0 2 Note that a reading from this channel returns Vs during the execution
166. two DACs digital to analog converters or analog outputs on the UE9 Each DAC can be set to a voltage between about 0 02 and 4 86 volts with 12 bits of resolution Although the DAC values are based on an absolute reference voltage and not the supply voltage the DAC output buffers are powered internally by Vs and thus the maximum output is limited to slightly less than Vs Another implication of this is that high frequency power supply noise might couple to the analog outputs 27 The analog output commands are sent as raw binary values low level functions For a desired output voltage the binary value can be approximated as Bits uncalibrated Volts 4 86 4096 For a proper calculation though use the calibration values Slope and Offset stored in the internal flash on the Control processor Table 2 4 Bits Slope Volts Offset The DACs appear both on the screw terminals and on the DB37 connector These connections are electrically the same and the user must exercise caution only to use one connection or the other and not create a short circuit The DACS on the UE9 can be disabled When disabled they are placed in a high impedance state Both DACs are enabled or disabled at the same time so if a command causes one DAC to be enabled the other is also enabled The power up condition of the DACs can be configured by the user From the factory the DACS default to enabled at minimum voltage 0 volts Note that even if the
167. uest is called on a particular Handle all previous data is erased and cannot be retrieved by any of the Get functions until a Go function is called again This is on a device by device basis so you can call AddRequest with a different handle while a device is busy performing its I O AddRequest only clears the request and result lists on the device handle passed and only for the current thread For example if a request is added to each of two different devices and then a new request is added to the first device but not the second a call to Go will cause the first device to execute the new request and the second device to execute the original request 57 In general the execution order of a list of requests in a single Go call is unpredictable except that all configuration type requests are executed before acquisition and output type requests AddRequestS is a special version of the Add function where IOType is a string rather than a long This is useful for passing string constants in languages that cannot include the header file and is generally used with all OTypes except put get config The string should contain the constant name as indicated in the header file such as LU_ioANALOG_INPUT The declaration for the S version of Add is the same as below except for const char plOType sk AddRequestSS is a special version of the Add function where IOType and Channel are strings rather than longs This is useful for
168. uest lngHandle LJ_ioPUT_DIGITAL PORT 18 20 5 0 Execute the requests GoOne IngHandle Get the FIO2 read GetResult lngHandle LJ_ioGET_DIGITAL_BIT 2 dblValue Get the EIO0 CIO1 read GetResult lngHandle LJ_ioGET_DIGITAL_ PORT 8 amp dblValue 4 3 6 Timers 8 Counters There are eight IOTypes used to write or read timer and counter information LJ_ioGET_COUNTER LJ_ioPUT_COUNTER_ENABLE UpdateConfig will be set LJ_ioGET_COUNTER_ENABLE LJ_ioPUT_COUNTER_RESET 71 LJ_ioGET_TIMER LJ_ioPUT_TIMER_VALUE LJ_ioPUT_TIMER_MODE UpdateConfig will be set LJ_ioGET_TIMER_MODE In addition to specifying the channel number the following mode constants are passed in the value parameter when doing a request with the timer mode IOType LJ_tmPWM16 16 bit PWM output LJ_tmPWM8 8 bit PWM output LJ_tmRISINGEDGES32 Period input 32 bit rising edges LJ_tmFALLINGEDGES32 Period input 32 bit falling edges LJ_tmDUTYCYCLE Duty cycle input LJ_tmFIRMCOUNTER Firmware counter input LJ_tmFIRMCOUNTERDEBOUNCE Firmware counter input with debounce LJ_tmFREQOUT Frequency output LJ_tmQUAD Quadrature input LJ_tmTIMERSTOP Timer stop input odd timers only LJI_tmSYSTIMERLOW System timer low read no FIO LJI_tmSYSTIMERHIGH System timer high read no FIO LJ_tmRISINGEDGES16 Period input 16 bit rising edges LJ_tmFALLINGEDGES16 Period input 16 bit falling edges The following
169. ught is required to determine what is necessary to make useful measurements with the UE9 or any measurement device Voltage versus ground The analog inputs on the UE9 measure a voltage with respect to UE9 ground When measuring parameters other than voltage or voltages too big or too small for the UE9 some sort of sensor or transducer is required to produce the proper voltage signal Examples are a temperature sensor amplifier resistive voltage divider or perhaps a combination of such things Impedance When connecting the UE9 or any measuring device to a signal source it must be considered what impact the measuring device will have on the signal The main consideration is whether the currents going into or out of the UE9 analog input will cause noticeable voltage errors due to the impedance of the source See Appendix A for the recommended maximum source impedance Resolution and Accuracy Based on the selected input range and resolution of the UE9 the resolution can be determined in terms of voltage or engineering units For example assume some temperature sensor provides a 0 10 mV signal corresponding to 0 100 degrees C Samples are then acquired with the UE9 using the 0 5 volt input range and 16 bit resolution resulting in a voltage resolution of about 5 65536 76 uV That means there will be about 131 discrete steps across the 10 mV span of the signal and the overall resolution is 0 76 degrees C If this experiment required a re
170. unt resistor is differential neither side is at ground and at least one side of the resistor has a high common mode voltage equal to the positive sensor supply If the sensor and or UE9 are isolated a possible solution is to connect the sensor signal or positive sensor supply to UE9 ground instead of sensor ground This requires a good understanding of grounding and isolation in the system The LJTick CurrentShunt is often a simple solution 26 Both Figure 2 6 and 2 7 show a 0 100 resistor in series with SGND which is discussed in general in Section 2 7 3 4 In this case if SGND is used rather than GND a direct connection 0 Q should be good The best way to handle 4 20 mA signals is with the LJTick CurrentShunt which is a two channel active current to voltage converter module that plugs into the UE9 screw terminals More information is available at labjack com 2 7 3 8 Floating Unconnected Inputs The reading from a floating no external connection analog input channel can be tough to predict and is likely to vary with sample timing and adjacent sampled channels Keep in mind that a floating channel is not at 0 volts but rather is at an undefined voltage In order to see 0 volts a O volt signal such as GND should be connected to the input Some data acquisition devices use a resistor from the input to ground to bias an unconnected input to read 0 This is often just for cosmetic reasons so that the input reads close to O
171. ution of those inputs These were measured by calling the function 1000 times and dividing the total time by 1000 and thus include everything Windows latency communication time UE9 processing time etc A USB high high configuration means the UE9 is connected to a high speed USB2 hub which is then connected to a high speed USB2 host Even though the UE9 is not a high speed USB device such a configuration does provide improved performance Resolution Ethernet USB high high USB other Index AIN milliseconds milliseconds milliseconds 0 1 2 1 4 4 0 0 12 4 1 6 1 7 4 0 0 12 8 1 9 2 0 4 0 0 12 16 2 6 2 8 4 0 13 4 1 7 1 8 4 0 13 8 2 2 2 3 4 0 13 16 3 1 3 3 4 9 14 4 2 2 2 3 4 0 14 8 3 2 3 3 5 0 14 16 5 1 5 3 6 3 15 4 4 2 4 4 6 0 15 8 7 2 7 4 9 0 15 16 13 2 13 4 15 1 16 4 12 3 12 5 14 0 16 8 23 4 23 6 25 1 16 16 45 6 45 9 47 2 17 4 44 7 45 0 46 1 17 8 88 2 88 7 90 0 17 16 175 1 175 7 176 5 Table 3 1 Typical Feedback Function Execution Times Note that specifying a resolution index of 17 still returns 16 bit data but is a special minimum noise mode 44 As an example with the LabJackUD driver If requests are added to write read all 23 bits of digital I O update both analog outputs and read 16 12 bit analog inputs the GoOne function call can be expected to typically take about 2 6 ms to execute via Ethernet The AddRequest and GetResult calls take relatively no time at all A resolution value of 18 is passed to
172. view and control the various I O on the UE9 If LJControlPanel does not find the UE9 check Windows Device Manager to see if the UE9 installed correctly One way to get to the Device Manager is Start gt Control Panel gt System gt Hardware gt Device Manager The entry for the UE9 should appear as in the following figure If it has a yellow caution symbol or exclamation point symbol right click and select Uninstall or Remove Then disconnect and reconnect the UE9 and repeat the Found New Hardware Wizard as described above Device Manager OBS File Action View Help Hees a gt Computer Se Disk drives E Display adapters DVD CD ROM drives Floppy disk controllers 43 Floppy disk drives 2 IDE ATA ATAPI controllers Keyboards LabJack USB Devices amp amp Lablack UES 10 Mice and other pointing devices Modems Monitors BB Network adapters Ports COM amp LPT MB Processors 0 Sound video and game controllers System devices Universal Serial Bus controllers 1 1 Control Panel Application LJControlPanel The LabJack Control Panel application LJCP exe handles configuration and testing of the UE9 Click on the Find LabJacks button to search for connected devices FA LJ Control Panel 2 10 File Options Help Devices Serial Number 272260863 UE Firmware Versions 272260863 Local ID Port amp Port B USB 1 hi 52360 5
173. with floating inputs and a reason not to do that is that this resistor can degrade the input impedance of the analog input In a situation where it is desired that a floating channel read a particular voltage say to detect a broken wire a resistor can be placed from the AINx screw terminal to the desired voltage GND VS DACx A 10 KQ resistor will pull the analog input readings to within 1 binary count of any desired voltage but obviously degrades the input impedance to 10 kQ For the specific case of pulling a floating channel to O volts a 100 KQ resistor to GND can typically be used to provide analog input readings within 100 mV of ground 2 7 4 Internal Temperature Sensor The UE9 has an internal temperature sensor Although this sensor measures the temperature inside the UEQ it has been calibrated to read ambient temperature For accurate measurements the temperature of the entire UE9 must stabilize relative to the ambient temperature which can take on the order of 1 hour Best results will be obtained in still air in an environment with slowly changing ambient temperatures The internal temperature sensor is also affected by the operating speed of the UE9 With Control firmware V1 08 or higher the UE9 is in high power mode by default which is assumed by the LabJack UD driver With the UD driver the internal temperature sensor is read by acquiring analog input channel 133 or 141 and returns degrees K 2 8 DAC There are
174. y high goes low at the beginning of each scan and stays low for about 6 microseconds All other synchronized units are then configured for an external scan trigger Something that could be useful is the ability to define a scan with multiple samples from the same channel So for instance a scan could be defined as channels 0 1 0 1 0 1 or 0 0 1 1 or whatever This can provide a small burst of samples for each external trigger The scan list can have up to 128 channels When using the LabJackUD driver duplicate channels in a scan only works if reading all channels simultaneously as channel by channel stream reads are specified by channel number One thing to consider when using external triggering is the buffering that takes place within the UE9 and PC If the external signal is fairly continuous such as in synchronized streaming this is not a problem but if the external trigger is more of a one time pulse the buffering must be considered to get the data when desired For instance each UE9 stream data packet contains 16 samples so if there is only 1 sample per scan the UE9 will not send any data until it has accumulated 16 scans Some applications might resolve this by defining each scan as 16 samples even if it is just 16 samples of the same channel see previous paragraph Another buffering issue will come into play if the LabJackUD driver is used with USB communication as the driver reads 4 packets at a time 64 samples Streaming always
175. y this driver When needed this function automatically configures the specified channel s for analog input Declaration LJ ERROR _stdcall eAIN LJ HANDLE Handle long ChannelP long ChamnelN double Voltage long Range long Resolution long Settling long Binary long Reserved1 long Reserved2 Parameter Description Returns LabJack errorcodes or 0 for no error Inputs e Handle Handle returned by OpenLabJack e ChannelP The positive AIN channel to acquire e ChannelN The negative AIN channel to acquire For the UE9 this parameter is ignored For single ended channels on the U3 this parameter should be 31 see Section 2 6 1 e Range See the header file for input range constants e Resolution Pass 12 17 to specify the resolution of the analog input reading and 18 for a high res reading from the UE9 Pro 0 11 corresponds to 12 bit e Settling Pass 0 for the default settling This parameter adds extra settling before the ADC conversion of about Settling times 5 microseconds e Binary If this is nonzero True the Voltage parameter will return the raw binary value e Reserved 1 amp 2 Pass 0 Outputs e Voltage Returns the analog input reading which is generally a voltage 4 2 18 eDAC An easy function that writes a value to one analog output This is a simple alternative to the very flexible OType based method normally used by this driver When needed this function automat
Download Pdf Manuals
Related Search
Related Contents
Colores del Mundo Mur & Plafond Peavey I User's Manual Pentax IC-360 User's Manual 取扱説明 書「 M形埋込み形照明器具 』保管用一 English - Siqura pdf, 392k - Sonic.net Polk Audio RTiA1 Avaya EU DoC for 1100 Series Deskphones User's Manual LanConn-100 User Guide Copyright © All rights reserved.
Failed to retrieve file