• slider image 442
  • slider image 483
  • slider image 484
  • slider image 485
  • slider image 486
  • slider image 487
:::


Browsing this Thread:   1 Anonymous Users






Re: 请教关于PIC18FXXJ60的系统时钟的问题?
#2
版主
版主


查看用戶資訊
delay_10uS 真的是 Delay 10uS 嗎?
建議使用MPLAB SIM 再配合 Stopwatch 功能量一下真正 delay 的時間為多少。

記的要在 Debug 下去設定 Simulation 的頻率後再測試。


while(1)
{
delay_10us();
LATGbits.LATG3^=1; //RG3以为置为输出
delay_10us(); **** 刪掉這一個 Delay 吧!
}

發表於: 2009/1/5 17:16
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


请教关于PIC18FXXJ60的系统时钟的问题?
#1
新會員
新會員


查看用戶資訊
大家好,我使用的是PIC18F97J60带以太网模块的单片机,主晶振使用的是25M的高速晶体振荡器,Timer1使用的是32.768K晶振。其中在电路初始化时,我将OSCTUNE 配置为 0x40; (将25M晶振先3分频,然后再5倍频,系统时钟最终为41.667Mhz)。
在main函数的死循环中我加入了以下一个语句
while(1)
{
delay_10us();
LATGbits.LATG3^=1; //RG3以为置为输出
delay_10us();
}

其中,delay_10us()定义为
{
unsigned char i;
for(i=2;i>0;i--);
}

随后,在Debug期间,我使用示波器观察RG3引脚看到RG3已经产生了20us的方波,可是我试想,PIC处理速度应该是非常快的,尤其是我使用了41.667M的高速系统时钟后,delay_10us()函数里的 i 取值因该比2要大的多,可是根据目前的情况看,这个系统的时钟好像没有运行在很高的频率下?但是我通过修改OSCTUNE的值发现这个值是有用处的,例如我将OSCTUNE=0x40修改为0x20后,就会发现delay_10us的延时时间会增至150us左右,请问版主,是PIC的正常运行速度就是这样还是我的哪里没有设置正确呢?谢谢您的回答。

發表於: 2009/1/5 14:07
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部







You can view topic.
不可以 發起新主題
You cannot reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You cannot vote in polls.
You cannot attach files to posts.
You cannot post without approval.
You cannot use topic type.
You cannot use HTML syntax.
You cannot use signature.
You cannot create PDF files.
You cannot get print page.

[進階搜尋]


:::

Microchip連結

https://www.facebook.com/microchiptechnologytaiwan/
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=13
https://mu.microchip.com/page/tmu
http://elearning.microchip.com.tw/modules/tad_link/index.php?cate_sn=1
https://page.microchip.com/APAC-PrefCenters-TW.html
http://www.microchip.com/
http://www.microchip.com/treelink
http://www.microchipdirect.com/
http://www.microchip.com.cn/newcommunity/index.php?m=Video&a=index&id=103
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=2
http://www.microchip.com.tw/Data_CD/eLearning/index.html
http://www.microchip.com.tw/RTC/RTC_DVD/
https://www.microchip.com/development-tools/
https://www.youtube.com/user/MicrochipTechnology
[ more... ]

教育訓練中心

!開發工具購買
辦法說明 [業界客戶] [教育單位]
----------------------------------
!校園樣品申請
辦法說明 [教師資格] [學生資格]
----------------------------------