Skip to main content

Nov 23, 2024. BFO Code for the TR-3 with a 9MHz Filter

 


   /* This is the  use of the Xiao RP2040 and the Si5351 for a BFO for the TR3
         *
         *
         *
         *
         *
         *
         */








        #include "xiaoRP2040pinNums.h" // Or use the device pin numbers with "u" suffix.
        #include <Wire.h>
       
        #include "si5351.h"
        
        #define i2cSDA D4
        #define i2cSCL D5

      
      
        
       
        
        
      
        
        
        // Values in whole integer Hz
        
        uint32_t bfo = 8998500;    // Declared as a 32-bit unsigned integer
        

       

        
        Si5351 si5351;
       
        
        ////========================================
        ////******** FUNCTION: setup ***************
        ////========================================
        void setup() {

          Serial.begin(57600);

          
          
          Wire.begin();
              
          // Initialize the Si5351
          si5351.init(SI5351_CRYSTAL_LOAD_8PF, 0, 0);             
          
          // Set Si5351 Clocks
          
          si5351.set_freq(bfo* 100, SI5351_CLK2);   // in integer hundredths of Hz (whole Hz times 100)

          si5351.set_correction(1000,SI5351_PLL_INPUT_XO);
          
          
          si5351.drive_strength(SI5351_CLK2,SI5351_DRIVE_8MA);


          
          pinMode(2u, INPUT_PULLUP);   // usb/Lsb select          
          


        }



        

        
        




         
       // End of setup()
        
        //========================================
        //********* FUNCTION: (main)loop *********
        //========================================
        void loop() {   // Empty

            
        
       
          checkSideband();

          
       
         }

                 
                
                  


                 
                 
               
                


                 



                  
      
      

  //********************* Check Sideband********************

          
                  void checkSideband(){
      
                if(digitalRead(2u)){  //********If SW is true do the following.    
           
           
                 bfo = 8998500L;

                if (bfo = 8998500L);
                si5351.set_freq( bfo*100, SI5351_CLK2);
           
           
          
                
          
                }
                  else{                //**********if not, do this.
          
          
          
         
                 bfo =  9001500L;
                 si5351.set_freq( bfo*100, SI5351_CLK2);
             
             
             
                 }

    
         }   
        
      

Popular posts from this blog

No work done on Sunday but something did arrive from Amazon.

The Mostly Vacuum Tube Wireless: Some final tasks before the Big Smoke Test.

First Contact with the Mostly Vacuum Tube Wireless Set.

The Last Posting on the Mostly Vacuum Tube SSB Transceiver.

Lots of work done on Saturday. About 90% done with the wiring and hookup.

Is something wrong with this picture?

Wires, and more Wires, everywhere. More installations & Sharing Info.