Exemple #1
0
        private bool InstrScopeImage(int Count, string instruCmd, ref string RdStr)
        {
            bool       ret = true;
            string     strPath = null, FileName = null;
            SL_IO_Util IOUtil = new SL_IO_Util();

            byte[]         ScopeScreenResultsArray; // Screen Results array.
            int            g_ScreenLength;
            VisaInstrument visaScope = new VisaInstrument(EquipUtil[Count].getInstrName());

            //ScopeList.SimpleScopeGraph(devices[1], ":DISPLAY:DATA? PNG, SCREEN, COLOR\r\n");
            // Download the screen image.
            // -----------------------------------------------------------
            visaScope.SetTimeoutSeconds(30000);
            visaScope.DoCommand(":STOP");
            visaScope.DoCommand(":HARDcopy:INKSaver OFF");
            // Get the screen data.
            g_ScreenLength = visaScope.DoQueryIEEEBlock(":DISPlay:DATA? PNG, COLor", out ScopeScreenResultsArray);

            if (instruCmd.CompareTo("auto") == 0)
            {
                FileName = "Scope_" + DateTime.Now.ToLocalTime().ToString("yyyyMMdd-HHmmss") + ".png";
            }
            else
            {
                FileName = instruCmd;
            }

            strPath = Setting.ExeScopeDirPath + "\\" + FileName;
            if (IOUtil.isFileExist(strPath))
            {
                IOUtil.FileDelete(strPath);
            }
            if (IOUtil.GetExtName(strPath).CompareTo("png") != 0)
            {
                strPath += ".png";
            }
            FileStream fStream = File.Open(strPath, FileMode.Create);

            fStream.Write(ScopeScreenResultsArray, 0, g_ScreenLength);
            fStream.Close();

            visaScope.DoCommand(":RUN");
            visaScope.Close();
            return(ret);
        }
Exemple #2
0
        /*
         * Initialize the oscilloscope to a known state.
         * --------------------------------------------------------------
         */
        private static void Initialize()
        {
            StringBuilder strResults;

            // Get and display the device's *IDN? string.
            strResults = myScope.DoQueryString("*IDN?");
            Console.WriteLine("*IDN? result is: {0}", strResults);

            // Clear status and load the default setup.
            myScope.DoCommand("*CLS");
            myScope.DoCommand("*RST");
        }