完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
电子发烧友论坛|
这可能是一个愚蠢的问题,但是你如何在18F45 K22的输出上做点什么呢?这对我的项目不起作用。在这里你看到文件
以上来自于百度翻译 以下为原文 This is maybe a stupid question but how do you make a bit on the output from a 18f45k22 high it doesn't work with my project.. Here under you see the file Attachment(s) frequentieselection.txt (0.76 KB) - downloaded 26 times |
|
相关推荐
4个回答
|
|
|
你有大量的问题,这里有几个问题:还有其他问题……你也不应该让main函数返回,没有地方返回(没有OS),所以它必须永远循环(或类似的东西)。
以上来自于百度翻译 以下为原文 You have a large number of issues, here are just a few: #define RD2 = 1; <<== this does not do what you think, to set an output high use: LATDbits.LATD2 = 1; PORTBbits.RB0; <<== this does nothing useful TMR0H = 0; TMR0L = 0; while(PORTBbits.RB0 = 0); T0CONbits.TMR0ON = 1; while(PORTBbits.RB0 = 1); T0CONbits.TMR0ON = 0; Ti = TMR0L; Th = TMR0H; Tt = Ti + Th; <<== this won't give you a 16 bit quantity - use Tt = Ti + (Th<<8); frequencie = 1 / Tt; <<== this will not give you anything useful - it is an integer divide whoch will alwyas = 0 There are other issues also... Also you should NEVER let the main function return, there is no place to return to (no OS) so it must loop forever (or something similar) |
|
|
|
|
|
好,我如何计算频率呢?你能给我一个解决办法吗?不是按频率=1/TT。你知道我想做什么。我将测量一个频率,在基础上我想做一个函数。我会尝试一些事情来发现。也许以后见。谢谢。
以上来自于百度翻译 以下为原文 Okay and how do i than calculate the frequency ? Can you give me a solution. Not by frequency = 1 / Tt. You know what i want to do. I will measure a frequency and at basis i want do a function. i will try some things to find out. See you maybe later. thanks. |
|
|
|
|
|
你需要考虑如何做一个除法,所以结果是一个整数。正如指出的那样,1/值总是给出一个小于1的结果,所以它将是整数运算中的零点。你的计时器有多快?如果它在1MHz的计数,也许尝试1000000 /值。
以上来自于百度翻译 以下为原文 You need to think about how to do a divide so the result is an integer. As pointed out, 1/value will always give a result less than 1, so it will be zero in integer arithmetic. How fast is your timer counting? If it is counting at 1MHz, maybe try 1,000,000 / value. |
|
|
|
|
|
好的QYB谢谢。我试着感谢你的帮助。我会回应的。我也有同样的问题。
以上来自于百度翻译 以下为原文 Okay qyb thanks i try to do thanks for the help. i will respond. i have also the same questions double you see. |
|
|
|
|
只有小组成员才能发言,加入小组>>
MPLAB X IDE V6.25版本怎么对bootloader和应用程序进行烧录
494 浏览 0 评论
5807 浏览 9 评论
2347 浏览 8 评论
2235 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3542 浏览 3 评论
1150浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
1117浏览 1评论
我是Microchip 的代理商,有PIC16F1829T-I/SS 技术问题可以咨询我,微信:A-chip-Ti
885浏览 1评论
MPLAB X IDE V6.25版本怎么对bootloader和应用程序进行烧录
495浏览 0评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-11 04:56 , Processed in 2.373299 second(s), Total 79, Slave 62 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
1775