Device-LabJack

 view release on metacpan or  search on metacpan

LabJack.xs  view on Meta::CPAN

// AIBurst: Reads a certain number of scans at a certain scan rate
//	    from 1,2, or 4 analog inputs.  First, data is acquired and
//	    stored in the LabJacks 4096 sample RAM buffer.  Then, the
//	    data is transferred to the PC application.
//
//	Returns:	LabJack errorcodes or 0 for no error (I32).
//	Inputs:		*idnum		-Local ID, Serial Number, or -1 for first
//					 found (I32).
//			demo		-Send 0 for normal operation, >0 for demo
//					 mode (I32).  Demo mode allows this function
//					 to be called without a LabJack, and does little
//					 but simulate execution time.
//			stateIOin	-Output states for IO0-IO3 (I32).
//			updateIO	-If >0, state values will be written.  Otherwise,
//					 just reads are performed (I32).
//			ledOn		-If >0, the LabJack LED is turned on (I32).
//			numChannels	-Number of channels.  1, 2, or 4 (I32).
//			*channels	-Pointer to an array of channel commands with at
//					 least numChannels elements (I32).  Each channel
//					 command is 0-7 for SE or 8-11 for Diff.
//			*gains		-Pointer to an array of gain commands with at
//					 least numChannels elements (I32).  Gain
//					 commands are 0=1,1=2,...,7=20.  Gain only
//					 available for differential channels.
//			*scanRate	-Scans acquired per second (SGL).  A scan is a
//					 reading from every channel (1,2, or 4).  The
//					 sample rate (scanRate*numChannels) must
//					 be 400-8192.
//			disableCal	-If >0, voltages returned will be raw readings
//					 that are not corrected using calibration
//					 constants (I32).
//			triggerIO	-Set the IO port to trigger on.  0=none,
//					 1=IO0,...,4=IO3 (I32).
//			triggerState	-If >0, the acquisition will be triggered
//					 when the selected IO port reads high (I32).
//			numScans	-Number of scans which will be collected (I32).
//					 Minimum is 1.  Maximum numSamples is 4096 where
//					 numSamples is numScans * numChannels.
//			timeout		-Function timeout value in seconds (I32).
//			*voltages	-Voltage readings buffer.  Send a 4096 by 4
//					 element array of zeros (SGL).
//			*stateIOout	-IO state readings buffer.  Send a 4096 element
//					 array of zeros (I32).
//			transferMode	-0=auto,1=normal,2=turbo (I32)
//	Outputs:	*idnum		-Returns the Local ID or -1 if no LabJack is
//					 found (I32).
//			*scanRate	-Returns the actual scan rate, which due to
//					 clock resolution is not always exactly the
//					 same as the desired scan rate (SGL).
//			*voltages	-Voltage readings are returned in this 4096 by
//					 4 array (SGL). Unused locations are filled
//					 with 9999s.
//			*stateIOout	-The states of all 4 IO are returned in this
//					 array (I32).  Unused locations are filled
//					 with 9999s.
//			*overVoltage	-If >0, an overvoltage has been detected on
//					 at least one sample of at least one of the
//					 analog inputs (I32).
//
//	Time:	The execution time of this function, in milliseconds, can be
//		estimated with the below formulas.  The actual number of scans
//		collected and transferred by the LabJack is the smallest power
//		of 2 from 64 to 4096 which is at least as big as numScans.  This
//		is represented below as numScansActual.
//		Normal => 30+(1000*numScansActual/scanRate)+(2.5*numScansActual)
//		Turbo  => 30+(1000*numScansActual/scanRate)+(0.4*numScansActual)
//----------------------------------------------------------------------
long _stdcall AIBurst(long *idnum,
		      long demo,
		      long stateIOin,
		      long updateIO,
		      long ledOn,
		      long numChannels,
		      long *channels,
		      long *gains,
		      float *scanRate,
		      long disableCal,
		      long triggerIO,
		      long triggerState,
		      long numScans,
		      long timeout,
		      float (*voltages)[4],
		      long *stateIOout,
		      long *overVoltage,
		      long transferMode);
=cut
#// ###########################################################################

#// ###########################################################################
=head
//======================================================================
// AIStreamStart: Starts a hardware timed continuous acquisition where data
//		  is sampled and stored in the LabJack RAM buffer, and
//		  simultaneously transferred out of the RAM buffer to the
//		  PC application.  A call to this function should be
//		  followed by periodic calls to AIStreamRead, and eventually
//		  a call to AIStreamClear.
//
//	Returns:	LabJack errorcodes or 0 for no error (I32).
//	Inputs:		*idnum		-Local ID, Serial Number, or -1 for first
//					 found (I32).
//			demo		-Send 0 for normal operation, >0 for demo
//					 mode (I32).  Demo mode allows this function
//					 to be called without a LabJack, and does little
//					 but simulate execution time.
//			stateIOin	-Output states for IO0-IO3 (I32).
//			updateIO	-If >0, state values will be written.  Otherwise,
//					 just reads are performed (I32).
//			ledOn		-If >0, the LabJack LED is turned on (I32).
//			numChannels     -Number of channels.  1, 2, or 4 (I32).  If
//					 readCount is >0, numChannels should be 4.
//			*channels	-Pointer to an array of channel commands with at
//					 least numChannels elements (I32).  Each channel
//					 command is 0-7 for SE or 8-11 for Diff.
//			*gains		-Pointer to an array of gain commands with at
//					 least numChannels elements (I32).  Gain commands
//					 are 0=1,1=2,...,7=20.  Gain only available for
//					 differential channels.
//			*scanRate	-Scans acquired per second (SGL).  A scan is a
//					 reading from every channel (1,2, or 4).  The
//					 sample rate (scanRate*numChannels) must



( run in 0.453 second using v1.01-cache-2.11-cpan-e1769b4cff6 )