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

 找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 2543|回復: 0
打印 上一主題 下一主題
收起左側

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)


分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏 分享淘帖 頂 踩
回復

使用道具 舉報

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規則

小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術交流QQ群281945664

Powered by 單片機教程網

快速回復 返回頂部 返回列表
主站蜘蛛池模板: 少妇在线 | 一区二区高清 | 国产黄色片在线观看 | 免费观看一区二区三区 | 成人一区二区视频 | 午夜视频免费观看 | 伊人国产女 | 国产91清纯白嫩初高中在线观看 | 成年人视频免费看 | 成人不卡 | 激情久久综合 | 欧美另类综合 | 日韩在线资源 | 午夜视频在线 | 欧美日韩在线一区 | 涩涩视频免费观看 | 波多野结衣在线观看一区二区 | 成人激情片 | 91片黄在线观看 | 成人毛片网 | 成人小网站 | 国产又粗又猛又黄又爽的视频 | 欧美成人黄色 | 欧美精品网| 欧美精品在线免费观看 | 日韩精品 | 国产精品99久久久久久久久久久久 | 免费av网址在线观看 | 日本视频免费观看 | 一区二区色 | 日韩成人免费视频 | 日韩中文字幕视频 | 亚洲午夜精品 | 中文字幕在线视频播放 | 少妇视频网站 | 97在线免费观看 | 亚洲三级黄色片 | 日本加勒比在线 | 国产激情在线视频 | 久久久在线 | 亚洲精品午夜精品 |