• slider image 442
  • slider image 477
  • slider image 479
  • slider image 480
  • slider image 481
  • slider image 482
:::


Browsing this Thread:   1 Anonymous Users






Re: SAME54-請教SAMPCTRL.SAMPLEN的作用
#4
管理員
管理員


查看用戶資訊
沒錯, 12bit累加的結果是放在16bit的暫存器中, 超過16bit時, 就會自動右移(除)n bit來避免超過16 bits.
最後的Number of Right Shifts(AVGCTRL.ADJRES)就是平均的分母,
這兩張投影片是對照累加平均暫存器與Harmony UI
縮圖

縮圖


至於解析度的增加也是要靠累加及平均, 稱OverSampling
假設Oversampling要增加的解析度為 n 個bit
則需要 4^n 次方次數的累加, 而且要搭配上面的表格來確保輸出的bit數結果
縮圖

舉例12bit Oversampling 到 16 bits時的條件
1. 增加4bit解析度, n=4, 需要累加 256次(4^4 = 2^8)
2. 累加後的結果12 bit + 8 = 20bit 大於 16 bits
3. 內部自動右移4bits => 20>>4 => 得到 16 bits,
4. AVGCTRL.ADJRES 不執行平均, 因此最後是16 bits 的Oversampling

如果只累加16次時(2^4), 12+4 = 16 則只能得到16 bit的結果, 沒有Oversampling的效果

Attach file:



jpg  SAMD21_AVG1.jpg (443.89 KB)
67979_60c31f5dc3e4d.jpg 1362X767 px

jpg  SAMD21_AVG2.jpg (453.95 KB)
67979_60c31f71bfd08.jpg 1361X768 px

jpg  ADC_OVERSAMP.jpg (117.55 KB)
67979_60c31f866c5e4.jpg 874X269 px

發表於: 2021/6/11 16:31
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: SAME54-請教SAMPCTRL.SAMPLEN的作用
#3
資深會員
資深會員


查看用戶資訊
感謝指導

因此從表45-1得到,若選擇Accumulation Averaging模式時,ADC就會被設定成12bit?

我看到關於CTRLB.RESSEL的說明,選擇For averaging mode output時,表上的16BIT應該不是指解析度?

還是說此時ADC是12bit,但被放在16bit的暫存器中做累加?

因為選擇Accumulation Averaging模式時,上面沒有顯示ADC是多少bit,Table 45-1. Accumulation中有一欄Final Result Precision,但單純的累加應該不會讓解析度增加吧?

發表於: 2021/6/11 13:01
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: SAME54-請教SAMPCTRL.SAMPLEN的作用
#2
管理員
管理員


查看用戶資訊
1. Select Sample Length (Cycles)
Ans: 取樣時間會影響ADC轉換速度, 需要依照Input的Source來調整, 調長不會變比較準反而變慢, 調太短反而會因為取樣時間不足而不準
縮圖

縮圖


2. AVGCTRL.SAMPLENUM (Accumulation)
Ans: Harmony中的設定, 藍字是內部累加平均自動右移後, 你自己想要再右移的位數
比如: 12bit真實ADC, 累加平均1024次(2的10次方), 最後得到22bits(12+10), 超過最大的16 bits, 因此內部會自動右移6位得到16 bits, 之後再自行位移4位得到12 bits
縮圖

縮圖

Attach file:



jpg  SAME54_ADC_SAMP1.jpg (166.70 KB)
67979_60c2d16e1f865.jpg 800X361 px

jpg  SAME54_ADC_AVG.jpg (182.96 KB)
67979_60c2d54615274.jpg 509X568 px

jpg  SAME54_ADC_SAMP.jpg (141.64 KB)
67979_60c2d576ead37.jpg 800X258 px

jpg  SAME54_ADC_AVG1.jpg (282.98 KB)
67979_60c2d59a3f3a1.jpg 1136X732 px

發表於: 2021/6/11 10:58

Edited by Libra on 2021年06月11日 11:14:29
Edited by Libra on 2021年06月11日 11:14:44
Edited by Libra on 2021年06月11日 11:15:21
Edited by Libra on 2021年06月11日 11:15:45
Edited by Libra on 2021年06月11日 11:16:10
Edited by Libra on 2021年06月11日 11:16:23
Edited by Libra on 2021年06月11日 11:16:44
Edited by Libra on 2021年06月11日 11:21:22
Edited by Libra on 2021年06月11日 11:26:36
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


SAME54-請教SAMPCTRL.SAMPLEN的作用
#1
資深會員
資深會員


查看用戶資訊
我在MHC的ADC裡看到有一個設定是Select Sample Length (Cycles),DataSheet的說明:
說明1
說明2

看起來只是把取樣時間拉長,但並沒有說明這樣的作用是什麼。
我設得比較長的話,取樣會比較準嗎?還是有什麼其它的作用?

另外我看到有一個AVGCTRL.SAMPLENUM (Accumulation),說明上看起來是可以設定取樣次數,然後就可以自動累加後輸出,但MHC上沒有看到可以設定的地方

相關說明在SAM E5x Family Data Sheet的45.6.2.9 Accumulation與45.6.2.10 Averaging

我須要偵測外部輸入的電壓,如果它裡面可以自動多取幾次再取平均值輸出的話,就可以比較方便的拿到較準的結果,請問有相關的設定方式嗎?

發表於: 2021/6/11 8:32
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... ]

教育訓練中心

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