完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
你好,我是PIC24的新手。我想问你一个问题,我使用的是PIC24FJ256GB206,我想要在RB29配置It1。我应该使用哪些代码?提前感谢。
以上来自于百度翻译 以下为原文 Hello, I am new to PIC24. I want to ask you a question. I am using PIC24FJ256GB206 and want ti configure INT1 at RB29. Which code should i use? Thanks in advance. |
|
相关推荐
6个回答
|
|
假设您的意思是说“RP29”,那么:In It1R=29;/ /分配It1到PPSγ29:在这里,I.It1R在PIC24FJ256GB206.H文件中定义为:
以上来自于百度翻译 以下为原文 assuming you meant to say 'RP29' then: _INT1R = 29; // assign INT1 to PPS #29 where: _INT1R is defined in the PIC24FJ256GB206.h file as: #define _INT1R RPINR0bits.INT1R |
|
|
|
感谢VJasiSky.我尝试为PNRB15/RP29做外部中断1,打开Pin RB5上的LED。但它仍然不起作用。你能帮助我吗?我不知道我的错误在哪里。ValuyAyAtditTyx((中断,AutoYPSV)){T1中断(空){ /检查中断是由PIN RB15/RP29 IF(IFS1BIT.It1IF=1)引起的/ /检查接收中断标志BITYLATB5=1;IFS1BIT.It1IF=0;//清除中断标志}主(空){TrISC=0;TrISBITS.TrIS。B15=1;(PIN RB15/RP29作为输入)TISBB6=0;IEC1BIT.It1IE=1;InCON2BIT.It1EP=0;IFS1BIT.It1IF=0;
以上来自于百度翻译 以下为原文 Thank vjasinski. I have tried to make external interrupt 1 for pinRB15/RP29 to turn on LED on pinRB5. But it still doesn't work. Can you help me? I don't know where my fault is. void __attribute__((interrupt, auto_psv)) _T1Interrupt(void) {//check if the interrupt is caused by the pin RB15/RP29 if(IFS1bits.INT1IF == 1) //Checks Receive Interrupt Flag bit _LATB5 = 1; IFS1bits.INT1IF = 0; // Clear Interrupt Flag } main (void) {TRISC = 0; TRISBbits.TRISB15=1; (pin RB15/RP29 as input) TRISBbits.TRISB6 =0; IEC1bits.INT1IE=1; INTCON2bits.INT1EP=0; IFS1bits.INT1IF=0; __builtin_write_OSCCONL(OSCCON & 0xBF) ; RPINR0bits.INT1R = 29; // Assign interrupt 1 to RP29 __builtin_write_OSCCONL(OSCCON | 0x40); IPC5bits.INT1IP1=1; while(1) {} } |
|
|
|
1。使用代码标签进行可读性。2。在这个引脚上是否有模拟输入。他们优先考虑,必须被禁用。3。我将OSCCon读取为局部变量,用于构建函数。如果生成的代码没有严格按照顺序执行,则可能不会锁定它。4。在分配之前,您不需要解锁,因为PPS在复位5上解锁。我想你可以检查计时器例程中的中断标志,但是为什么不设置和中断一个例程。包括边缘选择。6。你是否配置了计时器并启用了它的中断?都是现在,文斯
以上来自于百度翻译 以下为原文 1. Use code tags for readability. 2. Is there an analog input on this pin. They take priority and must be disabled. 3. I read OSCCON into a local variable for use in the builtin functions. You may not be locking it if the generated code does not follow the sequence exactly. oscconl = OSCCON & 0x00ff; __builtin_write_OSCCONL(oscconl | 0x40); // Lock the I/O 4. You don't need to unlock before the assignment, as PPS is unlocked on RESET. 5. I suppose you could check the interrupt flag in the timer routine, but why not set up and INT1 interrupt routine. Include the edge selection. 6. Did you configure the timer and enable its interrupt? All for now. Vince |
|
|
|
感谢VJasiSky.你是说RB15/RP29的模拟输入吗?我是在数据表上找到的。我应该使用ANSBSBIT.RB15=0来启用I/O数字(也禁用模拟)吗?我需要配置计时器吗?并且我是否应该改变这个CODESYBuffTyNoReWixEngOracle(OSCCon and 0xBF);RPRR0BITS?It1R=29;//将中断1分配给RP29 SyBuffTnIn编写器OSCCONLL(OSCCon 0x40);0);/ /锁定I/O感谢ALOT
以上来自于百度翻译 以下为原文 Thank vjasinski. Did you mean analog input on RB15/RP29. I found it on Datasheet. Should i use ANSBbits.RB15= 0 to enable I/O digital ( also disable analog) ? and do i need to configure timer ? And should i change this code __builtin_write_OSCCONL(OSCCON & 0xBF) ; RPINR0bits.INT1R = 29; // Assign interrupt 1 to RP29 __builtin_write_OSCCONL(OSCCON | 0x40); into int oscconl; RPINR0bits.INT1R = 29; // Assign interrupt 1 to RP29 oscconl = OSCCON & 0x00ff; __builtin_write_OSCCONL(oscconl | 0x40); // Lock the I/O Thanks alot |
|
|
|
HII注意到:TrbBITS.TrISB6=0;
以上来自于百度翻译 以下为原文 Hi I noticed: TRISBbits.TRISB6 =0; _LATB5 = 1; |
|
|
|
解锁,设置,然后锁定,这是一个好主意,即使它是默认解锁,我认为这是另一种方式。下载:第30节。具有外围引脚选择(PPS)的IO端口
以上来自于百度翻译 以下为原文 It's always a good idea to unlock, set then lock even if it is unlocked by default which I thought was the otherway round. Download: Section 30. IO Ports with Peripheral Pin Select (PPS) |
|
|
|
只有小组成员才能发言,加入小组>>
5228 浏览 9 评论
2026 浏览 8 评论
1950 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3199 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2253 浏览 5 评论
770浏览 1评论
658浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
585浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
668浏览 0评论
570浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-18 12:17 , Processed in 1.414093 second(s), Total 87, Slave 70 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号