General > General Technical Chat

Review: Hantek DDS 3X25. Anyone own one?

<< < (56/108) > >>

marmad:

--- Quote ---only its miss at 550KHz (4000 vs 3999 points). errr, just skip that
--- End quote ---

Ha, ha... you realize that's a VB6 floating point error, don't you?  363.636363636364 * 11 = 4000.  But in the math, Visual Basic 'fixes' it to 3999.  You can get around this by:
calcWavePointNum = calcWavePointNum * periods
calcWavePointNum = Fix(calcWavePointNum)

which should, theoretically, be equal to:
calcWavePointNum = Fix(calcWavePointNum * periods)

but is not in Visual Basic 6.

Or, alternatively, you can use this line:
calcWavePointNum = FormatNumber(DACclock / freq, 4)

instead of:
calcWavePointNum = DACclock / freq


--- Quote --- YOUR FORMULA IS PERFECT! no doubt about it!
--- End quote ---

I would never say that... in fact, your 550kHz example shows that it can be refined - at least in Visual Basic 6  ;)

Mechatrommer:

--- Quote from: marmad on August 07, 2011, 04:09:56 pm ---in fact, your 550kHz example shows that it can be refined - at least in Visual Basic 6  ;)

--- End quote ---
not your and my fault. its bill gates fault. and i dont die if i miss one point at that particular freq. thanx to your code its already included in my goltek controller for "offline simulation". dont worry i'll put you in the credit (and other contributors that i think appropriate)

marmad:
@torch (bug fix):


--- Quote ---The count often differs from the generated frequency slightly. EG: 1.00000kHz produced 1.00016khz with the occasional flicker to 1.00017kHz. The Rigol displays 1.000kHz, but flickers betweeen .992 to 1.004. 3MHz produces 3.03030MHz. (Rigol displays 3.030MHz) But 4MHz produces 4.00000MHz and the Rigol agrees.
--- End quote ---

As mentioned previously, the Hantek can't hit every frequency precisely, because of the way the hardware works.  The DAC clock is adjustable from 200MHz to 2kHz, but it does some binary-division tricks to get below this frequency.  For example, what's the closest number to 1000 (Hz) you can get by trying to divide 200000000 with a multiple of a number between 2000 - 4096?  1000.160026 - which is 200MHz / (2083 * 96).


--- Quote ---The Rigol does not agree with the voltage setting. EG: 3.5v p-p is measured as 3.6v p-p.
--- End quote ---

I think this is either your Rigol's measurement - or the output of your Hantek is greater than normal. My scope measures 3.44Vp-p for 3.5Vp-p output.  But there is an adjustment built into the software for this.  Double-click 'Current Settings'label, and set the Fine Tuning (multiplier): Amplitude to 0.972 (3.5 / 3.6 - or whatever the precise voltage measured is).  This will correct the offset between my software and measured values elsewhere.


--- Quote ---There is an error in setting the RMS amplitude function: Parameter input of 1.72 produced a "Human Error" message informing me that "RMS amplitude must be between 0.035355V and 3.5355V"
--- End quote ---

That's a mistake in my message - the RMS setting must actually be between 0.035355V and 1.237425V. This is now fixed in the new version. Well found!


--- Quote ---I think a digit gets lost when setting the sweep step. Set to 100.0Hz, it seems to climb by 1000.0Hz instead, according to the Sweep Data log.
--- End quote ---

I couldn't replicate this bug. For example, if I set freq1 = 1kHz, freq2 = 10Khz, step = 100Hz, it sweeps with 100Hz steps correctly. Do you know what your freq1, freq2 settings were?  BTW, if you have log sweep set to ON, it sweeps at 10 ^ x multiples of any given frequency.


--- Quote ---"Reset All" cause an error message then program crash. Couldn't catch the error message -- something not found, I think.
--- End quote ---

Hmm... I couldn't replicate this either. If I try to "Reset All" without a config file (the software looks for a folder in it's folder called "cfg" [where you can save different setting configuration files; e.g. "logsweep_10Hz_40kHz.cfg"] for a file called "default.cfg").  If it doesn't find that file, I get the message "Configuration file not found", but no crash.  But I've now changed the code to use the default start-up settings as an alternative - so maybe that will prevent your crash.  Please give it another try when you can.


