However, the program is rather more sophisticated than a simple analog chart recorder, as it is very flexible in what it will plot, and also has useful statistical capabilities. The setup is stored in a file - and that includes what data to plot, the chart title, and what colours to plot. Some parameters such as chart speed are also adjustable while the program is running. It records two chart channels and also has two independent meter displays. Finally it calculates the on-going OFFSET and P-P VARIANCE of the oscillator it is monitoring.
RECORD2F uses an ASCII data stream, and telemetry in HEX-ASCII form (that is, each byte represented by a pair of ASCII characters 0 - 9 and A - F). All that it needs is for the same data to always be in the same place in the telemetry sentence. A more general-purpose version (without OFFSET and VARIANCE calculations) is also available.
The program is a DOS executable, but will run full-screen on most Windows computers from WINDOWS™ 3.1 through to the latest WINXP and WIN2000. It requires a serial port that is supported by the operating system as a true COM port. (It probably won't work with USB serial adaptors). It may also run in a DOS window on some newer computers, although the graphics may be slightly distorted due to screen support limitations. Some display controllers do not support the dual scan modes required for "DOS BOX" graphics operation. The program requires little overhead, and will operate on a 486/25 DOS PC, will operate from a DOS floppy, but does require a VGA display with at least 640 x 480 resolution (mono LCD works fine as well, provided suitable colours are chosen).
The devices typically transmit a telemetry frame every second, containing time, master oscillator PHASE sampled at the edge of an external GPS or TV sync frequency reference, and the FEEDBACK voltage used to control the master oscillator (the input and output of the control algorithm). The RECORD2F program shows these PHASE and FEEDBACK terms from the frequency controller, and calculates from the PHASE the OFFSET and P-P VARIANCE of the oscillator.
Just to make things very clear, the frequency control algorithm used by these devices resides in the device, and operates in an autonomous manner. All the RECORD2F program does is monitor the performance of the master oscillator and its control system.
Here is an example:
After these eight lines may be some lines of text which describe what the settings do. These are ignored by the program. The information in the eight lines shown is as follows:
1 600 13,2,"PHASE",1 17,5,"FBACK",1 11,4,"PHASE",1 16,3,"FBACK",1 "ZL1BPU GPSCLOCK" 10.000
The chart speed can be any convenient value. By setting a default, you have the opportunity to use recording rates that are not provided by the program function keys. The program offers 1, 2, 5, 10 and 60 seconds per sample. Note that all data is recorded on the screen (i.e. every sample, typically received at 1Hz rate), but the chart only advances at the set speed. Thus at slower rates, there are multiple dots recorded for each time sample step. The fastest sample rate (chart speed) is one sample per second.
The data pointers are explained later. The data name can be any text up to six characters long, and must be in quotes. All values on the lines 3 - 6 must be comma delimited. The frequency is the nominal carrier frequency of the master oscillator in MHz, and is used for relative offset and variance calculations. (This is the frequency at which the micro operates, and may or may not be the actual crystal frequency in your design).
RECORD2F expects data in small text frames, up to 30 or so characters long, and terminated by CR and LF. Typically, there would be one frame per second, although this is not limited by the software, which will handle both slower and faster (to a maximum of about 10 frames/sec, depending on the speed of the computer). Each frame results in data recorded on the graph, so:
The data frame format is not fixed, but must:
where the UTC time is sent first, followed by a space and a device identifier (shown as "%" above). Then follows the PHASE (PPPP) and the FEEDBACK (FFFF), both 16-bit values (i.e. between 0 and 65535 or 0x0000 and 0xFFFF in hex notation). The following data indicated as "xxxxxxxx" depends on the device, and could represent anything. Here we just concentrate on the PHASE and FEEDBACK, and also only plot the lowest 8 bits of each. That's like dividing each value by 256 and only plotting the remainder, which gives best sensitivity. RECORD2F is a dual channel plotter, and uses different colours to indicate the two channels. It also has two colour coded meters. All these colours are user programmable.hh:mm:ss %PPPPFFFFxxxxxxxx<CR><LF>
This same format is used by all the ZL1BPU Frequency References, Frequency Comparator, SuperClock and GPSClock. The values sent at the start of the frame "hh:mm:ss" is of course the UTC time (if set). Time is represented in packed BCD, (two numeric digits 0-9, representing "00" to "99") so is both "human readable" and RECORD2F readable. There may be further data shown as "xxxxxxxx" which should be ignored by RECORD2F. The "^" marks the first character in the frame.
As each frame of data is received, it is displayed verbatum in the bottom right corner of the screen. It is then interpreted, using the pointers for channel numbers 1 to 4 (chart and meters) to decide which data to display. The selected data for channel 1 and channel 2 (PHASE and FBACK) are then reprinted (highlighted), using the colour chosen for that channel. In the example below, you'll see "09:33:29 %0CC508E9A011".
The chosen data is converted to binary (representing 0 - 255 decimal), and plotted on the chart. The vertical position represents the binary value (PHASE in Hz, FBACK in ~1mV steps), and the horizontal position the current sample point, which moves to the right at the sample rate.
The main chart is 256 dots high, so there are 256 vertical locations to plot in, which is why the lowest 8 bits are usually plotted (28 = 256). The chart is about 600 dots long, so will record 600 sample events, as the dot position changes with each sample (each time the program emits a "clunk"). Furthermore, when the plotting point gets to the right-hand side, the whole plot slides along to the left by 10 positions, and plotting continues. You lose the oldest 10 plotted points each time. A new sample every minute means about 10 hours of chart space.
The vertical scale marks shown on the left are from 0 to 255, marked every 10, and labelled every 50. The units depend on the parameter you are plotting. For example, with a 10MHz reference, the resolution is 100ns (1/f), so each dot, which represents one cycle, also represents 100ns of change of PHASE. The horizontal scale is time, marked as the chart progresses, in 10 seconds, 100 seconds and 1000 second marks of different heights. When the plot is very slow, the faster marks merge to become a grey band.
Below the main chart is a small "trend graph" which plots each sample of the data at full speed, a new horizontal position for every data sentence. This plot is only 64 dots high, and the data wraps around when it exceeds 63 or goes below zero. In other words, only the lowest six bits of the data are plotted. The trend graph is 256 samples long, and simply wraps around to the beginning - it does not scroll along like the main chart. However, there is a single dot marker under the graph so you can see where it is plotting.
There are two major advantages to the technique of plotting the least significant eight bits of data. First, the data can never overflow the graph, since it only ever represents 0 - 255, and the graph width is 0 - 255. Second, by choosing the pointer value wisely, data can be represented with "gain". For example, imagine the data "PPPP" in the above example is represented as "AAaa" to indicate the weight of the data. If the setup has a pointer value of 11, the values interpreted will be the most significant bits ("AA"). If the pointer is 12, the data bits interpreted are the next two ("Aa"), so the graph ignores the most significant data and plots with a gain of 16! If the pointer was set to 13, only the least significant bits ("aa") would be plotted, with a gain of 256. As the plotted data rolls off the top of the graph, it rolls back onto the bottom of the graph, with nothing lost.
Since the recorder has two channels, it is possible to plot a single channel at two gain settings - for example, setting CH1=11 and CH2=13 would plot "AA" and "aa" in the above example. The vertical scale to the left of the graph is marked in arbitrary 0 - 500 units, convenient for data representing 0-5V, typical of microcontroller A-D converters.
If you look closely at the screen example, you'll see that the recorded data is sometimes a thick line, sometimes thin. This is because sometimes in each sample period there are several values recorded. This might indicate that the data should be recorded faster, or it might indicate noise on the data.
The second line shows the OFFSET, i.e. the frequency error, which is calculated by dividing the 16 bit phase difference since reset by the time elapsed and the operating frequency:
ERROR = (CURRENT PHASE - STARTING PHASE) ÷ (ELAPSED TIME x REFERENCE FREQUENCY)The value is a very small number, a unit-less figure of merit (i.e. Hz per Hz), and is the usual way reference accuracy is quoted. The value can be positive or negative, indicating whether the reference is high or low of the true frequency. Depending on the performance of your reference, you may see figures as small as 1e-12 or more (1 part in 1012). In the ZL1BPU GPS disciplined references, this is an indication of the ageing rate of the reference crystal. The best reference crystals age at perhaps 1e-10 per day, and the GPS or TV referenced control system must compensate for this - in fact this is one of its main purposes.
A very small error occurs because of the lag in compensating for such slow changes in the reference. The performance which results has a small steady offset (rather than an ever increasing offset with age if uncompensated), and the size of offset is reduced by about two orders. If there was no ageing, the error in a GPS disciplined reference would be vanishingly small.
The OFFSET is calculated in real time, and will generally continue to improve as plotting time progresses. After a few hours recording it will stabilize. A quick indication of the offset can be deduced in a matter of a few minutes. OFFSET text is coloured pale blue. Note - if you start the recording while the oscillator is still stabilizing, the statistics won't look too good, remembering that the start point for offset calculations is the initial PHASE measurement. Wait until the oscillator has been stabilized and start again.
When used with non-locked references (for example while assessing a free-running oscillator or calibrating a Rubidium Standard), OFFSET is an accurate indication of the frequency error. See this example of a free-running 5MHz oscillator. The green phase trace is constantly moving upwards, but both the OFFSET and VARIANCE are constant. The calculations are made using the full 16-bit data, so will not be upset when the PHASE trace wraps around the screen. RECORD2F isn't much use unless the oscillator is able to achieve 1 part in 10-7 or better. Note - Be aware that if the PHASE rolls over from zero to maximum or vice-versa, the calculation will be invalid. You should reset the plot and start again. If this becomes a problem, perhaps your oscillator isn't very good!
The final figure displayed is the peak-to-peak VARIANCE. This is a measurement of the stability of the reference, and is achieved by remembering the highest and lowest 16-bit PHASE measurements since reset. The difference between these represents the p-p error. The value displayed is a unit-less figure of merit (i.e. Hz per Hz), calculated in the same way as the OFFSET. In order to isolate VARIANCE from OFFSET (because of course a change in phase of any type would move the minima and maxima apart), the maximum and minimum error values are repetitively calculated as a difference from the mean of the last 100 16-bit PHASE samples. The p-p error is the difference between the maximum and minimum. Note - The integration period of the mean value is affected by the chart speed, not the data frame rate. At one sample per second, the average is over 100 seconds; at one sample per hour, it will obviously be over 3600 seconds.
VARIANCE is scalar (there is no sign to the VARIANCE value, since the maximum is always bigger than the minimum!). The program cannot calculate the Allan Variance, since this requires all the data to be stored for post-processing to determine the standard deviation, and can't be plotted in real time. (The Allen Variance would typically be about 1/3 of the p-p value shown). Since this P-P VARIANCE information is available in real time, it is a handy measurement. Most good references show numerically similar VARIANCE and OFFSET. If one or the other is markedly worse, look at that aspect of the oscillator design. VARIANCE typically shows a valley-shaped curve with a minimum around the 10 - 100 second time interval. RECORD2F cannot give variance figures over short periods. This text is coloured pink.
Both the OFFSET and VARIANCE are plotted on the main chart, using the same colours as their text reports, pale blue and pink respectively. They are plotted in such a way that the more important values (PHASE first, FBACK second) overwrite them on the screen. The 100 sample mean is also plotted - as a dotted line in the same colour as the main PHASE plot. (You can see it clearly in the first example below). If the reference is really stable, you may never see this plot as it will be under the PHASE plot.
At the very bottom of the screen on the left is a legend showing what the Function Keys do. Pressing one of the keys F1 to F5 will change the sample rate to one of the built-in settings. At the same time, a vertical blue line will be shown on the chart, and the statistics will be reset. The next sample at the new setting will not occur until the time has elapsed for the next sample at the OLD sample rate. If you have a very long default time set, it will be quicker to edit the setup and start again.
Pressing F6 will cause a reset without changing the current sample rate. With F7 you can add a text comment to the chart. To save the chart to the clip-board, press ALT and PRINT SCREEN at the same time. Then change to a graphics program (Paint, Paintshop Pro, etc) and paste the picture from the clip-board. You can then clip out the chart and save it. This is how the example screen-shots were made.
F10 calls up the DOS editor to make changes to the setup file. Once the changes are made and saved, the program restarts. It appears that DOS EDIT changes the VGA colour pallette and does not restore it, so you may find that on restarting the colours are strange. If this happens, quite and start again.
Oh yes - to exit the program at any time, just press ESC!
Some examples of RECORD2F plots -
© Murray Greenman ZL1BPU 2002-2005