My Project
 All Classes Files Functions Variables Enumerations Enumerator Friends Macros Pages
LabjackU3.h
1 //Author: LabJack
2 //December 27, 2011
3 //Header for U3 example helper functions.
4 //
5 //History
6 //-added easy functions
7 //-added I2C function and LJTDAC functions and structure (09/04/2007)
8 //-fixed memory leak in ehFeedback and I2C functions (09/27/2007)
9 //-fixed some bugs in "easy" functions (09/27/2007)
10 //-added U3-LV/HV support (04/07/2008)
11 //-fixed bug in eAIN for positive channel 30 - temp sensor (04/25/2008)
12 //-Modified calibration constants structs. Modified the names and code of the
13 // functions that apply the calibration constants. (06/25/2009)
14 //-Replaced LJUSB_BulkWrite/Read with LJUSB_write/Read calls. Added serial
15 // number support to openUSBConnection. (12/27/2011)
16 
17 #ifndef U3_H_
18 #define U3_H_
19 
20 #include <sys/time.h>
21 #include <stdio.h>
22 #include <math.h>
23 #include <stdlib.h>
24 #include "labjackusb.h"
25 
26 
27 typedef unsigned char uint8;
28 typedef unsigned short uint16;
29 typedef unsigned int uint32;
30 
31 //Structure for storing calibration constants
33  uint8 prodID;
34  double hardwareVersion; //helps to determine which calibration calculations
35  //to use
36  int highVoltage; //indicates if the device is U3-HV
37  double ccConstants[20];
38  /*
39  Calibration constants order
40  0 - LV AIN SE Slope
41  1 - LV AIN SE Offset
42  2 - LV AIN Diff Slope
43  3 - LV AIN Diff Offset
44  4 - DAC0 Slope
45  5 - DAC0 Offset
46  6 - DAC1 Slope
47  7 - DAC1 Offset
48  8 - Temp Slope
49  9 - Vref @Cal
50  10 - Vref*1.5 @Cal
51  11 - Vreg @Cal
52  12 - HV AIN0 Slope
53  13 - HV AIN1 Slope
54  14 - HV AIN2 Slope
55  15 - HV AIN3 Slope
56  16 - HV AIN0 Offset
57  17 - HV AIN1 Offset
58  18 - HV AIN2 Offset
59  19 - HV AIN3 Offset
60  */
61 };
62 
64 
65 //Structure for storing LJTDAC calibration constants
67  uint8 prodID;
68  double ccConstants[4];
69  /*
70  DAC Calibration constants order
71  0 - SlopeA;
72  1 - OffsetA;
73  2 - SlopeB;
74  3 - OffsetB;
75  */
76 };
77 
79 
80 
81 /* Functions */
82 
83 void normalChecksum( uint8 *b,
84  int n);
85 //Adds checksum to a data packet for normal command format.
86 //b = data packet for normal command
87 //n = size of data packet
88 
89 void extendedChecksum( uint8 *b,
90  int n);
91 //Adds checksum to a data packet for extended command format.
92 //b = data packet for extended command
93 //n = size of data packet
94 
95 uint8 normalChecksum8( uint8 *b,
96  int n);
97 //Returns the Checksum8 for a normal command data packet.
98 //b = data packet for normal command
99 //n = size of data packet
100 
101 uint16 extendedChecksum16( uint8 *b,
102  int n);
103 //Returns the Checksum16 for a extended command data packet.
104 //b = data packet for extended command
105 //n = size of data packet
106 
107 uint8 extendedChecksum8( uint8 *b);
108 //Returns the Checksum8 for a extended command data packet.
109 //b = data packet for extended command
110 
111 HANDLE openUSBConnection( int localID);
112 //Opens a U3 connection over USB. Returns NULL on failure, or a HANDLE on
113 //success.
114 //localID = the local ID or serial number of the U3 you want to open
115 
116 void closeUSBConnection( HANDLE hDevice);
117 //Closes a HANDLE to a U3 device.
118 
119 long getTickCount();
120 //Returns the number of milliseconds that has elasped since the system was
121 //started.
122 
123 long getCalibrationInfo( HANDLE hDevice,
124  u3CalibrationInfo *caliInfo);
125 //Gets calibration information from memory blocks 0-4 of a U3. Returns the
126 //calibration information in a calibrationInfo structure.
127 //hDevice = handle to a U3 device
128 //caliInfo = structure where calibrarion information will be stored
129 
130 long getTdacCalibrationInfo( HANDLE hDevice,
131  u3TdacCalibrationInfo *caliInfo,
132  uint8 DIOAPinNum);
133 //Gets calibration information from the EEPROM of a LJTick-DAC (LJTDAC).
134 //Returns the calibration information in a u3TdacCalibrationInfo structure.
135 //hDevice = handle to a U3 device
136 //caliInfo = structure where LJTDAC calibration information will be stored
137 //DIOAPinNum = The U3 digital IO line where the LJTDAC DIOA pin is connected.
138 // The DIOB pin is assumed to be the next digital IO line.
139 
140 
141 double FPuint8ArrayToFPDouble( uint8 *buffer,
142  int startIndex);
143 //Converts a fixed point byte array (starting a startIndex) to a floating point
144 //double value. This function is used primarily by getCalibrationInfo.
145 
146 long isCalibrationInfoValid(u3CalibrationInfo *caliInfo);
147 //Performs a simple check to determine if the caliInfo struct was set up by
148 //getCalibrationInfo. Returns 0 if caliInfo is not valid, or 1 if it is.
149 //caliInfo = structure where calibrarion information is stored
150 
151 long isTdacCalibrationInfoValid(u3TdacCalibrationInfo *caliInfo);
152 //Performs a simple check to determine if the caliInfo struct was set up by
153 //getLJTDACCalibrationInfo. Returns 0 if caliInfo is not valid, or 1 if it is.
154 //caliInfo = structure where LJTDAC calibration information is stored
155 
156 long getAinVoltCalibrated( u3CalibrationInfo *caliInfo,
157  int dac1Enabled,
158  uint8 negChannel,
159  uint16 bytesVolt,
160  double *analogVolt);
161 //Translates the binary AIN reading from the U3, to a voltage value
162 //(calibrated) in Volts. Call getCalibrationInfo first to set up caliInfo.
163 //Returns -1 on error, 0 on success.
164 //This function is for U3 hardware versions 1.20 and 1.21. Function will also
165 //work for hardware version 1.30 U3-LV, but not U3-HV.
166 //caliInfo = structure where calibrarion information is stored
167 //dac1Enabled = If this is nonzero (True), then it is indicated that DAC1 is
168 // enabled and analog voltage will be calculated with Vreg. If
169 // this is 0 (False), then it is indicated that DAC1 is disabled
170 // and the analog voltage will be calculated with the AIN slopes
171 // and offsets.
172 //negChannel = the negative channel of the differential analog reading
173 //bytesVolt = the 2 byte voltage that will be converted
174 //analogVolt = the converted analog voltage
175 
176 long getAinVoltCalibrated_hw130( u3CalibrationInfo *caliInfo,
177  uint8 positiveChannel,
178  uint8 negChannel,
179  uint16 bytesVolt,
180  double *analogVolt);
181 //Translates the binary AIN reading from the U3, to a voltage value
182 //(calibrated) in Volts. Call getCalibrationInfo first to set up caliInfo.
183 //Returns -1 on error, 0 on success.
184 //This function is for U3 hardware versions 1.30 (U3-LV/HV).
185 //caliInfo = structure where calibrarion information is stored
186 //positiveChannel = the positive channel of the differential analog reading
187 //negChannel = the negative channel of the differential analog reading
188 //bytesVolt = the 2 byte voltage that will be converted
189 //analogVolt = the converted analog voltage
190 
191 long getDacBinVoltCalibrated( u3CalibrationInfo *caliInfo,
192  int dacNumber,
193  double analogVolt,
194  uint8 *bytesVolt);
195 //Translates a analog output voltage value (Volts) to a binary 8 bit value
196 //(calibrated) that can be sent to a U3. Call getCalibrationInfo first to set
197 //up caliInfo. Returns -1 on error, 0 on success.
198 //This function is for U3 hardware versions 1.20, 1.21 and 1.30, and does the
199 //same thing as the analogToCalibratedBinary8BitVoltage function.
200 //caliInfo = structure where calibrarion information is stored
201 //DACNumber - channel number of the DAC
202 //analogVolt = the analog voltage that will be converted
203 //bytesVolt = the converted binary 8 bit value
204 
205 long getDacBinVoltCalibrated8Bit( u3CalibrationInfo *caliInfo,
206  int dacNumber,
207  double analogVolt,
208  uint8 *bytesVolt8);
209 //Translates a analog output voltage value (Volts) to a binary 8 bit value
210 //(calibrated) that can be sent to a U3. Call getCalibrationInfo first to set
211 //up caliInfo. Returns -1 on error, 0 on success.
212 //This function is for U3 hardware versions 1.20, 1.21 and 1.30.
213 //caliInfo = structure where calibrarion information is stored
214 //dacNumber - channel number of the DAC
215 //analogVolt = the analog voltage that will be converted
216 //bytesVolt8 = the converted binary 8 bit value
217 
218 long getDacBinVoltCalibrated16Bit( u3CalibrationInfo *caliInfo,
219  int dacNumber,
220  double analogVolt,
221  uint16 *bytesVolt16);
222 //Translates a analog output voltage value (Volts) to a binary 16 bit value
223 //(calibrated) that can be sent to a U3. Call getCalibrationInfo first to set
224 //up caliInfo. Returns -1 on error, 0 on success.
225 //This function is for U3 hardware versions 1.30 (U3-LV/HV).
226 //caliInfo = structure where calibrarion information is stored
227 //dacNumber - channel number of the DAC
228 //analogVolt = the analog voltage that will be converted
229 //bytesVolt16 = the converted binary 16 bit value
230 
231 long getTdacBinVoltCalibrated( u3TdacCalibrationInfo *caliInfo,
232  int dacNumber,
233  double analogVolt,
234  uint16 *bytesVolt);
235 //Translates a voltage value (Volts) to binary analog input bytes (calibrated)
236 //that can be sent to a LJTick-DAC (LJTDAC). Call getTdacCalibrationInfo
237 //first to set up caliInfo. Returns -1 on error, 0 on success.
238 //caliInfo = structure where LJTDAC calibrarion information is stored
239 //dacNumber - channel number of the DAC (0 = DACA, 1 = DACB)
240 //analogVolt = the analog voltage that will be converted
241 //bytesVolt = the converted 2 byte voltage
242 
243 long getTempKCalibrated( u3CalibrationInfo *caliInfo,
244  uint32 bytesTemp,
245  double *kelvinTemp);
246 //Translates the binary reading from the U3, to a temperature value
247 //(calibrated) in Kelvins. Call getCalibrationInfo first to set up caliInfo.
248 //Returns -1 on error, 0 on success.
249 //caliInfo = structure where calibrarion information is stored
250 //bytesTemp = the 2 byte binary temperature that will be converted
251 //kelvinTemp = the converted Kelvin temperature
252 
253 
254 long getAinVoltUncalibrated( int dac1Enabled,
255  uint8 negChannel,
256  uint16 bytesVolt,
257  double *analogVolt);
258 //Translates the binary AIN reading from the U3, to a voltage value
259 //(uncalibrated) in Volts. Returns -1 on error, 0 on success.
260 //This function is for U3 hardware versions 1.20 and 1.21.
261 //dac1Enabled = If this is nonzero (True), then it is indicated that DAC1 is
262 // enabled and analog voltage will be calculated with Vreg. If
263 // this is 0 (False), then it is indicated that DAC1 is disabled
264 // and the analog voltage will be calculated with the AIN slopes
265 // and offsets.
266 //negChannel = the negative channel of the differential analog reading
267 //bytesVolt = the 2 byte voltage that will be converted
268 //analogVolt = the converted analog voltage
269 
270 long getAinVoltUncalibrated_hw130( int highVoltage,
271  uint8 positiveChannel,
272  uint8 negChannel,
273  uint16 bytesVolt,
274  double *analogVolt);
275 //Translates the binary AIN reading from the U3, to a voltage value
276 //(uncalibrated) in Volts. Returns -1 on error, 0 on success.
277 //This function is for U3 hardware versions 1.30 (U3-LV/HV).
278 //highVoltage = Set to 1 to indicate that U3-HV calculations should be used
279 // for the binary to voltage conversion, otherwise U3-LV voltage
280 // calculations will be used.
281 //positiveChannel = the positive channel of the differential analog reading
282 //negChannel = the negative channel of the differential analog reading
283 //bytesVolt = the 2 byte voltage that will be converted
284 //analogVolt = the converted analog voltage
285 
286 long getDacBinVoltUncalibrated( int dacNumber,
287  double analogVolt,
288  uint8 *bytesVolt);
289 //Translates a DAC voltage value (Volts) to a binary 8 bit value (uncalibrated)
290 //that can be sent to a U3. Returns -1 on error, 0 on success.
291 //This function is for U3 hardware versions 1.20 and 1.21, and does the same
292 //thing as the analogToUncalibratedBinary8BitVoltage function.
293 //dacNumber - channel number of the DAC
294 //analogVolt = the analog voltage that will be converted
295 //bytesVolt = the converted binary 8 bit value
296 
297 long getDacBinVoltUncalibrated8Bit( int dacNumber,
298  double analogVolt,
299  uint8 *bytesVolt8);
300 //Translates a DAC voltage value (Volts) to a binary 8 bit value (uncalibrated)
301 //that can be sent to a U3. Returns -1 on error, 0 on success.
302 //This function is for U3 hardware versions 1.20 and 1.21.
303 //dacNumber - channel number of the DAC
304 //analogVoltage = the analog voltage that will be converted
305 //bytesVoltage = the converted binary 8 bit value
306 
307 long getDacBinVoltUncalibrated16Bit( int dacNumber,
308  double analogVolt,
309  uint16 *bytesVolt16);
310 //Translates a DAC voltage value (Volts) to a binary 16 bit value
311 //(uncalibrated) that can be sent to a U3-LV/HV. Returns -1 on error, 0 on
312 //success.
313 //This function is for U3 hardware versions 1.30 (U3-LV/HV).
314 //dacNumber - channel number of the DAC
315 //analogVoltage = the analog voltage that will be converted
316 //bytesVoltage = the converted binary 16 bit value
317 
318 long getTempKUncalibrated( uint16 bytesTemp,
319  double *kelvinTemp);
320 //Translates the binary analog bytes read from the U3, to a temperature value
321 //(uncalibrated) in Kelvins. Call getCalibrationInfo first to set up caliInfo.
322 //Returns -1 on error, 0 on success.
323 //bytesTemp = the 2 byte binary temperature that will be converted
324 //kelvinTemp = the converted Kelvin temperature
325 
326 long I2C( HANDLE hDevice,
327  uint8 I2COptions,
328  uint8 SpeedAdjust,
329  uint8 SDAPinNum,
330  uint8 SCLPinNum,
331  uint8 Address,
332  uint8 NumI2CBytesToSend,
333  uint8 NumI2CBytesToReceive,
334  uint8 *I2CBytesCommand,
335  uint8 *Errorcode,
336  uint8 *AckArray,
337  uint8 *I2CBytesResponse);
338 //This function will perform the I2C low-level function call. Please refer to
339 //section 5.3.19 of the U3 User's Guide for parameter documentation. Returns
340 //-1 on error, 0 on success.
341 //hDevice = handle to a U3 device
342 //I2COptions = byte 6 of the command
343 //SpeedAdjust = byte 7 of the command
344 //SDAPinNum = byte 8 of the command
345 //SCLPinNum = byte 9 of the command
346 //Address = byte 10 of the command
347 //NumI2CBytesToSend = byte 12 of the command
348 //NumI2CBytesToReceive = byte 13 of the command
349 //*I2CBytesCommand = Array that holds bytes 14 and above of the command. Needs
350 // to be at least NumI2CBytesToSend elements in size.
351 //*Errorcode = returns byte 6 of the response
352 //*AckArray = Array that returns bytes 8 - 11 of the response. Needs to be at
353 // least 4 elements in size.
354 //*I2CBytesResponse = Array that returns bytes 12 and above of the response.
355 // Needs to be at least NumI2CBytesToReceive elements in
356 // size.
357 
358 
359 /* Easy Functions (Similar to the easy functions in the Windows UD driver) */
360 
361 long eAIN( HANDLE Handle,
362  u3CalibrationInfo *CalibrationInfo,
363  long ConfigIO,
364  long *DAC1Enable,
365  long ChannelP,
366  long ChannelN,
367  double *Voltage,
368  long Range,
369  long Resolution,
370  long Settling,
371  long Binary,
372  long Reserved1,
373  long Reserved2);
374 //An "easy" function that returns a reading from one analog input. This
375 //function does not automatically configure the specified channels as analog
376 //input, unless ConfigIO is set as True. Returns 0 for no error, or -1 or >0
377 //value (low-level errorcode) on error.
378 //Call getCalibrationInfo first to set up CalibrationInfo.
379 //Handle = Handle to a U3 device.
380 //CalibrationInfo = Structure where calibration information is stored.
381 //ConfigIO = If this is nonzero (True), then 1 or 2 ConfigIO low-level function
382 // calls will be made in addition to the 1 Feedback call to set the
383 // specified Channels to analog inputs. If this is 0 (False), then
384 // only a Feedback low-level call will be made, and an error will be
385 // returned if the specified Channels are not already set to analog
386 // inputs.
387 //DAC1Enable = This parameter helps to determine the appropriate equation to
388 // use when calculating Voltage. If the long variable that is
389 // being pointed to is nonzero (True), then it is indicated that
390 // DAC1 is enabled. If it is 0 (False), then it is indicated that
391 // DAC1 is disabled. For both case, if ConfigIO is set to True,
392 // then input value will be ignored and the output value will be
393 // set to the current DAC1Enable value in the ConfigIO low-level
394 // response.
395 //ChannelP = The positive AIN channel to acquire.
396 //ChannelN = The negative AIN channel to acquire. For single-ended channels on
397 // the U3, this parameter should be 31 (see Section 2.6.1).
398 //Voltage = Returns the analog input reading, which is generally a voltage.
399 //Range = Ignored on the U3.
400 //Resolution = Pass a nonzero value to enable QuickSample.
401 //Settling = Pass a nonzero value to enable LongSettling.
402 //Binary = If this is nonzero (True), the Voltage parameter will return the raw
403 // binary value.
404 //Reserved (1&2) = Pass 0.
405 
406 
407 long eDAC( HANDLE Handle,
408  u3CalibrationInfo *CalibrationInfo,
409  long ConfigIO,
410  long Channel,
411  double Voltage,
412  long Binary,
413  long Reserved1,
414  long Reserved2);
415 //An "easy" function that writes a value to one analog output. This function
416 //does not automatically enable the specified analog output, unless ConfigIO is
417 //set as True. Returns 0 for no error, or -1 or >0 value (low-level errorcode)
418 //on error.
419 //Call getCalibrationInfo first to set up CalibrationInfo.
420 //Handle = Handle to a U3 device.
421 //CalibrationInfo = structure where calibrarion information is stored
422 //ConfigIO = If this is nonzero (True) and Channel is 1, then 1 ConfigIO
423 // low-level function call will be made in addition to the 1 Feedback
424 // call to enable DAC1. If this is 0 (False), then only a Feedback
425 // low-level call will be made, and an error will be returned if DAC1
426 // is not already enabled.
427 //Channel = The analog output channel to write to.
428 //Voltage = The voltage to write to the analog output.
429 //Binary = If this is nonzero (True), the value passed for Voltage should be
430 // binary.
431 //Reserved (1&2) = Pass 0.
432 
433 long eDI( HANDLE Handle,
434  long ConfigIO,
435  long Channel,
436  long *State);
437 //An "easy" function that reads the state of one digital input. This function
438 //does not automatically configure the specified channel as digital, unless
439 //ConfigIO is set as True. Returns 0 for no error, or -1 or >0 value
440 //(low-level errorcode) on error.
441 //Handle = Handle to a U3 device.
442 //ConfigIO = If this is nonzero (True), then 2 ConfigIO low-level functions
443 // calls will be made in addition to the 1 Feedback call to set
444 // Channel as digital. If this is 0 (False), then only a Feedback
445 // low-level call will be made, and an error will be returned if
446 // Channel is not already set as digital.
447 //Channel = The channel to read. 0-19 corresponds to FIO0-CIO3.
448 // For U3 hardware versions 1.30, HV model, Channel needs to be 4-19,
449 //State = Returns the state of the digital input. 0=False=Low and 1=True=High.
450 
451 long eDO( HANDLE Handle,
452  long ConfigIO,
453  long Channel,
454  long State);
455 //An "easy" function that writes the state of one digital output. This
456 //function does not automatically configure the specified channel as digital,
457 //unless ConfigIO is set as True. Returns 0 for no error, or -1 or >0 value
458 //(low-level errorcode) on error.
459 //Handle = Handle to a U3 device.
460 //ConfigIO = If this is nonzero (True), then 2 ConfigIO low-level functions
461 // calls will be made in addition to the 1 Feedback call to set
462 // Channel as digital. If this is 0 (False), then only a Feedback
463 // low-level call will be made, and an error will be returned if
464 // Channel is not already set as digital.
465 //Channel = The channel to write to. 0-19 corresponds to FIO0-CIO3.
466 // For U3 hardware versions 1.30, HV model, Channel needs to be 4-19,
467 //State = The state to write to the digital output. 0=False=Low and
468 // 1=True=High.
469 
470 long eTCConfig( HANDLE Handle,
471  long *aEnableTimers,
472  long *aEnableCounters,
473  long TCPinOffset,
474  long TimerClockBaseIndex,
475  long TimerClockDivisor,
476  long *aTimerModes,
477  double *aTimerValues,
478  long Reserved1,
479  long Reserved2);
480 //An "easy" function that configures and initializes all the timers and
481 //counters. When needed, this function automatically configures the needed
482 //lines as digital. Returns 0 for no error, or -1 or >0 value (low-level
483 //errorcode) on error.
484 //Handle = Handle to a U3 device.
485 //aEnableTimers = An array where each element specifies whether that timer is
486 // enabled. Timers must be enabled in order starting from 0, so
487 // for instance, Timer1 cannot be enabled without enabling Timer
488 // 0 also. A nonzero for an array element specifies to enable
489 // that timer. For the U3, this array must always have at least
490 // 2 elements.
491 //aEnableCounters = An array where each element specifies whether that counter
492 // is enabled. Counters do not have to be enabled in order
493 // starting from 0, so Counter1 can be enabled when Counter0
494 // is disabled. A nonzero value for an array element
495 // specifies to enable that counter. For the U3, this array
496 // must always have at least 2 elements.
497 //TCPinOffset = Value from 0-8 specifies where to start assigning timers and
498 // counters.
499 // For U3 hardware versions 1.30, HV model, value needs to be 4-8.
500 //TimerClockBaseIndex = Pass a constant to set the timer base clock. The
501 // default is LJ_tc48MHZ.
502 //TimerClockDivisor = Pass a divisor from 0-255 where 0 is a divisor of 256.
503 //aTimerModes = An array where each element is a constant specifying the mode
504 // for that timer. For the U3, this array must always have at
505 // least 2 elements.
506 //aTimerValues = An array where each element specifies the initial value for
507 // that timer. For the U3, this array must always have at least
508 // 2 elements.
509 //Reserved (1&2) = Pass 0.
510 
511 long eTCValues( HANDLE Handle,
512  long *aReadTimers,
513  long *aUpdateResetTimers,
514  long *aReadCounters,
515  long *aResetCounters,
516  double *aTimerValues,
517  double *aCounterValues,
518  long Reserved1,
519  long Reserved2);
520 //An "easy" function that updates and reads all the timers and counters.
521 //Returns 0 for no error, or -1 or >0 value (low-level errorcode) on error.
522 //Handle = Handle to a U3 device.
523 //aReadTimers = An array where each element specifies whether to read that
524 // timer. A nonzero value for an array element specifies to read
525 // that timer. For the U3, this array must always have at least 2
526 // elements.
527 //aUpdateResetTimers = An array where each element specifies whether to
528 // update/reset that timers. A nonzero value for an array
529 // element specifies to update/reset that timer. For the
530 // U3, this array must always have at least 2 elements.
531 //aReadCounters = An array where each element specifies whether to read that
532 // counter. A nonzero value for an array element specifies to
533 // read that counter. For the U3, this array must always have
534 // at least 2 elements.
535 //aResetCounters = An array where each element specifies whether to reset that
536 // counter. A nonzero value for an array element specifies to
537 // reset that counter. For the U3, this array must always have
538 // at least 2 elements.
539 //aTimerValues = Input: An array where each element is the new value for that
540 // timer. Each value is only updated if the appropriate element
541 // is set in the aUpdateResetTimers array.
542 // Output: An array where each element is the value read from
543 // that timer if the appropriate element is set in the
544 // aReadTimers array. If the timer mode set for the timer is
545 // Quadrature Input, the value needs to be converted from an
546 // unsigned 32-bit integer to a signed 32-bit integer (2’s
547 // complement). For the U3, this array must always have at least
548 // 2 elements.
549 //aCounterValues = An array where each element is the value read from that
550 // counter if the appropriate element is set in the aReadTimers
551 // array. For the U3, this array must always have at least 2
552 // elements.
553 //Reserved (1&2) = Pass 0.
554 
555 
556 /* Easy Function Helpers */
557 
558 long ehConfigIO( HANDLE hDevice,
559  uint8 inWriteMask,
560  uint8 inTimerCounterConfig,
561  uint8 inDAC1Enable,
562  uint8 inFIOAnalog,
563  uint8 inEIOAnalog,
564  uint8 *outTimerCounterConfig,
565  uint8 *outDAC1Enable,
566  uint8 *outFIOAnalog,
567  uint8 *outEIOAnalog);
568 //Used by the eAIN, eDAC, eDI, eDO and eTCConfig easy functions. This function
569 //takes the ConfigIO low-level command and response bytes (not including
570 //checksum and command bytes) as its parameter and performs a ConfigIO call
571 //with the U3. Returns -1 or errorcode (>1 value) on error, 0 on success.
572 
573 long ehConfigTimerClock( HANDLE hDevice,
574  uint8 inTimerClockConfig,
575  uint8 inTimerClockDivisor,
576  uint8 *outTimerClockConfig,
577  uint8 *outTimerClockDivisor);
578 //Used by the eTCConfig easy function. This function takes the
579 //ConfigTimerClock low-level command and response bytes (not including checksum
580 //and command bytes) as its parameter and performs a ConfigTimerClock call with
581 //the U3. Returns -1 or errorcode (>1 value) on error, 0 on success.
582 
583 long ehFeedback( HANDLE hDevice,
584  uint8 *inIOTypesDataBuff,
585  long inIOTypesDataSize,
586  uint8 *outErrorcode,
587  uint8 *outErrorFrame,
588  uint8 *outDataBuff,
589  long outDataSize);
590 //Used by the all of the easy functions. This function takes the Feedback
591 //low-level command and response bytes (not including checksum and command
592 //bytes) as its parameter and performs a Feedback call with the U3. Returns -1
593 //or errorcode (>1 value) on error, 0 on success.
594 
595 
596 /* Easy function constants */
597 
598 
599 /* Timer clocks for Hardware Version 1.20 or lower */
600 
601 // 2 MHz
602 #define LJ_tc2MHZ 10
603 
604 // 6 MHz
605 #define LJ_tc6MHZ 11
606 
607 // 24 MHz
608 #define LJ_tc24MHZ 12
609 
610 // 500/Divisor KHz
611 #define LJ_tc500KHZ_DIV 13
612 
613 // 2/Divisor MHz
614 #define LJ_tc2MHZ_DIV 14
615 
616 // 6/Divisor MHz
617 #define LJ_tc6MHZ_DIV 15
618 
619 // 24/Divisor MHz
620 #define LJ_tc24MHZ_DIV 16
621 
622 
623 /* Timer clocks for Hardware Version 1.21 or higher */
624 
625 // 4 MHz
626 #define LJ_tc4MHZ 20
627 
628 // 12 MHz
629 #define LJ_tc12MHZ 21
630 
631 // 48 MHz
632 #define LJ_tc48MHZ 22
633 
634 // 1/Divisor MHz
635 #define LJ_tc1MHZ_DIV 23
636 
637 // 4/Divisor MHz
638 #define LJ_tc4MHZ_DIV 24
639 
640 // 12/Divisor MHz
641 #define LJ_tc12MHZ_DIV 25
642 
643 // 48/Divisor MHz
644 #define LJ_tc48MHZ_DIV 26
645 
646 
647 /* Timer modes */
648 
649 // 16 bit PWM
650 #define LJ_tmPWM16 0
651 
652 // 8 bit PWM
653 #define LJ_tmPWM8 1
654 
655 // 32-bit rising to rising edge measurement
656 #define LJ_tmRISINGEDGES32 2
657 
658 // 32-bit falling to falling edge measurement
659 #define LJ_tmFALLINGEDGES32 3
660 
661 // duty cycle measurement
662 #define LJ_tmDUTYCYCLE 4
663 
664 // firmware based rising edge counter
665 #define LJ_tmFIRMCOUNTER 5
666 
667 // firmware counter with debounce
668 #define LJ_tmFIRMCOUNTERDEBOUNCE 6
669 
670 // frequency output
671 #define LJ_tmFREQOUT 7
672 
673 // Quadrature
674 #define LJ_tmQUAD 8
675 
676 // stops another timer after n pulses
677 #define LJ_tmTIMERSTOP 9
678 
679 // read lower 32-bits of system timer
680 #define LJ_tmSYSTIMERLOW 10
681 
682 // read upper 32-bits of system timer
683 #define LJ_tmSYSTIMERHIGH 11
684 
685 // 16-bit rising to rising edge measurement
686 #define LJ_tmRISINGEDGES16 12
687 
688 // 16-bit falling to falling edge measurement
689 #define LJ_tmFALLINGEDGES16 13
690 
691 #endif
Definition: LabjackU3.h:66
Definition: logfile.c:27
Definition: LabjackU3.h:32
Definition: tVideoCapabilitiesEml.cc:67