/* BITX program for 60 M (USA allocation) Raduino V 1.1 Don Cantrell, ND6T 25 March 2017 Compiles under etherkit Si5351 library v 2.0.1 This source file is under General Public License version 3.0 Reduced Si5351 updates Simplified sketch. No metering. */ #include Si5351 si5351; #include LiquidCrystal lcd(8,9,10,11,12,13); int channel = 1; //Initial channel number unsigned long post; float BFO = 11999045; //My BFO frequency float LO = BFO + 5330500; //Local Oscillator for Upper sideband,CH.1 float frequency; void setup() { lcd.begin(16, 2); si5351.init(SI5351_CRYSTAL_LOAD_8PF,25004920,0); //My actual ref osc freq. si5351.set_pll(SI5351_PLL_FIXED, SI5351_PLLA); } void loop() { int tune = analogRead(A7);// Read the input on analog pin 7: //Set switching at knob limits and increment channel selection if (tune>1000) { ++channel; post=millis(); //Stake a time post for channel update limit } if (channel > 5)channel = 1; switch (channel) { case 1: frequency = 5330500; break; case 2: frequency = 5346500; break; case 3: frequency = 5357000; break; case 4: frequency = 5371500; break; case 5: frequency = 5403500; break; } if(millis()-post<100){ // Update 5351 only if under 100 ms LO = BFO + frequency; si5351.set_freq(LO * 100, SI5351_CLK2); //Program the synthesizer show(); delay(1000); // Slow down tuning } } void show() { lcd.clear(); lcd.setCursor(0, 0); lcd.print("Ch."); lcd.print(channel); lcd.print(" "); lcd.print ((LO-BFO)/1e6,4);//Calculate & show frequency lcd.print(" MHz"); }