差别

这里会显示出您选择的修订版和当前版本之间的差别。

到此差别页面的链接

两侧同时换到之前的修订记录 前一修订版
后一修订版
前一修订版
openinstru_protocol [2020/03/21 22:50]
gongyu
openinstru_protocol [2021/02/22 22:02] (当前版本)
gongyusu
行 1: 行 1:
 +## 命令格式
  
-### 波形发生器部分 +---- 
-Commands that provide access to **Arbitrary Waveform Generator** data and functions.+  * 下面的JSON数据已扩展以提高可读性。在传输之前,应将所有JSON缩小(删除空白). 
 +  * 除非另有说明,否则使用HTTP时,所有命令均使用POST方法发送. 
 +  * 所有Digilent Instrumentation协议命令必须是JSON对象或分块传输:​ 
 +    * **JSON对象** 
 +      * 必须以'​{'​字符开头,并以'​}'​字符结尾. 
 +      * 可能后跟一个或多个'​\ r \ n'. 
 +    *  **大块转移** 
 +      * 由一个或多个块组成. 
 +      * 每个块必须以ASCII十六进制格式的块中的字节数开头,后跟一个'​\ r \ n'​,二进制数据和一个'​\ r \ n'. 
 +        * 块长度在块长度和数据之间不包含'​\ r \ n'. 
 +        * 块长度不包含二进制数据后的尾随'​\ r \ n'. 
 +      * 每个分块传输都以零长度的分块终止. 
 +      * Ex. 
 +<​code>​ 
 +6\r\n 
 +chunk1\r\n 
 +8\r\n 
 +somedata\r\n 
 +E\r\n 
 + ​in\r\n\r\nchunks.\r\n 
 +0\r\n 
 +\r\n 
 +</​code>​ 
 + 
 +## 多命令 
 + 
 +---- 
 +可以使用多命令在单个事务中发送多个命令。 
 + 
 +### 举例: 
 +<WRAP group> 
 +<WRAP half column>​ 
 +**Command** 
 +<​code>​ 
 +
 +   "​dc":​{ 
 +      "​1":​[ 
 +         { 
 +            "​command":"​setVoltage",​ 
 +            "​voltage":​3300 
 +         }, 
 +         { 
 +            "​command":"​getVoltage"​ 
 +         } 
 +      ], 
 +      "​2":​[ 
 +         { 
 +            "​command":"​setVoltage",​ 
 +            "​voltage":​5000 
 +         } 
 +      ] 
 +   } 
 +
 +</​code>​ 
 +</​WRAP>​ 
 +<WRAP half column>​**Response**</​WRAP>​ 
 +<​code>​ 
 +
 +   "​dc":​{ 
 +      "​1":​[ 
 +         { 
 +            "​command":"​setVoltage",​ 
 +            "​statusCode":​0,​ 
 +            "​wait":​500 
 +         }, 
 +         { 
 +            "​command":"​getVoltage",​ 
 +            "​statusCode":​0,​ 
 +            "​wait":​100, ​            
 +            "​voltage":​3300 
 +         } 
 +      ], 
 +      "​2":​[ 
 +         { 
 +            "​command":"​setVoltage",​ 
 +            "​statusCode":​0,​ 
 +            "​wait":​500 
 +         } 
 +      ] 
 +   } 
 +
 +</​code>​ 
 +</​WRAP>​ 
 +\\ 
 +\\ 
 + 
 + 
 + 
 + 
 +## 波形发生器部分 
 +提供访问任意波形发生器的数据和功能的命令
  
-#### 获得当前状态+### 获得当前状态
  
 --- ---
 获得仪器通道的当前状态、 获得仪器通道的当前状态、
  
-** 命令 ​** +#### 命令 
-  * ** awg ** - (Object) - The arbitrary waveform generator object.+  * ** awg ** - (Object) - 任意波形发生器的目标.
     * ** # ** - (Array<​Object>​) - An array of command objects to apply to the awg channel.     * ** # ** - (Array<​Object>​) - An array of command objects to apply to the awg channel.
