Skip to content

Instantly share code, notes, and snippets.

@mroger
Created August 23, 2014 02:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mroger/75e4ef0f8105b6ea995c to your computer and use it in GitHub Desktop.
Save mroger/75e4ef0f8105b6ea995c to your computer and use it in GitHub Desktop.
Shows the calculation of the PLL information
void TEA5767N::transmitFrequency(float frequency) {
setFrequency(frequency);
transmitData();
}
void TEA5767N::setFrequency(float _frequency) {
frequency = _frequency;
unsigned int frequencyW;
if (hiInjection) {
setHighSideLOInjection();
frequencyW = 4 * ((frequency * 1000000) + 225000) / 32768;
} else {
setLowSideLOInjection();
frequencyW = 4 * ((frequency * 1000000) - 225000) / 32768;
}
transmission_data[FIRST_DATA] = ((transmission_data[FIRST_DATA] & 0xC0) | ((frequencyW >> 8) & 0x3F));
transmission_data[SECOND_DATA] = frequencyW & 0XFF;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment