完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我在MPLAB X版本4.10中遇到了一个问题,下面的代码在MPLAB 8.92中工作,但在MPLAX中没有,因为我已经设置了它。代码使用PIC16F616,从CCP1的特殊事件触发器在比较模式下产生中断,time1在FoSC/4上计时。代码以绝对寻址方式组装。我看到的问题是:1)即使CCP1IF标志设置为预期,也不会中断。2)如果我修改代码简单地轮询CCP1IF标志,它会按预期工作,但是秒表显示每次中断时应该有1个额外的周期。这是一个累积误差,所以秒表的时间随着错误的增加而漂移,虽然这几乎不重要,因为中断从来没有被拿走!在MPLAB 8.92中,我很容易就明白了这一点,但是我对MPLAB的旧版本有更多的经验,虽然不是很长时间。有很多事情我喜欢MPLAX X,但模拟器的工作是一个至关重要的功能对我来说!我有可能设置不正确的东西吗?谢谢,克里斯,-----------------------------------用Time1ListP=16F616,S=On,x=on,n=0,r=十进制包含,Eng& Gt;定义了FrasQualTeSEC标志,0Cbx0x20tQualTeStac;四分之一秒中断计时器;Sorg 0x04 Goto启动Org 0x004 Goto ISR启动CLRF PORTA CLRF PORTCBSF状态,RP0 CURRF安塞尔;没有模拟输入MOVLW 0;设置I/O模式MOVWF TrISA MOVLW 0;设置I/O模式MOVWF TISISC BCF状态,RP0CRF TQTROSEC CLRF TSLCRF RTMLCLAF标志;设置T1;设置T1 PRESCAER到1:8 BCF T1CON,TMR1BSF T1CON,T1CKPS1 BSF T1CON,T1CKPS0CRF RTM1LCRF TMR1H;设置CCP MOVLW 0x0B;用于比较模式产生特殊事件MOVWF CCP1CON;设置为62500,每250000毫秒MOVLW 0xF4 MOVWF CPR1H MOVLW 0x024 MOVWF CPR1LBSF状态,RP0BSF PIC1,CCP1IE;启用CCP1中断BCF状态,RP0 BSF ITCN,PEIE;启用外围中断BSF ITCCON,GIE BSF T1CON,TMR1 on CLRF PIR1主环路BTFSC,QualQualTSEC GOTO四分之一GOTO主环四分之一BCF QualQualTSEC调用增量定时器GOTO主回路增量定时器ICOF TQUActhSac BTFSS TQualTSEC,2 RealCurrTQTeSEC,CIF TS秒MOVLW。60亚WTs秒,W BTFSS状态,Z RealCurrf TS秒,IF f Tmin MOVLW。60次WTF Tmin,W BTFSS状态,Z RealCelRF Tmin IF返回。WF WTEMOP SWAPF状态,W MOVWF STATUSSIN TEMPBCF状态,RP0 BCF PIR1,CCP1IF BSF FrasQualTSEC;恢复W和状态寄存器,从中断SWAPF StasuSuMTEP返回,W MOVWF状态SWAPF WYTEMP,F SWAPF WYTEMP,W RESFIE;
以上来自于百度翻译 以下为原文 I'm having a problem with the simulator in MPLAB X version 4.10 The code below works as expected in MPLAB 8.92, but not in MPLAB X as I have set it up. The code uses a Pic16F616, generating interrupts from the special event trigger of CCP1 in compare mode, with Timer1 clocked at Fosc/4. The code is assembled with absolute addressing. The issues I see are: 1) The interrupt is never taken, even though the CCP1IF flag is set as expected. 2) If I modify the code to simply poll the CCP1IF flag, it works as expected, but the stopwatch shows 1 extra cycle every time the interrupt should have been taken. This is a cumulative error, so the stopwatch time drifts with increasing error, though this hardly counts since the interrrupt was never taken! I was impressed at how easily I got this going in MPLAB 8.92, but I do have a lot more experience with the older versions of MPLAB, though not for a long time. There are a lot of things I like about MPLAB X, but having the simulator work properly is a vital function for me! Is it possible I have something set up incorrectly? Thanks, Chris ;---------------------------------------------------------------------------------------- ; Testing ECCP with special event trigger and interrupt driven by Timer1 list p=16f616, st=ON, x=ON, n=0, r=decimal #include __CONFIG _WDT_OFF & _HS_OSC & _MCLRE_ON & _CP_OFF & _PWRTE_ON ;***************************************************** #define FlagQuarterSec flags,0 cblock 0x20 tquartersec ;timer for quarter second interrupts tseconds tminutes thours flags endc cblock 0xf0 W_TEMP STATUS_TEMP endc ;***************************************************** ; Code starts ORG 0x0000 goto start ORG 0x0004 goto isr start clrf PORTA clrf PORTC bsf STATUS,RP0 clrf ANSEL ; no analog inputs movlw 0 ;set I/O pattern movwf TRISA movlw 0 ;set I/O pattern movwf TRISC bcf STATUS,RP0 clrf tquartersec clrf tseconds clrf tminutes clrf thours clrf flags ; setup T1 ; set T1 prescaler to 1 :8 bcf T1CON,TMR1ON bsf T1CON,T1CKPS1 bsf T1CON,T1CKPS0 clrf TMR1L clrf TMR1H ; setup CCP movlw 0x0b ;for compare mode generating special event movwf CCP1CON ; set for 62,500 which should make an interrupt every 250,000 ms movlw 0xf4 movwf CCPR1H movlw 0x024 movwf CCPR1L bsf STATUS,RP0 bsf PIE1,CCP1IE ;enable ccp1 interrupt bcf STATUS,RP0 bsf INTCON,PEIE ; enable peripheral interrupts bsf INTCON,GIE bsf T1CON,TMR1ON clrf PIR1 mainloop btfsc FlagQuarterSec goto quartersecond goto mainloop quartersecond bcf FlagQuarterSec call incrementtimer goto mainloop incrementtimer incf tquartersec btfss tquartersec, 2 return clrf tquartersec incf tseconds movlw .60 subwf tseconds, w btfss STATUS, Z return clrf tseconds incf tminutes movlw .60 subwf tminutes, w btfss STATUS, Z return clrf tminutes incf thours return ;***************************************************** ISR start isr movwf W_TEMP swapf STATUS,w movwf STATUS_TEMP bcf STATUS,RP0 bcf PIR1,CCP1IF bsf FlagQuarterSec ;restores w and status registers, returns from interrupt swapf STATUS_TEMP,w movwf STATUS swapf W_TEMP,f swapf W_TEMP,w retfie ;***************************************************** ISR end END |
|
相关推荐
1个回答
|
|
祝贺你,你发现了一个在这个设备上不起作用的中断!这个问题将在MPLAB X 4.20中得到解决。但现在你可以修补你的MPLAB X 4.10。通过做下面的…0。关闭MPLAB x 1。将附加文件下载到MPLAB X 4.10安装目录。在Windows上,默认值将是“C:程序文件(x86) Microchip MPLABX V4.10MPLABBIDIDMPLABABLIS模块EXT”。适当地调整非Windows环境。2。在这个目录中,将P..jar重命名为P.Road,以便在需要时返回原始文件。3。将下载的文件从P..txt重命名为P.jar。(论坛不会让我上传.jar文件)现在我可以理解你可能不想在公共论坛上随机安装JAR文件!所以我给你发了一个PM,我的直接电子邮件地址,我们可以用来交换善意。如果你感兴趣,根本原因是这个设备使用字段名称EcPUI而不是ECP1IE。
以上来自于百度翻译 以下为原文 Congratulations, you found the one interrupt that doesn't work on this device! :P The issue will be fixed in MPLAB X 4.20. But for now you can patch your MPLAB X 4.10. By doing the following... 0. Shutdown MPLAB X. 1. Download the attached file to your MPLAB X 4.10 installation directory. On windows the default would be "C:Program Files (x86)MicrochipMPLABXv4.10mplab_idemplablibsmodulesext". Adjust for non-windows environments appropriately. 2. In this directory, rename per.jar to per.old so that you can go back to original file if needed. 3. Rename the downloaded file from per.txt to per.jar. (Forum won't let me upload .jar files.) Now I can understand that you might not want to install .jar files from random folks on public forums! So I sent you a PM with my direct email address which we can use to exchange bona fides. If you're interested the root cause was that this device uses the field name ECCPIE instead of ECCP1IE. Attachment(s) per.txt (72.05 KB) - downloaded 2 times |
|
|
|
只有小组成员才能发言,加入小组>>
5242 浏览 9 评论
2031 浏览 8 评论
1955 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3207 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2256 浏览 5 评论
778浏览 1评论
669浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
597浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
679浏览 0评论
577浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-24 05:21 , Processed in 1.459453 second(s), Total 78, Slave 62 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号