完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
嘿,我是新的PIC16F编程,我需要帮助如何使用time0生成1秒或2秒延迟,如何使用预分频器和谢谢
以上来自于百度翻译 以下为原文 hey im new to PIC16f programing i need help how to use timer0 to generate 1sec or 2sec delay and how to use prescaler and thank you |
|
相关推荐
14个回答
|
|
你必须使用PIC16F84吗?有更便宜、更便宜的PIC设备,你的芯片运行吗?你能做一个简单的程序,只需打开一个LED断断续续?
以上来自于百度翻译 以下为原文 Do you HAVE to use a PIC16F84? There are newer, cheaper PIC devices which are much easier to use. Do you have your chip running at all? Are you able to make a simple program to just flash an LED off and on? |
|
|
|
OP的经验水平是EE学生。请求是做第一个汇编语言项目。目标微控制器是PIC16F84.这个列表强烈地暗示了动机是一个嵌入式固件车间的工作。它会节省很多。如果OP会发布所有的课程作业,那么我们可以在星期一之前完成所有的作业。
以上来自于百度翻译 以下为原文 The is the Original Posters first post. The OP's experience level is EE Student. The request is about doing a first assembly language project. The target micrcontroller is the PIC16F84. This list strongly suggests that the motivation is course work for an embedded firmware workshop. It would save a lot of time and snarky posts if the OP would just post all of the course work assignments so we can complete all of the homework before Monday. |
|
|
|
我同意QHB,此外,为什么需要使用汇编语言?C更容易使用,1或2秒定时器工作得比C好。C组件通常只用于从MPU中挤出更多的性能。你当然不需要这里。但是,如果你真的需要使用这个MPU和汇编,我会帮助你。你看过数据表了吗?你下载并安装了免费的MPLABX软件吗?数据表解释了很多。让我知道你需要什么帮助。
以上来自于百度翻译 以下为原文 I agree with qhb, in addition, why do you need to use assembly language? C is easier to use and a 1 or 2 second timer will work more than fine with C. Assembly is usually only used to squeeze a little more performance out of the MPU. You certainly don't need that here. However, if you really need to use that MPU and assembly, I'll help. You're going to have to help yourself, though, too. Have you read the data sheet? Have you downloaded and installed the free MPLABX software? The data sheet explains a lot. Let me know what you need help with. |
|
|
|
你设置计时器在一秒的时间内过流。你每过流重新启动它,清除溢出标志。如果你使用中断,那么你会在中断中进行。如果你的振荡器给你一分秒的时间,那么你就不需要重新加载计时器。没有人会做你的学校工作。用问题注释你的代码。
以上来自于百度翻译 以下为原文 you set up the timer to over flow at some fraction of a second. You restart it with that value every over flow, and clear the overflow flag. if you are using interrupts, that you would do it in the interrupt. If you oscillator gives you an even fraction of a second, then you will not need to reload the timer. No one is going to do your school work. Post you commented code with your questions. |
|
|
|
星期一是很多人的节日,所以你可能会有一点喘息的空间。
以上来自于百度翻译 以下为原文 Monday is a holiday for a lot of people, so you might have a little more breathing room. |
|
|
|
包括:160800 BSF状态,RP0CRF RTRISB BCF状态,RP0LO:ClRF PORTB呼叫延迟BSF PORTB,1呼叫DELAY GOTO LODELAY:MOVLW 0x255 MOVWF计数器DEFSZ计数器,F GOTO $ 1;我想使用Time0来延迟这里返回
以上来自于百度翻译 以下为原文 #include COUNTER equ 0X0C org 0X00 bsf STATUS,RP0 clrf TRISB bcf STATUS,RP0 LO: clrf PORTB call DELAY bsf PORTB,1 call DELAY GOTO LO DELAY: movlw 0X255 movwf COUNTER decfsz COUNTER,F goto $-1 ;i want to use timer0 to make delay here return |
|
|
|
f状态,r0bbsf optopyrg,3bccopopyrg,0bccopopyrg,1bcf opistycf,2pRRF TrISBBCF状态,RP0LO:BSF PortB,1调用LBCF PORTB,1调用LGOTO LOL: BSF ITCCON,TMR0IEBSF ITCCON,GIMOMOVLW D '240' MOVWF TMR0D: BTFSS ItCONN,2Goto DrRundNoTo,我的问题是在我BSF PortB,1T之后org 0x00 b***他程序调用L后,Time0加载240,并测试它是否溢出,当它返回到程序中的第一行,为什么会发生这种情况?
以上来自于百度翻译 以下为原文 ORG 0X00 BSF STATUS,RP0 BCF OPTION_REG,T0CS BSF OPTION_REG,3 BCF OPTION_REG,0 BCF OPTION_REG,1 BCF OPTION_REG,2 CLRF TRISB BCF STATUS,RP0 LO: BSF PORTB,1 CALL L BCF PORTB,1 CALL L GOTO LO L: BSF INTCON, TMR0IE BSF INTCON, GIE MOVLW D'240' MOVWF TMR0 D: BTFSS INTCON,2 GOTO D RETURN END now my problem is after i bsf portb,1 the program call L after the timer0 loaded with 240 and testing if it overflow when return it return to the first line in the program why that is happening ? |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
回报永远不会被执行。您已经启用了Time0中断,因此它实际上分支到中断向量位置0x4。
以上来自于百度翻译 以下为原文 The RETURN will never get executed. You have Timer0 interrupt enabled, so it actually branches to the interrupt vector location 0x4. |
|
|
|
我如何解决它打开LED然后延迟使用Time0然后关闭LED然后延迟等
以上来自于百度翻译 以下为原文 How i can solve it to turn on led then delay using timer0 then turn led off then delay etc |
|
|
|
不要设置中断允许位,或者GIE。中断请求位总是工作的,不管这些标志是什么。设置这些标志会使您的PIC在设置定时器互锁请求标志时跳转到中断向量(位置0x00),这正是您不想要的。如果你在代码中加上一些注释,并使用有意义的标签名,而不仅仅是单个字母,那么你自己就更容易了,也有人试图帮助你。
以上来自于百度翻译 以下为原文 Do NOT set he interrupt enable bit, or GIE. The interrupt request bit always works, regardless of those flags. Setting those flags causes your PIC to jump to the interrupt vector (location 0x004) whenever the timer interrupot request flags is set, which is just what you do NOT want. You would make life much easier for yourself, and people trying to help you, if you put some comments in your code, and used meaningful label names, not just single letters |
|
|
|
只有小组成员才能发言,加入小组>>
5242 浏览 9 评论
2031 浏览 8 评论
1955 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3207 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2256 浏览 5 评论
778浏览 1评论
669浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
596浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
679浏览 0评论
577浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-23 23:53 , Processed in 1.458059 second(s), Total 101, Slave 85 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号