|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
- #include "xparameters.h"
- #include "xcache_l.h"
- #include "stdio.h"
- #include "xutil.h"
- #include "xuartlite.h"
- #include "xuartlite_l.h"
- #include "xintc.h"
- #include "xintc_l.h"
- #include "xintc_i.h"
- #include "xexception_l.h"
- //====================================================
- char buff;
- void RS232_IntHandler(void)
- {
- while(!XUartLite_mIsReceiveEmpty(XPAR_RS232_BASEADDR ))
- {
- buff=XUartLite_RecvByte(XPAR_RS232_BASEADDR );
- XUartLite_SendByte(XPAR_RS232_BASEADDR,buff);
- }
- }
- int main (void)
- {
- print("-- Entering main() --\r\n");
- XExc_Init();
- XExc_RegisterHandler(XEXC_ID_NON_CRITICAL_INT,(XExceptionHandler)XIntc_DeviceInterruptHandler,(void*)0);
- XCache_EnableICache(0xc0000001);
- XCache_EnableDCache(0xc0000001);
- XIntc_RegisterHandler(XPAR_XPS_INTC_0_BASEADDR,XPAR_XPS_INTC_0_RS232_INTERRUPT_INTR,(XInterruptHandler)RS232_IntHandler,(void *)0);
- XIntc_mMasterEnable(XPAR_XPS_INTC_0_BASEADDR );
- XIntc_mEnableIntr(XPAR_XPS_INTC_0_BASEADDR,XPAR_RS232_INTERRUPT_MASK );
- XUartLite_mEnableIntr(XPAR_RS232_BASEADDR);
-
- while(1){}
- return 0;
- XCache_DisableDCache();
- XCache_DisableICache();
- }
复制代码
我是想要实现用中断的方式实现串口收到数据之后马上将原数据发回,求大神解决,此函数现在不嫩刚进入到main函数,另外求教关于配置中断寄存器的方法 |
|