DigilentWaveForms.jl

A Julia interface to the Digilent WaveForms SDK
Author IanButterworth
Popularity
3 Stars
Updated Last
2 Years Ago
Started In
October 2019

DigilentWaveForms.jl

Work in progress. Not useful yet.

A Julia interface to the Digilent WaveForms SDK, to interact with Digilent devices:

  • Analog Discovery (Legacy) [untested]
  • Analog Discovery 2
  • Analog Discovery 2 - NI Edition [untested]
  • Digital Discovery [untested]
  • Electronics Explore [untested]

Build Status Codecov Coveralls

Installation

N.B. Only Linux and MacOS currently supported.

  1. Install Digilent Adept 2: https://reference.digilentinc.com/reference/software/adept/start

  2. Install Digilent WaveForms SDK: https://reference.digilentinc.com/reference/software/waveforms/waveforms-3/start

]add https://github.com/ianshmean/DigilentWaveForms.jl

Basic Usage

using DigilentWaveForms
devices = devicelist()
dev = devices[1]

Assorted functions:

using DigilentWaveForms
dev = devicelist()[1]
DigilentWaveForms.open!(dev)

DigilentWaveForms.AnalogIOEnable!(dev)
DigilentWaveForms.enablePositivePowerSupply!(dev)
DigilentWaveForms.setPositivePowerSupply!(dev, 4)
for x in 1:5
    for i in 2.0:0.01:4.5
        DigilentWaveForms.setPositivePowerSupply!(dev, i)
        sleep(0.01)
    end
end


DigilentWaveForms.AnalogOutChannelCount(dev)

DigilentWaveForms.AnalogOutEnableChannel!(dev, 0)
DigilentWaveForms.AnalogOutEnableChannel!(dev, 1)
DigilentWaveForms.AnalogOutDCMode!(dev, 0)
DigilentWaveForms.AnalogOutDCMode!(dev, 1)
DigilentWaveForms.AnalogOutStart!(dev, 0)
DigilentWaveForms.AnalogOutStart!(dev, 1)

for i in -5:0.1:5, j in -5:0.1:5
    DigilentWaveForms.AnalogOutDCVal!(dev, 0, i)
    DigilentWaveForms.AnalogOutDCVal!(dev, 1, j)
    sleep(0.01)
end

# Loop through enabling/disabling DigitalIO pins 0 and 1
for i in 1:10
    DigilentWaveForms.DigitalOutSet!(dev, 1, true)
    wait(Timer(0.01))
    DigilentWaveForms.DigitalOutSet!(dev, 1, false)
    wait(Timer(0.01))
    DigilentWaveForms.DigitalOutSet!(dev, 0, true)
    wait(Timer(0.01))
    DigilentWaveForms.DigitalOutSet!(dev, 0, false)
    wait(Timer(0.01))
end

DigilentWaveForms.close!(dev)

Developer Notes

To generate wrappers run gen/wrap.jl

Known issues

  • open(dev) returns false if device is open by the current thread