-      * ** command ** - (String) - The Get Current State command: “getCurrentState”+      * ** command ** - (String) - 获取当前状态的命令: “getCurrentState”
  
-** 响应 ​** +#### 响应  
-  * ** awg **  - (Object) - The arbitrary waveform generator object.+  * ** awg **  - (Object) - 任意波形发生器的目标
     * ** # ** - (Array<​Object>​) - An array of command objects applied to the awg channel.     * ** # ** - (Array<​Object>​) - An array of command objects applied to the awg channel.
       * ** command ** - (String) - The Get Current State command: “getCurrentState”       * ** command ** - (String) - The Get Current State command: “getCurrentState”
-      * ** statusCode ** - (Integer) - A numeric value representing the device status.  ​See [[reference/​software/​digilent-instrumentation-protocol/​status-codes]]+      * ** statusCode ** - (Integer) - A numeric value representing the device status.  ​
       * ** wait ** - (Integer) - The number of ms to wait before the device is ready to process another command. ​       * ** wait ** - (Integer) - The number of ms to wait before the device is ready to process another command. ​
       * ** state ** - (String) - The instrument channel state: "​idle"​ or "​running"​.       * ** state ** - (String) - The instrument channel state: "​idle"​ or "​running"​.
行 24: 行 115:
       * ** actualVpp ** - (Integer) - The actual peak-to-peak voltage in mV.       * ** actualVpp ** - (Integer) - The actual peak-to-peak voltage in mV.
       * ** actualVOffset ** - (Integer) - The actual voltage offset in mV.       * ** actualVOffset ** - (Integer) - The actual voltage offset in mV.
 +
  
 #### 例子 #### 例子
行 29: 行 121:
 <WRAP group> <WRAP group>
 <WRAP half column> <WRAP half column>
