stm32单片机时钟蜂鸣器的编程语言是怎么写的?
/** ??****************************************************************************** ??*?@file????main。 c ??*?@author?? ??*?@version?V1。0 ??*?@date????20xx-xx-xx ??*?@brief???用3。5。0版本库建的工程模板 ??****************************************************************************** ??*?@attention ??* ??*?实验...全部
/** ??****************************************************************************** ??*?@file????main。
c ??*?@author?? ??*?@version?V1。0 ??*?@date????20xx-xx-xx ??*?@brief???用3。5。0版本库建的工程模板 ??****************************************************************************** ??*?@attention ??* ??*?实验平台:野火?V2?开发板? ??*?硬件连接??C3??C4??C5 ??****************************************************************************** ??*/ ?? #include?"stm32f10x。
h" #include?"delay。h" #include?"led。h" /** ??*?@brief??主函数 ??*?@param??无 ??*?@retval?无 ??*/ int?main(void) { ????????//初始化用的GPIO口 ????????LED_GPIO_Config(); ????????while(1) ????????{ ????????????????/*?add?your?code?here?^_^。
?*/ ????????????????LED1(ON); ????????????????delay_1(0X0FFFFF?); ????????????????LED1(OFF); ????????????????LED2(ON); ????????????????delay_1(0X0FFFFF?); ????????????????LED2(OFF); ????????????????LED3(ON); ????????????????delay_1(0X0FFFFF?); ????????????????LED3(OFF); ????????} } /*********************************************END?OF?FILE**********************/ ? #include?"delay。
h" void?delay_1(__IO?u32?Count?) { ????????for(;Count!=0;Count--) ????????{} } #ifndef?_DELAY_H #define?_DELAY_H #include?"stm32f10x。
h" void?delay_1(?__IO?uint32_t?Count?); #endif ? #include?"led。h" void?LED_GPIO_Config(void) { ????????GPIO_InitTypeDef?GPIO_InitStructure; ????????//晶振启动 ????????RCC_APB2PeriphClockCmd?(RCC_APB2Periph_GPIOC?, ????????????????????????????????????????????????????????????????????????????????????????????????????????ENABLE); ????????//初始化对应的GPIO ????????GPIO_InitStructure。
GPIO_Mode???=?GPIO_Mode_Out_PP?; ????????GPIO_InitStructure。GPIO_Pin????=?GPIO_Pin_3|GPIO_Pin_4|GPIO_Pin_5; ????????GPIO_InitStructure。
GPIO_Speed??=?GPIO_Speed_50MHz; ????????GPIO_Init?(GPIOC,&GPIO_InitStructure); ????????//先关闭所有led ????????GPIO_SetBits(GPIOC,GPIO_Pin_3|GPIO_Pin_4|GPIO_Pin_5); } ? #ifndef?_LED_H #define?_LED_H //头文件引用 #include?"stm32f10x。
h" //函数声明 void?LED_GPIO_Config(void); #define?ON??0 #define?OFF?1 #define?LED1(a)?if?(a)? ????????????????????????????????????????????????????????GPIO_SetBits(GPIOC,GPIO_Pin_3);? ????????????????????????????????????????????????????????else? ????????????????????????????????????????????????????????GPIO_ResetBits?(GPIOC,GPIO_Pin_3); ???????????????????????????????????????????????????????? #define?LED2(a)?if?(a)? ????????????????????????????????????????????????????????GPIO_SetBits(GPIOC,GPIO_Pin_4);? ????????????????????????????????????????????????????????else? ????????????????????????????????????????????????????????GPIO_ResetBits?(GPIOC,GPIO_Pin_4); ???????????????????????????????????????????????????????? #define?LED3(a)?if?(a)? ????????????????????????????????????????????????????????GPIO_SetBits(GPIOC,GPIO_Pin_5);? ????????????????????????????????????????????????????????else? ????????????????????????????????????????????????????????GPIO_ResetBits?(GPIOC,GPIO_Pin_5); ???????????????????????????????????????????????????????? #endif ? 追答 : 以上是C语音。
收起