完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
|
|
相关推荐
1个回答
|
|
**AT32F403ZG 单片机的六路脉冲捕获** 1.单片机的型号是AT32F403ZG 六路的脉冲捕获,TMR1采集4路脉冲, 引脚为:PE9 、 PE11、 PE13、PE14;TMR2采集2路脉冲,引脚为:PB10、 PB11 。
2.计算捕获脉冲的频率,测量原理如下图 配置成上升沿触发,计算两次上升沿之间的时间,可以算出该脉冲的频率。 3.定时器1、定时器2的配置如下: /********************************************************* *º¯ÊýÃû£º void TIM1_Cap_Init(u16 arr,u16 psc) *º¯Êý¹¦ÄÜ£ºTMR1 4·Âö³å²¶»ñµÄ³õʼ»¯ *²ÎÊý£º arr :ʱÖӵļÆÊýÖÜÆÚ psc :ʱÖÓµÄÔ¤·ÖƵϵÊý£¨TMR1»ù׼ʱÖÓ192M£© *·µ»ØÖµ£º ÎÞ *ʱ¼ä£º 2021-01-28 *ÆäËû£º GPIO³õʼ»¯£¬TMR1 GPIOÈ«Ó³É䣬ÊäÈëÒý½Å£ºPE9 PE11 PE13 PE14 Ñ¡ÔñÊäÈë¶ËICxÓ³Éäµ½TIxÉÏ;ÅäÖÃÊäÈëÂ˲¨Æ÷ ÒÔFck_int²ÉÑù,8¸öʼþºóÓÐЧ; ÅäÖÃÊäÈë·ÖÅ䣬²»·ÖƵ;ÔÊÐí²¶»ñ¼ÆÊýÆ÷µÄÖµµ½²¶»ñ¼Ä´æÆ÷ÖÐ;ÔÊÐí4·²¶»ñÖÐ¶Ï ***************************************************************/ void TIM1_Cap_Init(u16 arr,u16 psc) { RCC_APB2PeriphClockCmd( RCC_APB2PERIPH_GPIOE | RCC_APB2PERIPH_TMR1 | RCC_APB2PERIPH_AFIO, ENABLE); GPIO_PinsRemapConfig(GPIO_FullRemap_TMR1, ENABLE); GPIO_InitType GPIO_InitStructure; //PE9 PE11 PE13 PE14 1 GPIO_InitStructure.GPIO_Pins = GPIO_Pins_9 | GPIO_Pins_11 | GPIO_Pins_13 | GPIO_Pins_14; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;//GPIO_Mode_IN_PU; GPIO_Mode_IN_FLOATING GPIO_InitStructure.GPIO_MaxSpeed = GPIO_MaxSpeed_50MHz; GPIO_Init(GPIOE, &GPIO_InitStructure); TMR1->AR=arr; // TMR1->DIV=psc; // //CH1 TMR1->CCM1|=1<<0; //C1SEL=01 Ñ¡ÔñÊäÈë¶ËIC1Ó³Éäµ½TI1ÉÏ TMR1->CCM1|=3<<4; //IC1F=0001 ÅäÖÃÊäÈëÂ˲¨Æ÷ ÒÔFck_int²ÉÑù,8¸öʼþºóÓÐЧ TMR1->CCM1|=0<<2; //IC1PS=00 ÅäÖÃÊäÈë·ÖÅ䣬²»·ÖƵ TMR1->CCE|=0<<1; //CC1P=0 ÉÏÉýÑز¶»ñ TMR1->CCE|=1<<0; //CC1E=1 ÔÊÐí²¶»ñ¼ÆÊýÆ÷µÄÖµµ½²¶»ñ¼Ä´æÆ÷ÖÐ //CH2 TMR1->CCM1|=1<<8; //C2SEL=01 Ñ¡ÔñÊäÈë¶ËIC2Ó³Éäµ½TI2ÉÏ TMR1->CCM1|=3<<12; //IC2F=0001 ÅäÖÃÊäÈëÂ˲¨Æ÷ ÒÔFck_int²ÉÑù,8¸öʼþºóÓÐЧ TMR1->CCM1|=0<<10; //IC2PS=00 ÅäÖÃÊäÈë·ÖÅ䣬²»·ÖƵ TMR1->CCE|=0<<5; //CC2P=0 ÉÏÉýÑز¶»ñ TMR1->CCE|=1<<4; //CC2E=1 ÔÊÐí²¶»ñ¼ÆÊýÆ÷µÄÖµµ½²¶»ñ¼Ä´æÆ÷ÖÐ //CH3 TMR1->CCM2|=1<<0; //C3SEL=01 Ñ¡ÔñÊäÈë¶ËIC3Ó³Éäµ½TI3ÉÏ TMR1->CCM2|=3<<4; //IC3F=0001 ÅäÖÃÊäÈëÂ˲¨Æ÷ ÒÔFck_int²ÉÑù,8¸öʼþºóÓÐЧ TMR1->CCM2|=0<<2; //IC3PS=00 ÅäÖÃÊäÈë·ÖÅ䣬²»·ÖƵ TMR1->CCE|=0<<9; //CC3P=0 ÉÏÉýÑز¶»ñ TMR1->CCE|=1<<8; //CC3E=1 ÔÊÐí²¶»ñ¼ÆÊýÆ÷µÄÖµµ½²¶»ñ¼Ä´æÆ÷ÖÐ //CH4 TMR1->CCM2|=1<<8; //C4SEL=01 Ñ¡ÔñÊäÈë¶ËIC4Ó³Éäµ½TI4ÉÏ TMR1->CCM2|=3<<12; //IC4F=0001 ÅäÖÃÊäÈëÂ˲¨Æ÷ ÒÔFck_int²ÉÑù,8¸öʼþºóÓÐЧ TMR1->CCM2|=0<<10; //IC4PS=00 ÅäÖÃÊäÈë·ÖÅ䣬²»·ÖƵ TMR1->CCE|=0<<13; //CC4P=0 ÉÏÉýÑز¶»ñ TMR1->CCE|=1<<12; //CC4E=1 ÔÊÐí²¶»ñ¼ÆÊýÆ÷µÄÖµµ½²¶»ñ¼Ä´æÆ÷ÖÐ TMR1->DIE|=1<<1; //ÔÊÐí²¶»ñ1ÖÐ¶Ï TMR1->DIE|=1<<2; //ÔÊÐí²¶»ñ2ÖÐ¶Ï TMR1->DIE|=1<<3; //ÔÊÐí²¶»ñ3ÖÐ¶Ï TMR1->DIE|=1<<4; //ÔÊÐí²¶»ñ4ÖÐ¶Ï // TMR1->DIE|=1<<0; //ÔÊÐí¸üÐÂÖÐ¶Ï TMR_SetCounter(TMR1,0); TMR1->CTRL1|=0x01; //ʹÄܼÆÊýÆ÷1 TIM1_CC_NVIC_Configuration(); //²¶»ñÖжϵÄÅäÖà 1 // TIM1_OV_NVIC_Configuration(); //Òç³öÖжϵÄÅäÖà } void TIM1_CC_NVIC_Configuration(void) { NVIC_InitType NVIC_InitStructure ; NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1); /* Enable the TMR1 Interrupt */ NVIC_InitStructure.NVIC_IRQChannel = TMR1_CC_IRQn;//TMR1_TRG_HALL_TMR11_IRQn; TMR1_OV_TMR10_IRQn NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority =0; NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_Init(&NVIC_InitStructure); } /********************************************************* *º¯ÊýÃû£º void TIM2_Cap_Init(u16 arr,u16 psc) *º¯Êý¹¦ÄÜ£ºTMR2 2·Âö³å²¶»ñµÄ³õʼ»¯£¨CH3¡¢CH4£© *²ÎÊý£º arr :ʱÖӵļÆÊýÖÜÆÚ psc :ʱÖÓµÄÔ¤·ÖƵϵÊý£¨TMR2»ù׼ʱÖÓ192M£© *·µ»ØÖµ£º ÎÞ *ʱ¼ä£º 2021-01-28 *ÆäËû£º GPIO³õʼ»¯£¬TMR2 GPIOÈ«Ó³É䣬ÊäÈëÒý½Å£ºPB10 PB11 Ñ¡ÔñÊäÈë¶ËICxÓ³Éäµ½TIxÉÏ;ÅäÖÃÊäÈëÂ˲¨Æ÷ ÒÔFck_int²ÉÑù,8¸öʼþºóÓÐЧ; ÅäÖÃÊäÈë·ÖÅ䣬²»·ÖƵ;ÔÊÐí²¶»ñ¼ÆÊýÆ÷µÄÖµµ½²¶»ñ¼Ä´æÆ÷ÖÐ;ÔÊÐí2·²¶»ñÖÐ¶Ï **************************************************************/ void TIM2_Cap_Init(u16 arr,u16 psc) { / TMR2 clock enable / RCC_APB1PeriphClockCmd(RCC_APB1PERIPH_TMR2, ENABLE); GPIO_PinsRemapConfig(GPIO_FullRemap_TMR2, ENABLE); / GPIOB clock enable */ RCC_APB2PeriphClockCmd(RCC_APB2PERIPH_GPIOB, ENABLE); GPIO_InitType GPIO_InitStructure; GPIO_InitStructure.GPIO_Pins = GPIO_Pins_10 | GPIO_Pins_11 ; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;//GPIO_Mode_IN_PU; GPIO_Mode_IN_FLOATING GPIO_InitStructure.GPIO_MaxSpeed = GPIO_MaxSpeed_50MHz; GPIO_Init(GPIOB, &GPIO_InitStructure); TMR2->AR=arr; // TMR2->DIV=psc; // //CH3 TMR2->CCM2|=1<<0; //C3SEL=01 Ñ¡ÔñÊäÈë¶ËIC3Ó³Éäµ½TI3ÉÏ TMR2->CCM2|=3<<4; //IC3F=0001 ÅäÖÃÊäÈëÂ˲¨Æ÷ ÒÔFck_int²ÉÑù,2¸öʼþºóÓÐЧ TMR2->CCM2|=0<<2; //IC3PS=00 ÅäÖÃÊäÈë·ÖÅ䣬²»·ÖƵ TMR2->CCE|=0<<9; //CC3P=0 ÉÏÉýÑز¶»ñ TMR2->CCE|=1<<8; //CC3E=1 ÔÊÐí²¶»ñ¼ÆÊýÆ÷µÄÖµµ½²¶»ñ¼Ä´æÆ÷ÖÐ //CH4 TMR2->CCM2|=1<<8; //C4SEL=01 Ñ¡ÔñÊäÈë¶ËIC4Ó³Éäµ½TI4ÉÏ TMR2->CCM2|=3<<12; //IC4F=0001 ÅäÖÃÊäÈëÂ˲¨Æ÷ ÒÔFck_int²ÉÑù,2¸öʼþºóÓÐЧ TMR2->CCM2|=0<<10; //IC4PS=00 ÅäÖÃÊäÈë·ÖÅ䣬²»·ÖƵ TMR2->CCE|=0<<13; //CC4P=0 ÉÏÉýÑز¶»ñ TMR2->CCE|=1<<12; //CC4E=1 ÔÊÐí²¶»ñ¼ÆÊýÆ÷µÄÖµµ½²¶»ñ¼Ä´æÆ÷ÖÐ TMR2->DIE|=1<<3; //ÔÊÐí²¶»ñ1ÖÐ¶Ï TMR2->DIE|=1<<4; //ÔÊÐí²¶»ñ1ÖÐ¶Ï // TMR2->DIE|=1<<0; //ÔÊÐí¸üÐÂÖÐ¶Ï TMR_SetCounter(TMR2,0); TMR2->CTRL1|=0x01; //ʹÄܼÆÊýÆ÷ TIM2_NVIC_Configuration(); //TMR2 Öжϵijõʼ»¯ } void TIM2_NVIC_Configuration(void) { NVIC_InitType NVIC_InitStructure ; NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1); /* Enable the TMR2 Interrupt */ NVIC_InitStructure.NVIC_IRQChannel = TMR2_GLOBAL_IRQn;// NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority =1; NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_Init(&NVIC_InitStructure); } 3.没有用到更新中断,仅仅用到了脉冲捕获中断,中断函数的处理如下: void TMR1_CC_IRQHandler(void) { if(TMR_GetINTStatus(TMR1, TMR_INT_CC1) != RESET) { TMR_ClearITPendingBit(TMR1, TMR_INT_CC1); if(state1==0) { TMR1CH1_CAPTURE_VAL1 = (uint16_t)TMR_GetCapture1(TMR1); state1=1; TMR1CH1_CAPTURE_VAL = 0; } else if(state1==1) { TMR1CH1_CAPTURE_VAL2 = (uint16_t)TMR_GetCapture1(TMR1); state1=0; if(TMR1CH1_CAPTURE_VAL1 <= TMR1CH1_CAPTURE_VAL2) TMR1CH1_CAPTURE_VAL = TMR1CH1_CAPTURE_VAL2 - TMR1CH1_CAPTURE_VAL1; else TMR1CH1_CAPTURE_VAL = 0xFFFF - TMR1CH1_CAPTURE_VAL1 + TMR1CH1_CAPTURE_VAL2 + 1; TMR1->DIE &= 0xFFFD; //½ûÖ¹²¶»ñ1ÖÐ¶Ï } } if(TMR_GetINTStatus(TMR1, TMR_INT_CC2) != RESET) { TMR_ClearITPendingBit(TMR1, TMR_INT_CC2); if(state2==0) { state2=1; TMR1CH2_CAPTURE_VAL1 = TMR_GetCapture2(TMR1); } else if(state2==1) { state2=0; TMR1CH2_CAPTURE_VAL2 = TMR_GetCapture2(TMR1); if(TMR1CH2_CAPTURE_VAL1 <= TMR1CH2_CAPTURE_VAL2) TMR1CH2_CAPTURE_VAL = TMR1CH2_CAPTURE_VAL2 - TMR1CH2_CAPTURE_VAL1; else TMR1CH2_CAPTURE_VAL = (0xFFFF - TMR1CH2_CAPTURE_VAL1) + TMR1CH2_CAPTURE_VAL2 + 1; TMR1->DIE &= 0xFFFB; //½ûÖ¹²¶»ñ2ÖÐ¶Ï } } if(TMR_GetINTStatus(TMR1, TMR_INT_CC3) != RESET) { TMR_ClearITPendingBit(TMR1, TMR_INT_CC3); if(state3==0) { state3=1; TMR1CH3_CAPTURE_VAL1 = TMR_GetCapture3(TMR1); } else if(state3==1) { state3=0; TMR1CH3_CAPTURE_VAL2 = TMR_GetCapture3(TMR1); if(TMR1CH3_CAPTURE_VAL1 <= TMR1CH3_CAPTURE_VAL2) TMR1CH3_CAPTURE_VAL = TMR1CH3_CAPTURE_VAL2 - TMR1CH3_CAPTURE_VAL1; else TMR1CH3_CAPTURE_VAL = (0xFFFF - TMR1CH3_CAPTURE_VAL1) + TMR1CH3_CAPTURE_VAL2 + 1 ; TMR1->DIE &= 0xFFF7; //½ûÖ¹²¶»ñ3ÖÐ¶Ï } } if(TMR_GetINTStatus(TMR1, TMR_INT_CC4) != RESET) { TMR_ClearITPendingBit(TMR1, TMR_INT_CC4); if(state4==0) { state4=1; TMR1CH4_CAPTURE_VAL1 = TMR_GetCapture4(TMR1); } else if(state4==1) { state4=0; TMR1CH4_CAPTURE_VAL2 = TMR_GetCapture4(TMR1); if(TMR1CH4_CAPTURE_VAL1 <= TMR1CH4_CAPTURE_VAL2) TMR1CH4_CAPTURE_VAL = TMR1CH4_CAPTURE_VAL2 - TMR1CH4_CAPTURE_VAL1; else TMR1CH4_CAPTURE_VAL = (0xFFFF - TMR1CH4_CAPTURE_VAL1) + TMR1CH4_CAPTURE_VAL2 + 1 ; TMR1->DIE &= 0xFFEF; //½ûÖ¹²¶»ñ4ÖÐ¶Ï } } } void TMR2_GLOBAL_IRQHandler(void) { if(TMR_GetINTStatus(TMR2, TMR_INT_CC3) == SET) 1 { /* Clear TMR2 Capture compare interrupt pending bit */ TMR_ClearITPendingBit(TMR2, TMR_INT_CC3); if(TMR2CH3_STATE == 0) { TMR2CH3_ReadValue1 = TMR_GetCapture3(TMR2); TMR2CH3_STATE = 1; } else if(TMR2CH3_STATE == 1) { TMR2CH3_STATE = 0; /* Get the Input Capture value */ TMR2CH3_ReadValue2 = TMR_GetCapture3(TMR2); /* Capture computation */ if (TMR2CH3_ReadValue2 >= TMR2CH3_ReadValue1) { TMR2CH3_CaptureValue = (TMR2CH3_ReadValue2 - TMR2CH3_ReadValue1); } else { TMR2CH3_CaptureValue = ((0xFFFF - TMR2CH3_ReadValue1) + TMR2CH3_ReadValue2 + 1); } TMR2->DIE &= 0xFFF7; //½ûÖ¹²¶»ñ3ÖÐ¶Ï } } if(TMR_GetINTStatus(TMR2, TMR_INT_CC4) == SET) 1 { /* Clear TMR2 Capture compare interrupt pending bit / TMR_ClearITPendingBit(TMR2, TMR_INT_CC4); if(TMR2CH4_STATE == 0) { / Get the Input Capture value / TMR2CH4_ReadValue1 = TMR_GetCapture4(TMR2); TMR2CH4_STATE = 1; } else if(TMR2CH4_STATE == 1) { TMR2CH4_STATE = 0; / Get the Input Capture value */ TMR2CH4_ReadValue2 = TMR_GetCapture4(TMR2); /* Capture computation */ if (TMR2CH4_ReadValue2 >= TMR2CH4_ReadValue1) { TMR2CH4_CaptureValue = (TMR2CH4_ReadValue2 - TMR2CH4_ReadValue1); } else { TMR2CH4_CaptureValue = ((0xFFFF - TMR2CH4_ReadValue1) + TMR2CH4_ReadValue2 + 1); } TMR2->DIE &= 0xFFEF; //½ûÖ¹²¶»ñ4ÖÐ¶Ï } } /* if(TMR_GetINTStatus(TMR2, TMR_INT_Overflow) != RESET ) { TMR_ClearITPendingBit(TMR2, TMR_INT_Overflow); //Clear TMR1 update interrupt } */ } 4.主函数的处理如下: volatile uint16_t TMR1CH1_CAPTURE_VAL,TMR1CH2_CAPTURE_VAL,TMR1CH3_CAPTURE_VAL,TMR1CH4_CAPTURE_VAL; volatile uint16_t TMR2CH3_CaptureValue, TMR2CH4_CaptureValue; int main(void) { Delay_init(); /* ¶¨Ê±Æ÷1¡¢2µÄĬÈÏƵÂÊÊÇ192MHZ ·ÖƵ 191 µÃµ½ 1MHZ ·ÖƵ 383 µÃµ½ 500KHZ ·ÖƵ 1919 µÃµ½ 100KHZ */ TIM1_Cap_Init(0xFFFF,383); TIM2_Cap_Init(0xFFFF,383); UART_NVIC_Configuration(); USART_Configuration(); while(1) { GET_PULSE(); TMR1CH1_CAPTURE_VAL = 0; TMR1CH2_CAPTURE_VAL = 0; TMR1CH3_CAPTURE_VAL = 0; TMR1CH4_CAPTURE_VAL = 0; TMR2CH3_CaptureValue = 0; TMR2CH4_CaptureValue = 0; TMR1CH1_CAPTURE_VAL1 = 0; TMR1CH1_CAPTURE_VAL2 = 0; TMR1CH1_flag = 0; TMR1CH2_flag = 0; TMR1CH3_flag = 0; TMR1CH4_flag = 0; TMR2CH3_flag = 0; TMR2CH4_flag = 0; TMR1->DIE |= 0x1E; //ÔÊÐí²¶»ñ1¡¢2¡¢3¡¢4ÖÐ¶Ï TMR2->DIE |= 0x18; //ÔÊÐí²¶»ñ3¡¢4ÖÐ¶Ï Delay_ms(1000); } } void GET_PULSE() { Int8 sendstr[100]; if(TMR1CH1_CAPTURE_VAL != 0) Fq1 = (float)Fre_HZ / TMR1CH1_CAPTURE_VAL; else Fq1 = 0; if(TMR1CH2_CAPTURE_VAL != 0) Fq2 = (float)Fre_HZ / TMR1CH2_CAPTURE_VAL; else Fq2 = 0; if(TMR1CH3_CAPTURE_VAL != 0) Fq3 = (float)Fre_HZ / TMR1CH3_CAPTURE_VAL; else Fq3 = 0; if(TMR1CH4_CAPTURE_VAL != 0) Fq4 = (float)Fre_HZ / TMR1CH4_CAPTURE_VAL; else Fq4 = 0; if(TMR2CH3_CaptureValue != 0) Fq5 = (float)Fre_HZ / TMR2CH3_CaptureValue; else Fq5 = 0; if(TMR2CH4_CaptureValue != 0) Fq6 = (float)Fre_HZ / TMR2CH4_CaptureValue; else Fq6 = 0; sprintf(sendstr,"GET_PULSE,%.2f,%.2f,%.2f,%.2f,%.2f,%.2f",Fq1,Fq2,Fq3,Fq4,Fq5,Fq6); gps_SendString(sendstr); } void UART_NVIC_Configuration(void) { NVIC_InitType NVIC_InitStructure; /* Configure the NVIC Preemption Priority Bits / NVIC_PriorityGroupConfig(NVIC_PriorityGroup_0); / Enable the USART3 Interrupt / NVIC_InitStructure.NVIC_IRQChannel = USART3_IRQn; NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0; NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_Init(&NVIC_InitStructure); } void USART_Configuration(void) { GPIO_InitType GPIO_InitStructure; USART_InitType USART_InitStructure; / Enable GPIO clock / RCC_APB2PeriphClockCmd(RCC_APB2PERIPH_GPIOC | RCC_APB2PERIPH_AFIO, ENABLE); GPIO_PinsRemapConfig(GPIO_PartialRemap_USART3, ENABLE); / Enable USART3 Clock */ RCC_APB1PeriphClockCmd(RCC_APB1PERIPH_USART3, ENABLE); /* Configure USART3 Rx as input floating */ 1 GPIO_InitStructure.GPIO_Pins = GPIO_Pins_11; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING; // GPIO_InitStructure.GPIO_MaxSpeed = GPIO_MaxSpeed_50MHz; GPIO_Init(GPIOC, &GPIO_InitStructure); /* Configure USART3 Tx as alternate function push-pull */ GPIO_InitStructure.GPIO_Pins = GPIO_Pins_10; GPIO_InitStructure.GPIO_MaxSpeed = GPIO_MaxSpeed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; GPIO_Init(GPIOC, &GPIO_InitStructure); USART_StructInit(&USART_InitStructure); 1 USART_InitStructure.USART_BaudRate = 115200; USART_InitStructure.USART_WordLength = USART_WordLength_8b; USART_InitStructure.USART_StopBits = USART_StopBits_1; USART_InitStructure.USART_Parity = USART_Parity_No; USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None; USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx; USART_Init(USART3, &USART_InitStructure); /* Configure USART3 */ USART_INTConfig(USART3, USART_INT_RDNE, ENABLE); USART_Cmd(USART3, ENABLE); USART_ClearFlag(USART3, USART_FLAG_TRAC); } 串口每秒打印一次六路脉冲的频率。 备注: 代码的注释显示不正常,可以把代码复制到 KEIL5环境下看,可以正常显示。代码已经验证正确。 |
|
|
|
只有小组成员才能发言,加入小组>>
3278 浏览 9 评论
2956 浏览 16 评论
3458 浏览 1 评论
8996 浏览 16 评论
4051 浏览 18 评论
1109浏览 3评论
572浏览 2评论
const uint16_t Tab[10]={0}; const uint16_t *p; p = Tab;//报错是怎么回事?
568浏览 2评论
用NUC131单片机UART3作为打印口,但printf没有输出东西是什么原因?
2301浏览 2评论
NUC980DK61YC启动随机性出现Err-DDR是为什么?
1858浏览 2评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-23 22:34 , Processed in 0.909893 second(s), Total 49, Slave 39 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号