HoWei Posted August 23, 2019 Share Posted August 23, 2019 In the SDK manual (4th April 2019) on page 83 the command "FDwfDigitalOutModeSet" is mentioned. I did not find any documentation of this command in the docu, nor did I find any example using this command. I want to set the DIO output mode to "PP" - like I can do it within the Waveforms application. Can you please provide information how to do it - perferrably in python ? Link to comment Share on other sites More sharing options...
HoWei Posted August 23, 2019 Author Share Posted August 23, 2019 Seems like the correct command is #Set output mode to push pull dwf.FDwfDigitalOutOutputSet(hdwf, c_int(4), DwfDigitalOutOutputPushPull) I found it by luck in one of the forum discussions. Link to comment Share on other sites More sharing options...
attila Posted August 23, 2019 Share Posted August 23, 2019 Hi @HoWei The WF application uses a kind of 'pulse' configuration to generate clock, like it is in the DigitalOut_Duty.py example See the SDK/ samples/ py/ DigitalOut_Duty.py Phase.py Pins.py Pulse.py iChannel = 0 hzFreq = 1000 # PWM freq Hz prcDuty = 1.23 # duty % hzSys = c_double() maxCnt = c_uint() dwf.FDwfDigitalOutInternalClockInfo(hdwf, byref(hzSys)) dwf.FDwfDigitalOutCounterInfo(hdwf, c_int(0), 0, byref(maxCnt)) # for low frequencies use divider as pre-scaler to satisfy counter limitation of 32k cDiv = int(math.ceil(hzSys.value/hzFreq/maxCnt.value)) # count steps to generate the given frequency cPulse = int(round(hzSys.value/hzFreq/cDiv)) # duty cHigh = int(cPulse*prcDuty/100) cLow = int(cPulse-cHigh) print("Generate: "+str(hzSys.value/cPulse/cDiv)+"Hz duty: "+str(100.0*cHigh/cPulse)+"% divider: "+str(cDiv)) dwf.FDwfDigitalOutEnableSet(hdwf, c_int(iChannel), c_int(1)) dwf.FDwfDigitalOutTypeSet(hdwf, c_int(iChannel), c_int(0)) # DwfDigitalOutTypePulse dwf.FDwfDigitalOutDividerSet(hdwf, c_int(iChannel), c_int(cDiv)) # max 2147483649, for counter limitation or custom sample rate dwf.FDwfDigitalOutCounterSet(hdwf, c_int(iChannel), c_int(cLow), c_int(cHigh)) # max 32768 dwf.FDwfDigitalOutConfigure(hdwf, c_int(1)) Link to comment Share on other sites More sharing options...
Question
HoWei
In the SDK manual (4th April 2019) on page 83 the command "FDwfDigitalOutModeSet" is mentioned.
I did not find any documentation of this command in the docu, nor did I find any example using this command.
I want to set the DIO output mode to "PP" - like I can do it within the Waveforms application.
Can you please provide information how to do it - perferrably in python ?
Link to comment
Share on other sites
2 answers to this question
Recommended Posts
Archived
This topic is now archived and is closed to further replies.