Clock generator @ 145 MHz and 7 mhz

Dependencies:   Si5351A

Fork of Check_Si5351A_Clock_generator by Kenji Arai

Committer:
kenjiArai
Date:
Sat Jan 07 05:57:55 2017 +0000
Revision:
4:5981cf106502
Parent:
3:92f31b23fb0b
Child:
5:e32ef4b85317
support RANGE_EXTENDED mode, Freq range=1.627KHz to 300MHz, You need to modify si5351a.h definition (CAUTION : Out of specification)

Who changed what in which revision?

UserRevisionLine numberNew 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 4:5981cf106502 11 * Revised: January 7th, 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 4:5981cf106502 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 // Function prototypes --------------------------------------------------------
kenjiArai 1:2b29f68043f7 50 void msg_hlp(void);
kenjiArai 1:2b29f68043f7 51 void test(uint8_t channel);
kenjiArai 0:d68f1e7f7f49 52 void test_si5351(void);
kenjiArai 1:2b29f68043f7 53 void special_command(void);
kenjiArai 0:d68f1e7f7f49 54 void put_rn( void );
kenjiArai 0:d68f1e7f7f49 55 void put_r( void );
kenjiArai 0:d68f1e7f7f49 56 void put_lin( void );
kenjiArai 0:d68f1e7f7f49 57 void put_spc( uint8_t n);
kenjiArai 0:d68f1e7f7f49 58 int xatoi(char **str, int32_t *res);
kenjiArai 0:d68f1e7f7f49 59 void get_line(char *buff, int len);
kenjiArai 0:d68f1e7f7f49 60 void get_line_no_param(char *buff);