![]() |
Linduino
1.3.0
Linear Technology Arduino-Compatible Demonstration Board
|
Library for LTC6950: 1.4GHz Low Phase Noise, Low Jitter PLL with Clock Distribution. More...
Library for LTC6950: 1.4GHz Low Phase Noise, Low Jitter PLL with Clock Distribution.
Definition in file LTC6950.cpp.
Go to the source code of this file.
Functions | |
uint8_t | LTC6950_read (uint8_t cs, int8_t address) |
LTC6950 Read Single Address reads 8 bit Data field to LTC6950. More... | |
long | LTC6950_read_field (uint8_t cs, uint8_t address, uint8_t MSB_loc, uint8_t numbits) |
LTC6950 Read Single Field For SPI FIELDS located in 1 or multiple address location reads specific address locations identifies and returns specific field in question can handle SPI fields in multiple addresses, if MSB bit is in the lower number address. More... | |
long | get_LTC6950_SPI_FIELD (uint8_t cs, uint8_t f) |
Gets the LTC6950 SPI field value calls function LTC6950_read_field, which reads specific address locations identifies and returns specific field in question can handle SPI fields in multiple addresses, if MSB bit is in the lower number address. More... | |
void | LTC6950_write (uint8_t cs, uint8_t address, uint8_t Data) |
LTC6950 Write Single Address writes 8 bit Data field to LTC6950. More... | |
uint8_t | LTC6950_write_field (uint8_t cs, long field_data, uint8_t address, uint8_t MSB_loc, uint8_t numbits) |
LTC6950 Write Single Field For SPI FIELDS in 1 or multiple address locations reads specific address/field location then writes to specific field can handle SPI fields in multiple addresses, if MSB bit is in the lower number address. More... | |
uint8_t | get_LTC6950_REGSIZE () |
returns # of addresses in parts register map (array size) More... | |
uint8_t | get_LTC6950_SPI_FIELD_NUMBITS (uint8_t f) |
returns the number of bits for a given field name in the SPI map More... | |
uint8_t | get_LTC6950_SPI_FIELD_RW (uint8_t f) |
returns if the given field name is (0)read/write or (1)read_only field More... | |
void | set_LTC6950_SPI_FIELD (uint8_t cs, uint8_t f, long field_data) |
Sets the LTC6950 SPI field value calls function LTC6950_read_field, which reads specific address/field location then writes to specific field can handle SPI fields in multiple addresses, if MSB bit is in the lower number address. More... | |
void | set_LTC6950_ALLREGS (uint8_t cs, uint8_t reg01, uint8_t reg02, uint8_t reg03, uint8_t reg04, uint8_t reg05, uint8_t reg06, uint8_t reg07, uint8_t reg08, uint8_t reg09, uint8_t reg0A, uint8_t reg0B, uint8_t reg0C, uint8_t reg0D, uint8_t reg0E, uint8_t reg0F, uint8_t reg10, uint8_t reg11, uint8_t reg12, uint8_t reg13, uint8_t reg14, uint8_t reg15) |
Writes values to ALL LTC6950 RW addresses. More... | |
void | LTC6950_init () |
Initializes the SPI MAP arrays The values set in initialization are used for all the LTC6950 SPI/WRITE and read functions (set_LTC6950_SPI_FIELD, get_LTC6950_SPI_FIELD, LTC6950_read, LTC6950_write, etc, etc) More... | |
void | set_LTC6950_global_fref (unsigned long fref_MHz, unsigned long fref_Hz) |
sets globals LTC6950_Fref_MHz and LTC6950_Fref_Hz More... | |
void | set_LTC6950_global_frf (unsigned long frf_MHz, unsigned long frf_Hz) |
sets globals LTC6950_Frf_MHz and LTC6950_Frf_Hz More... | |
void | set_LTC6950_global_vcolim (unsigned long fvco_max_MHz, unsigned long fvco_max_Hz, unsigned long fvco_min_MHz, unsigned long fvco_min_Hz) |
sets globals LTC6950_VCO_Max_Freq_MHz, LTC6950_VCO_Max_Freq_Hz, LTC6950_VCO_Min_Freq_MHz and LTC6950_VCO_Min_Freq_Hz More... | |
unsigned long | get_LTC6950_global_fref_MHz () |
returns global LTC6950_Fref_MHz More... | |
unsigned long | get_LTC6950_global_fref_Hz () |
returns global LTC6950_Fref_Hz More... | |
unsigned long | get_LTC6950_global_frf_MHz () |
returns global LTC6950_Frf_MHz More... | |
unsigned long | get_LTC6950_global_frf_Hz () |
returns global LTC6950_Frf_Hz More... | |
unsigned long | get_LTC6950_global_VCO_MAX_MHz () |
returns global LTC6950_VCO_Max_Freq_MHz More... | |
unsigned long | get_LTC6950_global_VCO_MIN_MHz () |
returns global LTC6950_VCO_Min_Freq_MHz More... | |
unsigned long | get_LTC6950_global_VCO_MAX_Hz () |
returns global LTC6950_VCO_Max_Freq_Hz More... | |
unsigned long | get_LTC6950_global_VCO_MIN_Hz () |
returns global LTC6950_VCO_Min_Freq_Hz More... | |
unsigned long | LTC6950_calc_odiv (unsigned long frf[2]) |
calculates the output divider setting based on the frf and on board VCO frequencies of LTC6950 More... | |
void | LTC6950_set_frf () |
FUNCTION: LTC6950_set_frf Calculates the integer (N) and output divider (OD) SPI values using self created 64bit math functions. More... | |
void | prt (unsigned long an[]) |
Prints HEX representation of 64 bit an. More... | |
void | init64 (unsigned long an[], unsigned long bigPart, unsigned long littlePart) |
Creates a equivalent 64 bit number from 2 32 bit numbers. More... | |
void | HZto64 (unsigned long an[], unsigned long MHzPart, unsigned long HzPart) |
create a 64 bit Hz number from 32 bit xxxx MHz number and 32 bit yyy yyy Hz number. More... | |
void | shl64 (unsigned long an[]) |
Single Bit shift left of equivalent 64 bit number (an[] = an[]<<1) More... | |
void | shr64 (unsigned long an[]) |
Single Bit shift right of equivalent 64 bit number (an[] = an[]<<1) More... | |
void | shl64by (unsigned long an[], uint8_t shiftnum) |
Multi Bit shift left of equivalent 64 bit number (an[] = an[]<<shiftnum) More... | |
void | shr64by (unsigned long an[], uint8_t shiftnum) |
Multi Bit shift right of equivalent 64 bit number (an[] = an[]>>shiftnum) More... | |
void | add64 (unsigned long an[], unsigned long ann[]) |
64 bit Add ann to an (an[] = an[] + ann[]) More... | |
void | sub64 (unsigned long an[], unsigned long ann[]) |
64 bit Subtract ann from an (an[] = an[] - ann[]) More... | |
boolean | eq64 (unsigned long an[], unsigned long ann[]) |
64 bit, if an == ann, then true More... | |
boolean | lt64 (unsigned long an[], unsigned long ann[]) |
64 bit, if an < ann, then true More... | |
void | div64 (unsigned long num[], unsigned long den[]) |
64 bit Divide, num=num/div More... | |
void | mul64 (unsigned long an[], unsigned long ann[]) |
64 bit multiply, an=an*ann More... | |
Variables | |
uint8_t | LTC6950_reg [LTC6950_NUM_REGADDR] |
number of LTC6950 spi addresses More... | |
uint8_t | LTC6950_spi_map [(LTC6950_NUM_REGFIELD+1)][4] |
LTC6950 spi map, stores MSB address location, MSB bit location, field length in bits, and R or RW capability. More... | |
unsigned long | LTC6950_Fref_MHz = 100 |
Default Fref frequency - MHz portion (xxx); Fref = xxx, yyy,yyy. More... | |
unsigned long | LTC6950_Fref_Hz = 0 |
Default Fref frequency - Hz portion (yyy,yyy); Fref = x,xxx, yyy,yyy. More... | |
unsigned long | LTC6950_Frf_MHz = 250 |
Default Frf frequency - MHz portion (xxxx); Frf = x,xxx, yyy,yyy. More... | |
unsigned long | LTC6950_Frf_Hz = 0 |
Default Frf frequency - Hz portion (yyy,yyy); Frf = x,xxx, yyy,yyy. More... | |
unsigned long | LTC6950_VCO_Max_Freq_MHz = 1002 |
Max Vco frequency for default on board VCO - MHz portion (xxxx); Fvco max = xxx, yyy,yyy. More... | |
unsigned long | LTC6950_VCO_Min_Freq_MHz = 998 |
Min Vco frequency for default on board VCO - MHz portion (xxxx); Fvco min = x,xxx, yyy,yyy. More... | |
unsigned long | LTC6950_VCO_Max_Freq_Hz = 0 |
Max Vco frequency for default on board VCO - Hz portion (yyy,yyy); Fvco max = x,xxx, yyy,yyy. More... | |
unsigned long | LTC6950_VCO_Min_Freq_Hz = 0 |
Min Vco frequency for default on board VCO - Hz portion (yyy,yyy); Fvco min= x,xxx, yyy,yyy. More... | |
unsigned long | zero64 [] = {0,0} |
for 64bit math functions More... | |
void add64 | ( | unsigned long | an[], |
unsigned long | ann[] | ||
) |
64 bit Add ann to an (an[] = an[] + ann[])
an | 64 bit number, in 1x2 32bit array |
ann | 64 bit number, in 1x2 32bit array |
Definition at line 995 of file LTC6950.cpp.
void div64 | ( | unsigned long | num[], |
unsigned long | den[] | ||
) |
64 bit Divide, num=num/div
num | numerator: 64 bit number, in 1x2 32bit array |
den | denominator: 64 bit number, in 1x2 32bit array |
Definition at line 1044 of file LTC6950.cpp.
boolean eq64 | ( | unsigned long | an[], |
unsigned long | ann[] | ||
) |
64 bit, if an == ann, then true
an | 64 bit number, in 1x2 32bit array |
ann | 64 bit number, in 1x2 32bit array |
Definition at line 1023 of file LTC6950.cpp.
unsigned long get_LTC6950_global_fref_Hz | ( | ) |
unsigned long get_LTC6950_global_fref_MHz | ( | ) |
unsigned long get_LTC6950_global_frf_Hz | ( | ) |
unsigned long get_LTC6950_global_frf_MHz | ( | ) |
unsigned long get_LTC6950_global_VCO_MAX_Hz | ( | ) |
returns global LTC6950_VCO_Max_Freq_Hz
Definition at line 671 of file LTC6950.cpp.
unsigned long get_LTC6950_global_VCO_MAX_MHz | ( | ) |
returns global LTC6950_VCO_Max_Freq_MHz
Definition at line 661 of file LTC6950.cpp.
unsigned long get_LTC6950_global_VCO_MIN_Hz | ( | ) |
returns global LTC6950_VCO_Min_Freq_Hz
Definition at line 676 of file LTC6950.cpp.
unsigned long get_LTC6950_global_VCO_MIN_MHz | ( | ) |
returns global LTC6950_VCO_Min_Freq_MHz
Definition at line 666 of file LTC6950.cpp.
uint8_t get_LTC6950_REGSIZE | ( | ) |
returns # of addresses in parts register map (array size)
Definition at line 239 of file LTC6950.cpp.
long get_LTC6950_SPI_FIELD | ( | uint8_t | cs, |
uint8_t | f | ||
) |
Gets the LTC6950 SPI field value calls function LTC6950_read_field, which reads specific address locations identifies and returns specific field in question can handle SPI fields in multiple addresses, if MSB bit is in the lower number address.
cs | Chip Select Pin |
f | SPI field number |
Definition at line 161 of file LTC6950.cpp.
uint8_t get_LTC6950_SPI_FIELD_NUMBITS | ( | uint8_t | f | ) |
returns the number of bits for a given field name in the SPI map
f | SPI field number |
Definition at line 249 of file LTC6950.cpp.
uint8_t get_LTC6950_SPI_FIELD_RW | ( | uint8_t | f | ) |
returns if the given field name is (0)read/write or (1)read_only field
f | SPI field number |
Definition at line 259 of file LTC6950.cpp.
void HZto64 | ( | unsigned long | an[], |
unsigned long | MHzPart, | ||
unsigned long | HzPart | ||
) |
create a 64 bit Hz number from 32 bit xxxx MHz number and 32 bit yyy yyy Hz number.
A) if an < 2^32 bits:
B) if an > 2^32 bits (4,294,967,296):
an | 64 bit number, 1x2 32 bit array |
MHzPart | integer in MHZ |
HzPart | integer in Hz |
Definition at line 914 of file LTC6950.cpp.
void init64 | ( | unsigned long | an[], |
unsigned long | bigPart, | ||
unsigned long | littlePart | ||
) |
Creates a equivalent 64 bit number from 2 32 bit numbers.
an | 64 bit number, 1x2 32 bit array |
bigPart | upper 32 bits |
littlePart | lower 32 bits |
Definition at line 897 of file LTC6950.cpp.
boolean lt64 | ( | unsigned long | an[], |
unsigned long | ann[] | ||
) |
64 bit, if an < ann, then true
an | 64 bit number, in 1x2 32bit array |
ann | 64 bit number, in 1x2 32bit array |
Definition at line 1033 of file LTC6950.cpp.
unsigned long LTC6950_calc_odiv | ( | unsigned long | frf[2] | ) |
calculates the output divider setting based on the frf and on board VCO frequencies of LTC6950
frf | output frequency |
Definition at line 687 of file LTC6950.cpp.
void LTC6950_init | ( | ) |
Initializes the SPI MAP arrays The values set in initialization are used for all the LTC6950 SPI/WRITE and read functions (set_LTC6950_SPI_FIELD, get_LTC6950_SPI_FIELD, LTC6950_read, LTC6950_write, etc, etc)
Definition at line 319 of file LTC6950.cpp.
uint8_t LTC6950_read | ( | uint8_t | cs, |
int8_t | address | ||
) |
LTC6950 Read Single Address reads 8 bit Data field to LTC6950.
has to shift data by one bit to account for RW bit
cs | Chip Select Pin |
address | Register address for the LTC6950. |
Definition at line 105 of file LTC6950.cpp.
long LTC6950_read_field | ( | uint8_t | cs, |
uint8_t | address, | ||
uint8_t | MSB_loc, | ||
uint8_t | numbits | ||
) |
LTC6950 Read Single Field For SPI FIELDS located in 1 or multiple address location reads specific address locations identifies and returns specific field in question can handle SPI fields in multiple addresses, if MSB bit is in the lower number address.
cs | Chip Select Pin |
address | Register address for the LTC6950. |
MSB_loc | MSB bit location of field |
numbits | length of field (i.e. number of bits in field) |
Definition at line 125 of file LTC6950.cpp.
void LTC6950_set_frf | ( | ) |
FUNCTION: LTC6950_set_frf Calculates the integer (N) and output divider (OD) SPI values using self created 64bit math functions.
For Out0 only. Use menu 3 to set dividers to achieve desired frequencies on other outputs.
Datasheet equations
fpfd = fref/R
can be modified to the following equations
where
Linduino One (Arduino Uno) is limited to 32 bit floats/double/long. 32 bit math functions will create rounding errors with the above equations, tha can result in frequency errors. Therefore, the following code uses self created 64bit functions for 64bit integer math.
step 1: create 64 bit frf and fref numbers
step 2: calculate O (output divider)
step 3: get current R-divider setting
step 4: calculate frf*O*R
step 5: calculate N(11b), using value from step 1
step 6: find N for closest frequency - accounts for rounding with integer math
Definition at line 766 of file LTC6950.cpp.
void LTC6950_write | ( | uint8_t | cs, |
uint8_t | address, | ||
uint8_t | Data | ||
) |
LTC6950 Write Single Address writes 8 bit Data field to LTC6950.
has to shift data by one bit to account for RW bit
cs | Chip Select Pin |
address | Register address for the LTC6950. |
Data | 8-bit data to be written to register |
Definition at line 172 of file LTC6950.cpp.
uint8_t LTC6950_write_field | ( | uint8_t | cs, |
long | field_data, | ||
uint8_t | address, | ||
uint8_t | MSB_loc, | ||
uint8_t | numbits | ||
) |
LTC6950 Write Single Field For SPI FIELDS in 1 or multiple address locations reads specific address/field location then writes to specific field can handle SPI fields in multiple addresses, if MSB bit is in the lower number address.
cs | Chip Select Pin |
field_data | Value field value to be set to |
address | Register address for the LTC6950. |
MSB_loc | MSB bit location of field |
numbits | length of field (i.e. number of bits in field) |
Definition at line 188 of file LTC6950.cpp.
void mul64 | ( | unsigned long | an[], |
unsigned long | ann[] | ||
) |
64 bit multiply, an=an*ann
an | 64 bit number, in 1x2 32bit array |
ann | 64 bit number, in 1x2 32bit array |
Definition at line 1091 of file LTC6950.cpp.
void prt | ( | unsigned long | an[] | ) |
Prints HEX representation of 64 bit an.
an | 64 bit number, in 1x2 32bit array |
Definition at line 883 of file LTC6950.cpp.
void set_LTC6950_ALLREGS | ( | uint8_t | cs, |
uint8_t | reg01, | ||
uint8_t | reg02, | ||
uint8_t | reg03, | ||
uint8_t | reg04, | ||
uint8_t | reg05, | ||
uint8_t | reg06, | ||
uint8_t | reg07, | ||
uint8_t | reg08, | ||
uint8_t | reg09, | ||
uint8_t | reg0A, | ||
uint8_t | reg0B, | ||
uint8_t | reg0C, | ||
uint8_t | reg0D, | ||
uint8_t | reg0E, | ||
uint8_t | reg0F, | ||
uint8_t | reg10, | ||
uint8_t | reg11, | ||
uint8_t | reg12, | ||
uint8_t | reg13, | ||
uint8_t | reg14, | ||
uint8_t | reg15 | ||
) |
Writes values to ALL LTC6950 RW addresses.
cs | Chip Select Pin |
reg01 | LTC6950 register 1 |
reg02 | LTC6950 register 2 |
reg03 | LTC6950 register 3 |
reg04 | LTC6950 register 4 |
reg05 | LTC6950 register 5 |
reg06 | LTC6950 register 6 |
reg07 | LTC6950 register 7 |
reg08 | LTC6950 register 8 |
reg09 | LTC6950 register 9 |
reg0A | LTC6950 register 10 |
reg0B | LTC6950 register 11 |
reg0C | LTC6950 register 12 |
reg0D | LTC6950 register 13 |
reg0E | LTC6950 register 14 |
reg0F | LTC6950 register 15 |
reg10 | LTC6950 register 16 |
reg11 | LTC6950 register 17 |
reg12 | LTC6950 register 18 |
reg13 | LTC6950 register 19 |
reg14 | LTC6950 register 20 |
reg15 | LTC6950 register 21 |
Definition at line 282 of file LTC6950.cpp.
void set_LTC6950_global_fref | ( | unsigned long | fref_MHz, |
unsigned long | fref_Hz | ||
) |
sets globals LTC6950_Fref_MHz and LTC6950_Fref_Hz
Definition at line 619 of file LTC6950.cpp.
void set_LTC6950_global_frf | ( | unsigned long | frf_MHz, |
unsigned long | frf_Hz | ||
) |
sets globals LTC6950_Frf_MHz and LTC6950_Frf_Hz
Definition at line 625 of file LTC6950.cpp.
void set_LTC6950_global_vcolim | ( | unsigned long | fvco_max_MHz, |
unsigned long | fvco_max_Hz, | ||
unsigned long | fvco_min_MHz, | ||
unsigned long | fvco_min_Hz | ||
) |
sets globals LTC6950_VCO_Max_Freq_MHz, LTC6950_VCO_Max_Freq_Hz, LTC6950_VCO_Min_Freq_MHz and LTC6950_VCO_Min_Freq_Hz
Definition at line 631 of file LTC6950.cpp.
void set_LTC6950_SPI_FIELD | ( | uint8_t | cs, |
uint8_t | f, | ||
long | field_data | ||
) |
Sets the LTC6950 SPI field value calls function LTC6950_read_field, which reads specific address/field location then writes to specific field can handle SPI fields in multiple addresses, if MSB bit is in the lower number address.
cs | Chip Select Pin |
f | SPI field number |
field_data | Value field value to be set to |
Definition at line 272 of file LTC6950.cpp.
void shl64 | ( | unsigned long | an[] | ) |
Single Bit shift left of equivalent 64 bit number (an[] = an[]<<1)
an | an[] = an[]<<1 |
Definition at line 933 of file LTC6950.cpp.
void shl64by | ( | unsigned long | an[], |
uint8_t | shiftnum | ||
) |
Multi Bit shift left of equivalent 64 bit number (an[] = an[]<<shiftnum)
an | an[] = an[]<<shiftnum |
shiftnum | number of bits to shift left |
Definition at line 959 of file LTC6950.cpp.
void shr64 | ( | unsigned long | an[] | ) |
Single Bit shift right of equivalent 64 bit number (an[] = an[]<<1)
an | an[] = an[]>>shiftnum |
Definition at line 946 of file LTC6950.cpp.
void shr64by | ( | unsigned long | an[], |
uint8_t | shiftnum | ||
) |
Multi Bit shift right of equivalent 64 bit number (an[] = an[]>>shiftnum)
an | an[] = an[]>>shiftnum |
shiftnum | number of bits to shift right |
Definition at line 977 of file LTC6950.cpp.
void sub64 | ( | unsigned long | an[], |
unsigned long | ann[] | ||
) |
64 bit Subtract ann from an (an[] = an[] - ann[])
an | 64 bit number, in 1x2 32bit array |
ann | 64 bit number, in 1x2 32bit array |
Definition at line 1008 of file LTC6950.cpp.
unsigned long LTC6950_Fref_Hz = 0 |
Default Fref frequency - Hz portion (yyy,yyy); Fref = x,xxx, yyy,yyy.
Definition at line 90 of file LTC6950.cpp.
unsigned long LTC6950_Fref_MHz = 100 |
Default Fref frequency - MHz portion (xxx); Fref = xxx, yyy,yyy.
Definition at line 89 of file LTC6950.cpp.
unsigned long LTC6950_Frf_Hz = 0 |
Default Frf frequency - Hz portion (yyy,yyy); Frf = x,xxx, yyy,yyy.
Definition at line 92 of file LTC6950.cpp.
unsigned long LTC6950_Frf_MHz = 250 |
Default Frf frequency - MHz portion (xxxx); Frf = x,xxx, yyy,yyy.
Definition at line 91 of file LTC6950.cpp.
uint8_t LTC6950_reg[LTC6950_NUM_REGADDR] |
number of LTC6950 spi addresses
Definition at line 86 of file LTC6950.cpp.
uint8_t LTC6950_spi_map[(LTC6950_NUM_REGFIELD+1)][4] |
LTC6950 spi map, stores MSB address location, MSB bit location, field length in bits, and R or RW capability.
Definition at line 87 of file LTC6950.cpp.
unsigned long LTC6950_VCO_Max_Freq_Hz = 0 |
Max Vco frequency for default on board VCO - Hz portion (yyy,yyy); Fvco max = x,xxx, yyy,yyy.
Definition at line 95 of file LTC6950.cpp.
unsigned long LTC6950_VCO_Max_Freq_MHz = 1002 |
Max Vco frequency for default on board VCO - MHz portion (xxxx); Fvco max = xxx, yyy,yyy.
Definition at line 93 of file LTC6950.cpp.
unsigned long LTC6950_VCO_Min_Freq_Hz = 0 |
Min Vco frequency for default on board VCO - Hz portion (yyy,yyy); Fvco min= x,xxx, yyy,yyy.
Definition at line 96 of file LTC6950.cpp.
unsigned long LTC6950_VCO_Min_Freq_MHz = 998 |
Min Vco frequency for default on board VCO - MHz portion (xxxx); Fvco min = x,xxx, yyy,yyy.
Definition at line 94 of file LTC6950.cpp.
unsigned long zero64[] = {0,0} |
for 64bit math functions
Definition at line 98 of file LTC6950.cpp.