欢迎来到天天文库
浏览记录
ID:52113171
大小:18.39 KB
页数:22页
时间:2020-03-23
《STM32 实验程序代码.doc》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、实验1GPIO#include"stm32f10x.h"#include"delay.h"//#include"sys.h"#include"stm32f10x_exti.h"//QHKJTEB-CM5000实验箱STM32实验1//固件库V3.5工程模板//QHKJGPIO_InitTypeDefGPIO_InitStructure;EXTI_InitTypeDefEXTI_InitStructure;/*Privatefunctionprototypes-----------------------------------------------*/voi
2、dRCC_Configuration(void);voidNVIC_Configuration(void);voidGPIO_Configuration(void);/*Privatefunctions---------------------------------------------------------*//********************************************************************************FunctionName:main*Description:Mainprogram.
3、*Input:None*Output:None*Return:None*******************************************************************************/intmain(void){/*Configurethesystemclocks*///RCC_Configuration();//SysTick_Configuration();delay_init();/*NVICConfiguration*/NVIC_Configuration();/*ConfiguretheGPIOports
4、*/GPIO_Configuration();/*ConnectEXTILine9toPA.9*/GPIO_EXTILineConfig(GPIO_PortSourceGPIOA,GPIO_PinSource9);/*ConfigureEXTILine8togenerateaninterruptonfallingedge*/EXTI_InitStructure.EXTI_Line=EXTI_Line9;EXTI_InitStructure.EXTI_Mode=EXTI_Mode_Interrupt;EXTI_InitStructure.EXTI_Trigger
5、=EXTI_Trigger_Falling;EXTI_InitStructure.EXTI_LineCmd=ENABLE;EXTI_Init(&EXTI_InitStructure);for(;;){GPIO_Write(GPIOF,0xf80f);delay_ms(100);GPIO_Write(GPIOF,0xf817);delay_ms(100);GPIO_Write(GPIOF,0xf827);delay_ms(100);GPIO_Write(GPIOF,0xf847);delay_ms(100);GPIO_Write(GPIOF,0xf887);de
6、lay_ms(100);GPIO_Write(GPIOF,0x8907);delay_ms(100);GPIO_Write(GPIOF,0xfa07);delay_ms(100);GPIO_Write(GPIOF,0xfc07);delay_ms(100);}}/********************************************************************************FunctionName:NVIC_Configuration*Description:ConfiguresVectorTablebaselo
7、cation.*Input:None*Output:None*Return:None*******************************************************************************/voidNVIC_Configuration(void){NVIC_InitTypeDefNVIC_InitStructure;/*Configureonebitforpreemptionpriority*/NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);/*Enableth
8、eEXTI9_5Interrupt*/
此文档下载收益归作者所有