Microchip
直播中

徐丹

7年用户 291经验值
私信 关注
[问答]

如何设置内部振荡器,XC8 PIC16F18313

大家好,我一直在玩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 configuration 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.

回帖(6)

张娜

2018-12-25 16:02:22
来自HTTP://www. McCHIP.COM/FUMMS/M102171.ASPX

以上来自于百度翻译


      以下为原文

    comes from
http://www.microchip.com/forums/m1021711.aspx
举报

张娜

2018-12-25 16:19:50
请原谅,“相关”(和CR AP-PYwilliam hill官网 ……)

以上来自于百度翻译


      以下为原文

    pardon, "related" (and cr ap py forum...)
举报

王桂香

2018-12-25 16:37:17
是的!我认为它们是不同的问题,而不是“相关的”,最好单独写两个线程。如果不是一个好主意,抱歉。

以上来自于百度翻译


      以下为原文

    Yes it is!
 
I thought that they are different issues and are not "related" It was better to write two threads individually.
 
Sorry if was not a great idea.
举报

张娜

2018-12-25 16:42:29
是的!但也许是那个PIC的专家能更容易地回答这两个问题。

以上来自于百度翻译


      以下为原文

    Yes they are! But maybe someone that is an expert of that PIC will be able to answer both question, more easily.
举报

更多回帖

发帖
×
20
完善资料,
赚取积分