本文整理汇总了C++中TIM_ClearITPendingBit函数的典型用法代码示例。如果您正苦于以下问题:C++ TIM_ClearITPendingBit函数的具体用法?C++ TIM_ClearITPendingBit怎么用?C++ TIM_ClearITPendingBit使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了TIM_ClearITPendingBit函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: USART1_IRQHandler
void USART1_IRQHandler(void)
{
u8 res; //存储接收到的数据
u8 err; //串口硬件错误出发的中断
if(USART_GetITStatus(USART1,USART_IT_RXNE)!=RESET) //接收中断
{
if(USART_GetFlagStatus(USART1,USART_FLAG_NE|USART_FLAG_FE|USART_FLAG_PE))
err=1;//检查到噪音、帧错误或校验错误
else
err=0;
res=USART_ReceiveData(USART1); //读接收到的字节,同时相关标志自动清除
if((RS485_RX_CNT<2047)&&(err==0)) //接收到的字节数量,在合理的范围内,同时无其他错误
{
RS485_RX_BUFF[RS485_RX_CNT]=res; //获取数据
RS485_RX_CNT++; //计数
TIM_ClearITPendingBit(TIM1,TIM_IT_Update); //清除定时器溢出中断
TIM_SetCounter(TIM1,0); //当接收到一个新的字节时,将定时器1复位为0,重新计时(相当于watchdog)
TIM_Cmd(TIM1,ENABLE); //使能定时器1,开始计时
}
}
}
示例2: TIMER_irq
void TIMER_irq() {
if (TIM_GetITStatus(STM32_SYSTEM_TIMER, TIM_IT_Update) != RESET) {
TIM_ClearITPendingBit(STM32_SYSTEM_TIMER, TIM_IT_Update);
#ifdef CONFIG_CNC
CNC_timer();
#endif
bool ms_update = SYS_timer();
if (ms_update) {
TRACE_MS_TICK(SYS_get_time_ms() & 0xff);
}
TASK_timer();
#ifdef CONFIG_LED
LED_SHIFT_tick();
LED_tick();
#endif
if (ms_update) {
__os_time_tick(SYS_get_time_ms());
}
CLI_timer();
}
}
示例3: tim_oc_irq_handler
// Used by interrupt system
static void tim_oc_irq_handler(void) {
uint16_t cval = TIM_MST->CNT;
// Clear interrupt flag
if (TIM_GetITStatus(TIM_MST, TIM_IT_CC1) == SET) {
TIM_ClearITPendingBit(TIM_MST, TIM_IT_CC1);
}
if (oc_rem_part > 0) {
set_compare(oc_rem_part); // Finish the remaining time left
oc_rem_part = 0;
}
else {
if (oc_int_part > 0) {
set_compare(0xFFFF);
oc_rem_part = cval; // To finish the counter loop the next time
oc_int_part--;
}
else {
us_ticker_irq_handler();
}
}
}
示例4: TIM3_IRQHandler
void TIM3_IRQHandler(void) //¶¨Ê±ÖжÏ3 ¶¨Ê±·¢ËÍÊý¾Ý¸øÉÏλ»ú
{
if (TIM_GetITStatus(TIM3 , TIM_IT_Update) == SET) //¶¨Ê±¸üÐÂ
{
TIM_ClearITPendingBit(TIM3 , TIM_IT_Update); //Çå¿Õ¶¨Ê±ÖжÏ
if((Inspection_Mode!=0)||(Key_En == 1)) //??
{
if(Transfer_DataDisable_CommandEnable_Sign==0) //?¡
{
if(Pressure_mmHg1<1.5)
Pressure_mmHg1=0;
else
Pressure_mmHg1=Pressure_mmHg1;
if(Pressure_mmHg2<1.5)
Pressure_mmHg2=0;
else
Pressure_mmHg2=Pressure_mmHg2;
if(Pressure_mmHg3<1.5)
Pressure_mmHg3=0;
else
Pressure_mmHg3=Pressure_mmHg3;
if(Pressure_mmHg4<1.5)
Pressure_mmHg4=0;
else
Pressure_mmHg4=Pressure_mmHg4;
Transfer_Agreement15x8b_Data(0x01,(u16)(Pressure_mmHg1*10),(u16)(Pressure_mmHg2*10),(u16)(Pressure_mmHg3*10),(u16)(Pressure_mmHg4*10));
//0x01 ±íʾ·½ÏòΪÏÂλ»úÏòÉÏλ»ú
}
}
}
}
示例5: TIM2_IRQHandler
void TIM2_IRQHandler(void)
{
if ( TIM_GetITStatus(TIM2 , TIM_IT_Update) != RESET )
{
TIM_ClearITPendingBit(TIM2 , TIM_FLAG_Update);
/////////////////////////////////////////////////////////////////
// Power OFF GPS and GSM before go into standby mode
/////////////////////////////////////////////////////////////////
GSM_TurnOnOff_delay();
#ifdef USE_STM32_GPS_BOARD_VB
GPSPowerOff();
GSM_PowerOff();
#endif
/* Wait till RTC Second event occurs */
RTC_ClearFlag(RTC_FLAG_SEC);
while(RTC_GetFlagStatus(RTC_FLAG_SEC) == RESET);
// normal working state
if(BKP_TRUE == BKP_ReadBackupRegister(BKP_DR1))
{
/* Set the RTC Alarm after xx s */
DEBUG("in timer2 bkptrue %d\n", (BKP_ReadBackupRegister(BKP_DR4) + BKP_ReadBackupRegister(BKP_DR4) <<16));
RTC_SetAlarm(RTC_GetCounter()+ ((BKP_ReadBackupRegister(BKP_DR4) + BKP_ReadBackupRegister(BKP_DR4) <<16)/SLEEP_TIM2_RATIO));
}
else
{
DEBUG("in timer2 bkpfalse\n");
RTC_SetAlarm(RTC_GetCounter()+ (SLEEP_NORMAL_SEC/SLEEP_TIM2_RATIO));
}
/* Wait until last write operation on RTC registers has finished */
RTC_WaitForLastTask();
/* Request to enter STANDBY mode (Wake Up flag is cleared in PWR_EnterSTANDBYMode function) */
PWR_EnterSTANDBYMode();
}
}
示例6: TIM14_IRQHandler
//***************************************************************************
//Обработчик прерывания TIM14 для определения окончания приёма данных по ModBus
//***************************************************************************
void TIM14_IRQHandler(void)
{
TIM_ClearITPendingBit(TIM14, TIM_IT_Update);
//blinking with PC9
// if(GPIO_ReadOutputDataBit ( GPIOA,GPIO_Pin_5))
// GPIO_WriteBit(GPIOA,GPIO_Pin_5,Bit_RESET);
// else
// GPIO_WriteBit(GPIOA,GPIO_Pin_5,Bit_SET);
//проверяем окончание приёма uart1
if((modbus1.rxtimer++ > modbus1.delay) & (modbus1.rxcnt > 1)){
modbus_slave1(&modbus1); //подготовка данных на отправку
/* Старт отправки данных по UART1 если данные готовы */
if((modbus1.txlen>0)&(modbus1.txcnt==0))
{
/* Configure USART1 TX (PA9) as alternate function push-pull*/
// GPIO_InitTypeDef GPIO_InitStructure;
// GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9;
// GPIO_InitStructure.GPIO_Speed = GPIO_Speed_10MHz;
// GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
// GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
// GPIO_Init(GPIOA, &GPIO_InitStructure);
// GPIO_PinAFConfig(GPIOA, GPIO_PinSource9, GPIO_AF_1);
//countReqUSART1 = 0;
USART_ITConfig(USART1, USART_IT_RXNE, DISABLE);
USART_ITConfig(USART1, USART_IT_TC, ENABLE);
//rs485 DE enable
// GPIOA->BSRR = GPIO_Pin_12;
//GPIO_WriteBit(PIN_USART_DE, Bit_SET);
USART_SendData(USART1, modbus1.buffer[modbus1.txcnt++]);
}
}
}
示例7: IniTimerPrzerwanie1
//konfiguracja przerwania i timera dla ZLICZANIA PREDKOSCI
void IniTimerPrzerwanie1()
{
//ustawienie trybu pracy priorytetow przerwan
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);
NVIC_InitTypeDef p;
//numer przerwania
p.NVIC_IRQChannel = TIM2_IRQn;
// priorytet główny
p.NVIC_IRQChannelPreemptionPriority = 0x00;
// subpriorytet
p.NVIC_IRQChannelSubPriority = 0x00;
// uruchom dany kanał
p.NVIC_IRQChannelCmd = ENABLE;
// zapisz wypełnioną strukturę do rejestrów
NVIC_Init(&p);
//doprowadzenie sygnalu zerowego
RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE);
//TIM2 przy prescaler=1 ma 42Mhz a przy wiekszym 84Mhz)
TIM_TimeBaseInitTypeDef a;
a.TIM_Prescaler=8400;
int obliczona = 2000 - 1;
a.TIM_CounterMode=TIM_CounterMode_Up;
a.TIM_Period=obliczona;
a.TIM_ClockDivision=0;
a.TIM_RepetitionCounter=0;
TIM_TimeBaseInit(TIM2, &a);
// wyczyszczenie przerwania od timera 2 (przy konfiguracji timera)
TIM_ClearITPendingBit(TIM2, TIM_IT_Update);
// zezwolenie na przerwania od przepelnienia dla timera 2
TIM_ITConfig(TIM2, TIM_IT_Update, ENABLE);
//wlaczenie timera
TIM_Cmd(TIM2, ENABLE);
}
示例8: TIM7_IRQHandler
/**
* @brief This function handles TIM7 global interrupt request.
* @param None
* @retval None
*/
void TIM7_IRQHandler(void)
{
if (TIM_GetITStatus(TIM7, TIM_IT_Update) != RESET)
{
/* if Display Timeout is working */
if(DisplayTimeout != TIMEOUT_DEFAULT)
{
DisplayTimeout--;
if (!DisplayTimeout)
{
DisplayTimeout = TIMEOUT_DEFAULT;
ExitMutex = 1;
}
}
/* Toggle leds */
STM_EVAL_LEDToggle(LED1);
STM_EVAL_LEDToggle(LED2);
STM_EVAL_LEDToggle(LED3);
STM_EVAL_LEDToggle(LED4);
/* if 20 TIM7 interrupt reached */
if (SaveReportCmd == 20)
{
ReqOperation = SAVE_REPORT_OP;
SaveReportCmd = 0;
}
else
{
SaveReportCmd++;
}
/* Clear TIM7 interrupt pending bits */
TIM_ClearITPendingBit(TIM7, TIM_IT_Update);
}
}
示例9: TIM4_IRQHandler
/**
* @brief This function handles TIM4 global interrupt request.
* @param None
* @retval None
*/
void TIM4_IRQHandler(void)
{
if (TIM_GetITStatus(TIM4, TIM_IT_CC2) != RESET)
{
/* Clear TIM4 Capture compare interrupt pending bit */
TIM_ClearITPendingBit(TIM4, TIM_IT_CC2);
if(CaptureNumber == 0)
{
/* Get the Input Capture value */
IC4ReadValue1 = TIM_GetCapture2(TIM4);
CaptureNumber = 1;
}
else if(CaptureNumber == 1)
{
/* Get the Input Capture value */
IC4ReadValue2 = TIM_GetCapture2(TIM4);
/* Capture computation */
if (IC4ReadValue2 > IC4ReadValue1)
{
Capture = (IC4ReadValue2 - IC4ReadValue1) - 1;
}
else if (IC4ReadValue2 < IC4ReadValue1)
{
Capture = ((0xFFFF - IC4ReadValue1) + IC4ReadValue2) - 1;
}
else
{
Capture = 0;
}
/* Frequency computation */
TIM4Freq = (uint32_t) SystemCoreClock / Capture;
CaptureNumber = 0;
}
}
}
示例10: TIM5_IRQHandler
//配置中断处理函数
void TIM5_IRQHandler(void)
{
if((TIM5CH1_CAPTURE_STA&0x80)==0)//if capture not done
{
if(TIM_GetITStatus(TIM5,TIM_IT_Update)!=RESET)//if overflow occured
{
if(TIM5CH1_CAPTURE_STA&0x40)//rising has been captured
{
if((TIM5CH1_CAPTURE_STA&0x3f)==0x3f)//if overflow times FULL,end capture anyway
{
TIM5CH1_CAPTURE_STA|=0x80;//end capture
TIM5CH1_CAPTURE_VAL=0xffff;//full
}
else TIM5CH1_CAPTURE_STA++;//if overflow times not full,overflow times++
}
}
if(TIM_GetITStatus(TIM5,TIM_IT_CC1)!=RESET)//if captured rising/falling
{
if(TIM5CH1_CAPTURE_STA&0x40)//if rising has been captured,capture下降沿
{
TIM5CH1_CAPTURE_STA|=0x80;//done capture
TIM5CH1_CAPTURE_VAL=TIM_GetCapture1(TIM5);//get value
TIM_OC1PolarityConfig(TIM5,TIM_ICPolarity_Rising);//reset to original mode
}
else//if rising not captured,set all to init value,and set rising captured
{
TIM5CH1_CAPTURE_STA=0;
TIM5CH1_CAPTURE_VAL=0;
TIM_SetCounter(TIM5,0);
TIM5CH1_CAPTURE_STA|=0x40;//set rising captured
TIM_OC1PolarityConfig(TIM5,TIM_ICPolarity_Falling);//then capture falling
}
}
}
TIM_ClearITPendingBit(TIM5,TIM_IT_CC1|TIM_IT_Update);
}
示例11: vTimer2IntHandler
void vTimer2IntHandler( void )
{
static unsigned short usLastCount = 0, usSettleCount = 0, usMaxDifference = 0;
unsigned short usThisCount, usDifference;
/* Capture the free running timer 3 value as we enter the interrupt. */
usThisCount = TIM3->CNT;
if( usSettleCount >= timerSETTLE_TIME )
{
/* What is the difference between the timer value in this interrupt
and the value from the last interrupt. */
usDifference = usThisCount - usLastCount;
/* Store the difference in the timer values if it is larger than the
currently stored largest value. The difference over and above the
expected difference will give the 'jitter' in the processing of these
interrupts. */
if( usDifference > usMaxDifference )
{
usMaxDifference = usDifference;
usMaxJitter = usMaxDifference - timerEXPECTED_DIFFERENCE_VALUE;
}
}
else
{
/* Don't bother storing any values for the first couple of
interrupts. */
usSettleCount++;
}
/* Remember what the timer value was this time through, so we can calculate
the difference the next time through. */
usLastCount = usThisCount;
TIM_ClearITPendingBit( TIM2, TIM_IT_Update );
}
示例12: vhADC_initTIM1
/*-----------------------------------------------------------
* @brief Function Name : vhADC_initTIM1
* @brief Description : Initializes TIM1 to give interrupt with specified
* frequency.
*/
void vhADC_initTIM1(void){
TIM_TimeBaseInitTypeDef TIM_InitStructure;
TIM_OCInitTypeDef TIM_OCInitStructure;
TIM_InitStructure.TIM_Prescaler = 4200-1; //84MHz : 42000 = 20000 Hz
TIM_InitStructure.TIM_Period = 100; //20000 Hz : 100 = 200 Hz
TIM_InitStructure.TIM_CounterMode = TIM_CounterMode_Up;
TIM_InitStructure.TIM_ClockDivision = TIM_CKD_DIV1;
TIM_InitStructure.TIM_RepetitionCounter = 0;
TIM_TimeBaseInit(TIM1, &TIM_InitStructure);
// Channel 1 configuration
TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_Active;
TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable;
TIM_OCInitStructure.TIM_Pulse = 10;
TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_High;
TIM_OC1Init(TIM1, &TIM_OCInitStructure);
TIM_OC1PreloadConfig(TIM1, TIM_OCPreload_Disable);
// Clear pending interrupt bits
TIM_ClearITPendingBit( TIM1, TIM_IT_Update | TIM_IT_CC1 );
TIM_ITConfig( TIM1, TIM_IT_Update | TIM_IT_CC1, ENABLE );
TIM_Cmd( TIM1, ENABLE );
}
示例13: TIM2_IRQHandler
/**-------------------------------------------------------
* @函数名 TIM5_IRQHandler
* @功能 TIM5中断处理函数,每0.1ms中断一次
* @参数 无
* @返回值 无
***------------------------------------------------------*/
void TIM2_IRQHandler(void)
{
/* www.armjishu.com ARM技术论坛 */
if (TIM_GetITStatus(TIM2, TIM_IT_Update) != RESET)
{
TIM_ClearITPendingBit(TIM2, TIM_IT_Update);
tick_1ms++;
if(tick_1ms >= 10)
{
tick_1ms = 0;
speed_count++;
tick_5ms++;
if(speed_count >= 50)
{
speed_count = 0;
}
CarMove();
}
//舵机PWM输出
duoji_count++;
if(duoji_count <= zhuanjiao)
{
Servo_SET;
}
else
{
Servo_RESET;
}
if(duoji_count >= 200)//20ms
{
duoji_count = 0;
}
}
}
示例14: TIM3_IRQHandler
void TIM3_IRQHandler()
{
if(TIM_GetITStatus(TIM3, TIM_IT_CC1) == SET)
{
// Clear TIM3 Capture compare interrupt pending bit
TIM_ClearITPendingBit(TIM3, TIM_IT_CC1);
if(CaptureNumber == 0)
{
// Get the Input Capture value
IC3ReadValue1 = TIM_GetCapture1(TIM3);
CaptureNumber = 1;
tim3ConfigFalling();
}
else if(CaptureNumber == 1)
{
// Get the Input Capture value
IC3ReadValue2 = TIM_GetCapture1(TIM3);
dataCaptureReady = 1;
CaptureNumber = 0;
tim3ConfigRising();
}
}
}
示例15: TIM3_IRQHandler
void TIM3_IRQHandler (void)
{
TIM_ClearITPendingBit (TIM3 , TIM_IT_Update );
dataX = mySPI_GetData(OutX);
dataY = mySPI_GetData(OutY);
dataZ = mySPI_GetData(OutZ);
out[0] = '\0';
strcpy(out,"X=");
tmp[0] = '\0';
itoa(tmp, 'd', dataX);
strcat(out, tmp);
strcat(out, ",Y=");
tmp[0] = '\0';
itoa(tmp, 'd', dataY);
strcat(out, tmp);
strcat(out, ",Z=");
tmp[0] = '\0';
itoa(tmp, 'd', dataZ);
strcat(out, tmp);
strcat(out, "\r\n");
uart_write(myUSART, out, strlen(out));
}