13
13
14
14
// You will need the SparkFun Toolkit. Click here to get it: http://librarymanager/All#SparkFun_Toolkit
15
15
16
- #include < SparkFun_ADS1219 .h> // Click here to get the library: http://librarymanager/All#SparkFun_ADS1219
16
+ #include < SparkFun_SiT5358 .h> // Click here to get the library: http://librarymanager/All#SparkFun_SiT5358
17
17
18
- SfeADS1219ArdI2C myADC ;
18
+ SfeSiT5358ArdI2C myTCXO ;
19
19
20
20
void setup ()
21
21
{
@@ -26,34 +26,33 @@ void setup()
26
26
{
27
27
delay (100 ); // Wait for the user to open the Serial Monitor
28
28
}
29
- Serial.println (" SparkFun ADS1219 Example" );
29
+ Serial.println (" SparkFun SiT5358 Example" );
30
30
31
31
Wire.begin (); // Begin the I2C bus
32
32
33
33
bool begun;
34
- begun = myADC.begin (Wire, 0x4F ); // Initialize the ADC - using a custom bus and address - see notes above
35
- begun = myADC.begin (0x4F ); // This is also possible. It defaults to Wire
34
+ begun = myTCXO.begin (Wire, 0x60 ); // Initialize the SiT5358 - using a custom bus and address
35
+ begun = myTCXO.begin (0x60 ); // This is also possible. It defaults to Wire
36
+ begun = myTCXO.begin (); // This is also possible. It defaults to Wire and address 0x60
36
37
37
38
if (!begun)
38
39
{
39
- Serial.println (" ADC not detected! Please check the address and try again..." );
40
+ Serial.println (" SiT5358 not detected! Please check the address and try again..." );
40
41
while (1 ); // Do nothing more
41
42
}
42
43
43
- Serial.println (" Reading the differential voltage between AIN0 (+) and AIN1 (-)" );
44
+ // Read the frequency control word - should be zero initially
45
+ int32_t fcw = myTCXO.getFrequencyControlWord ();
46
+ Serial.print (" The frequency control word is: " );
47
+ Serial.println (fcw);
48
+
49
+ // Read the pull range control
50
+ uint8_t prc = myTCXO.getPullRangeControl ();
51
+ Serial.print (" Pull range control is: " );
52
+ Serial.println (myTCXO.getPullRangeControlText (prc));
44
53
}
45
54
46
55
void loop ()
47
56
{
48
- myADC.startSync (); // Start a single-shot conversion.
49
-
50
- while (myADC.dataReady () == false ) // Check if the conversion is complete. This will return true if data is ready.
51
- {
52
- delay (10 ); // The conversion is not complete. Wait a little to avoid pounding the I2C bus.
53
- }
54
-
55
- myADC.readConversion (); // Read the conversion result from the ADC. Store it internally.
56
- int32_t sample = myADC.getConversionRaw (); // Get the raw ADC value. Note: this is NOT adjusted for gain.
57
- Serial.print (" Raw ADC value: " );
58
- Serial.println (sample); // Print the raw ADC value
57
+ // Nothing to do here
59
58
}
0 commit comments