独立按键中断实验说明

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
3.2 程序代码
/************************** Constant Definitions *****************************/ #ifndef TESTAPP_GEN
/*
* The following constants map to the XPAR parameters created in the
* tuned for faster or slower processor speeds. */ #define LED_DELAY 1000000
#endif /* TESTAPP_GEN */
#define INTR_DELAY 0x00FFFFFF #define INTR_MASK 0xF
/* * The following constant is used to wait after an LED is turned on to make
* sure that it is visible to the human eye. This constant might need to be
* xparameters.h file. They are defined here such that a user can easily
* change all the needed parameters in one place.
*/
#define BTN_DEVICE_ID
XPAR_GPIO_BTN_DEVICE_ID
#define INTC_DEVICE_IDXPAR_SCUGIC_SINGLE_DEVICE_ID
#define INTC
XScuGic
#define INTC_HANDLER XScuGic_InterruptHandler
/************************** Function Prototypes ******************************/ void GpioHandler(void *CallBackRef);
#define LEDS_DEVICE_ID
XPAR_GPIO_LEDS_DEVICE_ID
#define GPIO_CHANNEL1
1wk.baidu.com
#define INTC_GPIO_INTERRUPT_ID XPAR_FABRIC_GPIO_BTN_IP2INTC_IRPT_INTR #define INTC_DEVICE_ID XPAR_SCUGIC_SINGLE_DEVICE_ID
int GpioIntrInitialize();
int GpioSetupIntrSystem(INTC *IntcInstancePtr, XGpio *InstancePtr, u16 DeviceId, u16 IntrId, u16 IntrMask);
void GpioDisableIntr(INTC *IntcInstancePtr, XGpio *InstancePtr, u16 IntrId, u16 IntrMask);
/* * The following constant determines which buttons must be pressed at the
same * time to cause interrupt processing to stop and start */
#define INTERRUPT_CONTROL_VALUE 0x7
/*
* The following constants define the positions of the buttons and LEDs
each
* channel of the GPIO
*/
#define LEDS_ALL_ON
0x00
#define LEDS_ALL_OFF
0xFF
#define SEG7_ALL_ON
独立按键中断实验说明文档
一. 背景知识说明
1.1 电路原理说明
图 1-1 从图 1-1 可知,对应按键按下之后,FPGA 的对应管脚输入电平值应该为 0。
1.2 其他说明
图 1-2 从图 1-3 可知最左边为芯片引脚编号箭头所指为对应的网络标号。该对应关系用到设 计的管脚约束上,xdc 文件必须严格按照该图进行配置。
buttons * and the LEDs. They allow the channels to be reversed easily. */
#define LEDS_CHANNEL 1 /* Channel 1 of the GPIO Device */ #define SEG7_CHANNEL 2 /* Channel 2 of the GPIO Device */ #define BUTTON_INTERRUPT XGPIO_IR_CH1_MASK /* Channel 1 Interrupt Mask */
0x00FFFF
#define SEG7_ALL_OFF
0xFF0000
#define GPIO_ALL_LEDS
0xFFFF
#define GPIO_ALL_BUTTONS 0xFFFF
/* * The following constants define the GPIO channel that is used for the
二.Vivado 操作说明
2.1 特殊操作步骤说明
图 2-1 导入 PS 部分设置 该步骤需要根据硬件平台数据手册或者用户手册导入正确的 PS 部分设置文件,否则 SDK 中会出现找不到 ARM 的错误。
三.源代码说明
3.1 函数及变量说明
/***************************** Include Files *********************************/ #include "xparameters.h" #include "xgpio.h" #include "xil_exception.h" #include "xscugic.h" #include "xil_printf.h"
相关文档
最新文档