大家好,我一直在玩PIC16F18313。但是,我不清楚PIC16F18313是否有一个8MHz的内部振荡器。在数据表中搜索,你可以指定你要使用哪一个振荡器,首先在配置位:这里我把配置位I。对于这个问题,我认为我正确地配置了使用1MHz的内部振荡器。稍后在程序中,我用1行代码来调整振荡器时钟:我的问题是:这是正确的方法吗?我评论OsTuneButsHftun,因为我认为没有必要去调整它。我是正确的方式?我不能测试它,因为我手中没有硬件。谢谢,我希望能得到你们的帮助。
以上来自于百度翻译
以下为原文
Hello People,
I've been playing with a PIC16F18313.
However, I don't have a clear idea if PIC16F18313 has an Internal Oscillator at 8MHz.
Searching in the Datasheet it says that you can specify which oscillator are you going to use, firstly in the configura
tion bits:
// PIC16F18313 Configuration Bit Settings
// 'C' source line config statements
// CONFIG1
#pragma config FEXTOSC = OFF // FEXTOSC External Oscillator mode Selection bits (Oscillator not enabled)
#pragma config RSTOSC = HFINT1 // Power-up default value for COSC bits (HFINTOSC (1MHz))
#pragma config CLKOUTEN = OFF // Clock Out Enable bit (CLKOUT function is disabled; I/O or oscillator function on OSC2)
Here I put the configurations bit important for this issue, I think I configured correctly to use the Internal Oscillator at 1MHz.
Later in the very beggining of the program I put 1 line of code to adjust the oscillator clock:
OSCFRQbits.HFFRQ = 0b0100; // 8MHz Clock Source selected
//OSCTUNEbits.HFTUN = 0b0100; // 8MHz clock source adjusted
My question is: Is this the correct way to do this?
I comment the OSCTUNEbits.HFTUN because I consider that Is not necessary to adjust it.
I'm in the correct way?
I can't test it because I don't have the hardware in my hands.
Thanks and I hope to get a good help from you guys.