mirror of
https://github.com/JeffersGlass/DDS_VFO.git
synced 2025-07-17 07:29:50 -05:00
Add IF code, clean
Added 5th mode, "IF" mode to account for IF offsets. Not very good yet, always selects "VFO+IF" as the LO frequency
This commit is contained in:
17
VFO/VFO.ino
17
VFO/VFO.ino
@ -13,21 +13,23 @@
|
||||
* These adjustments are mode in the setFrequency_5351 function depending on the current mode held in currMode
|
||||
*/
|
||||
|
||||
long currFreq = 1800000;
|
||||
long currFreq = 1800000; //in HZ
|
||||
long ifFreq = 8865000; //in HZ
|
||||
|
||||
//-----Enumerations of frequency steps and their labels for each mode----//
|
||||
|
||||
enum modes{mode_testing = 0, mode_basic, mode_polyakov, mode_bfo};
|
||||
const int NUM_MODES = 4;
|
||||
enum modes{mode_testing = 0, mode_basic, mode_polyakov, mode_bfo, mode_if};
|
||||
const int NUM_MODES = 5;
|
||||
int currMode = mode_basic;
|
||||
|
||||
char* modeNames[NUM_MODES] = {"TEST", "VFO", "POLYA", "BFO"};
|
||||
char* modeNames[NUM_MODES] = {"TEST", "VFO", "POLYA", "BFO", "IF"};
|
||||
|
||||
long steps[][10] = { //don't forget to update the MAX_STEPS_INDEX array below
|
||||
{10000000, 5000000, 1000000, 500000, 100000, 10000, 1000, 10, 1}, //testing
|
||||
{10000, 1000, 100, 10}, //basic
|
||||
{1000, 100, 10, 1}, //polyakov
|
||||
{1000, 100, 10, 1}, //bfo
|
||||
{1000, 100, 10, 1} //IF Mode
|
||||
};
|
||||
|
||||
const int NUM_STEP_OPTIONS[NUM_MODES] = {
|
||||
@ -35,12 +37,14 @@ const int NUM_STEP_OPTIONS[NUM_MODES] = {
|
||||
4, //basic
|
||||
4, //polyakov
|
||||
4, //bfo
|
||||
4 //if
|
||||
};
|
||||
char* stepNames[][10] = {
|
||||
{" 10MHz", " 5MHz", " 1MHz", "500Khz", "100KHz", " 10KHz", " 1KHz", " 100Hz", " 10Hz", " 1 Hz"}, //basic
|
||||
{" 10KHz", " 1KHz", " 100 Hz", " 10 Hz"}, //basic
|
||||
{" 1KHz", " 100 Hz", " 10 Hz", " 1 Hz"}, //polyakov
|
||||
{" 1KHz", " 100 Hz", " 10 Hz", " 1 Hz"} //BFO
|
||||
{" 1KHz", " 100 Hz", " 10 Hz", " 1 Hz"} //IF
|
||||
};
|
||||
|
||||
int stepIndex = 0; // holds the index of the currently selected step value
|
||||
@ -313,6 +317,11 @@ void setFrequency_5351(long newFreq){
|
||||
case mode_bfo:
|
||||
si5351.set_freq(newFreq * 100ULL, 0ULL, SI5351_CLK0);
|
||||
break;
|
||||
case mode_if:
|
||||
si5351.set_freq((newFreq + ifFreq) * 100UL, 0ULL, SI5351_CLK0); //VFO+IF
|
||||
//VFO-IF
|
||||
//IF-VFO
|
||||
beak;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user