kopia lustrzana https://github.com/lightaprs/LightAPRS-W-1.0
66 wiersze
1.9 KiB
C++
Executable File
66 wiersze
1.9 KiB
C++
Executable File
/*
|
|
* si5351_vcxo.ino - Example for using the Si5351B VCXO functions
|
|
* with Si5351Arduino library
|
|
*
|
|
* Copyright (C) 2016 Jason Milldrum <milldrum@gmail.com>
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#include "si5351.h"
|
|
#include "Wire.h"
|
|
|
|
#define PLLB_FREQ 87600000000ULL
|
|
|
|
Si5351 si5351;
|
|
|
|
void setup()
|
|
{
|
|
// Start serial and initialize the Si5351
|
|
Serial.begin(57600);
|
|
si5351.init(SI5351_CRYSTAL_LOAD_8PF, 0, 0);
|
|
|
|
// Set VCXO osc to 876 MHz (146 MHz x 6), 40 ppm pull
|
|
si5351.set_vcxo(PLLB_FREQ, 40);
|
|
|
|
// Set CLK0 to be locked to VCXO
|
|
si5351.set_ms_source(SI5351_CLK0, SI5351_PLLB);
|
|
|
|
// Tune to 146 MHz center frequency
|
|
si5351.set_freq_manual(14600000000ULL, PLLB_FREQ, SI5351_CLK0);
|
|
|
|
si5351.update_status();
|
|
delay(500);
|
|
}
|
|
|
|
void loop()
|
|
{
|
|
// Read the Status Register and print it every 10 seconds
|
|
si5351.update_status();
|
|
Serial.print("corr: ");
|
|
Serial.print(si5351.get_correction());
|
|
Serial.print(" SYS_INIT: ");
|
|
Serial.print(si5351.dev_status.SYS_INIT);
|
|
Serial.print(" LOL_A: ");
|
|
Serial.print(si5351.dev_status.LOL_A);
|
|
Serial.print(" LOL_B: ");
|
|
Serial.print(si5351.dev_status.LOL_B);
|
|
Serial.print(" LOS: ");
|
|
Serial.print(si5351.dev_status.LOS);
|
|
Serial.print(" REVID: ");
|
|
Serial.println(si5351.dev_status.REVID);
|
|
|
|
delay(10000);
|
|
}
|