ZHCAEF0 September 2024 MSPM0G1507 , MSPM0G3105 , MSPM0G3105-Q1 , MSPM0G3106 , MSPM0G3106-Q1 , MSPM0G3107 , MSPM0G3107-Q1 , MSPM0G3505 , MSPM0G3505-Q1 , MSPM0G3506 , MSPM0G3506-Q1 , MSPM0G3507 , MSPM0G3507-Q1 , MSPM0G3519 , MSPM0L1105 , MSPM0L1106 , MSPM0L1227 , MSPM0L1228 , MSPM0L1228-Q1 , MSPM0L1303 , MSPM0L1304 , MSPM0L1304-Q1 , MSPM0L1305 , MSPM0L1305-Q1 , MSPM0L1306 , MSPM0L1306-Q1 , MSPM0L1343 , MSPM0L1344 , MSPM0L1345 , MSPM0L1346 , MSPM0L2227 , MSPM0L2228 , MSPM0L2228-Q1
要更改 TIMER 使用的特定值以及所需的频率范围,请修改文档开头的 #defines,如以下代码块所示:
/* Based on required specifications, vary the value
* between PERIOD_10ms, PERIOD_20ms, and PERIOD_50ms
* to achieve desired frequency range.
*
* RANGES:
* 10 ms: 100 Hz - 1 MHz
* 20 ms: 50 Hz - 1 MHz
* 50 ms: 20 Hz - 1 MHz
*
* Please reference [file name] for percent error
*/
#define CAPTURE_PERIOD (PERIOD_20ms) /* CHANGE THIS VARIABLE VALUE */
/* Set the desired frequency range
* NOTE: see [file name] to ensure proper capture period is set
* for desired frequency range
*/
#define LOWERBOUND (2000)
#define UPPERBOUND (10000)
/* The maximum amount of rising edge the Timer Compare
* will read from the COMP. Used as a limit rather than
* an actual fix value of counts
*/
#define MAX_COMPARE_COUNT 65000