Device-LabJack

 view release on metacpan or  search on metacpan

LabJack.xs  view on Meta::CPAN

//			address		-Starting address of data to read
//					 from 0-8188 (I32).
//	Outputs:	*idnum		-Returns the Local ID or -1 if no LabJack is
//					 found (I32).
//			*data3		-Byte at address (I32).
//			*data2		-Byte at address+1 (I32).
//			*data1		-Byte at address+2 (I32).
//			*data0		-Byte at address+3 (I32).
//
//	Time:		20 ms
//----------------------------------------------------------------------
long _stdcall ReadMem(long *idnum,
		      long address,
		      long *data3,
		      long *data2,
		      long *data1,
		      long *data0);
=cut
#// ###########################################################################
long
ReadMem(idnum,address)
	long idnum
	long address
  INIT:
	long errcode;
	long d0, d1, d2, d3;

  PPCODE:
	errcode = ReadMem(&idnum, address, &d3, &d2, &d1, &d0);

        // Return the results to perl in a big array
        if(errcode) {
          char errorString[51];
          GetErrorString ( errcode, errorString );
          XPUSHs(sv_2mortal(newSVpv(errorString,0)));
          XPUSHs(sv_2mortal(newSVnv(errcode)));
        } else {
          XPUSHs(sv_2mortal(newSVnv(errcode)));
        }

        XPUSHs(sv_2mortal(newSVnv(idnum)));
        XPUSHs(sv_2mortal(newSVnv(d0)));
        XPUSHs(sv_2mortal(newSVnv(d1)));
        XPUSHs(sv_2mortal(newSVnv(d2)));
        XPUSHs(sv_2mortal(newSVnv(d3)));

#// ###########################################################################
=head
//======================================================================
// WriteMem: Writes 4 bytes to the LabJack's nonvolatile memory at a
//	     specified address.  The data is read back and verified
//	     after the write.  Memory 0-511 is used for configuration
//	     and calibration data.  Memory from 512-1023 is unused by the
//     	     the LabJack and available for the user (this corresponds to
//	     starting addresses from 512-1020).  Memory 1024-8191 is
//	     used as a data buffer in hardware timed AI modes.
//
//	Returns:	LabJack errorcodes or 0 for no error (I32).
//	Inputs:		*idnum		-Local ID, Serial Number, or -1 for first
//					 found (I32).
//			unlocked	-If >0, addresses 0-511 are unlocked for
//					 writing (I32).
//			address		-Starting address for writing 0-8188 (I32).
//			data3		-Byte for address (I32).
//			data2		-Byte for address+1 (I32).
//			data1		-Byte for address+2 (I32).
//			data0		-Byte for address+3 (I32).
//	Outputs:	*idnum		-Returns the Local ID or -1 if no LabJack is
//					 found (I32).
//
//	Time:		20 ms
//----------------------------------------------------------------------
long _stdcall WriteMem(long *idnum,
		       long unlocked,
		       long address,
		       long data3,
		       long data2,
		       long data1,
		       long data0);
=cut
#// ###########################################################################
long
WriteMem(idnum,unlocked,address,data3,data2,data1,data0)
	long idnum
	long unlocked
	long address
	long data3
	long data2
	long data1
	long data0
  CODE:
	RETVAL = WriteMem(&idnum,unlocked,address,data3,data2,data1,data0);
  OUTPUT:
	RETVAL
	idnum

#// ###########################################################################

=head1 NAME

LabJack - access to USB LabJack libraries

=head1 SYNOPSIS

Perl Extension for access to the LabJack USB-based
measurement and automation device (http://www.labjack.com/) using
either the Eric Sortons Linux LabJack library
(http://www.cctcorp.com/~eric/labjack/) or the LabJack provided
ljackuw.lib (include on the LabJack CD).

=head1 DESCRIPTION

LabJack - Perl Extension for access to the LabJack USB-based
measurement and automation device (http://www.labjack.com/).

We can currently support the following library calls:

   EAnalog
   EAnalogOut
   ECount
   EDigitalIn
   EDigitalOut
   AISample
   Counter
   DigitalIO
   GetDriverVersion
   GetErrorString
   GetWinVersion
   ReEnum
   Reset
   ResetLJ
   SHT1X
   SHTComm
   SHTCRC
   Synch
   Watchdog
   ReadMem
   WriteMem

   BitsToVolts
   VoltsToBits

The following are not yet tested but written:

   AsynchConfig
   PulseOut
   PulseOutStart
   PulseOutFinish
   PulseOutCalc

The following are not yet supported:



( run in 0.594 second using v1.01-cache-2.11-cpan-39bf76dae61 )