Baliza WSPR simple
#include <Wire.h>
#include <Adafruit_SI5351.h>
Adafruit_SI5351 clockgen = Adafruit_SI5351();
/**************************************************************************/
void setup(void)
{
Serial.begin(9600);
PLL_INIT();
SI_FREC(7.010);
}
/**************************************************************************/
void loop(void)
{
TX_WSPR();
delay(8900);
}
/**************************************************************************/
void PLL_INIT(){
if (clockgen.begin() != ERROR_NONE)
{
/* There was a problem detecting the IC ... check your connections */
while(1);
}
//int A=24,B=1,C=1; //Multiplica por 25=24+(1/1)
clockgen.setupPLL(SI5351_PLL_A, 24, 1, 1); //configuro PLL A
}
/**************************************************************************/
void SI_FREC(double frec){
double a,PLL,b,c=100000;
//PLL=25.0*25; //Multiplica por 25=24+(1/1)
PLL=625000000.0;
a=floor(PLL/frec);
b=((PLL/frec)-a)*c;
//Serial.println(a);
//Serial.println(b);
clockgen.setupMultisynth(0, SI5351_PLL_A, a, b, c); //salida CLK_0
clockgen.enableOutputs(true);
}
/**************************************************************************/
void TX_WSPR(){
byte WSPR_DATA[] = {3,3,0,2,2,0,2,0,1,0,2,0,1,1,1,0,2,2,3,0,2,1,2,3,1,3,1,2,0,
2,0,2,0,2,3,2,0,1,2,1,2,2,0,0,2,2,3,2,1,1,2,2,3,1,2,1,2,2,
0,3,3,2,3,0,2,0,2,1,3,2,3,2,3,0,3,0,1,0,2,3,2,2,3,0,3,3,0,
0,2,1,1,0,1,0,3,0,2,2,1,0,0,2,0,2,1,0,2,3,0,0,3,3,1,0,3,1,
0,0,1,3,0,3,0,0,2,3,3,1,2,0,0,0,0,1,0,1,2,2,3,1,0,2,0,0,2,
2,2,3,3,0,3,0,3,1,2,2,0,3,1,0,2,2};
double base_frec=7038600; //frecuencia USB.
double min_frec=1500; //1400 Hz a 1600 Hz.
double shift=1.4648; //1,4648 HZ
double frec_wspr=0.0;
double base=0;
//float time_bit=682.666666; //duracion bit, 682.7 milisegundos
int i;
//base= base_frec+min_frec;
// Serial.print(base);
for(i=0;i<162;i++){
//frec_wspr=base + shift*(float(WSPR_DATA[i]));
switch(WSPR_DATA[i]){
case 0: SI_FREC(7040100.000);break;
case 1: SI_FREC(7040101.465);break;
case 2: SI_FREC(7040102.930);break;
case 3: SI_FREC(7040104.394);break;
default:SI_FREC(7040400.000);break;
}
//SI_FREC(frec_wspr);
delay(682);
delayMicroseconds(666);
}
SI_FREC(0.0);
}