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 Kenji Arai

Please refer following.
/users/kenjiArai/notebook/frequency-counters/

Revision:
11:20e7a45f1448
Parent:
9:e98e94ba17f9
Child:
13:1041596c416c
--- a/main.cpp	Thu Jan 01 05:24:19 2015 +0000
+++ b/main.cpp	Fri Jan 02 10:40:50 2015 +0000
@@ -5,7 +5,7 @@
  *  http://www.page.sannet.ne.jp/kenjia/index.html
  *  http://mbed.org/users/kenjiArai/
  *      Created: October   18th, 2014
- *      Revised: January    1st, 2015
+ *      Revised: January    2nd, 2015
  *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
  * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
@@ -27,6 +27,7 @@
 #include "PID.h"
 #include "frq_cuntr_full.h"
 #include "CheckRTC.h"
+#include "iSerial.h"
 #include "gps.h"
 
 using namespace Frequency_counter;
@@ -61,8 +62,10 @@
 
 //  Object ----------------------------------------------------------------------------------------
 DigitalOut  led_gate(LED1);
-Serial      pc(USBTX, USBRX);
-Serial      gps(NC, PA_10);             // GPS RX
+//Serial      pc(USBTX, USBRX);
+iSerial     pc(USBTX, USBRX, 1024, 32);
+//Serial      gps(NC, PA_10); // GPS RX
+iSerial     gps(PA_9, PA_10, 32, 1024); // GPS RX
 I2C         i2cBus(PB_9,PB_8);  // SDA, SCL
 DRV8830     heater(i2cBus, (uint8_t)DRV8830ADDR_00);
 ADT7410     t(i2cBus, ADT7410ADDR_NN);
@@ -105,9 +108,7 @@
 static char *const msg_msg3  = "    "__DATE__" ";
 
 //  Function prototypes ---------------------------------------------------------------------------
-void gps_rcv(void);
 uint32_t check_gps_ready(void);
-uint8_t check_gps_rmc_ready(void);
 void get_time_and_date(struct tm *pt);
 void getline_gps(void);
 
@@ -130,6 +131,8 @@
 
 void temp_control(void const *args)
 {
+    uint32_t error_count = 50;
+
     t.set_config(OPERATION_MODE_CONT + RESOLUTION_16BIT);
     pid.setInputLimits(0.0, 4.5);
     pid.setOutputLimits(0.0, 5.0);
@@ -144,6 +147,14 @@
         } else if (volt > 0.8f) {
             volt = 0.8f;
         }
+        if ((volt == -0.800f) || (volt == 0.800f)){
+            if (--error_count == 0){
+                pid.reset();
+                error_count = 50;
+            }
+        } else {
+            error_count = 50;
+        }
         heater.set_voltage(volt);
         if (heater.status()) {
             heater.reset();
@@ -250,7 +261,7 @@
         //                 31 Dec 2014 13:12:11
 //        strftime(buf,40, "%x %X ", localtime(&seconds));
         //                 1:12:11 PM (2014/12/31)
-        strftime(buf,40, "%I:%M:%S %p (%Y/%m/%d)", localtime(&seconds_jst));
+        strftime(buf,40, "%I:%M:%S %p %m/%d", localtime(&seconds_jst));
         PRINTF("%s, ", buf);
         if (fc.status_gps()) {
             PRINTF("RDY");
@@ -288,8 +299,8 @@
 // Thread definition
 osThreadDef(measure_freq, osPriorityNormal,1024);
 osThreadDef(temp_control, osPriorityNormal,1024);
-osThreadDef(display_data, osPriorityNormal,3072);
-osThreadDef(gps_data_rcv, osPriorityNormal,3072);
+osThreadDef(display_data, osPriorityNormal,1536);
+osThreadDef(gps_data_rcv, osPriorityNormal,1536);
 
 int main()
 {