• 下面的JSON数据已扩展以提高可读性。在传输之前,应将所有JSON缩小(删除空白).
  • 除非另有说明,否则使用HTTP时,所有命令均使用POST方法发送.
  • 所有Digilent Instrumentation协议命令必须是JSON对象或分块传输:
    • JSON对象
      • 必须以'{'字符开头,并以'}'字符结尾.
      • 可能后跟一个或多个'\ r \ n'.
    • 大块转移
      • 由一个或多个块组成.
      • 每个块必须以ASCII十六进制格式的块中的字节数开头,后跟一个'\ r \ n',二进制数据和一个'\ r \ n'.
        • 块长度在块长度和数据之间不包含'\ r \ n'.
        • 块长度不包含二进制数据后的尾随'\ r \ n'.
      • 每个分块传输都以零长度的分块终止.
      • Ex.
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

可以使用多命令在单个事务中发送多个命令。

Command

{
   "dc":{
      "1":[
         {
            "command":"setVoltage",
            "voltage":3300
         },
         {
            "command":"getVoltage"
         }
      ],
      "2":[
         {
            "command":"setVoltage",
            "voltage":5000
         }
      ]
   }
}

Response

{
   "dc":{
      "1":[
         {
            "command":"setVoltage",
            "statusCode":0,
            "wait":500
         },
         {
            "command":"getVoltage",
            "statusCode":0,
            "wait":100,            
            "voltage":3300
         }
      ],
      "2":[
         {
            "command":"setVoltage",
            "statusCode":0,
            "wait":500
         }
      ]
   }
}



提供访问任意波形发生器的数据和功能的命令


获得仪器通道的当前状态、

命令

  • awg - (Object) - 任意波形发生器的目标.
    • # - (Array<Object>) - An array of command objects to apply to the awg channel.
      • command - (String) - 获取当前状态的命令: “getCurrentState”

响应

  • awg - (Object) - 任意波形发生器的目标
    • # - (Array<Object>) - An array of command objects applied to the awg channel.
      • command - (String) - The Get Current State command: “getCurrentState”
      • 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. 
          * ** state ** - (String) - The instrument channel state: "idle" or "running".
          * ** waveType ** - (String) - The waveform type: "sine", "square", "triangle", "dc", "sawtooth", "arbitrary", or "none".
          * ** actualSignalFreq ** - (Integer) -  The actual waveform frequency in mHz.
          * ** actualVpp ** - (Integer) - The actual peak-to-peak voltage in mV.
          * ** actualVOffset ** - (Integer) - The actual voltage offset in mV.

例子

命令

{
    "awg": {
        "1": [
            {
                "command": "getCurrentState"
            }
        ]
    }
}

响应

{
    "awg": {
        "1": [
            {
                "command": "getCurrentState",
                "statusCode": 0,                
                "wait": 0,
                "state": "running",
                "waveType": "sine",
                "actualSignalFreq": 1000000,
                "actualVpp": 3000,
                "actualVOffset": 0
            }
        ]
    }
}



设置AWG的通道参数以输出正常的波形

命令

  • awg - (Object) - The arbitrary waveform generator object.
    • # - (Array<Object>) - An array of command objects to apply to the awg channel.
      • command - (String) - The Set Regular Waveform command: “setRegularWaveform”
      • signalType - (String) - The waveform type: “sine”, “square”, “triangle”, “dc”, “sawtooth”, “arbitrary”, or “none”.
      • signalFreq - (Integer) - The signal frequency in mHz.
      • vpp - (Integer) - The peak-to-peak voltage in mV.
      • vOffset - (Integer) - The voltage offset in mV.

响应

  • awg - (Object) - The arbitrary waveform generator object.
    • # - (Array<Object>) - An array of command objects applied to the awg channel.
      • command - (String) - The Set Regular Waveform command: “setRegularWaveform”
      • 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.
          * **actualSignalFreq** - (Integer) -  The actual waveform frequency in mHz.
          * **actualVpp** - (Integer) - The actual peak-to-peak voltage in mV.
          * **actualVOffset** - (Integer) - The actual voltage offset in mV.

举例(波形)


Command

{
   "awg":{
      "1":[
         {
            "command":"setRegularWaveform",
            "signalType":"sine",
            "signalFreq":1000000,
            "vpp":3000,
            "vOffset":0 
         }
      ]
   }
}

Response

{  
   "awg":{  
      "1":[  
         {  
            "command":"setRegularWaveform",
            "statusCode":0,            
            "wait":0,
            "actualSignalFreq": 1000000,
            "actualVpp": 3000,
            "actualVOffset":0
         }
      ]
   }
}




运行AWG通道

命令

  • awg - (Object) - The arbitrary waveform generator object.
    • # - (Array<Object>) - An array of command objects to apply to the awg channel.
      • command - (String) - The Run command: “run”

响应

  • awg - (Object) - The arbitrary waveform generator object.
    • # - (Array<Object>) - An array of command objects applied to the awg channel.

举例:

Command

{
   "awg":{
      "1":[
         {
            "command":"run"
         }
      ]
   }
}

Response

{
   "awg":{
      "1":[
         {
            "command":"run",
            "statusCode":0,
            "wait":0
         }
      ]
   }
}




停止AWG通道

命令

  • awg - (Object) - The arbitrary waveform generator object.
    • # - (Array<Object>) - An array of command objects to apply to the awg channel.
      • command - (String) - The Stop command: “stop”

响应

  • awg - (Object) - The arbitrary waveform generator object.
    • # - (Array<Object>) - An array of command objects applied to the awg channel.

举例:

Command

{
   "awg":{
      "1":[
         {
            "command":"stop"
         }
      ]
   }
}

Response

{
   "awg":{
      "1":[
         {
            "command":"stop",
            "statusCode":0,
            "wait":0
         }
      ]
   }
}



提供访问直流电压数据和函数的命令


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.
        
          

        #### 举例

命令

{
    "dc": {
        "1": [
            {
                "command":"getCurrentState"
            }
        ]
    }
}

响应

{
    "dc": {
        "1": [
            {
                "command": "getCurrentState",
                "statusCode": 0,
                "wait": 0,
                "state": "idle",
                "voltage": 3300                
            }
        ]
    }
}



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.

#### 举例

命令

{
   "dc":{
      "1":[
         {
            "command":"getVoltage"
         }
      ]
   }
}

Response

{
   "dc":{
      "1":[
         {
            "command":"getVoltage",
            "statusCode":0,
            "wait":100,
            "voltage":3300
         }
      ]      
   }
}




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

{
   "dc":{
      "1":[
         {
            "command":"setVoltage",
            "voltage":3300
         }
      ]
   }
}

Response

{
   "dc":{
      "1":[
         {
            "command":"setVoltage",
            "statusCode":0,
            "wait":500
         }
      ]
   }
}