Library to control Silicon Labs SI570 10 MHZ TO 1.4 GHZ I2C PROGRAMMABLE XO/VCXO.

Dependents:   t2d Thing2Do

Embed: (wiki syntax)

« Back to documentation index

SI570 Class Reference

SI570 Class Reference

Interface to the popular SI570 VCXO. More...

#include <SI570.h>

Public Member Functions

 SI570 (PinName sda, PinName scl, int address)
 Create an instance of the SI570 connected to specified I2C pins, with the specified address.
void si570reset (void)
 Resets the SI570.
double get_frequency (void)
 Read the current frequency.
double get_rfreq (void)
 Read the current rfreq value.
int get_n1 (void)
 Read the current n1.
int get_hsdiv (void)
 Read the current hsdiv.
int set_frequency (double frequency)
 Set a new frequency.

Detailed Description

Interface to the popular SI570 VCXO.

Definition at line 40 of file SI570.h.


Constructor & Destructor Documentation

SI570 ( PinName  sda,
PinName  scl,
int  address 
)

Create an instance of the SI570 connected to specified I2C pins, with the specified address.

Example:

 #include "mbed.h"
 #include "TextLCD.h"
 #include "SI570.h"
 #include "QEI.h"
 
 TextLCD lcd(p11, p12, p15, p16, p29, p30); // rs, e, d0-d3
 SI570 si570(p9, p10, 0xAA);
 QEI wheel (p5, p6, NC, 360);

 int main() {
     int wp,swp=0;
     float startfreq=7.0;
     float freq;

     while (1) {
         wp =  wheel.getPulses();
         freq=startfreq+wp*0.00001;
         if (swp != wp) {
             si570.set_frequency(freq);
             swp = wp;
         }                
         lcd.locate(0,0);
         lcd.printf("%f MHz", si570.get_frequency());
     }
 }
Parameters:
sdaThe I2C data pin
sclThe I2C clock pin
addressThe I2C address for this SI570

Definition at line 26 of file SI570.cpp.


Member Function Documentation

double get_frequency ( void   )

Read the current frequency.

get the SI570 registers an calculate the current frequency

Returns:
the current frequency

Definition at line 80 of file SI570.cpp.

int get_hsdiv ( void   )

Read the current hsdiv.

get the SI570 registers an calculate the current hsdiv

Returns:
the current hsdiv

Definition at line 95 of file SI570.cpp.

int get_n1 ( void   )

Read the current n1.

get the SI570 registers an calculate the current n1

Returns:
the current n1

Definition at line 90 of file SI570.cpp.

double get_rfreq ( void   )

Read the current rfreq value.

get the SI570 registers an calculate the current rfreq

Returns:
the current rfreq

Definition at line 85 of file SI570.cpp.

int set_frequency ( double  frequency )

Set a new frequency.

Set the SI570 registers to output frequency When the new frequency is within the 3500 PPM range of the center frequency, hsdiv and n1 needs not to be reprogrammed, resulting in a glitch free transition. For changes larger than 3500 PPM, the process of freezing and unfreezing the DCO will cause the output clock to momentarily stop and start at any arbitrary point during a clock cycle. This process can take up to 10 ms.

Parameters:
frequencythe frequency to set.
Returns:
the current frequency

Definition at line 100 of file SI570.cpp.

void si570reset ( void   )

Resets the SI570.

Resets and reads the startup configuration from the Si570

Definition at line 34 of file SI570.cpp.