--- Quote ---I tried entering "48828.125" for frequency 1, but it displayed 97.6562 kHz and output 48.8400kHz.
--- End quote ---

Wow! Nicely spotted bug! I've now changed the formula to my latest - to correctly display the actual output frequency for all entered frequencies.

BTW, since I didn't post any help file with the software, some of the features are a little hard to understand.  For example, if you'd like to trigger single shot waveforms from the software:
1 ) Decide what digital output you want to use for the external trigger. I tend to use DO11, because it's closest to the edge.
2 ) Make a jumper wire between that and the trigger input. It's very easy - I've included a photo below of how I do it on mine.
3 ) In the software, turn off 'Repeat Wave"
4 ) Make sure 'Digital Out' is set to the option: 'PROG[gramable]' (not 'PAT[tern]G[enerator]')
5 ) Set the last bit on the left (below Digital Out 7-segment display) or the bit for whichever output pin you're using; MSB...LSB [11...0] - so that it displays '1'
6 ) Make sure all LSBs are off (e.g. with DO11, make sure all other bits are Reset to '0'). The Trigger Bit logic will use the lowest Set bit.
7 ) Click 'Trigger Bit'
8 ) Confirm you want to change the Trigger Bit to what you've Set with 'OK'
9 ) Set 'Trigger' to 'External'
10) Set your scope for triggered single sweep.
11) Click 'Trigger Wave' for each desired single shot and have fun.

Note: Because of the way the Hantek creates frequencies > 100kHz (it adds multiple cycles), a single shot with those frequencies will actually produce the number of cycles in the point length.  This is caused by the Hantek firmware, not the software.  For example, try a single wave output with 100.050kHz ('Sync Stable' OFF); you will actually get 2 cycles of the wave. You can get around this by keeping 'Sync Stable' ON, which will only create waveform point tables with single cycles - but it won't be able to do every possible frequency.  In a later version of this software, you'll be able use your own edited waveform as the single shot one, which will get around this problem.

Shortcut keys:
S   = Sine wave
Q   = Square wave
T   = Triangle wave
W,R   = Sawtooth/Ramp wave

Numpad   = Entry for input box       
*,e,E   = Exponent in input box
/      = Backspace in input box
Delete   = Clear input box
Enter   = [F1] Set output frequency
   
F1   = Set output frequency (or sweep start frequency)
F3   = Set output voltage peak-to-peak
F4   = Set output voltage RMS
F5   = Set output voltage offset
F6   = Set output phase

F2   = Set sweep end frequency
F7   = Set sweep interval
F8   = Set sweep step
F9   = Set digital outputs (when in 'Prog' mode)
F10   = Copy digital inputs as decimal number to input box

F11   = Trigger (Single Shot) Wave - parameters must be set as mentioned above
F12   = Repeat Wave ON/OFF

Thanks again for your debugging efforts, torch!  I've attached a bug-fix version below, and will post an improved version with my glitch-free sweeping developments, as well as other stuff, next weekend or so.

DDS3X25Ctl_0_9_2.zip (87.03 kB - downloaded 14 times.)

Edit:  Bug fix to v0.9.3 - deleted ActiveX reference.  Sorry everyone (and thanks to Mecha)!

torch:

--- Quote from: marmad on August 07, 2011, 11:23:53 pm ---@torch (bug fix):

As mentioned previously, the Hantek can't hit every frequency precisely, because of the way the hardware works.  The DAC clock is adjustable from 200MHz to 2kHz, but it does some binary-division tricks to get below this frequency.  For example, what's the closest number to 1000 (Hz) you can get by trying to divide 200000000 with a multiple of a number between 2000 - 4096?  1000.160026 - which is 200MHz / (2083 * 96).
--- End quote ---

Makes sense.


--- Quote ---I think this is either your Rigol's measurement - or the output of your Hantek is greater than normal. My scope measures 3.44Vp-p for 3.5Vp-p output.  But there is an adjustment built into the software for this.  Double-click 'Current Settings'label, and set the Fine Tuning (multiplier): Amplitude to 0.972 (3.5 / 3.6 - or whatever the precise voltage measured is).  This will correct the offset between my software and measured values elsewhere.
--- End quote ---

Either is entirely possible. When I have time I'll check the actual voltage output with a meter to verify. Nice to know there is a means to compensate.