-**Command**+ 
 +** 命令 ​**
 <​code>​ <​code>​
 { {
行 42: 行 135:
 </​code>​ </​code>​
 </​WRAP>​ </​WRAP>​
-<WRAP half column>​**Response**</​WRAP>​+ 
 +<WRAP half column> ** 响应 ​** </​WRAP>​
 <​code>​ <​code>​
 { {
行 65: 行 159:
  
  
-#### 设置通用波形+### 设置通用波形
  
 ---- ----
-Set the parameters of the arbitrary waveform generator channel(s) to output a regular waveform.+设置AWG的通道参数以输出正常的波形
  
-**Command**+#### 命令
   * **awg** - (Object) - The arbitrary waveform generator object.   * **awg** - (Object) - The arbitrary waveform generator object.
     * **#** - (Array<​Object>​) - An array of command objects to apply to the awg channel.     * **#** - (Array<​Object>​) - An array of command objects to apply to the awg channel.
行 79: 行 173:
       * **vOffset** - (Integer) - The voltage offset in mV.       * **vOffset** - (Integer) - The voltage offset in mV.
  
-**Response**+#### 响应
   * **awg** ​ - (Object) - The arbitrary waveform generator object.   * **awg** ​ - (Object) - The arbitrary waveform generator object.
     * **#** - (Array<​Object>​) - An array of command objects applied to the awg channel.     * **#** - (Array<​Object>​) - An array of command objects applied to the awg channel.
行 113: 行 207:
 </​code>​ </​code>​
 </​WRAP>​ </​WRAP>​
-<WRAP half column>​**Response**</​WRAP>​+ 
 +<WRAP half column> **Response** </​WRAP>​
 <​code>​ <​code>​
 {  ​ {  ​
行 133: 行 228:
 \\ \\  \\ \\ 
  
-#### 运行+### 运行
  
 ---- ----
-Run the arbitrary waveform generator channel(s). 
  
-**Command**+运行AWG通道 
 + 
 +#### 命令
   * **awg** - (Object) - The arbitrary waveform generator object.   * **awg** - (Object) - The arbitrary waveform generator object.
     * **#** - (Array<​Object>​) - An array of command objects to apply to the awg channel.     * **#** - (Array<​Object>​) - An array of command objects to apply to the awg channel.
       * **command** - (String) - The Run command: “run”       * **command** - (String) - The Run command: “run”
  
-**Response**+#### 响应 ​
   * **awg** ​ - (Object) - The arbitrary waveform generator object.   * **awg** ​ - (Object) - The arbitrary waveform generator object.
     * **#** - (Array<​Object>​) - An array of command objects applied to the awg channel.     * **#** - (Array<​Object>​) - An array of command objects applied to the awg channel.
行 168: 行 264:
 </​code>​ </​code>​
 </​WRAP>​ </​WRAP>​
 +
 <WRAP half column>​**Response**</​WRAP>​ <WRAP half column>​**Response**</​WRAP>​
 <​code>​ <​code>​
行 186: 行 283:
 \\ \\
  
-#### 停止+### 停止
  
 ---- ----
-Stop the arbitrary waveform generator channel(s).+停止AWG通道
  
-**Command**+#### 命令
   * **awg** - (Object) - The arbitrary waveform generator object.   * **awg** - (Object) - The arbitrary waveform generator object.
     * **#** - (Array<​Object>​) - An array of command objects to apply to the awg channel.     * **#** - (Array<​Object>​) - An array of command objects to apply to the awg channel.
       * **command** - (String) - The Stop command: “stop”       * **command** - (String) - The Stop command: “stop”
  
-**Response**+#### 响应
   * **awg** ​ - (Object) - The arbitrary waveform generator object.   * **awg** ​ - (Object) - The arbitrary waveform generator object.
     * **#** - (Array<​Object>​) - An array of command objects applied to the awg channel.     * **#** - (Array<​Object>​) - An array of command objects applied to the awg channel.
行 221: 行 318:
 </​code>​ </​code>​
 </​WRAP>​ </​WRAP>​
 +
 <WRAP half column>​**Response**</​WRAP>​ <WRAP half column>​**Response**</​WRAP>​
 <​code>​ <​code>​
行 238: 行 336:
 \\ \\
 \\ \\
 +
 +
 +## 直流电压
 +提供访问直流电压数据和函数的命令
 +
 +### 获取当前状态
 +
 +----
 +Get the current state of the instrument'​s channel
 +
 +#### 命令
 +  * **dc** - (Object) - The DC power supply object.
 +    * **#** - (Array<​Object>​) - An array of command objects to apply to the DC power supply channel.
 +      * **command** - (String) - The Get Current State command: “getCurrentState”
 +
 +#### 响应
 +  * **gpio** - (Object) - The DC power supply object.
 +    * **#** - (Array<​Object>​) - An array of command objects applied to the DC power supply ​ channel.
 +      * **command** - (String) - The Get Current State command: “getCurrentState”
 +      * **statusCode** - (Integer) - A numeric value representing the device status. ​ See [[reference/​software/​digilent-instrumentation-protocol/​status-codes]]
 +      * **wait** - (Integer) - The number of ms to wait before the device is ready to process another command. ​  
 +      * **state** - (String) - The current state of the channel: "​idle"​ or "​running"​.
 +      * **voltage** - (Integer) - The current measured value of the channel in mV.
 +
 +  ​
 +#### 举例
 +
 +<WRAP group>
 +<WRAP half column>
 +**命令**
 +<​code>​
 +{
 +    "​dc":​ {
 +        "​1":​ [
 +            {
 +                "​command":"​getCurrentState"​
 +            }
 +        ]
 +    }
 +}
 +</​code>​
 +</​WRAP>​
 +<WRAP half column>​**响应**</​WRAP>​
 +<​code>​
 +{
 +    "​dc":​ {
 +        "​1":​ [
 +            {
 +                "​command":​ "​getCurrentState",​
 +                "​statusCode":​ 0,
 +                "​wait":​ 0,
 +                "​state":​ "​idle",​
 +                "​voltage":​ 3300                ​
 +            }
 +        ]
 +    }
 +}
 +</​code>​
 +</​WRAP>​
 +\\
 +
 +### 获取电压值
 +
 +----
 +
 +Get the output voltage(s) of the specified DC power supply channel(s).
 +
 +#### 命令
 +  * **dc** - (Object) - The DC power supply object.
 +    * **#** - (Array<​Object>​) - An array of command objects to apply to the DC power supply channel.
 +      * **command** - (String) - The Get Voltage command: “getVoltage”
 +
 +#### 响应
 +  * **gpio** - (Object) - The DC power supply object.
 +    * **#** - (Array<​Object>​) - An array of command objects applied to the DC power supply ​ channel.
 +      * **command** - (String) - The Get Voltage command: “getVoltage”
 +      * **statusCode** - (Integer) - A numeric value representing the device status. ​ See [[reference/​software/​digilent-instrumentation-protocol/​status-codes]]
 +      * **wait** - (Integer) - The number of ms to wait before the device is ready to process another command. ​  
 +      * **voltage** ​ - (Integer) - The current measured value of the channel in mV.
 +
 +#### 举例
 +
 +<WRAP group>
 +<WRAP half column>
 +**命令**
 +<​code>​
 +{
 +   "​dc":​{
 +      "​1":​[
 +         {
 +            "​command":"​getVoltage"​
 +         }
 +      ]
 +   }
 +}
 +</​code>​
 +</​WRAP>​
 +<WRAP half column>​**Response**</​WRAP>​
 +<​code>​
 +{
 +   "​dc":​{
 +      "​1":​[
 +         {
 +            "​command":"​getVoltage",​
 +            "​statusCode":​0,​
 +            "​wait":​100,​
 +            "​voltage":​3300
 +         }
 +      ]      ​
 +   }
 +}
 +</​code>​
 +</​WRAP>​
 +\\
 +\\
 +
 +### 设置电压
 +
 +----
 +
 +Set the output voltage(s) of the specified DC power supply channel(s).
 +
 +#### 命令
 +  * **dc** - (Object) - The DC power supply object.
 +    * **#** - (Array<​Object>​) - An array of command objects to apply to the DC power supply channel.
 +      * **command** - (String) - The Set Current State command: "​setCurrentState”
 +      * **voltage** - (Integer) - The desired voltage in mV.
 +
 +#### 响应
 +  * **gpio** - (Object) - The DC power supply object.
 +    * **#** - (Array<​Object>​) - An array of command objects applied to the DC power supply ​ channel.
 +      * **command** - (String) - The Set Current State command: "​setCurrentState”
 +      * **statusCode** - (Integer) - A numeric value representing the device status. ​ See [[reference/​software/​digilent-instrumentation-protocol/​status-codes]]
 +      * **wait** - (Integer) - The number of ms to wait before the device is ready to process another command. ​  
 +
 +#### 举例:
 +<WRAP group>
 +<WRAP half column>
 +**Command**
 +<​code>​
 +{
 +   "​dc":​{
 +      "​1":​[
 +         {
 +            "​command":"​setVoltage",​
 +            "​voltage":​3300
 +         }
 +      ]
 +   }
 +}
 +</​code>​
 +</​WRAP>​
 +<WRAP half column>​**Response**</​WRAP>​
 +<​code>​
 +{
 +   "​dc":​{
 +      "​1":​[
 +         {
 +            "​command":"​setVoltage",​
 +            "​statusCode":​0,​
 +            "​wait":​500
 +         }
 +      ]
 +   }
 +}
 +</​code>​
 +</​WRAP>​
 +\\
 +\\
 +