Frequency counter using GPS 1PPS signal and temperature controlled 50MHz Base clock. Ported from F411 Frequency Counter.
Dependencies: QEI DRV8830 PID ADT7410 TextLCD Frq_cuntr_Nucleo-F746ZG RingBuffer
Fork of Frequency_Counter_w_GPS_1PPS by
Please refer following.
/users/kenjiArai/notebook/frequency-counters/
Diff: main.cpp
- Revision:
- 15:ae0413277bc6
- Parent:
- 14:ba6ea409ab05
diff -r ba6ea409ab05 -r ae0413277bc6 main.cpp --- a/main.cpp Tue Dec 17 11:41:18 2019 +0000 +++ b/main.cpp Sun Dec 22 06:29:39 2019 +0000 @@ -8,7 +8,7 @@ * Created: October 18th, 2014 * Revised: January 2nd, 2015 * Re-started: June 25th, 2016 ported from F411 to F746 - * Revised: December 12th, 2019 + * Revised: December 22nd, 2019 * * Base program: Frequency_counter_w_GPS_1PPS (only for Nucleo-F411RE board) * https://developer.mbed.org/users/kenjiArai/code/Frequency_Counter_w_GPS_1PPS/ @@ -47,7 +47,6 @@ // Include -------------------------------------------------------------------- #include "mbed.h" -//#include "rtos.h" #include "GPSrcvr.h" #include "DRV8830.h" #include "ADT7410.h" @@ -96,27 +95,13 @@ using namespace Frequency_counter; // Object --------------------------------------------------------------------- -DigitalOut led_gate(LED1); -DigitalOut in_frq_slct(PC_9); -DigitalInOut prescaler10or20(PC_5); -DigitalIn pa1(PA_1); -Timer tmr0; -Timer tmr1; -Timer tmr2; -Ticker enter_irq; - +//DigitalOut led_gate(LED1); +DigitalIn pa1(PA_1); // GPS 1PPS input //**** UART Serial pc(USBTX, USBRX); - //**** Req. Counter FRQ_CUNTR fc(CLOCK_BASE); // External clock freq. -//**** Peltier temperature control -I2C i2cBus(PB_9,PB_8); // SDA, SCL -DRV8830 heater(i2cBus, (uint8_t)DRV8830ADDR_00); // H brige -PID pid(8.0f, 85.0f, 4.0f, 0.7f); // PID for oven -ADT7410 t(i2cBus, ADT7410ADDR_NN); // inside oven temp. - // RAM ------------------------------------------------------------------------ // all display data dispDef disp_data; @@ -161,6 +146,7 @@ void measure_freq_recipro(void const *args) { int32_t run2stop; + Timer tmr0; while(true) { tmr0.reset(); @@ -209,6 +195,13 @@ static uint32_t error_count = 3600; static int32_t keep_1sec; + //**** Peltier temperature control + I2C i2cBus(PB_9,PB_8); // SDA, SCL + DRV8830 heater(i2cBus, (uint8_t)DRV8830ADDR_00); // H brige + PID pid(8.0f, 85.0f, 4.0f, 0.7f); // PID for oven + ADT7410 t(i2cBus, ADT7410ADDR_NN); // inside oven temp. + Timer tmr2; + t.set_config(OPERATION_MODE_CONT + RESOLUTION_16BIT); pid.setInputLimits(0.0f, 5.0f); pid.setOutputLimits(0.0f, 5.0f); @@ -260,6 +253,7 @@ void display_data(void const *args) { int32_t tim_remain; + Timer tmr1; while(true){ tmr1.reset();