金牌会员
- 积分
- 1609
- 威望
- 838
- 贡献
- 459
- 兑换币
- 476
- 注册时间
- 2015-7-27
- 在线时间
- 156 小时
|
本帖最后由 小沐127 于 2016-1-14 21:00 编辑
........
main()
{
........
LPTMR_Config();
while(1)
{
LPTM_Value = LPTM_GetTimerCounterValue(LPTMR0);
OLED_MixStr(0,0,"LPTM_Value:",1);
OLED_ShowNum(80,0,LPTM_Value,5,12);
LPTM_ResetTimeCounter(LPTMR0);
}
}
..........
..........
#include "sys.h"
#include "lptm.h"
uint32_t LPTM_Value ;
void LPTMR_Config()
{
LPTM_InitTypeDef LPTM_InitStruct1;
LPTM_InitStruct1.LPTMxMap = LPTM_CH2_PC5;
LPTM_InitStruct1.LPTM_InitCompareValue = 200; //在PC模式下无意义
LPTM_InitStruct1.LPTM_Mode = LPTM_Mode_PC_FALLING; //下降沿触发计数模式
LPTM_Init(&LPTM_InitStruct1);
LPTM_ITConfig(LPTMR0,LPTM_IT_TCF,DISABLE);
}
...........
...........
#include "gpio.h"
void GPIO_Config()
{
//初始化默认的调试端口
GPIO_InitTypeDef GPIO_InitStruct1;
//初始化默认的调试端口
GPIO_InitStruct1.GPIOx = PTC; //C端口
GPIO_InitStruct1.GPIO_InitState = Bit_SET; //初始化后输出高电平
GPIO_InitStruct1.GPIO_IRQMode = GPIO_IT_DISABLE; //不时能中断
GPIO_InitStruct1.GPIO_Pin = GPIO_Pin_5; //PC5引脚
GPIO_InitStruct1.GPIO_Mode = GPIO_Mode_IPU; //
//执行GPIO初始化 点亮LED
GPIO_Init(&GPIO_InitStruct1);
}
lptm模块最大频率是多少?
|
|