I am developing code to have a si5351 replace the crystals of a vintage 2m radio. I need to be able to calculate the frequency of both the receive and transmit crystals. My code for the transmit crystal frequency works but I can't get the the receive code to work. The receive crystal is much higher in frequency, than the transmit crystal. Anyway here is a code fragment, I am grateful for any help.
union longlong
{
unsigned long long c;
unsigned long a;
unsigned long b;
};
union longlong Mylonglong;
unsigned long long ReceiverFreq = 147165000;
void setup() {
Serial.begin(57600);
ReceiverFreq = ReceiverFreq - 10700000;
ReceiverFreq = ReceiverFreq / 3 ;
Mylonglong.c = ReceiverFreq;
Serial.print("rec freq ");
Serial.println(Mylonglong.a, DEC);
ReceiverFreq = ReceiverFreq * 100L;
Mylonglong.c = ReceiverFreq;
Serial.print("rec freq ");
Serial.println(Mylonglong.a, DEC); // the result I wanr is 454883300
}
void loop() {
}
Thanks:
For receive: CrystalFrequency = (Receive_frequency - 10700000) / 3
my Receive_frequency is 147165000
The Receive crystal frequency has to be multiplied by 100 to work with the si5351
For Transmit : transmitFRequency / 24
My Transmit frequency 147765000
The Transmit crystal frequency has to be multiplied by 100 to work with the si5351
It will certainly give you any frequency for any crystal you can buy. Remember ALL crystals have a error value that is NOT constant and varies by both temperature and other changes in the circuitry.
You are correct. I just converted an SSB rig to use the si5351. I keep the si5351 in a temperature controlled enclosure to ensure that it stays exactly on frequency.