最近在做公司一个fct的测试及调试软件
设计到的比较多的通信问题
1,Gpib通信(调用ADL-GPIB)
2,串口通信
3,Usb通信(调用USBXpress)
4,Pci通信(调用PCIS-DASK)
大多数的驱动都是使用
先写了一个Gpib通信的类,参照园子里的朋友的cs文件,有改动
1.Gpibhelper如下:
using System.Runtime.InteropServices;
using System.Text; public class GPIB
{
public enum ibsta_bit_numbers
{
DCAS_NUM = ,
DTAS_NUM = ,
LACS_NUM = ,
TACS_NUM = ,
ATN_NUM = ,
CIC_NUM = ,
REM_NUM = ,
LOK_NUM = ,
CMPL_NUM = ,
EVENT_NUM = ,
SPOLL_NUM = ,
RQS_NUM = ,
SRQI_NUM = ,
END_NUM = ,
TIMO_NUM = ,
ERR_NUM =
}; /* IBSTA status bits (returned by all functions) */
public enum ibsta_bits
{
DCAS = ( << ibsta_bit_numbers.DCAS_NUM ), /* device clear state */
DTAS = ( << ibsta_bit_numbers.DTAS_NUM ), /* device trigger state */
LACS = ( << ibsta_bit_numbers.LACS_NUM ), /* GPIB interface is addressed as Listener */
TACS = ( << ibsta_bit_numbers.TACS_NUM ), /* GPIB interface is addressed as Talker */
ATN = ( << ibsta_bit_numbers.ATN_NUM ), /* Attention is asserted */
CIC = ( << ibsta_bit_numbers.CIC_NUM ), /* GPIB interface is Controller-in-Charge */
REM = ( << ibsta_bit_numbers.REM_NUM ), /* remote state */
LOK = ( << ibsta_bit_numbers.LOK_NUM ), /* lockout state */
CMPL = ( << ibsta_bit_numbers.CMPL_NUM ), /* I/O is complete */
EVENT = ( << ibsta_bit_numbers.EVENT_NUM ), /* DCAS, DTAS, or IFC has occurred */
SPOLL = ( << ibsta_bit_numbers.SPOLL_NUM ), /* board serial polled by busmaster */
RQS = ( << ibsta_bit_numbers.RQS_NUM ), /* Device requesting service */
SRQI = ( << ibsta_bit_numbers.SRQI_NUM ), /* SRQ is asserted */
END = ( << ibsta_bit_numbers.END_NUM ), /* EOI or EOS encountered */
TIMO = ( << ibsta_bit_numbers.TIMO_NUM ), /* Time limit on I/O or wait function exceeded */
ERR = ( << ibsta_bit_numbers.ERR_NUM ) /* Function call terminated on error */
};
/* IBERR error codes */
public enum iberr_code
{
EDVR = , /* system error */
ECIC = , /* not CIC */
ENOL = , /* no listeners */
EADR = , /* CIC and not addressed before I/O */
EARG = , /* bad argument to function call */
ESAC = , /* not SAC */
EABO = , /* I/O operation was aborted */
ENEB = , /* non-existent board (GPIB interface offline) */
EDMA = , /* DMA hardware error detected */
EOIP = , /* new I/O attempted with old I/O in progress */
ECAP = , /* no capability for intended opeation */
EFSO = , /* file system operation error */
EBUS = , /* bus error */
ESTB = , /* lost serial poll bytes */
ESRQ = , /* SRQ stuck on */
ETAB = /* Table Overflow */
};
/* Timeout values and meanings */ public enum gpib_timeout
{
TNONE = , /* Infinite timeout (disabled) */
T10us = , /* Timeout of 10 usec (ideal) */
T30us = , /* Timeout of 30 usec (ideal) */
T100us = , /* Timeout of 100 usec (ideal) */
T300us = , /* Timeout of 300 usec (ideal) */
T1ms = , /* Timeout of 1 msec (ideal) */
T3ms = , /* Timeout of 3 msec (ideal) */
T10ms = , /* Timeout of 10 msec (ideal) */
T30ms = , /* Timeout of 30 msec (ideal) */
T100ms = , /* Timeout of 100 msec (ideal) */
T300ms = , /* Timeout of 300 msec (ideal) */
T1s = , /* Timeout of 1 sec (ideal) */
T3s = , /* Timeout of 3 sec (ideal) */
T10s = , /* Timeout of 10 sec (ideal) */
T30s = , /* Timeout of 30 sec (ideal) */
T100s = , /* Timeout of 100 sec (ideal) */
T300s = , /* Timeout of 300 sec (ideal) */
T1000s = /* Timeout of 1000 sec (maximum) */
}; /* End-of-string (EOS) modes for use with ibeos */ public enum eos_flags
{
EOS_MASK = 0x1c00,
REOS = 0x0400, /* Terminate reads on EOS */
XEOS = 0x800, /* assert EOI when EOS char is sent */
BIN = 0x1000 /* Do 8-bit compare on EOS */
}; /* GPIB Bus Control Lines bit vector */
public enum bus_control_line
{
ValidDAV = 0x01,
ValidNDAC = 0x02,
ValidNRFD = 0x04,
ValidIFC = 0x08,
ValidREN = 0x10,
ValidSRQ = 0x20,
ValidATN = 0x40,
ValidEOI = 0x80,
ValidALL = 0xff,
BusDAV = 0x0100, /* DAV line status bit */
BusNDAC = 0x0200, /* NDAC line status bit */
BusNRFD = 0x0400, /* NRFD line status bit */
BusIFC = 0x0800, /* IFC line status bit */
BusREN = 0x1000, /* REN line status bit */
BusSRQ = 0x2000, /* SRQ line status bit */
BusATN = 0x4000, /* ATN line status bit */
BusEOI = 0x8000 /* EOI line status bit */
}; const int gpib_addr_max = ; /* max address for primary/secondary gpib addresses */ public enum ibask_option
{
IbaPAD = 0x1,
IbaSAD = 0x2,
IbaTMO = 0x3,
IbaEOT = 0x4,
IbaPPC = 0x5, /* board only */
IbaREADDR = 0x6, /* device only */
IbaAUTOPOLL = 0x7, /* board only */
IbaCICPROT = 0x8, /* board only */
IbaIRQ = 0x9, /* board only */
IbaSC = 0xa, /* board only */
IbaSRE = 0xb, /* board only */
IbaEOSrd = 0xc,
IbaEOSwrt = 0xd,
IbaEOScmp = 0xe,
IbaEOSchar = 0xf,
IbaPP2 = 0x10, /* board only */
IbaTIMING = 0x11, /* board only */
IbaDMA = 0x12, /* board only */
IbaReadAdjust = 0x13,
IbaWriteAdjust = 0x14,
IbaEventQueue = 0x15, /* board only */
IbaSPollBit = 0x16, /* board only */
IbaSpollBit = 0x16, /* board only */
IbaSendLLO = 0x17, /* board only */
IbaSPollTime = 0x18, /* device only */
IbaPPollTime = 0x19, /* board only */
IbaEndBitIsNormal = 0x1a,
IbaUnAddr = 0x1b, /* device only */
IbaHSCableLength = 0x1f, /* board only */
IbaIst = 0x20, /* board only */
IbaRsv = 0x21, /* board only */
IbaBNA = 0x200, /* device only */
IbaBaseAddr = 0x201 /* GPIB board's base I/O address.*/
}; public enum ibconfig_option
{
IbcPAD = 0x1,
IbcSAD = 0x2,
IbcTMO = 0x3,
IbcEOT = 0x4,
IbcPPC = 0x5, /* board only */
IbcREADDR = 0x6, /* device only */
IbcAUTOPOLL = 0x7, /* board only */
IbcCICPROT = 0x8, /* board only */
IbcIRQ = 0x9, /* board only */
IbcSC = 0xa, /* board only */
IbcSRE = 0xb, /* board only */
IbcEOSrd = 0xc,
IbcEOSwrt = 0xd,
IbcEOScmp = 0xe,
IbcEOSchar = 0xf,
IbcPP2 = 0x10, /* board only */
IbcTIMING = 0x11, /* board only */
IbcDMA = 0x12, /* board only */
IbcReadAdjust = 0x13,
IbcWriteAdjust = 0x14,
IbcEventQueue = 0x15, /* board only */
IbcSPollBit = 0x16, /* board only */
IbcSpollBit = 0x16, /* board only */
IbcSendLLO = 0x17, /* board only */
IbcSPollTime = 0x18, /* device only */
IbcPPollTime = 0x19, /* board only */
IbcEndBitIsNormal = 0x1a,
IbcUnAddr = 0x1b, /* device only */
IbcHSCableLength = 0x1f, /* board only */
IbcIst = 0x20, /* board only */
IbcRsv = 0x21, /* board only */
IbcLON = 0x22,
IbcBNA = 0x200 /* device only */
}; public enum t1_delays
{
T1_DELAY_2000ns = ,
T1_DELAY_500ns = ,
T1_DELAY_350ns =
};
// typedef ushort Addr4882_t;
// typedef int ssize_t;
// typedef uint size_t;
public const ushort NOADDR = 0xffff; /* IEEE 488 Function Prototypes */
[DllImport("Gpib-32.dll")]
public static extern int ibask( int ud, int option, ref int value );
[DllImport("Gpib-32.dll")]
public static extern int ibbna( int ud, string board_name );
[DllImport("Gpib-32.dll")]
public static extern int ibcac( int ud, int synchronous );
[DllImport("Gpib-32.dll")]
public static extern int ibclr( int ud );
[DllImport("Gpib-32.dll")]
public static extern int ibcmd( int ud, string cmd, long cnt );
[DllImport("Gpib-32.dll")]
public static extern int ibcmda( int ud, string cmd, long cnt );
[DllImport("Gpib-32.dll")]
public static extern int ibconfig( int ud, int option, int value );
[DllImport("Gpib-32.dll")]
public static extern int ibdev( int board_index, int pad, int sad, int timo, int send_eoi, int eosmode );
[DllImport("Gpib-32.dll")]
public static extern int ibdma( int ud, int v );
[DllImport("Gpib-32.dll")]
public static extern int ibeot( int ud, int v );
[DllImport("Gpib-32.dll")]
public static extern int ibeos( int ud, int v );
[DllImport("Gpib-32.dll")]
public static extern int ibfind( string dev );
[DllImport("Gpib-32.dll")]
public static extern int ibgts(int ud, int shadow_handshake);
[DllImport("Gpib-32.dll")]
public static extern int ibist( int ud, int ist );
[DllImport("Gpib-32.dll")]
public static extern int iblines( int ud, short line_status );
[DllImport("Gpib-32.dll")]
public static extern int ibln( int ud, int pad, int sad, short found_listener );
[DllImport("Gpib-32.dll")]
public static extern int ibloc( int ud );
[DllImport("Gpib-32.dll")]
public static extern int ibonl( int ud, int onl );
[DllImport("Gpib-32.dll")]
public static extern int ibpad( int ud, int v );
[DllImport("Gpib-32.dll")]
public static extern int ibpct( int ud );
[DllImport("Gpib-32.dll")]
public static extern int ibppc( int ud, int v );
[DllImport("Gpib-32.dll")]
public static extern int ibrd( int ud, StringBuilder buf, int count );
[DllImport("Gpib-32.dll")]
public static extern int ibrda( int ud, StringBuilder buf, int count );
[DllImport("Gpib-32.dll")]
public static extern int ibrdf( int ud, char file_path );
[DllImport("Gpib-32.dll")]
public static extern int ibrpp( int ud, char ppr );
[DllImport("Gpib-32.dll")]
public static extern int ibrsc( int ud, int v );
[DllImport("Gpib-32.dll")]
public static extern int ibrsp( int ud, StringBuilder spr );
[DllImport("Gpib-32.dll")]
public static extern int ibrsv( int ud, int v );
[DllImport("Gpib-32.dll")]
public static extern int ibsad( int ud, int v );
[DllImport("Gpib-32.dll")]
public static extern int ibsic( int ud );
[DllImport("Gpib-32.dll")]
public static extern int ibsre( int ud, int v );
[DllImport("Gpib-32.dll")]
public static extern int ibstop( int ud );
[DllImport("Gpib-32.dll")]
public static extern int ibtmo( int ud, int v );
[DllImport("Gpib-32.dll")]
public static extern int ibtrg( int ud );
[DllImport("Gpib-32.dll")]
public static extern int ibwait( int ud, int mask );
[DllImport("Gpib-32.dll")]
public static extern int ibwrt( int ud, string buf, int count );
[DllImport("Gpib-32.dll")]
public static extern int ibwrta( int ud, string buf, int count );
[DllImport("Gpib-32.dll")]
public static extern int ibwrtf( int ud, StringBuilder file_path ); [DllImport("Gpib-32.dll")]
public static extern int gpib_get_globals (out int pibsta, out int piberr, out int pibcnt, out int pibcntl); /* IEEE 488.2 Function Prototypes */
[DllImport("Gpib-32.dll")]
public static extern void AllSPoll( int board_desc, ushort[] addressList, ushort[] resultList );
[DllImport("Gpib-32.dll")]
public static extern void AllSpoll( int board_desc, ushort[] addressLis, ushort[] resultList );
[DllImport("Gpib-32.dll")]
public static extern void DevClear( int board_desc, ushort address );
[DllImport("Gpib-32.dll")]
public static extern void DevClearList( int board_desc, ushort[] addressLis );
[DllImport("Gpib-32.dll")]
public static extern void EnableLocal( int board_desc, ushort[] addressLis );
[DllImport("Gpib-32.dll")]
public static extern void EnableRemote( int board_desc, ushort[] addressLis );
[DllImport("Gpib-32.dll")]
public static extern void FindLstn( int board_desc, ushort[] padList, ushort[] resultList, int maxNumResults );
[DllImport("Gpib-32.dll")]
public static extern void FindRQS( int board_desc, ushort[] addressList, out short result );
[DllImport("Gpib-32.dll")]
public static extern void PassControl( int board_desc, ushort address );
[DllImport("Gpib-32.dll")]
public static extern void PPoll( int board_desc, out short result );
[DllImport("Gpib-32.dll")]
public static extern void PPollConfig( int board_desc, ushort address, int dataLine, int lineSense );
[DllImport("Gpib-32.dll")]
public static extern void PPollUnconfig( int board_desc, ushort[] addressList );
[DllImport("Gpib-32.dll")]
public static extern void RcvRespMsg( int board_desc, char[] buffer, long count, int termination );
[DllImport("Gpib-32.dll")]
public static extern void ReadStatusByte( int board_desc, ushort address, out short result );
[DllImport("Gpib-32.dll")]
public static extern void Receive( int board_desc, ushort address, char[] buffer, long count, int termination );
[DllImport("Gpib-32.dll")]
public static extern void ReceiveSetup( int board_desc, ushort address );
[DllImport("Gpib-32.dll")]
public static extern void ResetSys( int board_desc, ushort[] addressList );
[DllImport("Gpib-32.dll")]
public static extern void Send( int board_desc, ushort address, char[] buffer, long count, int eot_mode );
[DllImport("Gpib-32.dll")]
public static extern void SendCmds( int board_desc, char[] cmds, long count );
[DllImport("Gpib-32.dll")]
public static extern void SendDataBytes( int board_desc, char[] buffer, long count, int eotmode );
[DllImport("Gpib-32.dll")]
public static extern void SendIFC( int board_desc );
[DllImport("Gpib-32.dll")]
public static extern void SendLLO( int board_desc );
[DllImport("Gpib-32.dll")]
public static extern void SendList( int board_desc, ushort[] addressList, char[] buffer, long count, int eotmode );
[DllImport("Gpib-32.dll")]
public static extern void SendSetup( int board_desc, ushort[] addressList );
[DllImport("Gpib-32.dll")]
public static extern void SetRWLS( int board_desc, ushort[] addressList );
[DllImport("Gpib-32.dll")]
public static extern void TestSRQ( int board_desc, out short result );
[DllImport("Gpib-32.dll")]
public static extern void TestSys( int board_desc, ushort[] addrlist, short[] resultList );
[DllImport("Gpib-32.dll")]
public static extern void Trigger( int board_desc, ushort address );
[DllImport("Gpib-32.dll")]
public static extern void TriggerList( int board_desc, ushort[] addressList );
[DllImport("Gpib-32.dll")]
public static extern void WaitSRQ( int board_desc, out short result ); }
工具类
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading; namespace Common.GpibProtocol
{
public class GpibHelper
{
#region GPIB读写操作
private short address = ;
private int ibsta, iberr, ibcnt, ibcntl; private GpibHelper()
{ } public GpibHelper(short address)
{
this.address = address;
} public bool write(string strWrite)
{
//Open and intialize an GPIB instrument
int dev = GPIB.ibdev(, address, , (int)GPIB.gpib_timeout.T1s, , );
GPIB.gpib_get_globals(out ibsta, out iberr, out ibcnt, out ibcntl);
if ((ibsta & (int)GPIB.ibsta_bits.ERR) != )
{
//MessageBox.Show("Error in initializing the GPIB instrument.");
return false;
} //clear the specific GPIB instrument
GPIB.ibclr(dev);
GPIB.gpib_get_globals(out ibsta, out iberr, out ibcnt, out ibcntl);
if ((ibsta & (int)GPIB.ibsta_bits.ERR) != )
{
//MessageBox.Show("Error in clearing the GPIB device.");
return false;
} //Write a string command to a GPIB instrument using the ibwrt() command
GPIB.ibwrt(dev, strWrite, strWrite.Length);
GPIB.gpib_get_globals(out ibsta, out iberr, out ibcnt, out ibcntl);
if ((ibsta & (int)GPIB.ibsta_bits.ERR) != )
{
//MessageBox.Show("Error in writing the string command to the GPIB instrument.");
return false;
} //Offline the GPIB interface card
GPIB.ibonl(dev, );
GPIB.gpib_get_globals(out ibsta, out iberr, out ibcnt, out ibcntl);
if ((ibsta & (int)GPIB.ibsta_bits.ERR) != )
{
//MessageBox.Show("Error in offline the GPIB interface card.");
return false;
}
return true;
} public bool read(string strWrite, ref string strRead)
{
StringBuilder str = new StringBuilder();
//Open and intialize an GPIB instrument
int dev = GPIB.ibdev(, address, , (int)GPIB.gpib_timeout.T1s, , );
GPIB.gpib_get_globals(out ibsta, out iberr, out ibcnt, out ibcntl);
if ((ibsta & (int)GPIB.ibsta_bits.ERR) != )
{
//MessageBox.Show("Error in initializing the GPIB instrument.");
return false;
} //clear the specific GPIB instrument
GPIB.ibclr(dev);
GPIB.gpib_get_globals(out ibsta, out iberr, out ibcnt, out ibcntl);
if ((ibsta & (int)GPIB.ibsta_bits.ERR) != )
{
//MessageBox.Show("Error in clearing the GPIB device.");
return false;
} //Write a string command to a GPIB instrument using the ibwrt() command
GPIB.ibwrt(dev, strWrite, strWrite.Length);
GPIB.gpib_get_globals(out ibsta, out iberr, out ibcnt, out ibcntl);
if ((ibsta & (int)GPIB.ibsta_bits.ERR) != )
{
//MessageBox.Show("Error in writing the string command to the GPIB instrument.");
return false;
}
Thread.Sleep();
//Read the response string from the GPIB instrument using the ibrd() command
GPIB.ibrd(dev, str, );
strRead = str.ToString();
GPIB.gpib_get_globals(out ibsta, out iberr, out ibcnt, out ibcntl);
if ((ibsta & (int)GPIB.ibsta_bits.ERR) != )
{
//MessageBox.Show("Error in reading the response string from the GPIB instrument.");
return false;
} //Offline the GPIB interface card
GPIB.ibonl(dev, );
GPIB.gpib_get_globals(out ibsta, out iberr, out ibcnt, out ibcntl);
if ((ibsta & (int)GPIB.ibsta_bits.ERR) != )
{
//MessageBox.Show("Error in offline the GPIB interface card.");
return false;
}
return true;
} #endregion }
}
GpibHelper
2.PCI操作类
using System.Runtime.InteropServices;
using System; namespace Common.PciProtocol
{
public delegate void CallbackDelegate();
public class DASK
{
#region PCI Card Type
//ADLink PCI Card Type
public const ushort PCI_6208V = ;
public const ushort PCI_6208A = ;
public const ushort PCI_6308V = ;
public const ushort PCI_6308A = ;
public const ushort PCI_7200 = ;
public const ushort PCI_7230 = ;
public const ushort PCI_7233 = ;
public const ushort PCI_7234 = ;
public const ushort PCI_7248 = ;
public const ushort PCI_7249 = ;
public const ushort PCI_7250 = ;
public const ushort PCI_7252 = ;
public const ushort PCI_7296 = ;
public const ushort PCI_7300A_RevA = ;
public const ushort PCI_7300A_RevB = ;
public const ushort PCI_7432 = ;
public const ushort PCI_7433 = ;
public const ushort PCI_7434 = ;
public const ushort PCI_8554 = ;
public const ushort PCI_9111DG = ;
public const ushort PCI_9111HR = ;
public const ushort PCI_9112 = ;
public const ushort PCI_9113 = ;
public const ushort PCI_9114DG = ;
public const ushort PCI_9114HG = ;
public const ushort PCI_9118DG = ;
public const ushort PCI_9118HG = ;
public const ushort PCI_9118HR = ;
public const ushort PCI_9810 = ;
public const ushort PCI_9812 = ;
public const ushort PCI_7396 = ;
public const ushort PCI_9116 = ;
public const ushort PCI_7256 = ;
public const ushort PCI_7258 = ;
public const ushort PCI_7260 = ;
public const ushort PCI_7452 = ;
public const ushort PCI_7442 = ; public const ushort MAX_CARD = ;
#endregion
#region Error Number
//Error Number
public const short NoError = ;
public const short ErrorUnknownCardType = -;
public const short ErrorInvalidCardNumber = -;
public const short ErrorTooManyCardRegistered = -;
public const short ErrorCardNotRegistered = -;
public const short ErrorFuncNotSupport = -;
public const short ErrorInvalidIoChannel = -;
public const short ErrorInvalidAdRange = -;
public const short ErrorContIoNotAllowed = -;
public const short ErrorDiffRangeNotSupport = -;
public const short ErrorLastChannelNotZero = -;
public const short ErrorChannelNotDescending = -;
public const short ErrorChannelNotAscending = -;
public const short ErrorOpenDriverFailed = -;
public const short ErrorOpenEventFailed = -;
public const short ErrorTransferCountTooLarge = -;
public const short ErrorNotDoubleBufferMode = -;
public const short ErrorInvalidSampleRate = -;
public const short ErrorInvalidCounterMode = -;
public const short ErrorInvalidCounter = -;
public const short ErrorInvalidCounterState = -;
public const short ErrorInvalidBinBcdParam = -;
public const short ErrorBadCardType = -;
public const short ErrorInvalidDaRefVoltage = -;
public const short ErrorAdTimeOut = -;
public const short ErrorNoAsyncAI = -;
public const short ErrorNoAsyncAO = -;
public const short ErrorNoAsyncDI = -;
public const short ErrorNoAsyncDO = -;
public const short ErrorNotInputPort = -;
public const short ErrorNotOutputPort = -;
public const short ErrorInvalidDioPort = -;
public const short ErrorInvalidDioLine = -;
public const short ErrorContIoActive = -;
public const short ErrorDblBufModeNotAllowed = -;
public const short ErrorConfigFailed = -;
public const short ErrorInvalidPortDirection = -;
public const short ErrorBeginThreadError = -;
public const short ErrorInvalidPortWidth = -;
public const short ErrorInvalidCtrSource = -;
public const short ErrorOpenFile = -;
public const short ErrorAllocateMemory = -;
public const short ErrorDaVoltageOutOfRange = -;
public const short ErrorDaExtRefNotAllowed = -;
public const short ErrorDIODataWidthError = -;
public const short ErrorTaskCodeError = -;
public const short ErrortriggercountError = -;
public const short ErrorInvalidTriggerMode = -;
public const short ErrorInvalidTriggerType = -;
public const short ErrorInvalidCounterValue = -;
public const short ErrorInvalidEventHandle = -;
public const short ErrorNoMessageAvailable = -;
public const short ErrorEventMessgaeNotAdded = -;
#endregion
#region Error number for driver API
//Error number for driver API
public const short ErrorConfigIoctl = -;
public const short ErrorAsyncSetIoctl = -;
public const short ErrorDBSetIoctl = -;
public const short ErrorDBHalfReadyIoctl = -;
public const short ErrorContOPIoctl = -;
public const short ErrorContStatusIoctl = -;
public const short ErrorPIOIoctl = -;
public const short ErrorDIntSetIoctl = -;
public const short ErrorWaitEvtIoctl = -;
public const short ErrorOpenEvtIoctl = -;
public const short ErrorCOSIntSetIoctl = -;
public const short ErrorMemMapIoctl = -;
public const short ErrorMemUMapSetIoctl = -;
public const short ErrorCTRIoctl = -;
public const short ErrorGetResIoctl = -;
#endregion
#region Synchronous Mode
//Synchronous Mode
public const ushort SYNCH_OP = ;
public const ushort ASYNCH_OP = ;
#endregion
#region AD Range //AD Range
public const ushort AD_B_10_V = ;
public const ushort AD_B_5_V = ;
public const ushort AD_B_2_5_V = ;
public const ushort AD_B_1_25_V = ;
public const ushort AD_B_0_625_V = ;
public const ushort AD_B_0_3125_V = ;
public const ushort AD_B_0_5_V = ;
public const ushort AD_B_0_05_V = ;
public const ushort AD_B_0_005_V = ;
public const ushort AD_B_1_V = ;
public const ushort AD_B_0_1_V = ;
public const ushort AD_B_0_01_V = ;
public const ushort AD_B_0_001_V = ;
public const ushort AD_U_20_V = ;
public const ushort AD_U_10_V = ;
public const ushort AD_U_5_V = ;
public const ushort AD_U_2_5_V = ;
public const ushort AD_U_1_25_V = ;
public const ushort AD_U_1_V = ;
public const ushort AD_U_0_1_V = ;
public const ushort AD_U_0_01_V = ;
public const ushort AD_U_0_001_V = ;
#endregion
#region Clock Mode
//Clock Mode
public const ushort TRIG_SOFTWARE = ;
public const ushort TRIG_INT_PACER = ;
public const ushort TRIG_EXT_STROBE = ;
public const ushort TRIG_HANDSHAKE = ;
public const ushort TRIG_CLK_10MHZ = ; //PCI-7300A
public const ushort TRIG_CLK_20MHZ = ; //PCI-7300A
public const ushort TRIG_DO_CLK_TIMER_ACK = ; //PCI-7300A Rev. B
public const ushort TRIG_DO_CLK_10M_ACK = ; //PCI-7300A Rev. B
public const ushort TRIG_DO_CLK_20M_ACK = ; //PCI-7300A Rev. B
//Virtual Sampling Rate for using external clock as the clock source
public const double CLKSRC_EXT_SampRate = ;
#endregion
#region Constants for PCI-6208A/PCI-6308A/PCI-6308V //-------- Constants for PCI-6208A/PCI-6308A/PCI-6308V -------------------
//Output Mode
public const ushort P6208_CURRENT_0_20MA = ;
public const ushort P6208_CURRENT_4_20MA = ;
public const ushort P6208_CURRENT_5_25MA = ;
public const ushort P6308_CURRENT_0_20MA = ;
public const ushort P6308_CURRENT_4_20MA = ;
public const ushort P6308_CURRENT_5_25MA = ;
//AO Setting
public const ushort P6308V_AO_CH0_3 = ;
public const ushort P6308V_AO_CH4_7 = ;
public const ushort P6308V_AO_UNIPOLAR = ;
public const ushort P6308V_AO_BIPOLAR = ;
#endregion
#region Constants for PCI-7200
//-------- Constants for PCI-7200 --------------------
//InputMode
public const ushort DI_WAITING = 0x02;
public const ushort DI_NOWAITING = 0x00; public const ushort DI_TRIG_RISING = 0x04;
public const ushort DI_TRIG_FALLING = 0x00; public const ushort IREQ_RISING = 0x08;
public const ushort IREQ_FALLING = 0x00; //Output Mode
public const ushort OREQ_ENABLE = 0x10;
public const ushort OREQ_DISABLE = 0x00; public const ushort OTRIG_HIGH = 0x20;
public const ushort OTRIG_LOW = 0x00;
#endregion
#region Constants for PCI-7248/7296/7396/7442 //-------- Constants for PCI-7248/7296/7396/7442 ---------------
//DIO Port Direction
public const ushort INPUT_PORT = ;
public const ushort OUTPUT_PORT = ;
//DIO Line Direction
public const ushort INPUT_LINE = ;
public const ushort OUTPUT_LINE = ; //Channel & Port
public const ushort Channel_P1A = ;
public const ushort Channel_P1B = ;
public const ushort Channel_P1C = ;
public const ushort Channel_P1CL = ;
public const ushort Channel_P1CH = ;
public const ushort Channel_P1AE = ;
public const ushort Channel_P1BE = ;
public const ushort Channel_P1CE = ;
public const ushort Channel_P2A = ;
public const ushort Channel_P2B = ;
public const ushort Channel_P2C = ;
public const ushort Channel_P2CL = ;
public const ushort Channel_P2CH = ;
public const ushort Channel_P2AE = ;
public const ushort Channel_P2BE = ;
public const ushort Channel_P2CE = ;
public const ushort Channel_P3A = ;
public const ushort Channel_P3B = ;
public const ushort Channel_P3C = ;
public const ushort Channel_P3CL = ;
public const ushort Channel_P3CH = ;
public const ushort Channel_P4A = ;
public const ushort Channel_P4B = ;
public const ushort Channel_P4C = ;
public const ushort Channel_P4CL = ;
public const ushort Channel_P4CH = ;
public const ushort Channel_P5A = ;
public const ushort Channel_P5B = ;
public const ushort Channel_P5C = ;
public const ushort Channel_P5CL = ;
public const ushort Channel_P5CH = ;
public const ushort Channel_P6A = ;
public const ushort Channel_P6B = ;
public const ushort Channel_P6C = ;
public const ushort Channel_P6CL = ;
public const ushort Channel_P6CH = ;
//the following are used for PCI7396
public const ushort Channel_P1 = ;
public const ushort Channel_P2 = ;
public const ushort Channel_P3 = ;
public const ushort Channel_P4 = ;
public const ushort Channel_P1E = ; //only used by DIO_PortConfig function
public const ushort Channel_P2E = ; //only used by DIO_PortConfig function
public const ushort Channel_P3E = ; //only used by DIO_PortConfig function
public const ushort Channel_P4E = ; //only used by DIO_PortConfig function
//
public const ushort P7442_CH0 = ;
public const ushort P7442_CH1 = ;
public const ushort P7442_TTL0 = ;
public const ushort P7442_TTL1 = ;
//-------- Constants for PCI-7300A -------------------
//Wait Status
public const ushort P7300_WAIT_NO = ;
public const ushort P7300_WAIT_TRG = ;
public const ushort P7300_WAIT_FIFO = ;
public const ushort P7300_WAIT_BOTH = ; //Terminator control
public const ushort P7300_TERM_OFF = ;
public const ushort P7300_TERM_ON = ; //DI control signals polarity for PCI-7300A Rev. B
public const ushort P7300_DIREQ_POS = 0x00000000;
public const ushort P7300_DIREQ_NEG = 0x00000001;
public const ushort P7300_DIACK_POS = 0x00000000;
public const ushort P7300_DIACK_NEG = 0x00000002;
public const ushort P7300_DITRIG_POS = 0x00000000;
public const ushort P7300_DITRIG_NEG = 0x00000004; //DO control signals polarity for PCI-7300A Rev. B
public const ushort P7300_DOREQ_POS = 0x00000000;
public const ushort P7300_DOREQ_NEG = 0x00000008;
public const ushort P7300_DOACK_POS = 0x00000000;
public const ushort P7300_DOACK_NEG = 0x00000010;
public const ushort P7300_DOTRIG_POS = 0x00000000;
public const ushort P7300_DOTRIG_NEG = 0x00000020;
//-------- Constants for PCI-7432/7433/7434 ---------------
public const ushort PORT_DI_LOW = ;
public const ushort PORT_DI_HIGH = ;
public const ushort PORT_DO_LOW = ;
public const ushort PORT_DO_HIGH = ;
public const ushort P7432R_DO_LED = ;
public const ushort P7433R_DO_LED = ;
public const ushort P7434R_DO_LED = ;
public const ushort P7432R_DI_SLOT = ;
public const ushort P7433R_DI_SLOT = ;
public const ushort P7434R_DI_SLOT = ;
//-- Dual-Interrupt Source control for PCI-7248/96 & 7432/33 & 7230 & 8554 & 7396 &7256 &7260 ---
public const short INT1_DISABLE = -; //INT1 Disabled
public const short INT1_COS = ; //INT1 COS : only available for PCI-7396, PCI-7256, PCI-7260
public const short INT1_FP1C0 = ; //INT1 by Falling edge of P1C0 : only available for PCI7248/96/7396 public const short INT1_RP1C0_FP1C3 = ;
//INT1 by P1C0 Rising or P1C3 Falling : only available for PCI7248/96/7396 public const short INT1_EVENT_COUNTER = ;
//INT1 by Event Counter down to zero : only available for PCI7248/96/7396 public const short INT1_EXT_SIGNAL = ; //INT1 by external signal : only available for PCI7432/7433/7230/8554
public const short INT1_COUT12 = ; //INT1 COUT12 : only available for PCI8554
public const short INT1_CH0 = ; //INT1 CH0 : only available for PCI7256, PCI7260
public const short INT1_COS0 = ; //INT1 COS0 : only available for PCI-7452/PCI-7442
public const short INT1_COS1 = ; //INT1 COS1 : only available for PCI-7452/PCI-7442
public const short INT1_COS2 = ; //INT1 COS2 : only available for PCI-7452/PCI-7442
public const short INT1_COS3 = ; //INT1 COS3 : only available for PCI-7452/PCI-7442
public const short INT2_DISABLE = -; //INT2 Disabled
public const short INT2_COS = ; //INT2 COS : only available for PCI-7396
public const short INT2_FP2C0 = ; //INT2 by Falling edge of P2C0 : only available for PCI7248/96/7396 public const short INT2_RP2C0_FP2C3 = ;
//INT2 by P2C0 Rising or P2C3 Falling : only available for PCI7248/96/7396 public const short INT2_TIMER_COUNTER = ;
//INT2 by Timer Counter down to zero : only available for PCI7248/96/7396 public const short INT2_EXT_SIGNAL = ; //INT2 by external signal : only available for PCI7432/7433/7230/8554
public const short INT2_CH1 = ; //INT2 CH1 : only available for PCI7256, PCI7260
public const short INT2_WDT = ; //INT2 by WDT public const ushort ManualResetIEvt = 0x4000; //interrupt event is manually reset by user
public const ushort WDT_OVRFLOW_SAFETYOUT = 0x8000; // enable safteyout while WDT overflow
#endregion
#region Constants for PCI-8554
//-------- Constants for PCI-8554 --------------------
//Clock Source of Cunter N
public const ushort ECKN = ;
public const ushort COUTN_1 = ;
public const ushort CK1 = ;
public const ushort COUT10 = ; //Clock Source of CK1
public const ushort CK1_C8M = ;
public const ushort CK1_COUT11 = ; //Debounce Clock
public const ushort DBCLK_COUT11 = ;
public const ushort DBCLK_2MHZ = ;
#endregion
#region Constants for PCI-9111 //-------- Constants for PCI-9111 --------------------
//Dual Interrupt Mode
public const ushort P9111_INT1_EOC = ; //Ending of AD conversion
public const ushort P9111_INT1_FIFO_HF = ; //FIFO Half Full
public const ushort P9111_INT2_PACER = ; //Every Timer tick
public const ushort P9111_INT2_EXT_TRG = ; //ExtTrig High->Low //Channel Count
public const ushort P9111_CHANNEL_DO = ;
public const ushort P9111_CHANNEL_EDO = ;
public const ushort P9111_CHANNEL_DI = ;
public const ushort P9111_CHANNEL_EDI = ; //EDO function
public const ushort P9111_EDO_INPUT = ; //EDO port set as Input port
public const ushort P9111_EDO_OUT_EDO = ; //EDO port set as Output port
public const ushort P9111_EDO_OUT_CHN = ; //EDO port set as channel number ouput port //Trigger Mode
public const ushort P9111_TRGMOD_SOFT = 0x00; //Software Trigger Mode
public const ushort P9111_TRGMOD_PRE = 0x01; //Pre-Trigger Mode
public const ushort P9111_TRGMOD_POST = 0x02; //Post Trigger Mode //AO Setting
public const ushort P9111_AO_UNIPOLAR = ;
public const ushort P9111_AO_BIPOLAR = ;
#endregion
#region Constants for PCI-9118
//-------- Constants for PCI-9118 --------------------
public const ushort P9118_AI_BiPolar = 0x00;
public const ushort P9118_AI_UniPolar = 0x01; public const ushort P9118_AI_SingEnded = 0x00;
public const ushort P9118_AI_Differential = 0x02; public const ushort P9118_AI_ExtG = 0x04; public const ushort P9118_AI_ExtTrig = 0x08; public const ushort P9118_AI_DtrgNegative = 0x00;
public const ushort P9118_AI_DtrgPositive = 0x10; public const ushort P9118_AI_EtrgNegative = 0x00;
public const ushort P9118_AI_EtrgPositive = 0x20; public const ushort P9118_AI_BurstModeEn = 0x40;
public const ushort P9118_AI_SampleHold = 0x80;
public const ushort P9118_AI_PostTrgEn = 0x100;
public const ushort P9118_AI_AboutTrgEn = 0x200;
#endregion
#region Constants for PCI-9116
//-------- Constants for PCI-9116 --------------------
public const ushort P9116_AI_LocalGND = 0x00;
public const ushort P9116_AI_UserCMMD = 0x01;
public const ushort P9116_AI_SingEnded = 0x00;
public const ushort P9116_AI_Differential = 0x02;
public const ushort P9116_AI_BiPolar = 0x00;
public const ushort P9116_AI_UniPolar = 0x04; public const ushort P9116_TRGMOD_SOFT = 0x00; //Software Trigger Mode
public const ushort P9116_TRGMOD_POST = 0x10; //Post Trigger Mode
public const ushort P9116_TRGMOD_DELAY = 0x20; //Delay Trigger Mode
public const ushort P9116_TRGMOD_PRE = 0x30; //Pre-Trigger Mode
public const ushort P9116_TRGMOD_MIDL = 0x40; //Middle Trigger Mode
public const ushort P9116_AI_TrgPositive = 0x00;
public const ushort P9116_AI_TrgNegative = 0x80;
public const ushort P9116_AI_ExtTimeBase = 0x100;
public const ushort P9116_AI_IntTimeBase = 0x000;
public const ushort P9116_AI_DlyInSamples = 0x200;
public const ushort P9116_AI_DlyInTimebase = 0x000;
public const ushort P9116_AI_ReTrigEn = 0x400;
public const ushort P9116_AI_MCounterEn = 0x800;
public const ushort P9116_AI_SoftPolling = 0x0000;
public const ushort P9116_AI_INT = 0x1000;
public const ushort P9116_AI_DMA = 0x2000;
#endregion //-------- Constants for PCI-9812 --------------------
//Trigger Mode
public const ushort P9812_TRGMOD_SOFT = 0x00; //Software Trigger Mode
public const ushort P9812_TRGMOD_POST = 0x01; //Post Trigger Mode
public const ushort P9812_TRGMOD_PRE = 0x02; //Pre-Trigger Mode
public const ushort P9812_TRGMOD_DELAY = 0x03; //Delay Trigger Mode
public const ushort P9812_TRGMOD_MIDL = 0x04; //Middle Trigger Mode public const ushort P9812_AIEvent_Manual = 0x08; //Middle Trigger Mode //Trigger Source
public const ushort P9812_TRGSRC_CH0 = 0x00; //trigger source --CH0
public const ushort P9812_TRGSRC_CH1 = 0x08; //trigger source --CH1
public const ushort P9812_TRGSRC_CH2 = 0x10; //trigger source --CH2
public const ushort P9812_TRGSRC_CH3 = 0x18; //trigger source --CH3
public const ushort P9812_TRGSRC_EXT_DIG = 0x20; //External Digital Trigger //Trigger Polarity
public const ushort P9812_TRGSLP_POS = 0x00; //Positive slope trigger
public const ushort P9812_TRGSLP_NEG = 0x40; //Negative slope trigger //Frequency Selection
public const ushort P9812_AD2_GT_PCI = 0x80; //Freq. of A/D clock > PCI clock freq.
public const ushort P9812_AD2_LT_PCI = 0x00; //Freq. of A/D clock < PCI clock freq. //Clock Source
public const ushort P9812_CLKSRC_INT = 0x000; //Internal clock
public const ushort P9812_CLKSRC_EXT_SIN = 0x100; //External SIN wave clock
public const ushort P9812_CLKSRC_EXT_DIG = 0x200; //External Square wave clock //EMG shdn ctrl code
public const ushort EMGSHDN_OFF = ; //off
public const ushort EMGSHDN_ON = ; //on
public const ushort EMGSHDN_RECOVERY = ; //recovery //Hot Reset Hold ctrl code
public const ushort HRH_OFF = ; //off
public const ushort HRH_ON = ; //on //-------- Timer/Counter -----------------------------
//Counter Mode (8254)
public const ushort TOGGLE_OUTPUT = ; //Toggle output from low to high on terminal count
public const ushort PROG_ONE_SHOT = ; //Programmable one-shot
public const ushort RATE_GENERATOR = ; //Rate generator
public const ushort SQ_WAVE_RATE_GENERATOR = ; //Square wave rate generator
public const ushort SOFT_TRIG = ; //Software-triggered strobe
public const ushort HARD_TRIG = ; //Hardware-triggered strobe //General Purpose Timer/Counter
//Counter Mode
public const ushort General_Counter = 0x00; //general counter
public const ushort Pulse_Generation = 0x01; //pulse generation
//GPTC clock source
public const ushort GPTC_CLKSRC_EXT = 0x08;
public const ushort GPTC_CLKSRC_INT = 0x00;
public const ushort GPTC_GATESRC_EXT = 0x10;
public const ushort GPTC_GATESRC_INT = 0x00;
public const ushort GPTC_UPDOWN_SELECT_EXT = 0x20;
public const ushort GPTC_UPDOWN_SELECT_SOFT = 0x00;
public const ushort GPTC_UP_CTR = 0x40;
public const ushort GPTC_DOWN_CTR = 0x00;
public const ushort GPTC_ENABLE = 0x80;
public const ushort GPTC_DISABLE = 0x00; //Watchdog Timer
//Counter action
public const ushort WDT_DISARM = ;
public const ushort WDT_ARM = ;
public const ushort WDT_RESTART = ; //Pattern ID
public const ushort INIT_PTN = ;
public const ushort EMGSHDN_PTN = ; //16-bit binary or 4-decade BCD counter
public const ushort BIN = ;
public const ushort BCD = ; //Pattern ID for 7442
public const ushort INIT_PTN_CH0 = ;
public const ushort INIT_PTN_CH1 = ;
public const ushort SAFTOUT_PTN_CH0 = ;
public const ushort SAFTOUT_PTN_CH1 = ; //DAQ Event type for the event message
public const ushort AIEnd = ;
public const ushort DIEnd = ;
public const ushort DOEnd = ;
public const ushort DBEvent = ; public const ushort RegBySlot = 0x8000; /*------------------------------------------------------------------
** PCIS-DASK Function prototype
------------------------------------------------------------------*/ [DllImport("PCI-Dask.dll")]
public static extern short Register_Card(ushort CardType, ushort card_num); [DllImport("PCI-Dask.dll")]
public static extern short Release_Card(ushort CardNumber); [DllImport("PCI-Dask.dll")]
public static extern short GetActualRate(ushort CardNumber, double fSampleRate, out double fActualRate); [DllImport("PCI-Dask.dll")]
public static extern short EMGShutDownControl(ushort CardNumber, byte ctrl); [DllImport("PCI-Dask.dll")]
public static extern short EMGShutDownStatus(ushort CardNumber, out byte sts); [DllImport("PCI-Dask.dll")]
public static extern short HotResetHoldControl(ushort wCardNumber, byte enable); [DllImport("PCI-Dask.dll")]
public static extern short HotResetHoldStatus(ushort wCardNumber, out byte sts); [DllImport("PCI-Dask.dll")]
public static extern short GetInitPattern(ushort CardNumber, byte patID, out uint pattern); [DllImport("PCI-Dask.dll")]
public static extern short SetInitPattern(ushort wCardNumber, byte patID, uint pattern); [DllImport("PCI-Dask.dll")]
public static extern short IdentifyLED_Control(ushort CardNumber, byte ctrl); /*---------------------------------------------------------------------------*/ [DllImport("PCI-Dask.dll")]
public static extern short AI_9111_Config(ushort CardNumber, ushort TrigSource, ushort TrgMode, ushort TraceCnt); [DllImport("PCI-Dask.dll")]
public static extern short AI_9112_Config(ushort CardNumber, ushort TrigSource); [DllImport("PCI-Dask.dll")]
public static extern short AI_9113_Config(ushort CardNumber, ushort TrigSource); [DllImport("PCI-Dask.dll")]
public static extern short AI_9114_Config(ushort CardNumber, ushort TrigSource); [DllImport("PCI-Dask.dll")]
public static extern short AI_9116_Config(ushort CardNumber, ushort ConfigCtrl, ushort TrigCtrl, ushort PostCnt,
ushort MCnt, ushort ReTrgCnt); [DllImport("PCI-Dask.dll")]
public static extern short AI_9118_Config(ushort CardNumber, ushort ModeCtrl, ushort FunCtrl, ushort BurstCnt,
ushort PostCnt); [DllImport("PCI-Dask.dll")]
public static extern short AI_9812_Config(ushort CardNumber, ushort TrgMode, ushort TrgSrc, ushort TrgPol,
ushort ClkSel, ushort TrgLevel, ushort PostCnt); [DllImport("PCI-Dask.dll")]
public static extern short AI_9812_SetDiv(ushort wCardNumber, uint PacerVal); [DllImport("PCI-Dask.dll")]
public static extern short AI_9114_PreTrigConfig(ushort CardNumber, ushort PreTrgEn, ushort TraceCnt); [DllImport("PCI-Dask.dll")]
public static extern short AI_9116_CounterInterval(ushort wCardNumber, uint ScanIntrv, uint SampIntrv); [DllImport("PCI-Dask.dll")]
public static extern short AI_InitialMemoryAllocated(ushort CardNumber, out uint MemSize); [DllImport("PCI-Dask.dll")]
public static extern short AI_ReadChannel(ushort CardNumber, ushort Channel, ushort AdRange, out ushort Value); [DllImport("PCI-Dask.dll")]
public static extern short AI_VReadChannel(ushort CardNumber, ushort Channel, ushort AdRange, out double voltage); [DllImport("PCI-Dask.dll")]
public static extern short AI_VoltScale(ushort CardNumber, ushort AdRange, ushort reading, out double voltage); [DllImport("PCI-Dask.dll")]
public static extern short AI_ContReadChannel(ushort CardNumber, ushort Channel, ushort AdRange,
ushort[] Buffer, uint ReadCount, double SampleRate,
ushort SyncMode); [DllImport("PCI-Dask.dll")]
public static extern short AI_ContReadMultiChannels(ushort CardNumber, ushort NumChans, ushort[] Chans,
ushort[] AdRanges, ushort[] Buffer, uint ReadCount,
double SampleRate, ushort SyncMode); [DllImport("PCI-Dask.dll")]
public static extern short AI_ContScanChannels(ushort CardNumber, ushort Channel, ushort AdRange,
ushort[] Buffer, uint ReadCount, double SampleRate,
ushort SyncMode); [DllImport("PCI-Dask.dll")]
public static extern short AI_ContReadChannelToFile(ushort CardNumber, ushort Channel, ushort AdRange,
string FileName, uint ReadCount, double SampleRate,
ushort SyncMode); [DllImport("PCI-Dask.dll")]
public static extern short AI_ContReadMultiChannelsToFile(ushort CardNumber, ushort NumChans, ushort[] Chans,
ushort[] AdRanges, string[] FileName, uint ReadCount,
double SampleRate, ushort SyncMode); [DllImport("PCI-Dask.dll")]
public static extern short AI_ContScanChannelsToFile(ushort CardNumber, ushort Channel, ushort AdRange,
string FileName, uint ReadCount, double SampleRate,
ushort SyncMode); [DllImport("PCI-Dask.dll")]
public static extern short AI_ContStatus(ushort CardNumber, out ushort Status); [DllImport("PCI-Dask.dll")]
public static extern short AI_ContVScale(ushort wCardNumber, ushort adRange, ushort[] readingArray,
double[] voltageArray, int count); [DllImport("PCI-Dask.dll")]
public static extern short AI_AsyncCheck(ushort CardNumber, out byte Stopped, out uint AccessCnt); [DllImport("PCI-Dask.dll")]
public static extern short AI_AsyncClear(ushort CardNumber, out uint AccessCnt); [DllImport("PCI-Dask.dll")]
public static extern short AI_AsyncDblBufferHalfReady(ushort CardNumber, out byte HalfReady, out byte StopFlag); [DllImport("PCI-Dask.dll")]
public static extern short AI_AsyncDblBufferMode(ushort CardNumber, bool Enable); [DllImport("PCI-Dask.dll")]
public static extern short AI_AsyncDblBufferTransfer(ushort CardNumber, ushort[] Buffer); [DllImport("PCI-Dask.dll")]
public static extern short AI_AsyncDblBufferOverrun(ushort CardNumber, ushort op, out ushort overrunFlag); [DllImport("PCI-Dask.dll")]
public static extern short AI_EventCallBack(ushort CardNumber, ushort mode, ushort EventType,
MulticastDelegate callbackAddr); /*---------------------------------------------------------------------------*/ [DllImport("PCI-Dask.dll")]
public static extern short AO_6208A_Config(ushort CardNumber, ushort V2AMode); [DllImport("PCI-Dask.dll")]
public static extern short AO_6308A_Config(ushort CardNumber, ushort V2AMode); [DllImport("PCI-Dask.dll")]
public static extern short AO_6308V_Config(ushort wCardNumber, ushort Channel, ushort wOutputPolarity,
double refVoltage); [DllImport("PCI-Dask.dll")]
public static extern short AO_9111_Config(ushort CardNumber, ushort OutputPolarity); [DllImport("PCI-Dask.dll")]
public static extern short AO_9112_Config(ushort CardNumber, ushort Channel, double refVoltage); [DllImport("PCI-Dask.dll")]
public static extern short AO_WriteChannel(ushort CardNumber, ushort Channel, short Value); [DllImport("PCI-Dask.dll")]
public static extern short AO_VWriteChannel(ushort CardNumber, ushort Channel, double Voltage); [DllImport("PCI-Dask.dll")]
public static extern short AO_VoltScale(ushort CardNumber, ushort Channel, double Voltage, out short binValue); [DllImport("PCI-Dask.dll")]
public static extern short AO_SimuWriteChannel(ushort wCardNumber, ushort wGroup, short[] pwBuffer); [DllImport("PCI-Dask.dll")]
public static extern short AO_SimuVWriteChannel(ushort wCardNumber, ushort wGroup, double[] VBuffer); /*---------------------------------------------------------------------------*/ [DllImport("PCI-Dask.dll")]
public static extern short DI_7200_Config(ushort CardNumber, ushort TrigSource, ushort ExtTrigEn, ushort TrigPol,
ushort I_REQ_Pol); [DllImport("PCI-Dask.dll")]
public static extern short DI_7300A_Config(ushort CardNumber, ushort PortWidth, ushort TrigSource,
ushort WaitStatus, ushort Terminator, ushort I_REQ_Pol,
bool clear_fifo, bool disable_di); [DllImport("PCI-Dask.dll")]
public static extern short DI_7300B_Config(ushort CardNumber, ushort PortWidth, ushort TrigSource,
ushort WaitStatus, ushort Terminator, ushort I_Cntrl_Pol,
bool clear_fifo, bool disable_di); [DllImport("PCI-Dask.dll")]
public static extern short DI_InitialMemoryAllocated(ushort CardNumber, out uint DmaSize); [DllImport("PCI-Dask.dll")]
public static extern short DI_ReadLine(ushort CardNumber, ushort Port, ushort Line, out ushort State); [DllImport("PCI-Dask.dll")]
public static extern short DI_ReadPort(ushort CardNumber, ushort Port, out uint Value); [DllImport("PCI-Dask.dll")]
public static extern short DI_ContReadPort(ushort CardNumber, ushort Port, byte[] Buffer,
uint ReadCount, double SampleRate, ushort SyncMode); [DllImport("PCI-Dask.dll")]
public static extern short DI_ContReadPort(ushort CardNumber, ushort Port, ushort[] Buffer,
uint ReadCount, double SampleRate, ushort SyncMode); [DllImport("PCI-Dask.dll")]
public static extern short DI_ContReadPort(ushort CardNumber, ushort Port, uint[] Buffer,
uint ReadCount, double SampleRate, ushort SyncMode); [DllImport("PCI-Dask.dll")]
public static extern short DI_ContReadPortToFile(ushort CardNumber, ushort Port, string FileName,
uint ReadCount, double SampleRate, ushort SyncMode); [DllImport("PCI-Dask.dll")]
public static extern short DI_ContStatus(ushort CardNumber, out ushort Status); [DllImport("PCI-Dask.dll")]
public static extern short DI_AsyncCheck(ushort CardNumber, out byte Stopped, out uint AccessCnt); [DllImport("PCI-Dask.dll")]
public static extern short DI_AsyncClear(ushort CardNumber, out uint AccessCnt); [DllImport("PCI-Dask.dll")]
public static extern short DI_AsyncDblBufferHalfReady(ushort CardNumber, out byte HalfReady); [DllImport("PCI-Dask.dll")]
public static extern short DI_AsyncDblBufferMode(ushort CardNumber, bool Enable); [DllImport("PCI-Dask.dll")]
public static extern short DI_AsyncDblBufferTransfer(ushort CardNumber, byte[] Buffer); [DllImport("PCI-Dask.dll")]
public static extern short DI_AsyncDblBufferTransfer(ushort CardNumber, short[] Buffer); [DllImport("PCI-Dask.dll")]
public static extern short DI_AsyncDblBufferTransfer(ushort CardNumber, uint[] Buffer); [DllImport("PCI-Dask.dll")]
public static extern short DI_ContMultiBufferSetup(ushort wCardNumber, byte[] pwBuffer, uint dwReadCount,
out ushort BufferId); [DllImport("PCI-Dask.dll")]
public static extern short DI_ContMultiBufferSetup(ushort wCardNumber, short[] pwBuffer, uint dwReadCount,
out ushort BufferId); [DllImport("PCI-Dask.dll")]
public static extern short DI_ContMultiBufferSetup(ushort wCardNumber, uint[] pwBuffer, uint dwReadCount,
out ushort BufferId); [DllImport("PCI-Dask.dll")]
public static extern short DI_ContMultiBufferStart(ushort wCardNumber, ushort wPort, double fSampleRate); [DllImport("PCI-Dask.dll")]
public static extern short DI_AsyncMultiBufferNextReady(ushort CardNumber, out byte bNextReady,
out ushort wBufferId); [DllImport("PCI-Dask.dll")]
public static extern short DI_AsyncDblBufferOverrun(ushort CardNumber, ushort op, out ushort overrunFlag); [DllImport("PCI-Dask.dll")]
public static extern short DI_EventCallBack(ushort CardNumber, short mode, short EventType,
MulticastDelegate callbackAddr); /*---------------------------------------------------------------------------*/ [DllImport("PCI-Dask.dll")]
public static extern short DO_7200_Config(ushort CardNumber, ushort TrigSource, ushort OutReqEn,
ushort OutTrigSig); [DllImport("PCI-Dask.dll")]
public static extern short DO_7300A_Config(ushort CardNumber, ushort PortWidth, ushort TrigSource,
ushort WaitStatus, ushort Terminator, ushort O_REQ_Pol); [DllImport("PCI-Dask.dll")]
public static extern short DO_7300B_Config(ushort CardNumber, ushort PortWidth, ushort TrigSource,
ushort WaitStatus, ushort Terminator, ushort O_Cntrl_Pol,
uint FifoThreshold); [DllImport("PCI-Dask.dll")]
public static extern short DO_InitialMemoryAllocated(ushort CardNumber, out uint MemSize); [DllImport("PCI-Dask.dll")]
public static extern short DO_WriteLine(ushort CardNumber, ushort Port, ushort Line, ushort Value); [DllImport("PCI-Dask.dll")]
public static extern short DO_WritePort(ushort CardNumber, byte Port, uint Value); [DllImport("PCI-Dask.dll")]
public static extern short DO_WritePort(ushort CardNumber, ushort Port, uint Value); [DllImport("PCI-Dask.dll")]
public static extern short DO_WritePort(ushort CardNumber, uint Port, uint Value); [DllImport("PCI-Dask.dll")]
public static extern short DO_WriteExtTrigLine(ushort CardNumber, ushort Value); [DllImport("PCI-Dask.dll")]
public static extern short DO_ReadLine(ushort CardNumber, ushort Port, ushort Line, out ushort Value); [DllImport("PCI-Dask.dll")]
public static extern short DO_ReadPort(ushort CardNumber, ushort Port, out uint Value); [DllImport("PCI-Dask.dll")]
public static extern short DO_ContWritePort(ushort CardNumber, ushort Port, byte[] Buffer,
uint WriteCount, ushort Iterations, double SampleRate,
ushort SyncMode); [DllImport("PCI-Dask.dll")]
public static extern short DO_ContWritePort(ushort CardNumber, ushort Port, ushort[] Buffer,
uint WriteCount, ushort Iterations, double SampleRate,
ushort SyncMode); [DllImport("PCI-Dask.dll")]
public static extern short DO_ContWritePort(ushort CardNumber, ushort Port, uint[] Buffer,
uint WriteCount, ushort Iterations, double SampleRate,
ushort SyncMode); [DllImport("PCI-Dask.dll")]
public static extern short DO_PGStart(ushort CardNumber, byte[] Buffer, uint WriteCount, double SampleRate); [DllImport("PCI-Dask.dll")]
public static extern short DO_PGStart(ushort CardNumber, short[] Buffer, uint WriteCount, double SampleRate); [DllImport("PCI-Dask.dll")]
public static extern short DO_PGStart(ushort CardNumber, uint[] Buffer, uint WriteCount, double SampleRate); [DllImport("PCI-Dask.dll")]
public static extern short DO_PGStop(ushort CardNumber); [DllImport("PCI-Dask.dll")]
public static extern short DO_ContStatus(ushort CardNumber, out ushort Status); [DllImport("PCI-Dask.dll")]
public static extern short DO_AsyncCheck(ushort CardNumber, out byte Stopped, out uint AccessCnt); [DllImport("PCI-Dask.dll")]
public static extern short DO_AsyncClear(ushort CardNumber, out uint AccessCnt); [DllImport("PCI-Dask.dll")]
public static extern short EDO_9111_Config(ushort CardNumber, ushort EDO_Fun); [DllImport("PCI-Dask.dll")]
public static extern short DO_ContMultiBufferSetup(ushort CardNumber, byte[] pwBuffer, uint dwWriteCount,
out ushort BufferId); [DllImport("PCI-Dask.dll")]
public static extern short DO_ContMultiBufferSetup(ushort CardNumber, short[] pwBuffer, uint dwWriteCount,
out ushort BufferId); [DllImport("PCI-Dask.dll")]
public static extern short DO_ContMultiBufferSetup(ushort CardNumber, uint[] pwBuffer, uint dwWriteCount,
out ushort BufferId); [DllImport("PCI-Dask.dll")]
public static extern short DO_AsyncMultiBufferNextReady(ushort CardNumber, out byte bNextReady,
out ushort wBufferId); [DllImport("PCI-Dask.dll")]
public static extern short DO_ContMultiBufferStart(ushort wCardNumber, ushort wPort, double fSampleRate); [DllImport("PCI-Dask.dll")]
public static extern short DO_EventCallBack(ushort CardNumber, short mode, short EventType,
MulticastDelegate callbackAddr); /*---------------------------------------------------------------------------*/ [DllImport("PCI-Dask.dll")]
public static extern short DIO_PortConfig(ushort CardNumber, ushort Port, ushort Direction); [DllImport("PCI-Dask.dll")]
public static extern short DIO_LinesConfig(ushort wCardNumber, ushort wPort, ushort wLinesdirmap); [DllImport("PCI-Dask.dll")]
public static extern short DIO_LineConfig(ushort wCardNumber, ushort wPort, ushort wLine, ushort wDirection); [DllImport("PCI-Dask.dll")]
public static extern short DIO_SetDualInterrupt(ushort CardNumber, short Int1Mode, short Int2Mode, long hEvent); [DllImport("PCI-Dask.dll")]
public static extern short DIO_SetCOSInterrupt(ushort CardNumber, ushort Port, ushort ctlA, ushort ctlB,
ushort ctlC); [DllImport("PCI-Dask.dll")]
public static extern short DIO_INT1_EventMessage(ushort CardNumber, short Int1Mode, long windowHandle,
long message, MulticastDelegate callbackAddr); [DllImport("PCI-Dask.dll")]
public static extern short DIO_INT2_EventMessage(ushort CardNumber, short Int2Mode, long windowHandle,
long message, MulticastDelegate callbackAddr); [DllImport("PCI-Dask.dll")]
public static extern short DIO_7300SetInterrupt(ushort CardNumber, short AuxDIEn, short T2En, long hEvent); [DllImport("PCI-Dask.dll")]
public static extern short DIO_AUXDI_EventMessage(ushort CardNumber, short AuxDIEn, long windowHandle,
uint message, MulticastDelegate callbackAddr); [DllImport("PCI-Dask.dll")]
public static extern short DIO_T2_EventMessage(ushort CardNumber, short T2En, long windowHandle, uint message,
MulticastDelegate callbackAddr); [DllImport("PCI-Dask.dll")]
public static extern short DIO_GetCOSLatchData(ushort wCardNumber, out ushort CosLData); [DllImport("PCI-Dask.dll")]
public static extern short DIO_SetCOSInterrupt32(ushort wCardNumber, byte Port, uint ctl, out long hEvent,
bool bManualReset); [DllImport("PCI-Dask.dll")]
public static extern short DIO_GetCOSLatchDataInt32(ushort wCardNumber, byte Port, out uint CosLData); /*---------------------------------------------------------------------------*/ [DllImport("PCI-Dask.dll")]
public static extern short CTR_Setup(ushort CardNumber, ushort Ctr, ushort Mode, uint Count, ushort BinBcd); [DllImport("PCI-Dask.dll")]
public static extern short CTR_Clear(ushort CardNumber, ushort Ctr, ushort State); [DllImport("PCI-Dask.dll")]
public static extern short CTR_Read(ushort CardNumber, ushort Ctr, out uint Value); [DllImport("PCI-Dask.dll")]
public static extern short CTR_Update(ushort CardNumber, ushort Ctr, uint Count); [DllImport("PCI-Dask.dll")]
public static extern short CTR_8554_ClkSrc_Config(ushort CardNumber, ushort Ctr, ushort ClockSource); [DllImport("PCI-Dask.dll")]
public static extern short CTR_8554_CK1_Config(ushort CardNumber, ushort ClockSource); [DllImport("PCI-Dask.dll")]
public static extern short CTR_8554_Debounce_Config(ushort CardNumber, ushort DebounceClock); [DllImport("PCI-Dask.dll")]
public static extern short GCTR_Setup(ushort wCardNumber, ushort wGCtr, ushort wGCtrCtrl, uint dwCount); [DllImport("PCI-Dask.dll")]
public static extern short GCTR_Clear(ushort wCardNumber, ushort wGCtr); [DllImport("PCI-Dask.dll")]
public static extern short GCTR_Read(ushort wCardNumber, ushort wGCtr, out uint pValue); [DllImport("PCI-Dask.dll")]
public static extern short WDT_Setup(ushort CardNumber, ushort wCtr, float ovflowSec, out float actualSec,
out long hEvent); [DllImport("PCI-Dask.dll")]
public static extern short WDT_Control(ushort wCardNumber, ushort wCtr, ushort action); [DllImport("PCI-Dask.dll")]
public static extern short WDT_Status(ushort wCardNumber, ushort Ctr, out uint pValue); [DllImport("PCI-Dask.dll")]
public static extern short WDT_Reload(ushort wCardNumber, float ovflowSec, out float actualSec); /*---------------------------------------------------------------------------*/ [DllImport("PCI-Dask.dll")]
public static extern short AI_GetEvent(ushort wCardNumber, out long hEvent); [DllImport("PCI-Dask.dll")]
public static extern short AO_GetEvent(ushort wCardNumber, out long hEvent); [DllImport("PCI-Dask.dll")]
public static extern short DI_GetEvent(ushort wCardNumber, out long hEvent); [DllImport("PCI-Dask.dll")]
public static extern short DO_GetEvent(ushort wCardNumber, out long hEvent); /*---------------------------------------------------------------------------*/ [DllImport("PCI-Dask.dll")]
public static extern short AI_GetView(ushort wCardNumber, uint[] pView); [DllImport("PCI-Dask.dll")]
public static extern short DI_GetView(ushort wCardNumber, uint[] pView); [DllImport("PCI-Dask.dll")]
public static extern short DO_GetView(ushort wCardNumber, uint[] pView); /*---------------------------------------------------------------------------*/ [DllImport("PCI-Dask.dll")]
public static extern short GetCardType(ushort wCardNumber, out ushort cardType); [DllImport("PCI-Dask.dll")]
public static extern short GetCardIndexFromID(ushort wCardNumber, out ushort cardType, out ushort cardIndex); [DllImport("PCI-Dask.dll")]
public static extern short GetBaseAddr(ushort wCardNumber, uint[] BaseAddr, uint[] BaseAddr2); [DllImport("PCI-Dask.dll")]
public static extern short GetLCRAddr(ushort wCardNumber, uint[] LcrAddr);
}
}
PCI-DASK工具类
using System;
using System.Collections.Generic;
using System.Text;
using Common.PciProtocol;
using System.Collections; namespace PCI.PciProtocol
{
public class Card_7234
{
ushort cardNum = ;//卡号 public int iDI_7234_Max = ;//端口数量 int sum = ; private Card_7234() { } public Card_7234(ushort cardNum)
{
this.cardNum = cardNum;
} /*注册一个7234卡*/
public void Register()
{
short state = DASK.Register_Card(DASK.PCI_7234, cardNum);
if (state < )
{
throw new Exception("Register failed!");
}
//给端口赋值0
writePort();
} /*向端口写数据*/
public bool writePort(int out_value)
{
short ret;
ret = DASK.DO_WritePort((ushort)cardNum,, (uint)out_value); if (ret < )
{
return false;
}
else
{
return true;
}
} /*从端口读数据*/
public bool readPort(out uint int_value, ref int[] arr)
{
short ret;
ret = DASK.DO_ReadPort((ushort) cardNum, , out int_value);
if (ret < )
{
return false;
}
else
{
arr = getArr(int_value);
return true;
}
}
/*从端口读数据*/
public bool readPort(out uint int_value)
{
short ret;
ret = DASK.DO_ReadPort((ushort)cardNum, , out int_value);
if (ret < )
{
return false;
}
else
{
return true;
}
} public bool openLight(int indexLight)
{
uint sum=;
if(readPort(out sum))
{
sum+=(uint)Math.Pow(,indexLight-);
}
if(writePort((int)sum))
{
return true;
}
else
{
return false;
}
} public bool closeLight(int indexLight)
{
uint sum = ;
uint temp = (uint)Math.Pow(, indexLight-);
if (readPort(out sum))
{
if (sum >= temp)
{
sum -= temp;
}
}
if (writePort((int)sum))
{
return true;
}
else
{
return false;
}
} /*获取一个int类型的二进制数组*/
private static int[] getArr(uint count)
{
object[] objArr=IntConvert.Ten2TwoArr((int)count).ToArray();
int[] result=new int[objArr.Length];
for (int i = ; i < objArr.Length; i++)
{
result[i] = Convert.ToInt32(objArr[i]);
}
return result;
} /*释放端口*/
public void Release()
{
DASK.Release_Card(cardNum);
} }
}
Card_7234
/***********************************/
/* Author: Made by Anby */
/* Date Time: 2013-7-19 */
/* Using:用于读取9113数据 */
/***********************************/
using System;
using System.Collections.Generic;
using System.Text;
using Common.PciProtocol; namespace PCI.PciProtocol
{ #region 用法
/*
* Card_9113 c9113 = new Card_9113(0);
* c9113.Register();
* double value;
* if (c9113.ReadChannel(1, out value))
* {
* //@TODO
* }
* c9113.Release();
*/
#endregion public class Card_9113
{
ushort cardNum = ;//卡号 public int iAD_9113_MAX = ;//端口数量 int sum = ; private Card_9113() { } public Card_9113(ushort cardNum)
{
this.cardNum = cardNum;
} /*注册一个9113卡*/
public void Register()
{
short state = DASK.Register_Card(DASK.PCI_9113, cardNum);
if (state < )
{
throw new Exception("Register failed!");
}
} /*读通道数据*/
public bool ReadChannel(ushort channel, out double data)
{
//所有的通道都是一样的 if (channel > iAD_9113_MAX || channel < )
{
data = ;
return false;
} ushort value;//用来接收摸拟信号 //AD_B_10_V表示正负10v,AD_U_10_V表示正10v DASK.AI_ReadChannel(cardNum, channel, DASK.AD_B_10_V, out value); data = ((double)value * ) / ;//将读的摸拟信号转换为数字信号 公式: 10/4096=x/摸拟信号
return true; } /*释放端口*/
public void Release()
{
DASK.Release_Card(cardNum);
}
}
}
Card_9113
3.串口操作(使用的是vs自带的串口控件)
(略过)
4.usb操作
using System;
using System.Runtime.InteropServices;
using System.Text; namespace USBXpress_TestPanel
{
internal class SLUSBXpressDLL
{
// Return Codes
public const Int32 SI_SUCCESS = 0x00;
public const Int32 SI_DEVICE_NOT_FOUND = 0xFF;
public const Int32 SI_INVALID_HANDLE = 0x01;
public const Int32 SI_READ_ERROR = 0x02;
public const Int32 SI_RX_QUEUE_NOT_READY = 0x03;
public const Int32 SI_WRITE_ERROR = 0x04;
public const Int32 SI_RESET_ERROR = 0x05;
public const Int32 SI_INVALID_PARAMETER = 0x06;
public const Int32 SI_INVALID_REQUEST_LENGTH = 0x07;
public const Int32 SI_DEVICE_IO_FAILED = 0x08;
public const Int32 SI_INVALID_BAUDRATE = 0x09;
public const Int32 SI_FUNCTION_NOT_SUPPORTED = 0x0a;
public const Int32 SI_GLOBAL_DATA_ERROR = 0x0b;
public const Int32 SI_SYSTEM_ERROR_CODE = 0x0c;
public const Int32 SI_READ_TIMED_OUT = 0x0d;
public const Int32 SI_WRITE_TIMED_OUT = 0x0e;
public const Int32 SI_IO_PENDING = 0x0f; // GetProductString() function flags
public const Int32 SI_RETURN_SERIAL_NUMBER = 0x00;
public const Int32 SI_RETURN_DESCRIPTION = 0x01;
public const Int32 SI_RETURN_LINK_NAME = 0x02;
public const Int32 SI_RETURN_VID = 0x03;
public const Int32 SI_RETURN_PID = 0x04; // RX Queue status flags
public const Int32 SI_RX_NO_OVERRUN = 0x00;
public const Int32 SI_RX_EMPTY = 0x00;
public const Int32 SI_RX_OVERRUN = 0x01;
public const Int32 SI_RX_READY = 0x02; // Buffer size limits
public const Int32 SI_MAX_DEVICE_STRLEN = ;
public const Int32 SI_MAX_READ_SIZE = *;
public const Int32 SI_MAX_WRITE_SIZE = ; // Input and Output pin Characteristics
public const Int32 SI_HELD_INACTIVE = 0x00;
public const Int32 SI_HELD_ACTIVE = 0x01;
public const Int32 SI_FIRMWARE_CONTROLLED = 0x02;
public const Int32 SI_RECEIVE_FLOW_CONTROL = 0x02;
public const Int32 SI_TRANSMIT_ACTIVE_SIGNAL = 0x03;
public const Int32 SI_STATUS_INPUT = 0x00;
public const Int32 SI_HANDSHAKE_LINE = 0x01; // Mask and Latch value bit definitions
public const Int32 SI_GPIO_0 = 0x01;
public const Int32 SI_GPIO_1 = 0x02;
public const Int32 SI_GPIO_2 = 0x04;
public const Int32 SI_GPIO_3 = 0x08; // GetDeviceVersion() return codes
public const Int32 SI_CP2101_VERSION = 0x01;
public const Int32 SI_CP2102_VERSION = 0x02;
public const Int32 SI_CP2103_VERSION = 0x03; public static Int32 Status;
public static UInt32 hUSBDevice; [DllImport("SiUSBXp.dll")]
public static extern int SI_GetNumDevices
(ref Int32 lpdwNumDevices); [DllImport("SiUSBXp.dll")]
public static extern int SI_GetProductString
(Int32 dwDeviceNum,
StringBuilder lpvDeviceString,
Int32 dwFlags); [DllImport("SiUSBXp.dll")]
public static extern int SI_Open
(Int32 dwDevice,
ref UInt32 cyHandle); [DllImport("SiUSBXp.dll")]
public static extern int SI_Close
(UInt32 cyHandle); [DllImport("SiUSBXp.dll")]
public static extern int SI_Read
(UInt32 cyHandle,
ref Byte lpBuffer,
Int32 dwBytesToRead,
ref Int32 lpdwBytesReturned,
Int32 lpOverlapped); [DllImport("SiUSBXp.dll")]
public static extern int SI_Write
(UInt32 cyHandle,
ref Byte lpBuffer,
Int32 dwBytesToWrite,
ref Int32 lpdwBytesWritten,
Int32 lpOverlapped); [DllImport("SiUSBXp.dll")]
public static extern int SI_SetTimeouts
(Int32 dwReadTimeout,
Int32 dwWriteTimeout); [DllImport("SiUSBXp.dll")]
public static extern int SI_GetTimeouts
(ref Int32 dwReadTimeout,
ref Int32 dwWriteTimeout); [DllImport("SiUSBXp.dll")]
public static extern int SI_CheckRXQueue
(UInt32 cyHandle,
ref UInt32 lpdwNumBytesInQueue,
ref UInt32 lpdwQueueStatus);
}
}
SLUSBXpressDLL