问答

汇集网友智慧,解决技术难题

21ic问答首页 - TAG - keil ARM
  • 变量不用计算就可以自增吗?

    下边是航顺HK32F030MF4P6的官方基本定时器例程,看到里边定义了一个time变量,但是没看到有计算过程(在整个工程中其他文件中也没有找到time变量),请问变量不计算怎么可以自增?下附部分代码: [backcolor=rgb(255, 255, 255)][font=Consolas, "][color=#008000]/**[/color] [color=#008000] ******************************************************************************[/color] [color=#008000] * [/color][color=#0000ff]@file[/color][color=#008000] main.c[/color] [color=#008000] * [/color][color=#0000ff]@author[/color][color=#008000] Alexander[/color] [color=#008000] * [/color][color=#0000ff]@version[/color][color=#008000] V1.0[/color] [color=#008000] * [/color][color=#0000ff]@date[/color][color=#008000] 2022-xx-xx[/color] [color=#008000] * [/color][color=#0000ff]@brief[/color][color=#008000] 基本定时器[/color] [color=#008000] ******************************************************************************[/color] [color=#008000] * [/color][color=#0000ff]@attention[/color] [color=#008000] *[/color] [color=#008000] * 实验平台:HK32F030M开发板[/color] [color=#008000] * 论坛 :https://bbs.21ic.com/iclist-1010-1.html[/color] [color=#008000] *[/color] [color=#008000] ******************************************************************************[/color] [color=#008000] */[/color] [color=#af00db]#include[/color][color=#0000ff] [/color][color=#a31515]"hk32f030m.h"[/color] [color=#af00db]#include[/color][color=#0000ff] [/color][color=#a31515]"bsp_led.h"[/color] [color=#af00db]#include[/color][color=#0000ff] [/color][color=#a31515]"bsp_TimBase.h"[/color] [color=#0000ff]volatile[/color] [color=#267f99]uint32_t[/color] [color=#001080]time[/color] = [color=#098658]0[/color];[color=#008000] // ms 计时变量[/color] [color=#008000]/**[/color] [color=#008000] * [/color][color=#0000ff]@brief[/color][color=#008000] 主函数[/color] [color=#008000] * [/color][color=#0000ff]@param[/color][color=#008000] [/color][color=#001080]无[/color] [color=#008000] * [/color][color=#0000ff]@retval[/color][color=#008000] 无[/color] [color=#008000] */[/color] [color=#0000ff]int[/color] [color=#795e26]main[/color]([color=#0000ff]void[/color]) { [color=#008000] /* LED 端口初始化 */[/color] [color=#795e26]LED_GPIO_Config[/color](); [color=#795e26]BASIC_TIM_Init[/color](); [color=#af00db]while[/color] ([color=#098658]1[/color]) { [color=#af00db]if[/color] ([color=#001080]time[/color] == [color=#098658]500[/color])[color=#008000] /* 1000 * 1ms = 1s 时间到 */[/color] { [color=#001080]time[/color] = [color=#098658]0[/color]; [color=#008000] /* LED1 取反 */[/color] [color=#0000ff]HandLED_TOGGLE[/color]; } } } [color=#af00db]#ifdef[/color][color=#0000ff] USE_FULL_ASSERT[/color] [color=#008000]/**[/color] [color=#008000] * [/color][color=#0000ff]@brief[/color][color=#008000] Reports the name of the source file and the source line number[/color] [color=#008000] * where the assert_param error has occurred.[/color] [color=#008000] * [/color][color=#0000ff]@param[/color][color=#008000] [/color][color=#001080]file[/color][color=#008000]: pointer to the source file name[/color] [color=#008000] * [/color][color=#0000ff]@param[/color][color=#008000] [/color][color=#001080]line[/color][color=#008000]: assert_param error line source number[/color] [color=#008000] * [/color][color=#0000ff]@retval[/color][color=#008000] None[/color] [color=#008000] */[/color] [color=#0000ff]void[/color] [color=#795e26]assert_failed[/color]([color=#0000ff]char[/color] *[color=#001080]file[/color], [color=#0000ff]uint32_t[/color] [color=#001080]line[/color]) { [color=#008000] /* User can add his own implementation to report the file name and line number,[/color] [color=#008000] tex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */[/color] [color=#008000] /* Infinite loop */[/color] [color=#af00db]while[/color] ([color=#098658]1[/color]) { } } [color=#af00db]#endif[/color][color=#008000] /* USE_FULL_ASSERT */[/color] [/font][/backcolor] 我是新人,还没有家园币,暂时还没法设置悬赏,实在不好意思,麻烦大家了,多谢赐教!

    RT se TI keil ARM HK32F030MF4P6 航顺

    6943浏览量 10回复量 关注量