Created
October 19, 2025 14:23
-
-
Save sokil/595fdf10465b4e7626b0d61e2c4c652f to your computer and use it in GitHub Desktop.
rush_pll_test.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <cstdint> | |
| #include <cstdio> | |
| #define RUSH_REFERENCE_FREQ 50 // MHz | |
| #define RUSH_INTERMEDIATE_FREQ 480 // MHz | |
| #define RUSH_R_DIVIDER 1 | |
| #define RUSH_MOD 65536 | |
| #define RUSH_R_OUT_DIVIDER 1 | |
| #define FPFD (RUSH_REFERENCE_FREQ / RUSH_R_DIVIDER) | |
| int main () | |
| { | |
| uint16_t freq = 3400; | |
| uint16_t rfout = freq - RUSH_INTERMEDIATE_FREQ; | |
| float N = (float) rfout / FPFD / RUSH_R_OUT_DIVIDER; | |
| uint16_t INT = N; // rounded to lower | |
| uint32_t FRAC = (N - INT) * RUSH_MOD; | |
| printf("rfout: %d\n", rfout); | |
| printf("FPFD: %d\n", FPFD); | |
| printf("N: %f\n", N); | |
| printf("INT: %d\n", INT); | |
| printf("FRAC: %d\n", FRAC); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment