/* Shuttle Tuned PLL VFO for BITX40 Raduino Don Cantrell,ND6T v 1.1 22 April 2017 Compiles under Etherkit Si5351 library v 2.0.1 This source file is under General Public License version 3.0 Simplified sketch. No metering but with idle indicator. Eliminated unnecessary updating. */ #include Si5351 si5351; #include LiquidCrystal lcd(8,9,10,11,12,13); int tune; //Tuning knob position unsigned long post = 0;// Time post float BFO = 11.99855e6;//My I.F. frequency float LO = BFO -7.2e6; //I.F. minus starting frequency void setup() { lcd.begin(16, 2); si5351.init(SI5351_CRYSTAL_LOAD_8PF,24999020L,0); //My actual ref osc freq. si5351.set_pll(SI5351_PLL_FIXED, SI5351_PLLA); si5351.set_freq(LO * 100, SI5351_CLK2); //Program the synthesizer lcd.setCursor(0,0); ///////////Splash///////////// lcd.print("simpleST"); lcd.setCursor(0,1); lcd.print("ver. 1.1"); delay(2000); } void loop() { tune = analogRead(A7); //Read the input on analog pin 7: if (tune>560)up(); //Establish tuning direction if (tune<464)down(); //and idle zone if(millis()-post<50) show(); //Display the frequency } //****Functions**** void show() { //Display subroutine lcd.clear(); lcd.setCursor(0, 0); lcd.print ((BFO-LO)/1e3,3); //Calculate & show frequency if(tune>560)lcd.print(" >");//Tuning direction indicators if(tune<464)lcd.print(" <"); if(tune>464 && tune<560) lcd.print(" I"); //Idle indicator lcd.print(" KHz"); } void down() { LO = LO + (pow((464 - tune)/5,3)/100); //Increase local osc frequency (decreases T/R freq) si5351.set_freq(LO * 100, SI5351_CLK2);//Program the synthesizer delay(300);// To ease tuning post=millis();//Display } void up() { LO = LO - (pow((tune - 560)/5,3)/100); //Decrease local osc frequency (increases T/R freq) si5351.set_freq(LO * 100, SI5351_CLK2);//Program the synthesizer delay(300);// To ease tuning post=millis();//Display }