野火电子论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 13355|回复: 3

外部中断 按教程PC13改成PA0 怎么提醒程序有误 在线等

[复制链接]
发表于 2015-5-25 15:37:47 | 显示全部楼层 |阅读模式
编译主函数时候,EXTI_PA0_Config();  这里会出现感叹号。不知道怎么情况。
外部中断 按教程PC13改成PA0 怎么提醒程序有误 。


实现PA0按键 LED翻转
主函数
  1. #include "stm32f10x.h"
  2. #include "bsp_led.h"
  3. #include "bsp_exti.h"

  4. #define CLI()   __set_PRIMASK(1)                /
  5. #define SEI() __set_PRIMASK(0)                                /

  6. /
  7. int main(void)
  8. {       
  9.         /* config the led */
  10.         LED_GPIO_Config();
  11.         LED1_ON;
  12.        
  13.         CLI();               //1Ø¿a ò»Æeóà 
  14.         SEI();
  15.        
  16.         /* exti line config */
  17. EXTI_PA0_Config();
  18.         /* wait interrupt */
  19.         while(1)                           
  20.         {
  21.         }
  22. }
复制代码
bsp_exti.c
  1. #include "bsp_exti.h"


  2. static void NVIC_Configuration(void)
  3. {
  4.   NVIC_InitTypeDef NVIC_InitStructure;
  5.   
  6.   /* Configure one bit for preemption priority */
  7.   NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);
  8.   
  9.   /* ÅäÖÃP[A|B|C|D|E]13ÎaÖD¶ÏÔ′ */
  10.   NVIC_InitStructure.NVIC_IRQChannel = EXTI0_IRQn;
  11.   NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
  12.   NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
  13.   NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
  14.   NVIC_Init(&NVIC_InitStructure);
  15. }


  16. void EXTI_PA0_Config(void)
  17. {
  18.         GPIO_InitTypeDef GPIO_InitStructure;
  19.         EXTI_InitTypeDef EXTI_InitStructure;

  20.         /* config the extiline(PC13) clock and AFIO clock */
  21.         RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_AFIO,ENABLE);
  22.                                                                                                
  23.         /* config the NVIC(PC13) */
  24.         NVIC_Configuration();

  25.         /* EXTI line gpio config(PC13) */       
  26.   GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0;      
  27.   GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU;         // éÏà-êäèë
  28.   GPIO_Init(GPIOA, &GPIO_InitStructure);

  29.         /* EXTI line(PC13) mode config */
  30.   GPIO_EXTILineConfig(GPIO_PortSourceGPIOA, GPIO_PinSource0);
  31.   EXTI_InitStructure.EXTI_Line = EXTI_Line0;
  32.   EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
  33.   EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling;
  34.   EXTI_InitStructure.EXTI_LineCmd = ENABLE;
  35.   EXTI_Init(&EXTI_InitStructure);
  36. }
  37. /*********************************************END OF FILE**********************/
复制代码


bsp_exti.h
  1. #ifndef __EXTI_H
  2. #define        __EXTI_H

  3. #include "stm32f10x.h"
  4. void EXTI_PA0_Config(void);

  5. #endif /* __EXTI_H */
复制代码


这里出现一个感叹号。

这里出现一个感叹号。

这里有问题描述。

这里有问题描述。
回复

使用道具 举报

发表于 2015-5-25 17:51:17 | 显示全部楼层
你的头文件里没有改声明吧
回复 支持 反对

使用道具 举报

 楼主| 发表于 2015-5-26 17:24:39 | 显示全部楼层
flyleaf 发表于 2015-5-25 17:51
你的头文件里没有改声明吧

已经改啦啊
QQ图片20150526172420.png
回复 支持 反对

使用道具 举报

发表于 2015-5-29 09:13:14 | 显示全部楼层

你改的这个.h头文件不是你工程里用的
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

联系站长|手机版|野火电子官网|野火淘宝店铺|野火电子论坛 ( 粤ICP备14069197号 ) 大学生ARM嵌入式2群

GMT+8, 2024-9-20 09:11 , Processed in 0.049462 second(s), 27 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表