LTC6904 - 1kHz - 68MHz Serial Port Programmable Oscillator
Features
- 1kHz to 68MHz Square Wave Output
- 0.5% (Typ) Initial Frequency Accuracy
- Frequency Error <1.1% Over All Settings
- 10ppm/°C Typical Frequency Drift Over Temperature
- 0.1% Resolution
- 1.7mA Typical Supply Current (f < 1MHz, VS = 2.7V)
- 2.7V to 5.5V Single Supply Operation
- Jitter <0.4% Typical 1kHz to 8MHz
- Easy to Use SPI (LTC6903) or I2C (LTC6904) Serial Interface
- Output Enable Pin
- –55°C to 125°C Operation
- MS8 Package
AEC-Q100 data available for specific packages
Typical Application
Description
The LTC6903/LTC6904 are low power self contained digital frequency sources providing a precision frequency from 1kHz to 68MHz, set through a serial port. The LTC6903/ LTC6904 require no external components other than a power supply bypass capacitor, and they operate over a single wide supply range of 2.7V to 5.5V.
The LTC6903/LTC6904 feature a proprietary feedback loop that linearizes the relationship between digital control setting and frequency, resulting in a very simple frequency setting equation:
Packaging
CAD Symbols and Footprints: The downloadable Zip file below contains the schematic symbol and PCB footprints.
For complete and up to date package information and drawings, please refer to our packaging page
| Part Number | Package | Code | Temp | Package Drawing |
RoHS |
|---|---|---|---|---|---|
| LTC6904CMS8#PBF | MS-8 | MS8 | C | 05-08-1660 | Yes |
| LTC6904CMS8#TRPBF | MS-8 | MS8 | C | 05-08-1660 | Yes |
| LTC6904HMS8#PBF | MS-8 | MS8 | H | 05-08-1660 | Yes |
| LTC6904HMS8#TRPBF | MS-8 | MS8 | H | 05-08-1660 | Yes |
| LTC6904IMS8#PBF | MS-8 | MS8 | I | 05-08-1660 | Yes |
| LTC6904IMS8#TRPBF | MS-8 | MS8 | I | 05-08-1660 | Yes |
| LTC6904MPMS8#PBF | MS-8 | MS8 | MP | 05-08-1660 | Yes |
| LTC6904MPMS8#TRPBF | MS-8 | MS8 | MP | 05-08-1660 | Yes |
Order Info
- Part numbers ending in PBF are lead free. Solder plated terminal finish (SnPb) versions are non-standard and special terms and conditions and pricing applies if available. Please contact LTC marketing for information.
- Part numbers containing TR or TRM are shipped in tape and reel or 500 unit mini tape and reel, respectively
- Please refer to our general ordering information or the product datasheet for more details
Package Variations and Pricing
| Part Number | Package | Temp | Price (1-99) |
Price (1k)* |
RoHS | |
|---|---|---|---|---|---|---|
| LTC6904CMS8#PBF | MS-8 | C | $2.60 | $2.10 | Yes | |
| LTC6904CMS8#TRPBF | MS-8 | C | $2.16 | Yes | ||
| LTC6904HMS8#PBF | MS-8 | H | $2.99 | $2.42 | Yes | |
| LTC6904HMS8#TRPBF | MS-8 | H | $2.48 | Yes | ||
| LTC6904IMS8#PBF | MS-8 | I | $2.99 | $2.42 | Yes | |
| LTC6904IMS8#TRPBF | MS-8 | I | $2.48 | Yes | ||
| LTC6904MPMS8#PBF | MS-8 | MP | $8.78 | $6.30 | Yes | |
| LTC6904MPMS8#TRPBF | MS-8 | MP | $8.84 | $6.36 | Yes | |
| Buy Now • Request Samples | ||||||
Demo Boards
Linear Technology offers many demo boards free of charge to qualified customers. Contact your local sales office or distributor to inquire about a demo board. Certain demo boards are also available for sale via credit card on this website. Demo boards are for evaluation purposes only. It remains the customer’s responsibility to verify proper and reliable operation in the actual end application.| Part Number | Description | Price | Documentation |
|---|---|---|---|
| DC726B-B | LTC6904 Demo Board | 1kHz to 68MHz Serial Port Programmable Oscillator (req DC2026) | $100.00 | |
| Buy Now | |||
Companion Boards
| Part Number | Description | Price | Documentation |
|---|---|---|---|
| DC2026C | Linduino One Isolated USB Demo Board: An Arduino- and QuikEval-Compatible Code Development Platform | $75.00 | |
| DC590B | Isolated USB Serial Controller for Linear Technology QuikEval-Compatible Demo Boards | $50.00 | |
| Buy Now | |||
Designed for Automotive and Transportation Applications
AEC-Q100 data is available for these specific part numbers. Please contact your local sales representative for more information regarding reliability reports or to inquire about parts that are not included. For more information, view our Automotive and Transportation page
| Part Number | Package | Temp | Price (1-99) |
Price (1k)* |
RoHS | |
|---|---|---|---|---|---|---|
| LTC6904HMS8#PBF | MS-8 | H | $2.99 | $2.42 | Yes | |
| LTC6904HMS8#TRPBF | MS-8 | H | $2.48 | Yes | ||
| LTC6904IMS8#PBF | MS-8 | I | $2.99 | $2.42 | Yes | |
| LTC6904IMS8#TRPBF | MS-8 | I | $2.48 | Yes | ||
| LTC6904MPMS8#PBF | MS-8 | MP | $8.78 | $6.30 | Yes | |
| LTC6904MPMS8#TRPBF | MS-8 | MP | $8.84 | $6.36 | Yes | |
| Buy Now • Request Samples | ||||||
Applications
- Precision Digitally Controlled Oscillator
- Power Management
- Direct Digital Frequency Synthesis (DDS) Replacement
- Replacement for DAC and VCO
- Switched Capacitor Filter Clock
People Who Viewed This Product Also Viewed
- LTC6903 - 1kHz – 68MHz Serial Port Programmable Oscillator
- LTC1799 - 1kHz to 33MHz Resistor Set SOT-23 Oscillator
- LT3080 - Adjustable 1.1A Single Resistor Low Dropout Regulator
- LT5400 - Quad Matched Resistor Network
- LTC6905 - 17MHz to 170MHz Resistor Set SOT-23 Oscillator
- LTC6992 - TimerBlox: Voltage-Controlled Pulse Width Modulator (PWM)
- LTC6655 - 0.25ppm Noise, Low Drift Precision References
- LT4320/LT4320-1 - Ideal Diode Bridge Controller
- LT1763 - 500mA, Low Noise, LDO Micropower Regulators
- LTC6990 - TimerBlox: Voltage Controlled Silicon Oscillator
Product Notifications
Please login to your MyLinear account for notifications of datasheet updates, new document releases and LTspice model announcements for your favorite products. If you do not have a MyLinear account you may Sign Up Now.
Forgot your password? Click here.
Need help? Email mylinear@linear.com with questions and comments.
Design Tools
Linduino
Linduino is an Arduino compatible platform for developing and distributing firmware libraries and code for SPI and I²C-compatible integrated circuits. The Linduino One board interfaces to more than 300 QuikEval demonstration cards, supporting a variety of product types including analog-to-digital converters (ADCs), digital-to-analog converters (DACs), power monitors, and more. Firmware libraries for individual devices are written in C and designed to be portable to a wide variety of processors and microcontrollers. Each library has a demonstration program that can be uploaded to the Linduino One platform to allow the circuit and software to be quickly and easily verified.
OscCalc, an Excel based selection and synthesis tool, allows you to choose and configure the Silicon Oscillator best suited for your application.
- Download and open OscCalc
- Enable Macros
- Enter your desired switching frequency. Suitable silicon oscillators will be highlighted in green. Clicking on a part will show you the external component values and settings required to achieve your desired switching frequency.
Code
Linduino is Linear Technology's Arduino compatible system for developing and distributing firmware libraries and example code for Linear Technology’s integrated circuits. The code below can be downloaded or copied and pasted into your project. Please visit the Linduino Home Page for demo board, manual and setup information.
This part is Code Supported: There is example code available for this part. The code below may rely on other drivers available in the full library.
Download LTC6904 - DC726B_B Linduino.INO File
/*!
Linear Technology DC726B-B (or DC726A-B) Demonstration Board.
LTC6904: 1kHz to 68MHz Serial Port Programmable Oscillator
@verbatim
NOTES
Setup:
Set the terminal baud rate to 115200 and select the newline terminator. Equipment
required is a precision voltage source and a precision voltmeter (to monitor
voltage source). No external power supply is required. Ensure JP1 is installed in
the default position from the factory.
Demo Board Configuration:
To properly use this program with the DC726B-B demo board (or the DC726A-B), JMP 2
needs to be set to QuikEval.
USER INPUT DATA FORMAT:
decimal : 1024
hex : 0x400
octal : 02000 (leading 0 "zero")
binary : B10000000000
float : 1024.0
@endverbatim
http://www.linear.com/product/LTC6904
http://www.linear.com/product/LTC6904#demoboards
REVISION HISTORY
$Revision: 3592 $
$Date: 2015-06-10 11:50:47 -0700 (Wed, 10 Jun 2015) $
Copyright (c) 2013, Linear Technology Corp.(LTC)
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of Linear Technology Corp.
The Linear Technology Linduino is not affiliated with the official Arduino team.
However, the Linduino is only possible because of the Arduino team's commitment
to the open-source community. Please, visit http://www.arduino.cc and
http://store.arduino.cc , and consider a purchase that will help fund their
ongoing work.
*/
/*! @file
@ingroup LTC6904
*/
#include <Arduino.h>
#include <stdint.h>
#include "Linduino.h"
#include "UserInterface.h"
#include "LT_I2C.h"
#include "QuikEval_EEPROM.h"
#include "LTC6904.h"
#include <Wire.h>
// Function Declaration
void print_title();
void print_prompt();
void settings();
uint8_t set_frequency();
uint8_t manually_set_reg();
// Global variables
static uint8_t output_config = LTC6904_CLK_ON_CLK_INV_ON; //!< Keeps track of output configuration.
//! Initialize Linduino
void setup()
{
quikeval_I2C_init(); // Configure the EEPROM I2C port for 100kHz
quikeval_I2C_connect(); // Connect I2C to main data port
Serial.begin(115200); // Initialize the serial port to the PC
print_title();
print_prompt();
}
//! Repeats Linduino loop
void loop()
{
int16_t user_command;
uint8_t ack = 0;
user_command = read_int();
Serial.println(user_command);
switch(user_command)
{
case 1:
ack = set_frequency();
break;
case 2:
ack = manually_set_reg();
break;
case 3:
settings();
break;
default:
Serial.println(F("Invalid command"));
break;
}
// A buffer is used for SDA to the LTC6904.
// This does not allow the Linduino to observe an
// I2C ACK. Thus, the following code is not used
// to ignore the NACK.
/*
if(ack == 1)
{
Serial.println();
Serial.println(F("I2C ACK Error"));
}
*/
print_prompt();
}
//! Prints the title block when program first starts.
void print_title()
{
Serial.println();
Serial.println(F("*****************************************************************"));
Serial.println(F("* DC726A Demonstration Program *"));
Serial.println(F("* *"));
Serial.println(F("* This program demonstrates how to send data to the *"));
Serial.println(F("* programmable oscillator *"));
Serial.println(F("* *"));
Serial.println(F("* Set the baud rate to 115200 and select the newline terminator.*"));
Serial.println(F("* *"));
Serial.println(F("*****************************************************************"));
}
//! Prints main menu.
void print_prompt()
{
Serial.println();
Serial.println(F("1-Set frequency out"));
Serial.println(F("2-Manually set OCT and DAC code"));
Serial.println(F("3-Settings"));
Serial.println();
Serial.print(F("Enter a command:"));
}
//! Sets the output frequency.
//! @return the ACK if 0, NACK if 1
uint8_t set_frequency()
{
float freq;
uint16_t clock_code;
uint8_t ack;
Serial.print(F("Enter the desired clock freq (KHz):"));
freq = read_float();
Serial.println(freq, 4);
// Calculates the code necessary to create the clock frequency
clock_code = LTC6904_frequency_to_code(freq/1000, output_config);
ack = LTC6904_write(LTC6904_ADDRESS, (uint16_t)clock_code);
return(ack);
}
//! Manually Sets OCT and DAC Code
//! @return ack
uint8_t manually_set_reg()
{
uint8_t oct;
uint8_t ack;
uint16_t dac_code;
Serial.print(F("Enter the OCT:"));
oct = read_int();
if(oct > 15)
oct = 15;
Serial.println(oct);
Serial.println();
Serial.print(F("Enter the DAC code:"));
dac_code = read_int();
Serial.println(dac_code);
Serial.println();
// Manually set registers
ack = LTC6904_write(LTC6904_ADDRESS, (uint16_t)((oct<<12)|(dac_code<<2)|output_config));
return(ack);
}
//! Configures the output
void settings()
{
int16_t user_command;
Serial.println();
Serial.println(F("Output Configuration"));
Serial.println(F("1-CLK On and CLK INV ON"));
Serial.println(F("2-CLK Off and CLK INV ON"));
Serial.println(F("3-CLK On and CLK INV Off"));
Serial.println(F("4-Power Down"));
Serial.println();
Serial.print(F("Enter a command:"));
user_command = read_int();
Serial.println(user_command);
switch(user_command)
{
case 1:
output_config = LTC6904_CLK_ON_CLK_INV_ON;
break;
case 2:
output_config = LTC6904_CLK_OFF_CLK_INV_ON;
break;
case 3:
output_config = LTC6904_CLK_ON_CLK_INV_OFF;
break;
case 4:
output_config = LTC6904_POWER_DOWN;
break;
default:
Serial.println(F("Invalid command"));
}
}
Download LTC6904 - Linduino Header File
/*!
LTC6904: 1kHz to 68MHz Serial Port Programmable Oscillator
@verbatim
The LTC6903/LTC6904 are low power self contained digital
frequency sources providing a precision frequency from
1kHz to 68MHz, set through a serial port. The LTC6903/
LTC6904 require no external components other than a
power supply bypass capacitor, and they operate over a
single wide supply range of 2.7V to 5.5V.
@endverbatim
http://www.linear.com/product/LTC6904
http://www.linear.com/product/LTC6904#demoboards
REVISION HISTORY
$Revision: 2172 $
$Date: 2014-01-22 10:25:19 -0800 (Wed, 22 Jan 2014) $
Copyright (c) 2013, Linear Technology Corp.(LTC)
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of Linear Technology Corp.
The Linear Technology Linduino is not affiliated with the official Arduino team.
However, the Linduino is only possible because of the Arduino team's commitment
to the open-source community. Please, visit http://www.arduino.cc and
http://store.arduino.cc , and consider a purchase that will help fund their
ongoing work.
*/
/*! @file
@ingroup LTC6904
Library Header File for LTC6904: 1kHz to 68MHz Serial Port Programmable Oscillator
*/
#ifndef LTC6904_H
#define LTC6904_H
// LT6904 address options
// Uncomment the desired address
#define LTC6904_ADDRESS 0x17 //!< ADR 0
//#define LTC6904_ADDRESS 0x16 //!< ADR 1
/*!
@{
| OCT Options | f>= (MHz) | f< (MHz) |
| :----------- | :--------: | :-------: |
| LTC6904_OCT_15 | 34.05 | 68.03 |
| LTC6904_OCT_14 | 17.02 | 34.01 |
| LTC6904_OCT_13 | 8.5111 | 17.01 |
| LTC6904_OCT_12 | 4.256 | 8.503 |
| LTC6904_OCT_11 | 2.128 | 4.252 |
| LTC6904_OCT_10 | 1.064 | 2.126 |
| LTC6904_OCT_9 | 0.532 | 1.063 |
| LTC6904_OCT_8 | 0.266 | 0.5314 |
| LTC6904_OCT_7 | 0.133 | 0.2657 |
| LTC6904_OCT_6 | 0.0665 | 0.1329 |
| LTC6904_OCT_5 | 0.03325 | 0.06643 |
| LTC6904_OCT_4 | 0.01662 | 0.03322 |
| LTC6904_OCT_3 | 0.008312 | 0.01661 |
| LTC6904_OCT_2 | 0.004156 | 0.008304 |
| LTC6904_OCT_1 | 0.002078 | 0.004152 |
| LTC6904_OCT_0 | 0.001039 | 0.002076 |
*/
// OCT Options
// f>= (MHz) | f< (MHz)
#define LTC6904_OCT_15 0x0F // 34.05 | 68.03
#define LTC6904_OCT_14 0x0E // 17.02 | 34.01
#define LTC6904_OCT_13 0x0D // 8.5111 | 17.01
#define LTC6904_OCT_12 0x0C // 4.256 | 8.503
#define LTC6904_OCT_11 0x0B // 2.128 | 4.252
#define LTC6904_OCT_10 0x0A // 1.064 | 2.126
#define LTC6904_OCT_9 0x09 // 0.532 | 1.063
#define LTC6904_OCT_8 0x08 // 0.266 | 0.5314
#define LTC6904_OCT_7 0x07 // 0.133 | 0.2657
#define LTC6904_OCT_6 0x06 // 0.0665 | 0.1329
#define LTC6904_OCT_5 0x05 // 0.03325 | 0.06643
#define LTC6904_OCT_4 0x04 // 0.01662 | 0.03322
#define LTC6904_OCT_3 0x03 // 0.008312 | 0.01661
#define LTC6904_OCT_2 0x02 // 0.004156 | 0.008304
#define LTC6904_OCT_1 0x01 // 0.002078 | 0.004152
#define LTC6904_OCT_0 0x00 // 0.001039 | 0.002076
//! @}
// Output Configuration
#define LTC6904_CLK_ON_CLK_INV_ON 0x00 //!< Clock on, inverted clock on
#define LTC6904_CLK_OFF_CLK_INV_ON 0x01 //!< Clock off, inverted clock on
#define LTC6904_CLK_ON_CLK_INV_OFF 0x02 //!< Clock on, inverted clock off
#define LTC6904_POWER_DOWN 0x03 //!< Powers down clocks
//! Writes 2 bytes
//! @return 1 if successful, 0 if failure
uint8_t LTC6904_write(uint8_t address, //!< I2C address
uint16_t code //!< Code to be written
);
//! Calculates the code necessary to create the clock frequency
//! @return the code for the LTC6904
uint16_t LTC6904_frequency_to_code(float frequency, //!< Clock frequency in MHz
uint8_t clk //!< Output configuration
);
#endif
Download LTC6904 - Linduino.CPP File
/*!
LTC6904: 1kHz to 68MHz Serial Port Programmable Oscillator
@verbatim
The LTC6903/LTC6904 are low power self contained digital
frequency sources providing a precision frequency from
1kHz to 68MHz, set through a serial port. The LTC6903/
LTC6904 require no external components other than a
power supply bypass capacitor, and they operate over a
single wide supply range of 2.7V to 5.5V.
@endverbatim
http://www.linear.com/product/LTC6904
http://www.linear.com/product/LTC6904#demoboards
REVISION HISTORY
$Revision: 2172 $
$Date: 2014-01-22 10:25:19 -0800 (Wed, 22 Jan 2014) $
Copyright (c) 2013, Linear Technology Corp.(LTC)
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of Linear Technology Corp.
The Linear Technology Linduino is not affiliated with the official Arduino team.
However, the Linduino is only possible because of the Arduino team's commitment
to the open-source community. Please, visit http://www.arduino.cc and
http://store.arduino.cc , and consider a purchase that will help fund their
ongoing work.
*/
//! @defgroup LTC6904 LTC6904: 1kHz to 68MHz Serial Port Programmable Oscillator
/*! @file
@ingroup LTC6904
Library for LTC6904: 1kHz to 68MHz Serial Port Programmable Oscillator
*/
#include <stdint.h>
#include <Arduino.h>
#include "Linduino.h"
#include "LT_I2C.h"
#include "LTC6904.h"
#include <Wire.h>
#include "math.h"
// Writes 2 bytes
uint8_t LTC6904_write(uint8_t address, uint16_t code)
{
uint8_t ack;
ack = i2c_write_byte_data(address, (0x0FF00 & code)>>8, 0x0FF & code);
return(ack);
}
// Calculates the code necessary to create the clock frequency
// Returns the Code for the LTC6904
uint16_t LTC6904_frequency_to_code(float frequency, uint8_t clk)
{
uint8_t oct;
double oct_double;
float float_dac;
uint16_t dac;
// Calculate OCT
oct_double = log10((double)((frequency*1000000)/1039));
oct_double *= 3.322;
// Keep OCT within range
if(oct_double>15)
oct = 15;
if(oct_double<0)
oct = 0;
oct = (uint8_t)oct_double; // Cast as uint8_t , round down
// Calculate DAC code
float_dac = 2048-(2078*pow(2, (10+ oct)))/(frequency*1000000); // Calculate the dac code
float_dac = (float_dac > (floor(float_dac) + 0.5)) ? ceil(float_dac) : floor(float_dac); // Round
// Keep DAC within range
if(float_dac>1023)
float_dac = 1023;
if(float_dac<0)
float_dac = 0;
dac = (uint16_t)float_dac; // Cast as uint16_t
return((uint16_t)((oct<<12)| (dac<<2) | clk));
}Technical Support
- For immediate technical assistance, contact your local sales office or distributor or call 1-800-4-LINEAR (US customers only) or 408-432-1900.
- For less urgent requests, please complete our Technical Support Request Form. Please allow 2-3 business days for reply.