Oscilloscope

Commands that provide access to oscilloscope instrument data and functions.

Get Current State


Get the current state of the instrument's channel

Command

  • osc - (Object) - The oscilloscope object.
    • # - (Array<Object>) - An array of command objects to apply to the oscilloscope channel.
      • command - (String) - The Get Current State command: “getCurrentState”

Response

  • osc - (Object) - The oscilloscope object.
    • # - (Array<Object>) - An array of command objects applied to the oscilloscope channel.
      • command - (String) - The Get Current State command: “getCurrentState”
      • statusCode - (Integer) - A numeric value representing the device status. See 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 state of the instrument channel: “armed”, “acquiring”, “idle”, or “triggered”.
      • acqCount: - (Integer) - The channel acquisition count. This value increments with each successful acquisition.
      • actualVOffset - (Integer) - The actual voltage offset used in mV.
      • actualSampleFreq- (Integer) - The actual sample frequency used in mHz.
      • actualGain - (Integer) - The actual gain used.
      • actualBufferSize- (Integer) - The actual buffer size used in samples.
      • triggerDelay- (Integer) - The actual trigger delay used in pS.

Example

Command

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

Response

{
    "osc": {
        "1": [
            {
                "command": "getCurrentState",
                "statusCode": 0,
                "wait": 0,
                "state": "triggered",
                "acqCount": 10,
                "actualVOffset": 0,
                "actualSampleFreq": 1000000,
                "actualGain": 0.25,
                "actualBufferSize": 32000,
                "triggerDelay": 0                
            }
        ]
    }
}


Read


Read data from the device. Data will be returned if the device acqCount is greater or equal to the command acqCount. If the device acqCount is less than the command acqCount the device responds with it's trigger status and optionally a estimated time before a new buffer will be available.

Data is returned in chunked transfer format. The first chunk of data is a JSON object that describes the following chunk of binary data. The binary data type and resolution are defined in the device enumeration and units are in mV. The first byte in the binary data corresponds to the first sample in the buffer (the earliest sample chronologically).

Command

  • # - (ASCII Hexadecimal) - The number of bytes in the chunk in ASCII hexadecimal followed by '\r\n'.
  • osc - (Object) - The oscilloscope object.
    • # - (Array<Object>) - An array of command objects to apply to the oscilloscope channel.
      • command - (String) - The Read command: “read”.

Response

  • osc - (Object) - The oscilloscope object.
  • # - (Array<Object>) - An array of command objects applied to the oscilloscope channel.
    • command - (String) - The Read command: “read”.
    • statusCode - (Integer) - A numeric value representing the device status. See Digilent Instrumentation Protocol Status Codes
    • wait - (Integer) - The number of ms to wait before the device is ready to process another command.
    • binaryOffset - (Integer) - The first byte of the buffer in the binary data chunk.
    • binaryLength - (Integer) - The buffer size in bytes.
    • acqCount - (Integer) - The acquisition count.
    • actualSampleFreq - (Integer) - The actual sample frequency used to generate the data buffer in mHz.
    • pointOfInterest - (Integer) - The sample index of the point of interest in the buffer or -1 if the point of interest is not in the buffer.
    • triggerIndex - (Integer) - The sample index where the trigger occurred in the buffer or -1 if the trigger is not in the buffer.
    • triggerDelay - (Integer) - The time in pS between the point of interest and the trigger. A negative triggerDelay means that the point of interest is before the trigger chronologically.
    • actualVOffset - (Integer) - The voltage offset value used when acquiring the buffer in mV.
    • actualGain - (Decimal) - The gain value used when acquiring the data buffer.

Example:

Command

{  
   "osc":{  
      "1":[  
         {  
            "command":"read",
            "acqCount":101
         }
      ]
   }
}

Response

160\r\n
{
    "osc": {
        "1": [
            {
                "command": "read",
                "statusCode": 0,
                "wait": 0,
                "binaryOffset": 0,
                "binaryLength": 1024,
                "acqCount": 3,
                "actualSampleFreq": 6250000000,
                "pointOfInterest": 256,
                "triggerIndex": 256,
                "triggerDelay": 0
                "actualVOffset": 48,
                "actualGain": 1                
            }
        ]
    }
}\r\n
400\r\n 
<1024 Byte BLOB>
\r\n
0\r\n
\r\n



Set Parameters


Set the specified parameter(s) of the specified oscilloscope channel(s).

Command

  • osc - (Object) - The oscilloscope object.
    • # - (Array<Object>) - An array of command objects to apply to the oscilloscope channel.
      • command - (String) - The Set Parameters command: “setParameters”.
      • bufferSize- (Integer) - The desired buffer size in samples.
      • gain - (Integer) - The desired gain.
      • vOffset - (Integer) - The desired voltage offset in mV.
      • sampleFreq- (Integer) - The desired sample frequency in mHz.
      • triggerDelay- (Integer) - The desired trigger delay in pS.

Response

  • osc - (Object) - The oscilloscope object.
    • # - (Array<Object>) - An array of command objects applied to the oscilloscope channel.
      • command - (String) - The Set Parameters command: “setParameters”
      • statusCode - (Integer) - A numeric value representing the device status. See Digilent Instrumentation Protocol Status Codes
      • actualVOffset - (Integer) - The actual voltage offset used in mV.
      • actualSampleFreq- (Integer) - The actual sample frequency used in mHz.
      • wait - (Integer) - The number of ms to wait before the device is ready to process another command.

Example:

Command

{  
   "osc":{  
      "1":[  
         {  
            "command":"setParameters",
            "bufferSize": 32000,            
            "gain": 0.25,
            "vOffset":3000,
            "sampleFreq": 1000000,            
            "triggerDelay": 100000
         }
      ]
   }
}

Response

{  
   "osc":{  
      "1":[  
         {  
            "command":"setParameters",
            "statusCode":0,
            "actualVOffset":3100,
            "actualSampleFreq": 1000000,
            "wait":0
         }
      ]
   }
}