Exemplo n.º 1
0
 internal override void ClearInBuffer()
 {
     if (IsConnected())
     {
         li.ibclr(Dev);
     }
 }
Exemplo n.º 2
0
        public GPIB(int ADDR)        //构造函数
        {
            //ADDR为GPIB设备地址
            try
            {
                li      = new LangInt();                     // Contains all GPIB functions
                c       = new GpibConstants();               // Contains all GPIB global constants
                TIMEOUT = c.T3s;

                Dev = li.ibdev(BDINDEX, ADDR, NO_SECONDARY_ADDR, TIMEOUT, EOTMODE, EOSMODE);         //Get the device handle
                if ((li.ibsta & c.ERR) != 0)
                {
                    throw new System.Exception("Unable to open device!\nibsta:" + li.ibsta + "\nERR:" + c.ERR);
                }


                li.ibclr(Dev);
                if ((li.ibsta & c.ERR) != 0)
                {
                    throw new System.Exception("Unable to clear device!\nibsta:" + li.ibsta + "\nERR:" + c.ERR);
                }
            }
            catch (System.Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Exemplo n.º 3
0
 //read data form device
 public string GPIBrd(int buffersize)
 {
     try
     {
         li.ibrd(Dev, out ValueStr, buffersize);
         li.ibclr(Dev);
         return(ValueStr);
     }
     catch (System.Exception Ex)
     {
         throw new Exception("Error: " + Ex.Message +          //error Name
                             "ibsta = " + li.ibsta +           //ibsta
                             "iberr = " + li.iberr +           //iberr
                             ErrorMnemonic[li.iberr]);         //error code
     }
 }