EasyManua.ls Logo

LabJack U12 - 4.6 - AlSample

LabJack U12
61 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
>>> d = u12.U12()
open called
Writing: [0x0, 0x0, 0x0, 0x0, 0x0, 0x57, 0x0, 0x0]
Received: [0x57, 0x0, 0x0, 0x0, 0xff, 0xff, 0x0, 0x0]
>>> d.eDigitalOut(0, 1)
Writing: [0x0, 0x0, 0x0, 0x0, 0x0, 0x57, 0x0, 0x0]
Received: [0x57, 0x0, 0x0, 0x50, 0x0, 0x0, 0x0, 0x0]
Writing: [0x0, 0x0, 0x0, 0x0, 0x1, 0x57, 0x1, 0x0]
Received: [0x57, 0x0, 0x0, 0x10, 0x0, 0x0, 0x0, 0x0]
{'idnum': 12}
4.6 - AISample
Reads the voltages from 1,2, or 4 analog inputs. Also controls/reads the 4 IO ports.
Execution time for this function is 20 milliseconds or less (typically 16 milliseconds in Windows).
Declaration:
long AISample ( long *idnum,
long demo,
long *stateIO,
long updateIO,
long ledOn,
long numChannels,
long *channels,
long *gains,
long disableCal,
long *overVoltage,
float *voltages )
Parameter Description:
Returns: LabJack errorcodes or 0 for no error.
Inputs:
*idnum – Local ID, serial number, or -1 for first found.
demoSend 0 for normal operation, >0 for demo mode. Demo mode allows this function to be called without a LabJack.
*stateIO – Output states for IO0-IO3. Has no effect if IO are configured as inputs, so a different function must be used to
configure as output.
updateIO – If >0, state values will be written. Otherwise, just a read is performed.
ledOnIf >0, the LabJack LED is turned on.
numChannels Number of analog input channels to read (1,2, or 4).
*channelsPointer to an array of channel commands with at least numChannels elements. Each channel command is 0-7
for single-ended, or 8-11 for differential.
*gains – Pointer to an array of gain commands with at least numChannels elements. Gain commands are 0=1, 1=2, …,
7=20. This amplification is only available for differential channels.
disableCal – If >0, voltages returned will be raw readings that are not corrected using calibration constants.
*voltages – Pointer to an array where voltage readings are returned. Send a 4-element array of zeros.
Outputs:
*idnum – Returns the local ID or 1 if no LabJack is found.
*stateIO – Returns input states of IO0-IO3.
*overVoltageIf >0, an overvoltage has been detected on one of the selected analog inputs.
*voltages – Pointer to an array where numChannels voltage readings are returned.
ActiveX Function Differences:
Thechannels” andgains” arrays are replaced withchannelsPacked” andgainsPacked”. The OCX has a functionFourPack”
which will convert 4 elements to a packed value. The packed value is determined as: element[0] + (element[1] * 2
8
) + (element[2] *
2
16
) + (element[3] * 2
24
).
Thevoltages” array is replaced with 4 individual parameters.
Declaration (ActiveX):
long AISampleX ( long FAR* idnum,
long demo,
long FAR* stateIO,
long updateIO,
long ledOn,
long numChannels,
21

Other manuals for LabJack U12