Data AcQuisition And Real-Time AnalysisScope - Spectrum - Spectrogram - Signal Generator
Software for Windows
Science with your Sound Card!
Contact us about
The Jitter_Tbl macro computes jitter for square waves that are generated using a phase table approach, such as Daqarta's Square wave in Snap mode, or the Arduino square wave oscillators used in DaquinOscope and Arduino_Oscillators via the DaqPort 0xF0, 'F' Set Oscillator Frequency And Phase functions.
The table shows the square wave frequency and jitter period for all even divisors of the sample rate from 2 to 1024. This may allow you to optimize for certain output frequencies and sample rates.
The Jitter_Tbl macro mini-app is included with Daqarta. However, before you use it, you may want to change certain parameters that are set near the start of the macro. To do that, first hit CTRL+F8 to open the Macro Dialog. Then scroll the Macro List down and single-click on Jitter_Tbl to select it without running it, and click the Edit button.
(Note that you can open this Help topic by selecting Jitter_Tbl as above, then clicking the Help button below the list, next to Run. Or, once you have opened the Edit dialog, you can click the duplicate Help button near the upper right.)
The first thing you might want to change is the name of the file that Jitter_Tbl will create in the Documents - Daqarta - User_Data folder. The default is "JitterTbl" as set here (with an automatic .TXT extension):
Next, select if you want a table for DaquinOscope or the Daqarta Generator square wave:
UV=0 ;0=DaquinOscope Osc, 1 = Daqarta Gen
Finally, under the relevant branch of the IF.UV=1 statement set the desired sample rate S. The default is 48000 for sound cards, but you may want to set 96000 or 192000 according to the Sample Rate value you will be using in the X-Axis Dialog control.
For DaquinOscope, the default is 10000. If you set another rate, it will automatically be forced to the nearest valid frequency that can be obtained with the Arduino timer running at 2 MHz.
Then exit the Macro Editor by clicking the Save Macro button at the bottom, and click the Run button.
;<Help=H4927 A.LogName#0="JitterTbl" UV=0 ;0=DaquinOscope Osc, 1 = Daqarta Gen IF.UV=1 ;Daqarta Generator Snap Square? S=48000 ;Default sound card sample rate C=2^29 ;Osc base S=cint(S) ;Integer only Str0="Daqarta Generator Snap Square" ELSE. ;Else DaquinOscope Square Osc S=10000 ;Default Osc sample Rate C=2^25 ;Osc base IF.S=>50000 ;Above max sample rate? S=50000 ENDIF. IF.S=<7812.5 ;Below min sample rate? S=7812.5 ENDIF. S=2M/cint(2M / S) ;Limit to valid freqs w. 2M clock Str0="DaquinOscope Square Osc" ENDIF. UI=2 ;Starting divisor UE=1024 ;Ending divisor LogTxt=Str0 +" at sample rate = " +S _ +n +"Div Frequency" +p25 + "Jitter period, sec" WHILE.UI=<(UE + 1) US=C / UI ;Osc step size F=US * S / C ;Osc frequency N=C / (2 * US) ;Steps (samples) per square phase E=abs(N - cint(N)) ;Error fraction per square phase E=E / cint(N) ;Error fraction per sample IF.E=0 LogTxt=n + UI +p6 + F(5_9) + p25 + "*******" ELSE. J=E * S / 2 ;Jitter freq G=1/J ;Jitter period LogTxt=n + UI +p6 + F(5_9) + p25 + G ENDIF. UI=UI+2 WEND.
Questions? Comments? Contact us!We respond to ALL inquiries, typically within 24 hrs.
Over 35 Years of Innovative Instrumentation
© Copyright 2007 - 2021 by Interstellar Research
All rights reserved