完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
大家好。我有一个问题PIC16F1823和T1GVAL寄存器。我用TMR0的基础时间和时间1。当TMR0溢出时,应该变成T1GVAL切换,但是T1GVAL上没有任何变化。
以上来自于百度翻译 以下为原文 Hello every body. I have a problem with pic16f1823 and T1gval register. I use from tmr0 for base time and timer1. when tmr0 be overflow should become t1gval toggle but I don't have any change on t1gval. org 0 goto Init ; Interrupt Service Routine ----------------------------------------------- org 4 ; ISR beginning btfss INTCON,TMR0IF retfie btfsc T1GCON,T1GVAL goto ButtonCheckEnds ButtonCheckEnds MOVLW 0XFF MOVWF TMR0 BTFSS T1GCON,T1GVAL GOTO $-1 CLRF TMR1L CLRF TMR1H ; CLRF TMR0 BSF T1CON,TMR1ON BCF INTCON,TMR0IF GOTO MainLoop ; Main Program ------------------------------------------------------------ Start BANKSEL INTCON CLRF INTCON bsf INTCON,TMR0IE BANKSEL OPTION_REG movlw b'11000101' MOVWF OPTION_REG BANKSEL T1CON movlw b'11000101' movwf T1CON BANKSEL T1GCON MOVLW B'11100001' MOVWF T1GCON BANKSEL TMR1L CLRF TMR1L CLRF TMR1H CLRF TMR0 BSF T1CON,TMR1ON bsf INTCON,GIE MainLoop GOTO MainLoop |
|
相关推荐
19个回答
|
|
|
|
|
|
嗯,你的代码有几个问题,第一个是你从一个中断返回到主代码…
以上来自于百度翻译 以下为原文 Hmm, your code has several issues, first one is that you return from an interrupt by jumping to main code... |
|
|
|
我的问题是T1GVAL。当TMR0溢出时,T1GVAL成为切换。但我看不到T1GVAL有任何变化。为什么?你明白吗??
以上来自于百度翻译 以下为原文 my problem is T1gval. when tmr0 be overflow should T1gval become toggle. but I don't see any change on T1gval. why?? do you understand?? |
|
|
|
是的,我从来没有使用过T1GVAL的函数:但是,就像现在一样,您的代码会一遍遍地崩溃。
以上来自于百度翻译 以下为原文 Yes, I have never used that function of T1gval: but, as is now, your code will crash over and over |
|
|
|
谢谢,但是我的问题是T1GVAL。这是PIC组装中的一个非常大的问题。我从来没有见过PIC的问题。在数据表中写的每件事都是正确的,但是关于T1GVAL没有响应!!!!!!!!!!!!!为什么?我的问题在哪里??
以上来自于百度翻译 以下为原文 Thanks but my problem is T1gval . this is a very big problem in pic assembly . I don't have ever seen about problem in pic . every thing that write in datasheet is correct but about T1gval not response!!!!!!!!!!why??where is my problem ?? |
|
|
|
你如何测试/表明T1GVAL不在切换?
以上来自于百度翻译 以下为原文 How are you testing/indicating that the T1gval is/is not toggling? |
|
|
|
确切地。T1GVAL在TMR0溢出时不切换。MOVLW 0XFFMOVWF TMR0BTFSS T1GCON,T1GVALL GOTO $ 1
以上来自于百度翻译 以下为原文 Exactly. T1gval is not toggling when tmr0 be overflow. MOVLW 0XFF MOVWF TMR0 BTFSS T1GCON,T1GVAL GOTO $-1 |
|
|
|
我的问题是,你怎么知道T1GVAL比特不切换?您是否使用调试器在PIC中运行代码(哪一个?)你在运行模拟器吗?哦,正如Dario所说,你的代码有严重的错误——使用从ISR出来的goto肯定会很快使代码崩溃。
以上来自于百度翻译 以下为原文 My question was how do you know T1gval bit is NOT toggling? Are you running the code in the pic with a debugger (which one?)? Are you running the simulator? Oh, and as Dario said, your code has serious errors - using a goto out of an ISR is bound to crash the code very quickly. |
|
|
|
对。我使用MPLAB SIM。我在模拟器中运行这个程序,但是T1GVAL从不切换。
以上来自于百度翻译 以下为原文 yes. I use from MPLAB SIM .I run this program in simulator but T1gval never not toggle. Attached Image(s) |
|
|
|
模拟器往往不准确,或者可能不支持硬件的某些特性。
以上来自于百度翻译 以下为原文 Simulator often is not accurate, or maybe it does not support some features of hardware. |
|
|
|
|
|
|
|
此文件不正确
以上来自于百度翻译 以下为原文 this file is incorrect Attachment(s) Untitled.asm (12.08 KB) - downloaded 18 times |
|
|
|
哦,我的程序是这个。你能记住这个吗??
以上来自于百度翻译 以下为原文 oh my program is this. Untitled.asm that is full version. can you repear this?? Attachment(s) Untitled.asm (3.26 KB) - downloaded 23 times |
|
|
|
16f1823中与t1gval一起工作的重要寄存器是:并且我希望当tmr0溢出时并且我去了中断(ORG 0x4),并且当到达时设置为T1gval。这里有人帮我吗????
以上来自于百度翻译 以下为原文 important register in 16f1823 for work with t1gval are: BANKSEL INTCON CLRF INTCON bsf INTCON,TMR0IE BANKSEL OPTION_REG movlw b'11000101' MOVWF OPTION_REG BANKSEL T1CON movlw b'11000101' movwf T1CON BANKSEL T1GCON MOVLW B'11100001' MOVWF T1GCON and I want when tmr0 overf flow and I went to Interrupt (ORG 0x4) , and when arrive to MOVLW 0XFF MOVWF TMR0 BTFSS T1GCON,T1GVAL ;when program arrive here must T1gval be set when tmr0 been overflow GOTO $-1 T1gval be set . is any one here to help me??? |
|
|
|
在什么?模拟器?你已经被告知不是100%准确。
以上来自于百度翻译 以下为原文 In what? The simulator? You've already been told that is not 100% accurate. |
|
|
|
|
|
|
|
上面,OP说它也在真实的硬件上发生。现在还不确定……我仍然指着那个结束ISR的“goto主循环”。
以上来自于百度翻译 以下为原文 Above, OP said it happens on real hardware too. Not sure now... I am still pointing finger against that "goto mainloop" that concludes the ISR |
|
|
|
但是我不能去“Goto MyLoCro”,因为T1GVAL没有设置,我在MPLAB SIM中看到了
以上来自于百度翻译 以下为原文 but I can't to go "goto mainloop" because T1gval does not set and I see this in MPLAB SIM |
|
|
|
我认为你没有抓住要点:IRQ处理程序不能在没有延迟的情况下结束(甚至更糟的是Goto主回路)!!!!这会使你的程序崩溃,因此你不能希望获得任何你想要的结果!顺便说一下,我以前没有写过这篇文章,也没什么意义……你是什么意思?
以上来自于百度翻译 以下为原文 I think you did not get the point: an IRQ handler CANNOT END without a RETFIE (and even worse with a goto mainloop) !!! ; Interrupt Service Routine ----------------------------------------------- org 4 ; ISR beginning btfss INTCON,TMR0IF retfie btfsc T1GCON,T1GVAL goto ButtonCheckEnds ButtonCheckEnds MOVLW 0XFF MOVWF TMR0 BTFSS T1GCON,T1GVAL ;when program arrive here must T1gval be set when tmr0 be overflow GOTO $-1 CLRF TMR1L CLRF TMR1H ; CLRF TMR0 BSF T1CON,TMR1ON BCF INTCON,TMR0IF GOTO MainLoop This WILL MAKE YOUR PROGRAM CRASH and hence you cannot hope to obtain any result you're trying to! By the way - I did not write that before - this one makes no sense too: btfsc T1GCON,T1GVAL goto ButtonCheckEnds ButtonCheckEnds ...what did you mean? |
|
|
|
只有小组成员才能发言,加入小组>>
5132 浏览 9 评论
1985 浏览 8 评论
1914 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3153 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2213 浏览 5 评论
699浏览 1评论
589浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
470浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
606浏览 0评论
497浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-4 22:32 , Processed in 1.939209 second(s), Total 112, Slave 97 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号