Hi @attila
I manage to create a pulse at 1V8 during 1.1 ms using the Digital Discovery.
I have 1 question that remains :
How can I ouput 5V with the DD? In the Reference manual it's says that it's possible at least to read 5V signals. (Shall I use VIO? how can I address to that PIN ?) For this issue this is what I tried :
"""
DWF Python Example
Author: Digilent, Inc.
Revision: 2020-04-07
Requires:
Python 2.7, 3
"""
from ctypes import *
from dwfconstants import *
import math
import time
import sys
if sys.platform.startswith("win"):
dwf = cdll.dwf
elif sys.platform.startswith("darwin"):
dwf = cdll.LoadLibrary("/Library/Frameworks/dwf.framework/dwf")
else:
dwf = cdll.LoadLibrary("libdwf.so")
version = create_string_buffer(16)
dwf.FDwfGetVersion(version)
print("DWF Version: "+str(version.value))
print("Opening first device")
hdwf = c_int()
dwf.FDwfDeviceOpen(c_int(-1), byref(hdwf))
if hdwf.value == 0:
print("failed to open device")
szerr = create_string_buffer(512)
dwf.FDwfGetLastErrorMsg(szerr)
print(str(szerr.value))
quit()
# the device will only be configured when FDwf###Configure is called
dwf.FDwfDeviceAutoConfigureSet(hdwf, c_int(0))
hzSys = c_double()
dwf.FDwfDigitalOutInternalClockInfo(hdwf, byref(hzSys))
# 1kHz pulse on IO pin 25
dwf.FDwfDigitalOutEnableSet(hdwf, c_int(1), c_int(1)) #GPIO 1 to get PIN 25
# prescaler to 2kHz, SystemFrequency/1kHz/2
#dwf.FDwfDigitalOutDividerSet(hdwf, c_int(0), c_int(int(hzSys.value/1e3/2)))
# 0 tick low, 1 tick high
dwf.FDwfDigitalOutCounterSet(hdwf, c_int(1), c_int(0), c_int(1))
# set 5V digital IO voltage for devices which support
dwf.FDwfDeviceParamSet(hdwf, DwfParamDigitalVoltage, 5000) # mV
dwf.FDwfDigitalOutConfigure(hdwf, c_int(1))
print("Generating output for 10 seconds...")
time.sleep(10)
dwf.FDwfDigitalOutReset(hdwf)
dwf.FDwfDeviceCloseAll()
Unfortunately, I only have a 3V2 output and not a 5V output.
Source : https://digilent.com/reference/test-and-measurement/digital-discovery/reference-manual
Section 9.2. Multi-purpose Digital I/O