**********  3.02 *********************************************

A user had a problem with timing out in the slope / intercept
calibration function.  Only 30 seconds is allowed.  Rather
than change the timeout value, I put a

while (Serial.available() == 0);

in front of the call to serial.ParseFloat().  Now the clock
doesn't start until the user has hit a key.

2/21/2014

*******  PHSNA STANDARD REVISION 3.01 **************

Starting 3.01 on 1/27/2014 to fix bugs that crept in with 
the upgrade to 3.00 and some that may have existed earlier.
The file package includes some integer math routines that
allow a 64 bit result by Dana Browne AD5VC.  Currently named with 
a .C extension to keep out of compile, but it has been verified to
compile OK.

First fix:  I somehow took out the line break between the header row
and the data row for crystal prarmeters. That screws up the CSV formatting.  
Put that back.

Second - Jerry Hall W0PWE reported a crystal reading the low -3dB point
only 1 Hz below the peak point when it should have been 30 Hz or so.
I found the same problem.  Not sure of the cause, but I put in some
more delays and another read and throw away of the ADC and it seems
to have corrected the problem.

While I was at it I noticed that my feature to find the width of the -3dB
points and use the average frequency instead of the first found point had
an error.  I always got width = 1 even for a single point. So my BW could 
be high by 1 Hz as a result.  I changed my adder / subtractor value from
width/2 to (width-1)/2 to fix this.





Revision 1r11 completed 1/25/2014 and renamed 

standard_ref_3r00 ...

Revision 1r11 is supposed to just iron out a few wrinkles so we
can go to a major revision.  Jim asked for a RLB function and
move all the setup / preferences / calibrations into a separate
sub-menu, which I've been wanting to do.

Got the RLB separate function going.  It does this:

1)  Scans a specified band and interval and outputs frequency,
    return loss, SWR, and rho in CSV format.
2)  Optionally reports just for a single frequency
2a) As a sub-function of the above, continuously updates RL/SWR

You are prompted to measure the open/shorted condition first,
but can do repeats without re-doing that measurement.

Did the new menu structure and sub-menu for setup / calibrations /
options.  Also changed the menus so a single keypress gives the
action -- no Enter key required.

In the "crystal" function, made the name field hold "N/A" if the
user doesn't give a name, so the field  won't hold garbage.

I'm working on saving the polynomial coefficients to EEPROM. The
Arduino doesn't have any function for writing floats (to EEPROM) 
-- just bytes.  I downloaded some code to write & read  doubles 
(same as float on Arduino).  It worked, but with scientific notation,
I got 'ovf' (overflow) when I tried to print it out.  My example
was 6.023E15.  I found out that it does store correctly because
if I divided it by 1E14 and printed it, it comes out correctly as 
60.23.  So I won't worry much about the printing.

BTW, I may have avoided all that PSTR stuff and PROGMEM --
The Arduino docs say you can encode strings in flash by using the
'F' thing like this:

	Serial.print(F(Hello World))

I found out that Serial.ParseFloat() won't read scientific notation.
But I can read it in as a string and use atof() to convert the string
to a float.

Added a function get_char() in misc_functions.ino to get a single char
since I do it a million times and it takes several lines of code.

Added an "about PHSNA" option to the setup menu that gives credits and 
info.

1/24/2014 After backing away from the integer frequency version yesterday
(64 bit multiplication resulted in a 4K size jump), I wrote the Memories
function today.  Ten memories 0 - 9 saved in EEPROM.  Functions are to save,
clear, and load.  Loads with a keypress. Shows all memories on entry to
the sub-menu.

1/25/2014 Wrote the Scan option today, so I'm done except for looking for bugs.
Scan option has some good features.  You can only scan up, one limitation. 
You enter Low, High, Step, and Delay values and it starts.  Doesn't update 
continuously, but prints a line with all parameters.  During scan you have 
the option to press keys and change any parameter without having to do the
whole setup again.  Then it re-starts after you make the change.  You can also
hit P to pause and it prints out the current frequency, then hit any key to resume.
After each user interruption, the line of parameters is re-printed.


Revision 1r10:

Adding the ability to give a crystal a name, which will print
before and after the parameters.  So if you do a string of them,
you'll know what was what.

Also added some conditional statments to compile for me or for
release.  Use #define NICK 1 for my personal version and use
#define NICK 0 for general use.

I moved the point where you input the crystal fixture resistance
up a bit so it's not after measurments have already started.

I changed the way the crystal test function prints out the data.
Now instead of a line for each parameter, all parameters are 
printed on a single line, separated by commas.  In my version of
Excel, I highlight the line of data, click in an Excel cell, do a
control-V (paste).  It puts everything into one cell, but there's a 
little symbol with a drop-down allowing me to choose the Text Import
Wizard.  I do that, choose delimited and specifiy the comma as
the delimiter.  Now is spreads them out into one value (and the label)
per cell.

Finished 1/16/2014

Revision 1r9:

Had a mistake in the clock frequency selection and reasonableness 
check after I added the AD9851.  Fixing that.
  
Also breaking the project up into multiple files.
  
Also adding in the "generator" function the ability to choose an 
"update" option that continuously updates the dBm power level without 
additional keystrokes.  This can be helpful when you are adjusting
a network or tuner, for example.

Also added an option to the SNA function to include uncompensated
level in dBm, displayed alongside the compensated level. This shows
the actual output of your DDS.  It could be used to verify that
your polynomical coefficients are still OK. If you haven't yet
put cofficients into the source code (main file), you won't see
a difference between compensated and uncompensated power levels.


**************************************************************


Revision 1r8 does these things:

Looks at cell O3 in PLX-DAQ and if 100, uses the crystal fixture loss 
factor in data sent back.  Revised the PLX-DAQ spreadsheet to 4r2.

Added the ability to toggle between AD9850 and AD9851 modes, setting a
flag in EEPROM.

********************************


In the bump up to 1.7, starting 12/19/2013 I want to ...

Add a switch to turn frequency compensation and normalization to 0 dBm
On or Off.  Not saved to EEPROM though.

Add automatic crystal scanning and calculation of parameters.

I'm getting the crystal calcs going.  I found that following a
frequency change by an immediate ADC read is not a good idea.
Now allowing 5 ms between.

Also noted that the sendFrequency() routine will accept any float
as an argument, but the compensation routine assumes that f_out is
the current frequency.  So I changed sendFrequency() to set f_out
to the current frequency.


PLX-DAQ is currently unaware of the loss term for the shorted fixture,
so won't scan crystals with a 0 dB reference.  I'm going to set a
cell in the PLX spreadsheet to 100 to tell PHSNA to factor in that
value before returning the dBm value ...  DONE!  o4 = 100 to flag.



The 1.6 revision.  Starting 12/7/2013

Here I'm trying to add the PLX-DAQ version to the terminal version and
have it figure out if the Excel macro is connected, otherwise go to the
terminal version.


The 1.5 revision.  Starting 12/6/2013 ...

Mainly I want to get rid of the 1 MHz lower limit in option #2, Generator.

Also should add the ability to manually input slope and intercept when
desired. I did that.  Had some issues with getting wrong numbers back
from EEPROM.  Something to do with converting int to two bytes and back.
I wound up using lowByte() and highByte() operators instead of 
(byte)(myint>>8 &0xFF), (byte)(myint<<8 & 0xFF).








