• Content Count

  • Joined

  • Last visited

Reputation Activity

  1. Like
    spri reacted to attila in synchronization issues at certain frequences with AnalogDiscovery2 using SDK on Digital Outputs   
    Hi @spri
    The drift is cause by the resulting dividers, like:
    100e6Hz/30/100Hz ~= 33M333 ~= 30.(00030) Hz
    100e6Hz/60/100Hz ~= 16M666 ~= 60.00240 Hz
    You should use for 30Hz division of 33M332, which will be 2x of 16M666. For other frequencies, the divider to have a low common multiple.
    You could also set run-length to longest or common multiple period, like for 30/60Hz:
    dwf.FDwfDigitalOutRunSet(hdwf, c_double(1.0/30))
    dwf.FDwfDigitalOutRepeatSet(hdwf, c_int(0))
  2. Like
    spri reacted to attila in python trouble with funcCustom on AnalogDiscovery2   
    Hi @spri
    Using the channels in master mode/synchronized, configured with -1, these will will be in the same state at the same time. You won't have different wait-run time.
    The previous WF application screenshot translates to WF SDK code like:
    dwf.FDwfAnalogOutNodeEnableSet(hdwf, c_int(0), AnalogOutNodeCarrier, c_bool(True)) dwf.FDwfAnalogOutNodeEnableSet(hdwf, c_int(1), AnalogOutNodeCarrier, c_bool(True)) dwf.FDwfAnalogOutTriggerSourceSet(hdwf, c_int(-1), trigsrcExternal1) dwf.FDwfAnalogOutRepeatSet(hdwf, c_int(-1), c_int(0)) # infinite repeat dwf.FDwfAnalogOutRepeatTriggerSet(hdwf, c_int(-1), c_int(1)) # wait for trigger event in each cycle dwf.FDwfAnalogOutIdleSet(hdwf, c_int(-1), c_int(1)) # idle output offset dwf.FDwfAnalogOutWaitSet(hdwf, c_int(0), c_double(0)) # start immediately dwf.FDwfAnalogOutWaitSet(hdwf, c_int(1), c_double(sDelay)) # wait after trigger dwf.FDwfAnalogOutRunSet(hdwf, c_int(0), c_double(sTotal)) # run time dwf.FDwfAnalogOutRunSet(hdwf, c_int(1), c_double(sTotal-sDelay)) # channels will stop at the same time dwf.FDwfAnalogOutNodeFunctionSet(hdwf, c_int(-1), AnalogOutNodeCarrier, funcSquare) dwf.FDwfAnalogOutNodeFrequencySet(hdwf, c_int(-1), AnalogOutNodeCarrier, c_double(1)) dwf.FDwfAnalogOutNodeAmplitudeSet(hdwf, c_int(-1), AnalogOutNodeCarrier, c_double(5)) dwf.FDwfAnalogOutNodeSymmetrySet(hdwf, c_int(-1), AnalogOutNodeCarrier, c_double(0)) # 0V while running, +5offset -5amplitude dwf.FDwfAnalogOutNodeOffsetSet(hdwf, c_int(-1), AnalogOutNodeCarrier, c_double(5)) # +5V in idle dwf.FDwfAnalogOutConfigure(hdwf, c_int(0), c_bool(True)) dwf.FDwfAnalogOutConfigure(hdwf, c_int(1), c_bool(True))  
  3. Like
    spri reacted to attila in AD + python: how to create a analog DC output voltage   
    Hi @spri
    This will output 3V for xduration after each trigger event.
    self.dwf.FDwfAnalogOutEnableSet(hdwf, c_int(0), c_int(True)) self.dwf.FDwfAnalogOutTriggerSourceSet(hdwf, c_int(0), trigsrcExternal1) self.dwf.FDwfAnalogOutTriggerSlopeSet(hdwf, c_int(0), c_int(1)) # rising edge self.dwf.FDwfAnalogOutRepeatTriggerSet(hdwf, c_int(0), c_bool(True)) # arm after each run cycle, with false it would wait only at start self.dwf.FDwfAnalogOutRepeatSet(hdwf, c_int(0), c_int(0)) # unlimited repeat self.dwf.FDwfAnalogOutRunSet(hdwf, c_int(0), c_double(self.active.xduration)) # set run duration self.dwf.FDwfAnalogOutWaitSet(hdwf, c_int(0), c_double(0)) # no wait self.dwf.FDwfAnalogOutIdleSet(hdwf, c_int(0), c_int(1)) # DwfAnalogOutIdleOffset self.dwf.FDwfAnalogOutOffsetSet(hdwf, c_int(0), c_double(0)) # offset value = 0v self.dwf.FDwfAnalogOutFunctionSet(hdwf, c_int(0), funcSquare) # self.dwf.FDwfAnalogOutSymmetrySet(hdwf, c_int(0), c_double(100)) # 100% duty, only +amplitude while running self.dwf.FDwfAnalogOutAmplitudeSet(hdwf, c_int(0), c_double(3)) # offset + amplitude after trigger = 3v self.dwf.FDwfAnalogOutFrequencySet(hdwf, c_int(0), c_double(1.0/self.active.xduration)) # not really needed here, but it could be used for burst signals print("starting") dwf.FDwfAnalogOutConfigure(hdwf, c_int(0), c_bool(True)) # start analog output #1  
  4. Like
    spri reacted to attila in Function to return remaining wait time when using waitset or trigdelay   
    Hi @spri
    Actually, the FDwfAnalogOutRunStatus returns not only the the remaining run but also the wait time.
    dwf.FDwfAnalogOutRunSet(hdwf, channel, c_double(2)) dwf.FDwfAnalogOutWaitSet(hdwf, channel, c_double(2)) dwf.FDwfAnalogOutRepeatSet(hdwf, channel, c_int(2)) dwf.FDwfAnalogOutConfigure(hdwf, channel, c_bool(True)) for i in range(10): sts = c_byte() sec = c_double() dwf.FDwfAnalogOutStatus(hdwf, channel, byref(sts)) dwf.FDwfAnalogOutRunStatus(hdwf, channel, byref(sec)) print("State: "+str(int(sts.value))+ " time left: "+ str(sec.value)) time.sleep(1) State: 7 time left: 1.99928738 // wait State: 7 time left: 1.00601063 State: 3 time left: 1.99434336 // run State: 3 time left: 0.97901375 State: 7 time left: 1.97874957 // wait State: 7 time left: 0.97872712 State: 3 time left: 1.9787507 // run State: 3 time left: 0.96878297 State: 2 time left: 0.0 // done @JColvin
    The *Get function return the configured value by *Set functions, like if you *Set the sample rate to 60MHz, the *Get will return the actually configured 50MHz, since the device can only do 100MHz, 50MHz, 33.3MHz...1uHz
    The *Status function return the monitorized information.
  5. Like
    spri reacted to attila in WaitSet for individual channels on Discovery2   
    Hi @spri
    The constant is generated specifying zero low/high counts.
    Setting start with low, low-count zero and high to a non-zero, when running after the divider init expires it will change to and remain at high value.

  6. Like
    spri reacted to attila in WaitSet for individual channels on Discovery2   
    Hi @spri
    The digital-out/Patterns controls all the lines a the same time with trigger-wait-run-repeat.
    You could use the FDwfDigitalOutDividerInitSet and FDwfDigitalOutCounterInitSet to have delay between lines like this:

  7. Like
    spri reacted to attila in Waveforms SDK - identification of channels and nodes   
    The AnalogIO provides generic interface for various IOs of different devices.
    The channel/nodes for Analog Discovery 2 are the following:
    0/ positive supply /0 enable/disable /1 voltage setting 1/ negative supply /0 enable/disable /1 voltage setting 2/ USB monoitor /0 voltage reading /1 current reading /2 temperature reading 3/ auxiliary supply /0 voltage reading /1 current reading The channel/nodes relevant to AD2 power supplies are listed in the AnalogIO_AnalogDiscovery2_Power.py example:
    # enable positive supply dwf.FDwfAnalogIOChannelNodeSet(hdwf, c_int(0), c_int(0), c_double(True)) # set voltage to 5 V dwf.FDwfAnalogIOChannelNodeSet(hdwf, c_int(0), c_int(1), c_double(5.0)) # enable negative supply dwf.FDwfAnalogIOChannelNodeSet(hdwf, c_int(1), c_int(0), c_double(True)) # set voltage to -5 V dwf.FDwfAnalogIOChannelNodeSet(hdwf, c_int(1), c_int(1), c_double(-5.0)) # master enable dwf.FDwfAnalogIOEnableSet(hdwf, c_int(True)) for ... #fetch analogIO status from device if dwf.FDwfAnalogIOStatus(hdwf) == 0: break # in case of over-current condition the supplies are disabled dwf.FDwfAnalogIOEnableStatus(hdwf, byref(IsEnabled)) if not IsEnabled: #re-enable supplies print "Restart" dwf.FDwfAnalogIOEnableSet(hdwf, c_int(False)) dwf.FDwfAnalogIOEnableSet(hdwf, c_int(True)) The channel/nodes relevant to AD2 system monitor are listed in the AnalogIO_AnalogDiscovery2_SystemMonitor.py example:
    usbVoltage = c_double() usbCurrent = c_double() auxVoltage = c_double() auxCurrent = c_double() deviceTemperature = c_double() for ... # fetch analog IO status from device if dwf.FDwfAnalogIOStatus(hdwf) == 0 : break; # get system monitor readings dwf.FDwfAnalogIOChannelNodeStatus(hdwf, c_int(2), c_int(0), byref(usbVoltage)) dwf.FDwfAnalogIOChannelNodeStatus(hdwf, c_int(2), c_int(1), byref(usbCurrent)) dwf.FDwfAnalogIOChannelNodeStatus(hdwf, c_int(2), c_int(2), byref(deviceTemperature)) dwf.FDwfAnalogIOChannelNodeStatus(hdwf, c_int(3), c_int(0), byref(auxVoltage)) dwf.FDwfAnalogIOChannelNodeStatus(hdwf, c_int(3), c_int(1), byref(auxCurrent))  
  8. Like
    spri reacted to attila in AD2 - turning power supplies on and off w/ SDK   
    Hi @spri
    See the WaveForms SDK Reference Manual.pdf in C:\Program Files (x86)\Digilent\WaveFormsSDK\

  9. Like
    spri reacted to JColvin in AD2 - turning power supplies on and off w/ SDK   
    Hi @spri,
    I believe this thread addresses your question.
  10. Like
    spri got a reaction from jpeyron in AnalogOut Triggers   
    I configured my program slightly differently so I don't need to do this anymore. Thanks for checking! 
  11. Like
    spri reacted to attila in Erratic behavior on DigitalIO pins on Discovery2   
    Hi @spri
    It looks like you are configuring only DIO-0 line to output pulse.
    The other unconfigured DIO lines, by default are in high impedance and you are seeing these floating lines randomly toggling.
    In case you need you can configure the other DIO lines to output the same signal, like: dwf.FDwfDigitalOut***Set(hdwf, c_int(-1), ...) # -1 enable all lines or configure enabled lines
    or mask the acquisition to see only the DIO-0 line, like:
    rgpy[i] = 1 & rgwSamples[i]