Re: dspic4011 A/D暫存器
|
||||
---|---|---|---|---|
版主
|
51的AD功能無法跟這顆dsPIC比,差太多了。這是硬體的掃描無關軟體的 polling。有個暫存器先要了解 : ADCSSL Register
dsPIC30F Peripheral Module - 10-bit ADC 的教材 第47頁有說明怎樣設定ADC掃描功能。 http://www.microchip.com.tw/modules/mydownloads/viewcat.php?cid=4
發表於: 2008/3/19 17:58
|
|||
|
Re: dspic4011 A/D暫存器
|
||||
---|---|---|---|---|
新會員
|
SCAN 的方式直接掃瞄~~是輪循法嗎??....................
像51系列是用輪循~~ 現在使用的a/d就是中斷.... 那有無SCAN的範利程式.............. 還是也是暫存器,在設定上面會說明..........使用中斷orSCAN的嗎???? 是在那些暫存器上面會說明?? 沒用過SCAN~~~~所以請教一下板主................ 謝謝!!
發表於: 2008/3/19 17:23
|
|||
|
Re: dspic4011 A/D暫存器
|
||||
---|---|---|---|---|
版主
|
記住,每次的AD中斷都會將儲存的指標就會指向 ADBUF0, 這時新的AD轉換後的資料就會到 ADBUF0。
在中斷之前的轉換都會依序的存入 ADBUFx 中,直到最後一個AD轉換完產生中斷。你可以參考一下利用 SCAN 的方式直接掃瞄你要的輸入全部完成後再中斷,這樣處理比較簡單好用。
發表於: 2008/3/19 15:45
|
|||
|
Re: dspic4011 A/D暫存器
|
||||
---|---|---|---|---|
新會員
|
ADNCON2暫存器裡有一個
SMPI<3:0>~~~~~~~~~~~~ SMPI<3:0> - 設定AD 要轉換幾次後才產生一次中斷 (這些轉換後的資料會被存到ADCBUFx 的暫存器列裡) 這意思是不是說如果我設SMPI為0的話轉換一次的話~~他就存在ADCUF0~~~~~~~~那轉換兩次的話不就存在ADCBUF1 那是不是說~如果我使用兩估A/D 要儲存在兩估不同的BFU0跟BFU1,就是分別給他轉換一次跟兩次,就是SMPI設0 跟1 ....................對嗎??? 板主~~
發表於: 2008/3/19 15:22
|
|||
|
Re: dspic4011 A/D暫存器
|
||||
---|---|---|---|---|
版主
|
採用AD輸入掃描的方式,這樣第一次的轉換就會存到 ADBUF0 而第二個輸入的轉換就可以存到 ADBUF1 了。而且可以設定轉兩次後產生中斷。
相關的設定與說明可以參考 dsPIC30F Peripheral Module - 10-bit ADC 的教材說明。在左邊的檔案下載裡有。
發表於: 2008/3/19 11:58
|
|||
|
dspic4011 A/D暫存器
|
||||
---|---|---|---|---|
新會員
|
個位先進:
如果使用A/D的話,如果不做任何設定那他轉換完的值,會儲存在ADCBUFO, 可是若我要使用兩A/D,想要分別存在不同的暫存器ADCBUF1,那要如何設定。 曾百由的書上好像也沒說到要設定那估地方,是在a/d的其他暫存器設定嗎看了DATA Family 還是不清楚怎麼設定??? ADCON1 ADCON2 ADCON3 ADCHS ADPCFG ADCSSL 看了好久了~~麻煩了~~~~~~ 因為要用兩個A/D怕都會存在同一估暫存器還是它會存在BUF0~BUF7~~??? 麻煩各位先進說明一下有程式說明更好!!謝謝啦~~ 以下是我在Family找到的但看太懂是什意思~~ 那邊是把他放到自已想要的暫存器裡面............... \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ ADPCFG = 0xFF78; // RB0,RB1,RB2 & RB7 = analog ADCON1 = 0x00EC; // SIMSAM bit = 1 implies ... // simultaneous sampling // ASAM = 1 for auto sample after convert // SSRC = 111 for 3Tad sample time ADCHS = 0x0007; // Connect AN7 as CH0 input ADCSSL = 0; ADCON3 = 0x0302; // Auto Sampling 3 Tad, Tad = internal 2 Tcy ADCON2 = 0x030C; // CHPS = 1x implies simultaneous ... // sample CH0 to CH3 // SMPI = 0011 for interrupt after 4 converts ADCON1bits.ADON = 1; // turn ADC ON while (1) // repeat continuously { ADC16Ptr = &ADCBUF0; // initialize ADCBUF pointer OutDataPtr = &OutData[0]; // point to first TXbuffer value IFS0bits.ADIF = 0; // clear interrupt while (IFS0bits.ADIF); // conversion done? for (count = 0; count < 4; count++) // save the ADC values { ADCValue = *ADC16Ptr++; LoadADC(ADCValue); } } // repeat
發表於: 2008/3/19 0:48
|
|||
|