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

論壇索引


Board index » All Posts (Ryang)




Re: 時鐘問題
版主
版主


還有一個問題? 你說用4MHz (16F877用20MHZ)確定振盪頻率是否在20PPM誤差以內呢? 計時的部分是用軟體計數(那問題就大了)還是用硬體的計時器計數呢?

如果是用軟體計數方式,保證你會被其它的硬體中斷程式打亂時間保證不準的啦!

發表於: 2004/8/18 9:51
頂部


Re: 時鐘問題
版主
版主


既然使用PIC18F452那就簡單了,這裡有一個馬兒會跑又不太需要吃草的方法大家討論一下:
1. PIC18F452主振盪器使用 RC Mode (4-8MHz隨你便),Timer1接一個32.768KHz的Crystal; 利用 Timer1 的中斷來做為 Real Time Clock的來源。這樣程式就可以跑高速,又可以精確計時。
不過這種方式也會有些許誤差(中斷發生時至載入新的Timer1計數值的時間差) ; 但如果用Timer2的auto reload功能誤差就會非常非常低。


#define Timer_Count 32768

//************************************************
//* Function: InitializeTimer1 *
//************************************************
void InitializeTMR1(void)
{
T1CON=0b10001111; // Initialize Timer1 for using External 32.768KHz
IPR1bits.TMR1IP=0; // Set Timer1 for Low Priority Interrupt
PIR1bits.TMR1IF=0; // Clear Interrupt flag of Timer 1

TMR1H = (0xFFFF-Timer_Count)/256;
TMR1L = (0xFFFF-Timer_Count)%256; // Set for 1 Second Interrupt Time

PIE1bits.TMR1IE=1; // Enable Timer1 Interrupt
}


//************************************************
//* Function: isr_low_direct *
//* - Direct execution to the actual *
//* low-priority interrupt code. *
//************************************************
#pragma code isrlowcode = 0x0018

void isr_low_direct(void)
{
_asm //begin in-line assembly
goto isr_low //go to isr_high function
_endasm //end in-line assembly
}
#pragma code

//************************************************
//* Function: isr_low(void) *
//* - Timer 1 Interrupt for the 1 Second Delay *
//* for send the ON BUS polling *
//************************************************
#pragma interruptlow isr_low

void isr_low(void)
{
if (PIR1bits.TMR1IF)
{
TMR1H = (0xFFFF-Timer_Count)/256;
TMR1L = (0xFFFF-Timer_Count)%256; // Reload 1 Second value to Timer1
PIR1bits.TMR1IF=0; // Clear interrupt flag of Timer 1
:
:
}
}

發表於: 2004/8/18 9:41
頂部


Re: 無法用icd2的除錯模式...
版主
版主


舊版本的 MPLAB IDE v6.30 可以除錯,較新版本的 MPLAB IDE v6.6 就不行除錯??? 我覺得很奇怪 ...

請問 ICD2 的 Operation System 是否有隨 MPLAB IDE 的版本一起更新? 要是你用 V6.6 但 ICD2 內部的 Firmware 還是舊版本鐵定是無法debug的。
更新方式 : In the MPLAB IDE "Debugger Manual --> DOwnload ICD2 Operation Syatem"

發表於: 2004/8/17 14:22
頂部


Re: 新手問個小問題
版主
版主


你說你在研究PIC12F629,但指令卻是用12C508(Base-Line 16C5x)的指令,所以你會兜不起來。
PIC12F629/675是採用Mid-Range的指令,它與16C5x的有四個不同的指令(OPTION, TRISn, RETFIE, RETURN), OPTION 與 TRIS 指令無法使用於12F629,
因為在mid-range的設計裡,OPTION及TRIS已經變成暫存器了,所以你的程式需改成:

banksel TRISIO ; Select to RAM Bank1
movlw B'11000111'
movwf OPTION_REG ; Option Register at 0x81

movlw B'00111000'
movwf TRISIO ; Set GPIO 0~2 for Output (ox85)

......

發表於: 2004/8/17 14:05
頂部


Re: PIC 產品編碼
版主
版主


Microchip PIC 的編號除了PIC18Fxxxx有照規矩來,其餘的應該說是沒有固定的編號規則。不只客戶會對PIC16Fxxx 編號產生混淆,有時候連我們也會像得了帕斯金示症一樣會記不起來。
底下是一些基本編號規則因該可以用的到:
PIC10Fxxx ---> 6-pin PIC
PIC12Fxxx ,PIC12Cxxx ---> 8-pin PIC (F為flash,C為OTP)
PIC16C5x , PIC16F5x --> 12-bit Core (Base-Line) 真的有Flash的16F54/F57/F505,可以向代理商要樣品。
PIC16Cxxx --> Mid-Range OTP PIC
PIC16Fxxx --> Mid-Range Flash PIC (此類型料號最多,也最亂)
PIC18Fxxxx --> Hi-End Flash PIC
dsPIC10Fxxxx --> 16-bit RISC PIC + DSP engine

有關PIC18Fxxxx的編號規則如下:
第一個x為:接腳數,1-->18-pin, 2-->28-pin, 4-->40-pin, 6-->64-pin, 8--> 80-pin ....
第二個x為:FLASH記憶容量, 基本上是以二的幾次方來計算。4-->16Kbyte, 5-->32KB, 7-->128KB ...
第三與四個x為:功能定義。例:50-->USB, 20-->通用型,80-->CAN .......

發表於: 2004/8/17 10:15
頂部


Re: 結構化語法
版主
版主


在組合語言裡 if...else...endif.. 稱之為"條件式組譯"它不是個實體指令,只是提供組譯判斷功能合乎該條件就執行該區塊的組譯動作。
if...else...不可與高階的語言比擬,if else 在 C 語言是種敘述(眾多指令的集合體),在編譯時會產生執行碼的。
有關更多的 Directive 指令可參考 MPASM & MPLINK User's Guide 說明。

http://ww1.microchip.com/downloads/en/DeviceDoc/33014g.pdf

發表於: 2004/8/17 9:45
頂部


Re: 請問有誰使用過Power Control PWM-18F4431
版主
版主


是不是中正大學的?
範例程式應該有收到吧!

發表於: 2004/8/16 18:00
頂部


Re: ex738
版主
版主


This is very simple, use the Google search engine with the key word "VT-100", you will find a lots of specification for the VT-100.

發表於: 2004/8/16 17:56
頂部


Re: 問題:連接ICD2時出現Failed Self Test是哪裡出錯了呢
版主
版主


ICD2有問題就送修吧!

發表於: 2004/8/16 17:53
頂部


Re: 請問有誰用過Pic18的HS/PLL模式??
版主
版主


要讓PIC18F452跑40MHZ,只有兩種方法:
1. 用10MHz Crystal + HS PLL 模式
2. 直接用40MHz的振盪器直接輸入(選HS mode)

我用過很多次,PIC18F452跑40MHz是沒問題的。

發表於: 2004/8/16 17:49
頂部



« 1 ... 1597 1598 1599 (1600) 1601 1602 1603 ... 1610 »



:::

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... ]

教育訓練中心

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