How Do I Use Multiple Analog Discovery 2’s in WaveForms?

Adding More Channels in WaveForms

Let’s assume you have an Analog Discovery 2 and love it, but your setup needs more than two oscilloscope channels and the more powerful ADP3450 with FOUR oscilloscope channels would be a bit overkill, like driving a rocket ship to the grocery store. Wouldn’t it be great if a single instance of WaveForms could manage multiple devices to result in the equivalent of a multi-channel scope/generator?  Luckily, the advanced triggering options in WaveForms will let you synchronize multiple Digilent Test and Measurement devices so that they can capture, or provide, data simultaneously. Learn more by visiting the discussion on the Digilent Forum.

Using the Script Editor

  1. Slave application/device saves the data to a fileConnecting multiple devices
    {
    var f = File("1.bin")
    f.writeDouble(Scope.Channel1.alldata)
    }
    {
    var f = File("2.bin")
    f.writeDouble(Scope.Channel2.alldata)
    }
  2. Master application/device loads the data to ref1/ref2Connecting multiple devices
    • {
      // update time information, restore offset/range
      var r = Scope.Ref1.Range.value
      var o = Scope.Ref1.Offset.value
      Scope.Ref1.Clone(Scope.Channel1) 
      Scope.Ref1.Range.value = r
      Scope.Ref1.Offset.value = o
      var f = File("1.bin")
      // we might have to wait for the other process to save the data
      for(var i = 0; i < 1000 && !f.exist(); i++);
      // read data and set it to reference channel
      var rg = f.readDouble()
      f.deleteFile()
      Scope.Ref1.data = rg
      }
      {
      var r = Scope.Ref2.Range.value
      var o = Scope.Ref2.Offset.value
      Scope.Ref2.Clone(Scope.Channel2) 
      Scope.Ref2.Range.value = r
      Scope.Ref2.Offset.value = o
      var f = File("2.bin")
      for(var i = 0; i < 1000 && !f.exist(); i++);
      var rg = f.readDouble()
      f.deleteFile()
      Scope.Ref2.data = rg
      }

*Important note* For each instance of the time base or position changing, the Ref channel needs to be updated. You can accomplish this by using the Clone function (below):

// update time information, restore offset/range
var r = Scope.Ref1.Range.value
var o = Scope.Ref1.Offset.value
Scope.Ref1.Clone(Scope.Channel1) 
Scope.Ref1.Range.value = r
Scope.Ref1.Offset.value = o

Author

Be the 1st to vote.

Leave a Reply

Your email address will not be published. Required fields are marked *