完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
嗨,伙计们,我在设置主CPU的时钟速度时遇到了很大的问题。我在MPLAB配置寄存器中生成了语用设置,并将代码粘贴到myC文件中。我有一个C文件和一个汇编文件。C文件使用EXTERN调用汇编器文件。我有一个LED闪烁使用我的汇编程序。我改变乘法和除法时钟设置语用,然后编译和下载代码,我的LED仍然闪烁在同一速度。显然,主CPU时钟没有随着新的设置而改变。有人可以发布一些实际工作的C代码来设置主时钟速度吗?不管代码将CPU设置为什么速度,我只想要一些实际工作的C代码。谢谢:)Pete
以上来自于百度翻译 以下为原文 Hi Guys, I'm having major problems trying to set any clock speed of the main CPU. I've generated the pragma settings in MPLAB config registers and pasted the code to my C file. I have a C file and an Assembler file. The C file calls the assembler file using EXTERN. I have a LED blinking away using my asssembly program. I change the multiply and divide clock settings in pragma and then compile and download the code and my LED still flashes at the same speed. Obviously the main CPU clock isn't being changed with the new settings. Can someone please post some C code that actually works to set up the main clock speed. It doesn't matter what speed the code sets the cpu at, I just would like some C code that actually works. Thanks guys :) Pete |
|
相关推荐
3个回答
|
|
FRM是一个很好的起点。第42部分:具有增强PLL的振荡器:HTTP:/WW1.MICCHIP.COM/DIXBOSS/En/DeVICEDCO/6000 1250B.PDF
以上来自于百度翻译 以下为原文 The FRM is a good place to start. Section 42 - Oscillators with Enhanced PLL. http://ww1.microchip.com/downloads/en/DeviceDoc/60001250B.pdf |
|
|
|
AcLink 2,请共享您的代码。同时,像拉里建议的那样阅读FRM。你应该检查振荡器控制/状态寄存器,以确保事情按需要启用和配置。此外,我非常确信,您应该设置配置词来默认系统的时钟配置。我相信你提到过这一点(通过PrimaMet来设置)。无论哪种方式,你都应该确认这些配置词是通过调试和设置一个断点在你的“主”入口点停在那里,并检查振荡器寄存器(OSCCon等)。这将让你知道你的设置是否已被采纳。
以上来自于百度翻译 以下为原文 Acelink2, please share your code. As well, read up the FRM as Larry suggested. You should be checking the oscillator control/status registers to make sure things are enabled and configured as desired. Also, I am pretty sure that you should be setting up the configuration words to default the system's clocking configuration. I believe you mentioned this (set via pragma's). Either way, you should confirm that these configuration words are being programmed by debugging and setting a breakpoint at your 'main' entry point to halt there and inspect oscillator registers (OSCCON, etc.). This will let you know if your settings have been taken. |
|
|
|
以上来自于百度翻译 以下为原文 285: int switch_clock_lprc() { 9D0006C4 27BDFFF8 ADDIU SP, SP, -8 9D0006C8 AFBE0004 SW S8, 4(SP) 9D0006CC 03A0F021 ADDU S8, SP, ZERO 286: SYSKEY = 0xaa996655; 9D0006D0 3C02BF80 LUI V0, -16512 9D0006D4 3C03AA99 LUI V1, -21863 9D0006D8 34636655 ORI V1, V1, 26197 9D0006DC AC430030 SW V1, 48(V0) 287: SYSKEY = 0x556699aa; 9D0006E0 3C02BF80 LUI V0, -16512 9D0006E4 3C035566 LUI V1, 21862 9D0006E8 346399AA ORI V1, V1, -26198 9D0006EC AC430030 SW V1, 48(V0) 288: OSCCONbits.NOSC = 5; 9D0006F0 3C03BF80 LUI V1, -16512 9D0006F4 8C621200 LW V0, 4608(V1) 9D0006F8 24040005 ADDIU A0, ZERO, 5 9D0006FC 7C825204 INS V0, A0, 8, 3 9D000700 AC621200 SW V0, 4608(V1) 289: OSCCONbits.OSWEN = 1; 9D000704 3C03BF80 LUI V1, -16512 9D000708 8C621200 LW V0, 4608(V1) 9D00070C 24040001 ADDIU A0, ZERO, 1 9D000710 7C820004 INS V0, A0, 0, 1 9D000714 AC621200 SW V0, 4608(V1) 290: while (OSCCONbits.OSWEN); 9D000718 00000000 NOP 9D00071C 3C02BF80 LUI V0, -16512 9D000720 8C421200 LW V0, 4608(V0) 9D000724 30420001 ANDI V0, V0, 1 9D000728 1440FFFC BNE V0, ZERO, 0x9D00071C 9D00072C 00000000 NOP 291: return 0; 9D000730 00001021 ADDU V0, ZERO, ZERO 292: } 9D000734 03C0E821 ADDU SP, S8, ZERO 9D000738 8FBE0004 LW S8, 4(SP) 9D00073C 27BD0008 ADDIU SP, SP, 8 9D000740 03E00008 JR RA 9D000744 00000000 NOP |
|
|
|
只有小组成员才能发言,加入小组>>
5250 浏览 9 评论
2037 浏览 8 评论
1958 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3218 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2266 浏览 5 评论
788浏览 1评论
680浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
609浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
685浏览 0评论
582浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-28 22:48 , Processed in 1.390115 second(s), Total 80, Slave 64 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号