色偷偷偷久久伊人大杳蕉,色爽交视频免费观看,欧美扒开腿做爽爽爽a片,欧美孕交alscan巨交xxx,日日碰狠狠躁久久躁蜜桃

x
x

PG-1000系列脈沖發(fā)生器SCPI遠程控制

發(fā)布時間:2018-8-30 15:52    發(fā)布者:Stone_Mei
關鍵詞: MAX , SCPI , 脈沖發(fā)生器 , 虹科 , AT

PG-1000系列脈沖發(fā)生器SCPI遠程控制.pdf (1.12 MB)

本文以Active Technologies公司(簡稱AT)的PG 1000系列脈沖發(fā)生器為例,講述了在進行SCPI控制儀器前,如何使用NI MAX進行系統(tǒng)配置。





1.        概要        1
2.        工具/準備        1
2.1 PG-1000系列SDK        1
2.2 NI VISA        2
2.3 NI NAX(Measurement & Automation Explorer)        3
2.4 PG-1000系列軟件        3
3. 配置系統(tǒng)(使用NI MAX)        4
4. 調(diào)試系統(tǒng)(使用AT Instrument Communicator)        8
5. 例程/范例        9
5.1 LabVIEW        10
5.2 Microsoft C#        11
5.3 Microsoft C++        13

1.        概要
可以連接儀器至用戶的網(wǎng)絡中,實現(xiàn)打印、文件共享、互聯(lián)網(wǎng)訪問等其他功能。請聯(lián)系貴公司的網(wǎng)絡管理員,并使用標準Windows在用戶的網(wǎng)絡中配置儀器。
儀器是通過VXI-11 (LAN)協(xié)議進行控制的,用戶可以利用SCPI命令遠程控制儀器,請參考《Pulse Rider PG-1000 programmer manual》了解詳細的SCPI命令語法、語句。
2.        工具/準備
2.1 PG-1000系列SDK
1.        用戶在www.activetechnologies.it網(wǎng)站注冊賬戶后,登錄網(wǎng)站并“Register”儀器。

2.        點擊“Support”—“Client Area”,訪問“Users Products”界面。

3.        點擊AT-PG1072或AT-PG1074鏈接,訪問下載界面。點擊SDK-AT-PULSE-GENERATOR安裝包并下載。

SDK內(nèi)包括:
                AT Instrument Communicator安裝程序(用途,參考下節(jié)“配置系統(tǒng)”的第9步)
                C++例程
C#例程
LabVIEW例程
2.2 NI VISA
在Client-PC(即Remote PC)中下載并安裝NI VISA。
VISA為硬件與開發(fā)環(huán)境(比如,Visual Studio .NET、LabVIEW、LabWindows/CVI、Measurement Studio for Microsoft Visual Studio、MatLab等)提供編程接口。NI VISA是National Instruments公司提供的VISA I/O標準。NI VISA包括軟件庫、交互式工具(例如, NI I/O Trace與VISA交互式控制)、配置程序等。
2.3 NI NAX(Measurement & Automation Explorer)
在Client-PC(即Remote PC)中下載并安裝NI MAX軟件。
2.4 PG-1000系列軟件

打開PG-1000系列儀器中自帶的控制軟件,找到“Remote/Local”界面中的VXI-11(LAN協(xié)議)Server。默認情況下,VXI-11 Server是開啟的,意味著PG1000系列儀器可以接收來自Client-PC的SCPI命令。
當PG-1000系列儀器接收SCPI命令時,PG-1000系列軟件界面會根據(jù)SCPI命令做出相應的變化(例如,參數(shù)設置等)。
注意:不能在本地PC(即PG-1000系列儀器本身中的PC系統(tǒng))中通過SCPI命令控制PG-1000系列儀器。
若VXI-11 Server被關閉,SCPI命令通信將會失敗。
3. 配置系統(tǒng)(使用NI MAX)
使用NI MAX進行如下配置:
1.        使用LAN線纜連接儀器與Client-PC。
2.        在Client-PC中安裝NI VISA與NI MAX。
3.        打開Client-PC中的NI MAX。點擊“Add Network Device ”——“VISA TCP/IP Resource…”。





