timer_initpara.counterdirection = TIMER_COUNTER_UP;timer_initpara.period = arr;timer_initpara....
timer_initpara.counterdirection = TIMER_COUNTER_UP; timer_initpara.period = 0xffff; timer_init(TIMER5, &timer_initpara); timer_counter_value_config(TIMER5, 0); timer_update_source_config(TIMER5, TIMER_UPDATE_SRC_REGULAR); timer_auto_reload_shadow_disable(TIMER5); timer_single_pulse_mode_...
OLED_ShowNum(2, 5, timer_counter_read(TIMER2), 5);OLED_ShowNum(3, 5, timer_prescaler_read(...
timer_input_capture_config(TIMER3,TIMER_CH_2,&timer_icinitpara); }else///捕获到下降沿,为0是下降沿{ Dval=timer_counter_read(TIMER3); timer_icinitpara.icpolarity=TIMER_IC_POLARITY_RISING; timer_icinitpara.icselection=TIMER_IC_SELECTION_DIRECTTI; timer_icinitpara.icprescaler=TIMER_IC_PSC_DIV...
timer_initpara.counterdirection = TIMER_COUNTER_UP; timer_initpara.period = 4000-1; //800ms timer_initpara.clockdivision = TIMER_CKDIV_DIV1; timer_init(TIMER4, &timer_initpara); 对于定时器定时周期的计算,设 TIMER4 的经过总线分频后得到的时钟为 30MHz,通过预分频 5999,得到 TIMER4 每个计 数...
表3-489.函数timer_counter_value_config411 表3-490.函数timer_counter_read412 表3-491.函数timer_prescaler_read413 表3-492.函数timer_single_pulse_mode_config413 表3-493.函数timer_update_source_config414 表3-494.函数timer_dma_enable415
mode=TIMER_COUNTER_EDGE;timer_initpara.counterdirection=TIMER_COUNTER_UP;timer_initpara.period=999;timer_initpara.clockdivision=TIMER_CKDIV_DIV1;timer_initpara.repetitioncounter=0;timer_init(TIMER1,&timer_initpara);nvic_priority_group_set(NVIC_PRIGROUP_PRE1_SUB3);nvic_irq_enable(TIMER1_IRQn,0,...
timer_parameter_struct timer_initpara; rcu_periph_clock_enable(RCU_TIMER4); timer_deinit(TIMER4);/*TIMER1 configuration*/timer_initpara.prescaler=1199; timer_initpara.alignedmode=TIMER_COUNTER_EDGE; timer_initpara.counterdirection=TIMER_COUNTER_UP; ...
timer_deinit(TIMER2);/* TIMER2 configuration */timer_initpara.prescaler =120-1;//定时器的时钟频率是120MHz,预分频120-1timer_initpara.alignedmode = TIMER_COUNTER_EDGE;//对齐模式timer_initpara.counterdirection = TIMER_COUNTER_UP;//向上计数timer_initpara.period =65535;//重载值timer_initpara.cl...
实验原理timer_channel_eapture_value_register_read函数的功能是读取通道捕获值。具体描述如表13-7所示。实验原理timer_counter_value_config函数的功能是配置外设TIMERx的计数器值。具体描述如表13-8所示。实验原理输入捕获实验的程序架构如图13-7所示。实验原理03实验步骤步骤1:复制并编译原始工程;步骤2:添加Capture...