完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
以下是我写的外部中断程序,运行时按按钮无法进入中断服务程序。请给位帮忙看一下,程序有没有问题。
#include "gpio.h" #include "interrupt.h" #include "psc.h" //#include "Sys_Init.h" #include "soc_C6748.h" #include "lcdkC6748.h" volatile unsigned char flag = 0; /****************************************************************************/ /* LOCAL FUNCTION PROTOTYPES */ /****************************************************************************/ static void Delay(volatile unsigned int delay); void EVMC6748_pinmuxConfig(unsigned int in_reg, unsigned int in_mask, unsigned int in_val) ; static void InitDspIntc(void) ; static void GPIOIsr(void) ; /****************************************************************************/ /* GLOBAL VARIABLES */ /****************************************************************************/ /****************************************************************************/ /* LOCAL FUNCTION DEFINITIONS */ /****************************************************************************/ int main(void) [ int i = 0 ; PSCModuleControl(SOC_PSC_1_REGS, HW_PSC_GPIO, PSC_POWERDOMAIN_ALWAYS_ON, PSC_MDCTL_NEXT_ENABLE); EVMC6748_pinmuxConfig(6,0xF000,0x8000); GPIODirModeSet(SOC_GPIO_0_REGS, 37, GPIO_DIR_INPUT); GPIODirModeSet(SOC_GPIO_0_REGS, 37, GPIO_INT_TYPE_RISEDGE); GPIOBankIntEnable(SOC_GPIO_0_REGS, 2); InitDspIntc() ; while(1) [ i ++ ; Delay(1000000); ] ] /* ** brief This function sets up the status of interrupt. ** */ static void InitDspIntc(void) [ IntDSPINTCInit(); //initialize the interrupt controller IntGlobalEnable(); //enable DSP CPU interrupts globally IntRegister(C674X_MASK_INT4, GPIOIsr); //register the ISR in the interrupt vector table IntEventMap(C674X_MASK_INT4, SYS_INT_GPIO_B2INT); //map the system event GPIO_Bank2(BUTTON) to CPU INT4 IntEnable(C674X_MASK_INT4); //enable the CPU masked INT4 IntEventSet(SYS_INT_GPIO_B2INT); //set the EVTFLAG register of GPIO_Bank2 ] /* ** brief Interrupt Service Routine to be executed on GPIO interrupts. ** This disables the bank interrupts, clears the system interrupt ** status and pin interrupt status. This also sets flag as 1. */ static void GPIOIsr(void) [ /* Disable the interrupts for pins of bank 2 in GPIO.*/ GPIOBankIntDisable(SOC_GPIO_0_REGS, 2); /* Clear the system interrupt status in the DSPINTC*/ IntEventClear(SYS_INT_GPIO_B2INT); /* Clears the Interrupt Status of GP2[4] in GPIO.*/ GPIOPinIntClear(SOC_GPIO_0_REGS, 37); flag = 1; ] /* ** brief This function checks the insertion status of the MMC/SD card ** in the device and prints related statements on the serial ** commuincation console of the external device. ** */ /* ** brief This function can be called to generate a delay. */ static void Delay(volatile unsigned int delay) [ while(delay--); ] void EVMC6748_pinmuxConfig(unsigned int in_reg, unsigned int in_mask, unsigned int in_val) [ // unlock the system config registers. SYSCONFIG->KICKR[0] = KICK0R_UNLOCK; SYSCONFIG->KICKR[1] = KICK1R_UNLOCK; // make sure the pinmux register is cleared for the mask bits before // setting the value. CLRBIT(SYSCONFIG->PINMUX[in_reg], in_mask); SETBIT(SYSCONFIG->PINMUX[in_reg], in_val); // lock the system config registers. SYSCONFIG->KICKR[0] = KICK0R_LOCK; SYSCONFIG->KICKR[1] = KICK1R_LOCK; ] /*****************************END OF FILE************************************/ |
|
相关推荐
5 个讨论
|
|
只有小组成员才能发言,加入小组>>
TMS320F28377D:新做了以377d为芯片的板子,上电后芯片复位引脚出现方波请问如何解决?
1872 浏览 0 评论
TPS55340通电后输入端保险丝烧断,芯片输入和GND之间短路
3614 浏览 4 评论
5020 浏览 0 评论
请问如何用DM368对RGB格式的图片数据进行编码生成JPEG格式图片?
1725 浏览 1 评论
9311 浏览 8 评论
CC3100BOOST使用CC3200lunchXL进行烧录
654浏览 2评论
697浏览 1评论
TMS320F28034: 利用C2prog通过SCI给TMS320F28034烧录程序,出现错误提示:Bootloading... failed (invalid echo)!
651浏览 1评论
1179浏览 1评论
求DLPC350 Programmer’s Guide User's Guide 中文版说明书
1174浏览 1评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-3-29 21:59 , Processed in 0.771149 second(s), Total 69, Slave 54 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 深圳华秋电子有限公司
电子发烧友 (电路图) 粤公网安备 44030402000349 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号