--- Quote ---I couldn't replicate this bug. For example, if I set freq1 = 1kHz, freq2 = 10Khz, step = 100Hz, it sweeps with 100Hz steps correctly. Do you know what your freq1, freq2 settings were?  BTW, if you have log sweep set to ON, it sweeps at 10 ^ x multiples of any given frequency.
--- End quote ---

Sorry, I neglected to record those details. However it's entirely possible that it has to do with the 10x multiple, since I think I had the log set to ON pretty much the whole time. I'll have to play with that again.


--- Quote ---Hmm... I couldn't replicate this either. If I try to "Reset All" without a config file (the software looks for a folder in it's folder called "cfg" [where you can save different setting configuration files; e.g. "logsweep_10Hz_40kHz.cfg"] for a file called "default.cfg").  If it doesn't find that file, I get the message "Configuration file not found", but no crash.  But I've now changed the code to use the default start-up settings as an alternative - so maybe that will prevent your crash.  Please give it another try when you can.
--- End quote ---

I never saved a configuration file, so that may be what wasn't found. I am running 64 bit Vista, which doesn't always play nice with 32 bit compatible software. That may be related to the crash. I will make sure to try this again and see what happens now.


--- Quote ---Thanks again for your debugging efforts, torch!  I will post a newer version with all the latest developments in glitch-free sweeping, as well as other stuff, later this week.
--- End quote ---

I'm not much of a programmer, so debugging is one of the few ways I can give back to those that are. Thanks for sharing your work.

marmad:
Here are the results from my attempt to do a glitch-free logarithmic sweep from 100Hz to 10MHz.  I'm not going to post more .pngs to show the sweep - it's glitch-free like the rest; what's more interesting is what frequencies I'm able to hit.

I started with a point length of 4080 with 204 periods (cycles), since that is what the Hantek normally uses for 10MHz - I then reverse calculated the frequency I would have to send (>= 1Hz) to generate as close as possible the desired output frequency.  If one sweep step output duplicated the last, it was skipped, and the sweep was stopped as soon as the real output frequency was >= 10MHz.  It almost works, but gets off the desired mark in the higher frequencies.  Also, of course, the Sync Out does not sync to periods, but instead to the point length.

Desired Frequency ------DDSSetFrequency ------Output Frequency ------1001102.40032Hz2001.953125200.00020Hz3002.92971679716797300.01245Hz4003.90625400.00080Hz5004.8828125500.00125Hz6005.85960938437537600.02580Hz7006.8362793139657700.08646Hz8007.8125800.00320Hz9008.78915039150391900.09406Hz10009.7656251.00001kHz200019.531252.00002kHz300029.2998049804983.00125kHz400039.06254.00008kHz500048.8281255.00013kHz600058.61719687875156.00980kHz700068.38672969187687.00305kHz800078.1258.00032kHz900087.89941494149419.00941kHz1000097.6562510.00050kHz20000195.312520.00200kHz30000293.26201201201230.12502kHz40000390.62540.00800kHz50000488.2812550.51781kHz60000588.29066265060260.24200kHz70000687.72007042253570.42400kHz80000781.2580.64400kHz90000879.78603603603690.90800kHz100000976.5625102.04200kHz2000001953.125208.33400kHz3000002959.2803030303312.50000kHz4000003906.25416.66600kHz5000004882.8125555.55400kHz6000006103.515625625.00000kHz7000006975.44642857143714.28600kHz8000008138.02083333333833.33200kHz9000008877.840909090911.00000MHz10000009765.6251.25000MHz200000019531.252.50000MHz300000032552.08333333335.00000MHz600000097656.2510.00000MHz
@Mecha and others - the formula I used for reverse calculation was this:
Dim points As Long = 4080
Dim periods As Long = 204
Dim neededFrequency as Double

I first DDSSetFrequency(x, 10MHz, y, z) and DDSDownload(x, points, periods) the wave points..

Then run this for each desired frequency, starting with 100 as desiredFrequency:

neededFrequency = hantekClock / ((Int(hantekClock / (desiredFrequency * (points / periods ))) / 2) * 4096)
if neededFrequency < 1 then neededFrequency = 1
DDSSetFrequency (x, neededFrequency, y, z)

And the usual loop with increment, check, blah blah.

It may not be perfect.. I banged it out quickly.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

There was an error while thanking
Thanking...
Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod