I'm using the python SDK to control a Digital Discovery. I want to have a constant clock output signal on one port and sometimes trigger 1/2/5 pulses on another port. With the FDwfDigitalOutRepetitionSet function this works pretty good but sometimes the initialization of the pulse leads to an interrupt in the clock signal.
I think it could be because I am using "FDwfDigitalOutConfigure" after configuring every single signal. If I set AutoConfigure on and don't use FDwfDigitalOutConfigure I don't get an output. Maybe I am doing something wrong/ forgetting something in configuring the output. This is the code I call every time to start a output signal:
Quote
#check if analog discovery is connected
if self.hdwf.value == hdwfNone.value:
#if not, set error code to NOK_NO_DEVICE_CONNECTED before other functions
return self._retval_helper(self._error_codes.NOK_NO_DEVICE_CONNECTED[0])
# get clock info clock
hzSys = _ct.c_double()
if not self.dwf.FDwfDigitalOutInternalClockInfo(self.hdwf, _ct.byref(hzSys)):
return self._retval_helper(self._error_codes.NOK_FAILED_TO_GET_CLOCK_INFO[0])
# enable DIO
if not self.dwf.FDwfDigitalOutEnableSet(self.hdwf, data.port, 1):
return self._retval_helper(self._error_codes.NOK_FAILED_TO_ENABLE[0])
# prescaler to xkHz, SystemFrequency/x/2
# frequency is doubled because for an alternating signal a minimum counter high + counter low of 2 is neccessary
# the divider defines the frequency of one step --> 2 steps for a clock signal requires frquency*2
# with higher counters (eg. for duty cycle) the frequency needs to be adjusted accordingly
if not self.dwf.FDwfDigitalOutDividerSet(self.hdwf, data.port, int(hzSys.value/data.frequency/2)):
return self._retval_helper(self._error_codes.NOK_FAILED_TO_SET_DIVIDER[0])
# set divider init to delay signal output
if not self.dwf.FDwfDigitalOutDividerInitSet(self.hdwf, data.port, data.divider_init):
return self._retval_helper(self._error_codes.NOK_FAILED_TO_SET_DIVIDER_INIT[0])
# set counter info
if not self.dwf.FDwfDigitalOutCounterInitSet(self.hdwf, data.port, data.startHigh, data.offset_counter):
return self._retval_helper(self._error_codes.NOK_FAILED_TO_SET_COUNTER_INIT[0])
# 1 tick low, 1 tick high
if not self.dwf.FDwfDigitalOutCounterSet(self.hdwf, data.port, data.counter1, data.counter2):
return self._retval_helper(self._error_codes.NOK_FAILED_TO_SET_COUNTER_VALUES[0])
Question
Philipp
Hello,
I'm using the python SDK to control a Digital Discovery. I want to have a constant clock output signal on one port and sometimes trigger 1/2/5 pulses on another port. With the FDwfDigitalOutRepetitionSet function this works pretty good but sometimes the initialization of the pulse leads to an interrupt in the clock signal.
I think it could be because I am using "FDwfDigitalOutConfigure" after configuring every single signal. If I set AutoConfigure on and don't use FDwfDigitalOutConfigure I don't get an output. Maybe I am doing something wrong/ forgetting something in configuring the output. This is the code I call every time to start a output signal:
Attached is a photo of the signal with the interrupt
Link to comment
Share on other sites
3 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now