Clock generator @ 145 MHz and 7 mhz
Fork of Check_Si5351A_Clock_generator by
si5351a_check.h@1:2b29f68043f7, 2017-01-01 (annotated)
- Committer:
- kenjiArai
- Date:
- Sun Jan 01 01:33:59 2017 +0000
- Revision:
- 1:2b29f68043f7
- Parent:
- 0:d68f1e7f7f49
- Child:
- 2:73d79424daa5
clean up
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kenjiArai | 0:d68f1e7f7f49 | 1 | /* |
kenjiArai | 0:d68f1e7f7f49 | 2 | * mbed Application program / Si5351A sample program |
kenjiArai | 0:d68f1e7f7f49 | 3 | * tested on: |
kenjiArai | 0:d68f1e7f7f49 | 4 | * ST Nucleo-F411RE & F401RE |
kenjiArai | 0:d68f1e7f7f49 | 5 | * LPC1114FN28 |
kenjiArai | 0:d68f1e7f7f49 | 6 | * |
kenjiArai | 0:d68f1e7f7f49 | 7 | * Copyright (c) 2016,'17 Kenji Arai / JH1PJL |
kenjiArai | 0:d68f1e7f7f49 | 8 | * http://www.page.sannet.ne.jp/kenjia/index.html |
kenjiArai | 0:d68f1e7f7f49 | 9 | * http://mbed.org/users/kenjiArai/ |
kenjiArai | 0:d68f1e7f7f49 | 10 | * Created: December 28th, 2016 |
kenjiArai | 0:d68f1e7f7f49 | 11 | * Revised: January 1st, 2017 |
kenjiArai | 0:d68f1e7f7f49 | 12 | * |
kenjiArai | 0:d68f1e7f7f49 | 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
kenjiArai | 0:d68f1e7f7f49 | 14 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
kenjiArai | 0:d68f1e7f7f49 | 15 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
kenjiArai | 0:d68f1e7f7f49 | 16 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
kenjiArai | 0:d68f1e7f7f49 | 17 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR |
kenjiArai | 0:d68f1e7f7f49 | 18 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR |
kenjiArai | 0:d68f1e7f7f49 | 19 | * THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
kenjiArai | 0:d68f1e7f7f49 | 20 | */ |
kenjiArai | 0:d68f1e7f7f49 | 21 | |
kenjiArai | 0:d68f1e7f7f49 | 22 | // Definition ------------------------------------------------------------------------------------ |
kenjiArai | 0:d68f1e7f7f49 | 23 | #define BAUD(x) pc.baud(x) |
kenjiArai | 0:d68f1e7f7f49 | 24 | #define GETC(x) pc.getc(x) |
kenjiArai | 0:d68f1e7f7f49 | 25 | #define PUTC(x) pc.putc(x) |
kenjiArai | 0:d68f1e7f7f49 | 26 | #define PRINTF(...) pc.printf(__VA_ARGS__) |
kenjiArai | 0:d68f1e7f7f49 | 27 | #define READABLE(x) pc.readable(x) |
kenjiArai | 0:d68f1e7f7f49 | 28 | |
kenjiArai | 0:d68f1e7f7f49 | 29 | #define BAUD_RATE 9600 |
kenjiArai | 0:d68f1e7f7f49 | 30 | |
kenjiArai | 0:d68f1e7f7f49 | 31 | #if 0 |
kenjiArai | 0:d68f1e7f7f49 | 32 | #define INCREMENT // command 1,2,3 -> INCREMENT or TABLE_LOOK |
kenjiArai | 0:d68f1e7f7f49 | 33 | #endif |
kenjiArai | 0:d68f1e7f7f49 | 34 | #if !defined(INCREMENT) |
kenjiArai | 0:d68f1e7f7f49 | 35 | #define TABLE_LOOK |
kenjiArai | 0:d68f1e7f7f49 | 36 | #endif |
kenjiArai | 0:d68f1e7f7f49 | 37 | |
kenjiArai | 0:d68f1e7f7f49 | 38 | // Object --------------------------------------------------------------------- |
kenjiArai | 0:d68f1e7f7f49 | 39 | |
kenjiArai | 0:d68f1e7f7f49 | 40 | // RAM ------------------------------------------------------------------------ |
kenjiArai | 0:d68f1e7f7f49 | 41 | char linebuf[64]; |
kenjiArai | 0:d68f1e7f7f49 | 42 | int buf_size = sizeof(linebuf); |
kenjiArai | 0:d68f1e7f7f49 | 43 | |
kenjiArai | 0:d68f1e7f7f49 | 44 | // ROM / Constant data -------------------------------------------------------- |
kenjiArai | 0:d68f1e7f7f49 | 45 | char *const opening_msg = |
kenjiArai | 0:d68f1e7f7f49 | 46 | "Si5351 test program, created on UTC: "__DATE__"("__TIME__")"; |
kenjiArai | 0:d68f1e7f7f49 | 47 | char *const msg0 = "output: Please enter freq. ex 1230000"; |
kenjiArai | 0:d68f1e7f7f49 | 48 | |
kenjiArai | 0:d68f1e7f7f49 | 49 | static const uint32_t freq_tbl[] = |
kenjiArai | 0:d68f1e7f7f49 | 50 | { |
kenjiArai | 0:d68f1e7f7f49 | 51 | 4000, 5000, 8000, // 4KHz-8KHz |
kenjiArai | 0:d68f1e7f7f49 | 52 | 10000, 20000, 50000, 80000, // 10KHz-80KHz |
kenjiArai | 0:d68f1e7f7f49 | 53 | 100000, 200000, 500000, 800000, // 100KHz-800KHz |
kenjiArai | 0:d68f1e7f7f49 | 54 | 1000000, 2000000, 5000000, 8000000, // 1MHz-8MHz |
kenjiArai | 0:d68f1e7f7f49 | 55 | 10000000, 20000000, 50000000, 80000000, // 10MHz-80MHz |
kenjiArai | 0:d68f1e7f7f49 | 56 | 100000000, 150000000, 200000000, // 100MHz-200MHz |
kenjiArai | 0:d68f1e7f7f49 | 57 | 0 // Terminate data!! |
kenjiArai | 0:d68f1e7f7f49 | 58 | }; |
kenjiArai | 0:d68f1e7f7f49 | 59 | |
kenjiArai | 0:d68f1e7f7f49 | 60 | // Function prototypes -------------------------------------------------------- |
kenjiArai | 1:2b29f68043f7 | 61 | void msg_hlp(void); |
kenjiArai | 1:2b29f68043f7 | 62 | void test(uint8_t channel); |
kenjiArai | 0:d68f1e7f7f49 | 63 | void test_si5351(void); |
kenjiArai | 1:2b29f68043f7 | 64 | void special_command(void); |
kenjiArai | 0:d68f1e7f7f49 | 65 | void put_rn( void ); |
kenjiArai | 0:d68f1e7f7f49 | 66 | void put_r( void ); |
kenjiArai | 0:d68f1e7f7f49 | 67 | void put_lin( void ); |
kenjiArai | 0:d68f1e7f7f49 | 68 | void put_spc( uint8_t n); |
kenjiArai | 0:d68f1e7f7f49 | 69 | int xatoi(char **str, int32_t *res); |
kenjiArai | 0:d68f1e7f7f49 | 70 | void get_line(char *buff, int len); |
kenjiArai | 0:d68f1e7f7f49 | 71 | void get_line_no_param(char *buff); |