4.        選擇“Auto-detect of LAN Instrument”,并點擊“Next”。

5.        面板將會顯示在LAN網(wǎng)絡中搜索到的儀器,選擇PG-1000系列儀器,并點擊“Next”。

6.        輸入“Alias”(此步非必須,可省略),并點擊“Next”。

7.        點擊“Finish”。

8.        PG-1000儀器資源將會在“Network Devices”列表中顯示。

9.        現(xiàn)在,可以使用NI Visa Test Panel或AT Instrument Communicator(軟件的獲取下載,參考“PG-1000系列 SDK”小節(jié)的第3步;軟件的使用,參考下節(jié)“使用AT Instrument Communicator調(diào)試系統(tǒng)”)發(fā)送SCPI命令至PG-1000。

4. 調(diào)試系統(tǒng)(使用AT Instrument Communicator)

VXI-11(LAN協(xié)議)Server可以為在同一LAN網(wǎng)絡下的PG-1000儀器與Client-PC提供軟件接口。
AT Instrument Communicator軟件需安裝在Client-PC中,且Client-PC中需安裝NI VISA。
通過以下步驟,操控Client-PC中AT Instrument Communicator軟件實現(xiàn)對PG-1000儀器的控制:
1.        在Client-PC中安裝AT Instrument Communicator軟件。
2.        在“Device”列表中選擇PG-1000系列儀器。
3.        點擊“Connect”按鈕。
4.        若連接成功,“Command”復選框內(nèi)的“Write”、“Read”等按鈕將會可選(非灰色)
5.        在“Command”文本框內(nèi)輸入*IDN?并點擊“Write”按鈕。
6.        點擊“Query”按鈕。
7.        在“Event Logger”列表中,PG-1000系列儀器會顯示返回值,例如:
ACTIVE TECHNOLOGIES, AT-PULSE-RIDER PG1072 00000001,SCPI 99.0, SV 1.0.0 where 00000001 is the serialnumber, SCPI 99.0 is the SCPI command version and SV 1.0.0 is the software version.
8.        TXT命令腳本(script)文件包括一系列SCPI命令(每行一條命令),用戶可以發(fā)送TXT命令腳本文件。點擊“File”—“Open”打開加載TXT命令腳本文件對話框。
9.        參考《Pulse Rider PG-1000 programmer manual》了解詳細的SCPI命令語法、語句。
5. 例程/范例
PG-1000系列SDK中包含由很多種語言編寫的例程,例如LabVIEW、Microsoft Visual C++與Microsoft C# .NE語言。
例程可以在安裝了NI VISA并兼容Microsoft Windows®的PC上運行。
NI VISA是National Instruments公司提供的VISA I/O標準。NI VISA包括軟件庫、交互式工具(例如, NI I/O Trace與VISA交互式控制)、配置程序等。
在軟件中使用NI VISA編寫的儀器驅(qū)動,可以處理軟件應用程序與硬件儀器之間的通信。
可下載并安裝NI VISA。
例程假設系統(tǒng)已經(jīng)識別PG-1000系列儀器的資源名稱(resource name),即IP地址或主機名稱,可參考前文“配置系統(tǒng)”小節(jié)了解資源名稱(resource name)。
5.1 LabVIEW
LabVIEW例程要求最低使用LabView 2013 64 bit版本,可在…\LabView 2013 Examples\AT-PULSE-RIDER-PG1000 Series文件夾內(nèi)找到LabVIEW工程。

LabVIEW工程中包含一些VI用于控制儀器的基礎特性,還包含有三個例程。
雙擊GenerateSinglePulse.vi,本例程可以連續(xù)模式生成單脈沖。在運行VI之前,需要選擇“VISA resource name”。
用戶可以更改脈寬、延時、高電平、低電平和其他輸出參數(shù)。
運行VI開始生成輸出脈沖,點擊“Stop”按鈕控件停止PG-1000系列脈沖發(fā)生器。

5.2 Microsoft C#
可以在…\VS2015 Examples\PulseRiderCSharp文件夾內(nèi)找到C++例程,需要安裝Microsoft Visual Studio 2015打開例程。

用戶需要編譯并運行例程;在Form中需要輸入“Instrument Address”并點擊“Connect”按鈕建立連接。
若成功連接,儀器會在“Server Answer”文本框內(nèi)顯示*IDN?命令的返回值。

點擊“Generate Pulse”按鈕發(fā)送SCPI命令至PG-1000系列儀器,儀器將會以連續(xù)模式生成輸出單脈沖。
private void btnGeneratePulse_Click(object sender, EventArgs e)
        {
            // Reset to default
            tbAnswer.Text = vs.SendTo(sInstrumentAddress, "*RST");
            // Set the channel parameters
            tbAnswer.Text = vs.SendTo(sInstrumentAddress, "SOURce1:VOLT:HIGH 1.5");
            tbAnswer.Text = vs.SendTo(sInstrumentAddress, "SOURce1:VOLTOW -1.5");
            tbAnswer.Text = vs.SendTo(sInstrumentAddress, "SOURce2:VOLT:HIGH 2");
            tbAnswer.Text = vs.SendTo(sInstrumentAddress, "SOURce2:VOLTOW -2");
            // Set the pulse parameters
            tbAnswer.Text = vs.SendTo(sInstrumentAddress, "SOURce1ULSe1:WIDth 50 ns");
            tbAnswer.Text = vs.SendTo(sInstrumentAddress, "SOURce1ULSe1ELay 0");
            tbAnswer.Text = vs.SendTo(sInstrumentAddress, "SOURce2ULSe1:WIDth 50 ns");
            tbAnswer.Text = vs.SendTo(sInstrumentAddress, "SOUrce2ULSe1ELay 50 ns");
            // Set the pulse mode
            tbAnswer.Text = vs.SendTo(sInstrumentAddress, "OUTPut1ULSe:MODe SINgle");
            tbAnswer.Text = vs.SendTo(sInstrumentAddress, "OUTPut2ULSe:MODe SINgle");
            // Turn On the channels
            tbAnswer.Text = vs.SendTo(sInstrumentAddress, "OUTPut1 ON");
            tbAnswer.Text = vs.SendTo(sInstrumentAddress, "OUTPut2 ON");
            // Set the trigger mode and arm the instrument
            tbAnswer.Text = vs.SendTo(sInstrumentAddress, "TRIGger:MODE CONTinuous");
            tbAnswer.Text = vs.SendTo(sInstrumentAddress, "PULSEGENControl:START");
            // Send the trigger
            tbAnswer.Text = vs.SendTo(sInstrumentAddress, "*TRG");
        }
點擊“ Load Script…”按鈕可加載SCPI命令TXT腳本文件;在工程目錄文件夾內(nèi)有三個腳本文件:GenerateSinglePulse.txt、GenerateMultiplePulse.txt、GeneratePulseTriggerIN.txt。
5.3 Microsoft C++
可以在…\VS2015 Examples\PulseRiderMSVC\TCPIP文件夾內(nèi)找到C++例程,例程是使用 Microsoft® Visual C++語言編寫的。
/*********************************************************************/
/* This example demonstrates opening a simple TCPIP connection and   */
/* implements a single pulse generation in Continuous Mode.                         */
/*                                                                   */
/* The general flow of the code is                                   */
/*      Open Resource Manager                                        */
/*      Open a session to the TCP/IP site at NI                      */
/*      Perform write/read, and check properties                     */
/*      Close all VISA Sessions                                      */
/*********************************************************************/

#include "visa.h"

#include
#include
#include

static char outputBuffer[VI_FIND_BUFLEN];
static ViSession defaultRM, instr;
static ViStatus status;
static ViUInt32 count;
static char acBuffer[10000000] = "";   
static unsigned int u32Timeout = 20000; //timeout value in milliseconds

static const char acInstrument[] = "TCPIP::192.168.0.6::INSTR"; // instrument address

