Re: [請問] Link step failed!! 我慌了! 請問大大該怎麼辦呢?
|
||||
---|---|---|---|---|
版主
|
用示波器確定轉呈方波後或直接砍成有點像方波就可以了,輸入到 INT0 的腳位因為 INT 屬於 Schmitt Trigger 輸入是不是太方正就無所謂了。利用上升緣或下降緣觸發中斷配合一個 Timer 來計時即可。每次中斷就將 Timer 讀取並將 Timer 歸零即可。
發表於: 2009/4/7 9:19
|
|||
|
Re: [請問] Link step failed!! 我慌了! 請問大大該怎麼辦呢?
|
||||
---|---|---|---|---|
初級會員
|
版大:
謝謝版大的回答,所以我只要把正弦波轉成方波,這樣MCU就可以抓到訊號了嗎? 那我想請教一下大大,Input Capture讀取速度可以多快呢? kHz ? MHz ? 還是可以讀到GHz呢?
發表於: 2009/4/7 0:11
|
|||
|
Re: [請問] Link step failed!! 我慌了! 請問大大該怎麼辦呢?
|
||||
---|---|---|---|---|
版主
|
輸入電壓或電流對於讀取方面建議使用 AD 來讀取。
頻率即時間則用Timer 或 Input Capture 讀取。 測量AC輸入頻率,因為頻率不高只要用硬體方式整形找出 Zero Cross 點後就可以交給INT中斷輸入腳配合一個低速的Timer就可以準確的算出 AC 輸入的頻率。當然整形過的 AC訊號最好是方波有 0 --> 5V 的變化。
發表於: 2009/4/6 17:56
|
|||
|
Re: [請問] Link step failed!! 我慌了! 請問大大該怎麼辦呢?
|
||||
---|---|---|---|---|
初級會員
|
版大:
真是太感謝您的解答了! 原來要這樣才可以Link到! 不好意思我是新手! 剛碰PIC不久! 耽誤您這麼久時間! 真是謝謝您! 那我想再請教版大您一個問題,我在用Input Capture的時候有什麼限制嗎? 像是只能讀取振盪器所產生出來的頻率嗎? 還有輸入電壓或電流對於讀取方面會有影響嗎? 因為我想要拿來量交流電的頻率,我將他降成1伏特以下可是MCU不會產生中斷, 那不就表示說MCU對於這個訊號不會動作,是不是因為在輸入方面有哪些限制? MCU才能讀到訊號的上升緣或是下降緣?
發表於: 2009/4/6 17:04
|
|||
|
Re: [請問] Link step failed!! 我慌了! 請問大大該怎麼辦呢?
|
||||
---|---|---|---|---|
版主
|
改好了,測看看。
主要是改了 Project 裡的 include 的路徑及加入了PIC24F 的 Peripheral Library 到 Project 裡。 Attach file: Link only for registered users
發表於: 2009/4/6 16:13
|
|||
|
Re: [請問] Link step failed!! 我慌了! 請問大大該怎麼辦呢?
|
||||
---|---|---|---|---|
初級會員
|
版大:
這是ZIP檔,麻煩您幫小弟看一下! 謝謝! Attach file: Link only for registered users
發表於: 2009/4/6 15:25
|
|||
|
Re: [請問] Link step failed!! 我慌了! 請問大大該怎麼辦呢?
|
||||
---|---|---|---|---|
版主
|
照dsPIC30F Peripheral Libraries 的說明如下所示,不過你所附的 rar 壓縮檔我打不開,說是資料錯誤,要不要將整個 Project 壓成 ZIP 再傳上來看看。
dsPIC30F 對 ReadCapture1 的使用方式: 3.4 ReadCapturex Function Prototype void ReadCapture1(unsigned int *buffer); void ReadCapture2(unsigned int *buffer); void ReadCapture3(unsigned int *buffer); void ReadCapture4(unsigned int *buffer); void ReadCapture5(unsigned int *buffer); void ReadCapture6(unsigned int *buffer); void ReadCapture7(unsigned int *buffer); void ReadCapture8(unsigned int *buffer); Include InCap.h Description This function reads all the pending Input Capture buffers. Arguments buffer - This is the pointer to the locations where the data read from the Input Capture buffers have to be stored. Return Value None Remarks: This function reads all the pending Input Capture buffers until the buffers are empty indicated by the ICxCON<ICBNE> bit getting cleared. Source File: ReadCapture1.c ReadCapture2.c ReadCapture3.c ReadCapture4.c ReadCapture5.c ReadCapture6.c ReadCapture7.c ReadCapture8.c Code Example unsigned int *buffer = 0x1900; ReadCapture1(buffer);
發表於: 2009/4/6 14:56
|
|||
|
Re: [請問] Link step failed!! 我慌了! 請問大大該怎麼辦呢?
|
||||
---|---|---|---|---|
初級會員
|
版大:
可是我已經有加入了,還是出現Link step failed. #include <p24FJ128GA006.h> #include <incap.h> 我還把"ReadCapture1"裡面所包含的C code也加進去了 void ReadCapture1(unsigned int * buffer) { while (IC1CONbits.ICBNE) { *buffer++ = IC1BUF; /* reads the input capture buffer */ } } 可是還是出現一樣的問題!請教大大! 是哪裡有問題呢??
發表於: 2009/4/6 14:15
|
|||
|
Re: [請問] Link step failed!! 我慌了! 請問大大該怎麼辦呢?
|
||||
---|---|---|---|---|
版主
|
使用 Microcip 所提供的編函數要加入該函數的 H 檔,Input Capture 就要加入 #include <incap.h> 的定義。
有關 Input Capture 的使用範例可以參考 dsPIC30F Peripheral Module 的教材。 http://www.microchip.com.tw/modules/w ... glefile.php?cid=4&lid=229
發表於: 2009/4/6 10:55
|
|||
|