Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: FreqCntr_GPS1PPS_F746F4xx_w_recipro Freq_Cntr_GPS1PPS_F746NG_GUI
Fork of Frq_cuntr_full by
Diff: frq_cuntr_full.h
- Revision:
- 4:9d3b3f0a3882
- Parent:
- 3:339307e1dc0d
--- a/frq_cuntr_full.h Tue Dec 23 23:26:49 2014 +0000
+++ b/frq_cuntr_full.h Thu Jan 01 05:04:20 2015 +0000
@@ -8,7 +8,7 @@
* http://mbed.org/users/kenjiArai/
* Additional functions and modification
* started: October 18th, 2014
- * Revised: December 24th, 2014
+ * Revised: January 1st, 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
@@ -38,9 +38,6 @@
// use avaraged 1pps data
#define ONEPPS_AVE
-// External clock divided by 2
-#define CLOCK_DIVIDED_BY_2
-
namespace Frequency_counter
{
@@ -57,13 +54,13 @@
* // PC_6,PC_7 & PB_6 use for Timer3 & 4(16+16bit)
* // PA_0,PA_1 & PB_10 use for Timer2(32bit)
* // PA_8 & PC_7 use for MCO (Test purpose)
- * FRQ_CUNTR fc(PC_6, 1.0, 50.000000);// Input port, gate time[sec] and External clock freq.
+ * FRQ_CUNTR fc(PC_6, 1.0, 24.999982f); //Input port, gate time[sec] & External clock freq.
*
* int main() {
* uint32_t counter_1pps = 0;
* double new_frequency = 0;
* // This is for test purpose
- * fc.port_mco1_mco2_set(2); // Clk/2 ->1/1(100MHz) cannot measure!!
+ * fc.port_mco1_mco2_set(4); // Clk/4 ->1/1(100MHz) cannot measure!!
* fc.read_frequency_TIM2(1.0); // read TIM2 source frequency (test)
* fc.read_frequency_TIM3P4(1.0); // read TIM3 source frequency (test)
* while(true) {
@@ -71,7 +68,7 @@
* counter_1pps = fc.read_avarage_1pps();
* while (fc.status_freq_update() == 0) {;}
* new_frequency = fc.read_freq_data();
- * PRINTF("1PPS/ave = %9d , FREQUENCY = %11.3f\r\n", counter_1pps, new_frequency);
+ * printf("1PPS/ave = %9d , FREQUENCY = %11.3f\r\n", counter_1pps, new_frequency);
* }
* }
* @endcode
@@ -92,6 +89,12 @@
*/
double set_gate_time(double gt);
+ /** Set external clock frequency
+ * @param frequency e.g. 25.000000 [MHz]
+ * @return none
+ */
+ void set_external_clock(double ex_clock);
+
/** Read gate time
* @param none
* @return gate time (range 50mS to 1 minute)
@@ -116,6 +119,12 @@
*/
uint32_t read_avarage_1pps(void);
+ /** Read newest measued data GPS 1PPS
+ * @param none
+ * @return Frequency
+ */
+ uint32_t read_newest_1pps(void);
+
/** Read status (new 1PPS data is available or not)
* @param none
* @return !=0: new data is avairable, 0: not yet
@@ -164,7 +173,6 @@
void initialize_TIM2(void);
// Initialize TIM3 and TIM4 as 32bit counter (TIM3(16bit) + TIM4(16bit))
void initialize_TIM3P4(void);
- void set_external_clock(double ex_clock); // Set external clock data
uint32_t set_1PPS_data(void); // Set GPS 1PPS counter value
uint32_t read_ic2_counter_TIM2(void); // Read TIM2 captured counter value
uint32_t check_ic2_status_TIM2(void); // Check TIM2 IC2 status
