I am trying to generate a 20MHz clock on a DIO with Analog Discovery Pro 3450, using the SDK.
I understand that I need to divide the internal clock frequency, and take into account the number of low and high states.
The problem is, if I divide 100MHz by 20MHz, I have a divider of 5. If I divide by 1 low state and 1 high state (so I divide by 2), that is 2.5. But the divider must be an integer, so it will adjust the divider and output the wrong frequency.
The same goes for the number of high and low states, as it has to be an integer, I can't play with them to get my 20MHz frequency.
But I see that in WaveForms I can set a clock with a 20MHz output, and that gives the correct frequency (as I saw on my scope).
Is there an explanation I didn't understand or something?
Thank you for the help,
Manon.
Here is the relevant part of the script, if it helps:
Question
ManonH
Hi,
I am trying to generate a 20MHz clock on a DIO with Analog Discovery Pro 3450, using the SDK.
I understand that I need to divide the internal clock frequency, and take into account the number of low and high states.
The problem is, if I divide 100MHz by 20MHz, I have a divider of 5. If I divide by 1 low state and 1 high state (so I divide by 2), that is 2.5. But the divider must be an integer, so it will adjust the divider and output the wrong frequency.
The same goes for the number of high and low states, as it has to be an integer, I can't play with them to get my 20MHz frequency.
But I see that in WaveForms I can set a clock with a 20MHz output, and that gives the correct frequency (as I saw on my scope).
Is there an explanation I didn't understand or something?
Thank you for the help,
Manon.
Here is the relevant part of the script, if it helps:
S_Clk = c_int(0)
frequency = 20000000
dwf.FDwfDigitalOutInternalClockInfo(hdwf, byref(internal_clock_frequency))
dwf.FDwfDigitalOutEnableSet(hdwf, S_Clk, True)
dwf.FDwfDigitalOutTypeSet(hdwf, S_Clk, constants.DwfDigitalOutTypePulse)
dwf.FDwfDigitalOutIdleSet(hdwf, S_Clk, constants.DwfDigitalOutIdleInit)
dwf.FDwfDigitalOutDividerSet(hdwf, S_Clk, c_uint(int(internal_clock_frequency.value/frequency/2)))
dwf.FDwfDigitalOutCounterSet(hdwf, S_Clk, c_uint(1), c_uint(1))
Link to comment
Share on other sites
2 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