ViStatus VisaWrite(std::string sInput)
{
        printf("viWrite - %s \n", sInput.c_str());

        status = viWrite (instr, (ViBuf)sInput.c_str(), sInput.length(), &count);

        if (status < VI_SUCCESS)
        {
                viStatusDesc(instr, status, outputBuffer);
                printf("viWrite failed with error code %x - %s\n", status, outputBuffer);
                viClose(defaultRM);
                exit (EXIT_FAILURE);
        }       

        // In case of query command, retrieve the output string
        memset(outputBuffer, 0, sizeof(outputBuffer));

        status = viRead (instr, (ViBuf)outputBuffer, sizeof(outputBuffer), &count);

        if (status < VI_SUCCESS)
        {
                viStatusDesc(instr, status, outputBuffer);
                printf("viRead failed with error code %x - %s\n",status, outputBuffer);
                viClose(defaultRM);
                exit (EXIT_FAILURE);
        }

        outputBuffer[strlen(outputBuffer)-1] = 0;

        if(strlen(outputBuffer) > 0)
        {
                printf("The server response is:\n %s\n\n",outputBuffer);
        }

        return status;
}

int main()
{
        int iIndex = 0;
        FILE* pFile = NULL;
        ViFindList objFindList;

        /* First we will need to open the default resource manager. */
        status = viOpenDefaultRM (&defaultRM);
        if (status < VI_SUCCESS)
        {
                printf("Could not open a session to the VISA Resource Manager!\n");
                exit (EXIT_FAILURE);
        }  

        status = viFindRsrc (defaultRM, "?*INSTR", &objFindList, &count, outputBuffer);
        if (status < VI_SUCCESS)
        {
                viStatusDesc(instr, status, outputBuffer);
                printf("viFindRsrc failed with error code %x - %s\n", status, outputBuffer);
                exit (EXIT_FAILURE);
        }  

        printf("viFindRsrc - %s\n", outputBuffer);

        /* Now we will open a session via TCP/IP */
        status = viOpen (defaultRM, (ViRsrc) acInstrument, VI_NULL, u32Timeout, &instr);
        if (status < VI_SUCCESS)
        {
                printf ("An error occurred opening the session to %s\n", acInstrument);
                viClose(defaultRM);
                exit (EXIT_FAILURE);
        }

        // Set the timeout attribute
        viSetAttribute (instr, VI_ATTR_TMO_VALUE, u32Timeout);

        //Identify and reset the instrument
        VisaWrite("*IDN?");
        VisaWrite("*RST");
        //Set the Channel Parameters
        VisaWrite("SOURce1ERiod 600 ns");
        VisaWrite("SOURce2ERiod 600 ns");
        VisaWrite("SOURce1:VOLT:HIGH 1");
        VisaWrite("SOURce1:VOLTOW -1");
        VisaWrite("SOURce2:VOLT:HIGH 0.5");
        VisaWrite("SOURce2:VOLTOW -0.5");
        // Set the Pulse Parameters
        VisaWrite("SOURce1ULSe1:WIDth 100 ns");
        VisaWrite("SOURce2ULSe1:WIDth 20 ns");
        // Turn On the Outputs
        VisaWrite("OUTPut1 ON");
        VisaWrite("OUTPut2 ON");
        // Set the Pulse Mode
        VisaWrite("SOURce1:PULSe:MODE SINGLE");
        // Set the Trigger Mode
        VisaWrite("TRIGger:MODE CONTinuous");
        // Arm the instrument
        VisaWrite("PULSEGENControl:START");
        // Start the generation
        VisaWrite("*TRG");

        status = viClose (instr);
        status = viClose (defaultRM);
        printf ("\nHit enter to continue.");
        fflush(stdin);
        getchar();

        return 0;  
}



















本文地址:http://www.54549.cn/thread-546584-1-1.html     【打印本頁】

本站部分文章為轉(zhuǎn)載或網(wǎng)友發(fā)布,目的在于傳遞和分享信息,并不代表本網(wǎng)贊同其觀點和對其真實性負責;文章版權(quán)歸原作者及原出處所有,如涉及作品內(nèi)容、版權(quán)和其它問題,我們將根據(jù)著作權(quán)人的要求,第一時間更正或刪除。
您需要登錄后才可以發(fā)表評論 登錄 | 立即注冊

相關視頻

關于我們  -  服務條款  -  使用指南  -  站點地圖  -  友情鏈接  -  聯(lián)系我們
電子工程網(wǎng) © 版權(quán)所有   京ICP備16069177號 | 京公網(wǎng)安備11010502021702
快速回復 返回頂部 返回列表