久久久久久久999_99精品久久精品一区二区爱城_成人欧美一区二区三区在线播放_国产精品日本一区二区不卡视频_国产午夜视频_欧美精品在线观看免费

標題: STM32F4 input_capture_frq [打印本頁]

作者: JAVADSALAR    時間: 2017-12-19 19:11
標題: STM32F4 input_capture_frq
Input Capture Library (STM32F4)
To measure one (or more) external frequencies with the STM32F4, this library (s) can be used.
(there is also an extra LIB if the duty cycle is to be measured)

As with the PWM-Lib, I have each written a library for the four timers "TIM2, TIM3, TIM4, TIM5".

The timers are operated in input capture mode. The interrupt function is therefore called only once per Hi-edge from the external signal. After two hi-edges, the time interval between the edges is determined and stored. This value then corresponds to the period duration.

Per timer up to 4 different input signals can be measured.

The number and name of the channels to be used must be declared in the H file and assigned to the corresponding port pins in the C file.
(in the examples, I have always activated only two channels per timer)

The H-File also sets the clock frequency of the timer. This then applies to all channels and affects the resolution and the minimum frequency that can be measured.

Note: the function for reading the frequency only transfers the timer value of the period. The conversion into a frequency must be made extra if necessary. If there is no signal (or the measurement is not finished yet), the return value = 0. This means that a missing signal can be detected.

Image :


Benutzte Module der CooCox-IDE : GPIO, TIM, MISCBenutzte Librarys : keineEnumerationen (für FRQ mit TIM2) :
typedef enum {  ICFRQ_T2_PB11 = 0,  // FRQ-Messung per TIM2 an PB11  ICFRQ_T2_PA2  = 1   // FRQ-Messung per TIM2 an PA2}ICFRQ_TIM2_NAME_t;Funktionen (für FRQ mit TIM2) :
void UB_ICFRQ_TIM2_Init(void);                           // um die FRQ-Messung mit TIM2 zu initialisierenuint32_t UB_ICFRQ_TIM2_ReadFRQ(ICFRQ_TIM2_NAME_t vname); // zum auslesen der gemessenen FrequenzBeispiel :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//--------------------------------------------------------------
// File     : main.c
// Datum    : 10.07.2013
// Version  : 1.0
// Autor    : UB
// EMail    : mc-4u(@)t-online.de
// CPU      : STM32F4
// IDE      : CooCox CoIDE 1.7.0
// Module   : CMSIS_BOOT, M4_CMSIS_CORE
// Funktion : Demo der InputCapture FRQ-Library
// Hinweis  : Diese zwei Files muessen auf 8MHz stehen
//              "cmsis_boot/stm32f4xx.h"
//              "cmsis_boot/system_stm32f4xx.c"
//--------------------------------------------------------------

#include "main.h"
#include "stm32_ub_icfrq_tim2.h"

int main(void)
{
  uint32_t messwert=0,freuqenz=0;

  SystemInit(); // Quarz Einstellungen aktivieren

  // Init vom Timer2 zur FRQ-Messung
  UB_ICFRQ_TIM2_Init();

  while(1)
  {
    // gemessene FRQ an PB11 auslesen
    messwert=UB_ICFRQ_TIM2_ReadFRQ(ICFRQ_T2_PB11);
    if(messwert>0) {
      // wenn Messwert gueltig
      // frequenz ausrechnen
      freuqenz=(1000000/messwert);
    }
  }
}





全部資料51hei下載地址:
Demo_49_FRQ_IN.zip (233.79 KB, 下載次數: 9)







歡迎光臨 (http://m.zg4o1577.cn/bbs/) Powered by Discuz! X3.1
主站蜘蛛池模板: 99中文字幕 | av黄色网 | 草草网 | 天天爽| 糖心vlog精品一区二区 | www.精品国产| 99热99re6国产在线播放 | 性色av一区二区三区 | 色激情网 | 久久久香蕉 | 一级黄色网| 精品一区二区三区免费看 | 久久国产精品99久久人人澡 | 久草新视频 | 亚洲经典一区 | 欧美日韩在线播放 | 国产一区二区av | 九九热这里 | 国产一区二区三区免费 | 国产一区二区三区久久 | 五月色丁香 | 香蕉久久久 | 免费色视频| 亚洲成人精品视频 | 日韩在线视频观看 | 在线成人免费视频 | 亚洲一区二区三区在线视频 | 精品免费国产一区二区三区四区 | 欧美在线激情 | 久久久久久久网站 | 久草久草久草 | 欧美色图一区 | 成人免费视频播放 | 在线看片a | 欧美日韩三区 | 久久久精品在线观看 | 久草资源| 国产乱码精品一区二区三区忘忧草 | 日日夜夜精品视频免费 | 欧美日韩亚洲一区二区 | 日产精品久久久一区二区 |