在线时间0 小时
UID381442
ST金币0
蝴蝶豆0
注册时间2012-8-20
新手上路
- 最后登录
- 1970-1-1
|
a0a.1 0b0c
#include "stm8s.h"
#include "stm8s_tim1.h"
#include "stm8s_gpio.h"
#include "stm8s_flash.h"
void TIM1_Init(void)
{
u8 status;
TIM1_DeInit();
GPIO_Init(GPIOB, GPIO_PIN_ALL , GPIO_MODE_IN_FL_NO_IT );
FLASH_Unlock(FLASH_MEMTYPE_DATA);
FLASH_ProgramOptionByte(0x4803,0x20);
status = FLASH_WaitForLastOperation(FLASH_MEMTYPE_DATA);
if (status == FLASH_STATUS_SUCCESSFUL_OPERATION)
{
}
FLASH_Lock(FLASH_MEMTYPE_DATA);
TIM1_ETRClockMode2Config(TIM1_EXTTRGPSC_DIV2, TIM1_EXTTRGPOLARITY_INVERTED, 0x00);
TIM1_Cmd(ENABLE);
}
u8 COUN1=0;
int main(void)
{
while(1)
{
COUN1=TIM1->CNTRH;
}
}
调用库函数,这个程序能实现这个功能吗? |
|