完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
电子发烧友论坛|
当数据进来时,我的USATAR2中断没有被调用。这是我的代码:
以上来自于百度翻译 以下为原文 my Usart2 interrupt is not being called when data is coming in. here is my code: int main(int argc, char** argv) { ... OpenUART1(UART_EN| UART_NO_PAR_8BIT | UART_1STOPBIT , UART_RX_ENABLE|UART_TX_ENABLE, (FPb /16/desired_baud) - 1 ); ConfigIntUART2(UART_RX_INT_EN | UART_TX_INT_DIS | UART_ERR_INT_EN | UART_INT_PR0 | UART_INT_SUB_PR0); OpenUART2(UART_EN| UART_NO_PAR_8BIT | UART_1STOPBIT , UART_RX_ENABLE|UART_TX_ENABLE, (FPb /16/desired_baud) - 1 ); EnableIntU2TX; INTEnableSystemMultiVectoredInt(); ... } ... void __ISR(_UART2_VECTOR, IPL2SOFT) IntUart2Handler(void) { unsigned char buffer[21] = {0}; //unsigned char temp[ask_number]; //int loop_time = size - 5; int i2 = 4; int intTemp =0; int i; int t; int counter =1; float ff; char str2[4]; char intValue[1]; for( t = 0 ; t < 21; t++) { while(!DataRdyUART2()); { buffer[t] = ReadUART2(); } } Write_Usart(": completing answer = "); char RX_data = '0'; for( int t = 0; t <(buffer[2]/2); t++ ) { intTemp = (((unsigned int)buffer[i2] << 8) + (unsigned int)buffer[i2 +1]); sprintf(intValue,"%i",counter ); Write_Usart(intValue); Write_Usart(": Value is = "); sprintf(intValue,"%i",intTemp); Write_Usart(intValue); Write_Usart("rn"); i2 = i2 + 2; counter++; } } |
|
相关推荐
5个回答
|
|
|
您是否丢失:Itabl中断();/启用中断。全局启用中断吗?您的代码看起来略有不同,因此它可能在您正在调用的函数“TealablSistMuleVeCurtEnter()”中。您使用的是编译器、DEV环境。
以上来自于百度翻译 以下为原文 Are you missing: INTEnableInterrupts(); // Enable interrupts. to Globally enable the interrupts? Your code looks slightly different so it might be in the function "INTEnableSystemMultiVectoredInt()" that you are calling. which compiler, dev environment are you using> regards PhilipJ |
|
|
|
|
|
|
|
|
|
|
|
Hiu还没有显示你的UART配置。你的优先级设置为2吗?当你的ISR正在期待这个“IPL2SOFF”空洞y-ISR(U-UART2X矢量,IPL2SOFT)Itudi2Huffer-Load(空)将你的优先级设置为2时,也可以设置优先级,因为PIC32 MX文档中的某些表中有错误,只需检查所有表,看看是否存在错配。当我设置错误的向量表时,在我的设备上有了uART3。我看到了你的设置错误检查,你检查了你的标志是否有问题?要小心,因为错误检查中有bug(论坛上有很多问题),我有很多问题需要使用Unter中断来获得和谐OriBBS,所以现在我只使用XC32编码。这使得CoCube更紧凑,更容易看到如果有问题。我使用PIC32 MX和5 USTART。不同的速度,都使用中断。和谐伟大,但如果它不起作用,你很快就会迷路。
以上来自于百度翻译 以下为原文 hi you haven't shown your uart config. Is your priority set to 2? as your ISR is expecting this "IPL2SOFT" void __ISR(_UART2_VECTOR, IPL2SOFT) IntUart2Handler(void) your setting your priority to 2. Also be carful of setting the priority as there are error in some tables in the PIC32MX documents, just check all tables to see if there a mismatch. this got me with uart3 on my device as I was setting up the wrong vector table. I see your setting error checking, have you checked your flags to see if there is a problem? be careful as there are bugs in the error checks(lots of issues raise on the forums) I have had lots of issues getting Harmony or PLIBs working with Usart interrupts, so now I just code using XC32. This makes the code is more compact and easier to see if there an issue. I am using PIC32MX with 5 usarts at different speeds, all using interrupts. Harmony great but if it does not work you can get lost quickly. regards Ross |
|
|
|
|
|
我必须这样做:
以上来自于百度翻译 以下为原文 I had to do this : // Configure UART2 RX Interrupt with priority 2 ConfigIntUART2(UART_INT_PR2 | UART_RX_INT_EN); // Must enable glocal interrupts - in this case, we are using multi-vector mode INTEnableSystemMultiVectoredInt(); |
|
|
|
|
|
|
|
|
|
|
只有小组成员才能发言,加入小组>>
MPLAB X IDE V6.25版本怎么对bootloader和应用程序进行烧录
475 浏览 0 评论
5795 浏览 9 评论
2334 浏览 8 评论
2224 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3530 浏览 3 评论
1126浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
1098浏览 1评论
我是Microchip 的代理商,有PIC16F1829T-I/SS 技术问题可以咨询我,微信:A-chip-Ti
873浏览 1评论
MPLAB X IDE V6.25版本怎么对bootloader和应用程序进行烧录
476浏览 0评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-3 17:00 , Processed in 1.368243 second(s), Total 81, Slave 64 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
890