• 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: 關於CORCON暫存器的SATA位元問題?(dsPIC33FJ128MC802晶片)
#4
資深會員
資深會員


查看用戶資訊
程式測試如下:

register int regA asm("A");
register int regB asm("B");
int value1;
int value2;
int output;

_SATA=0;
value1=-32766;
value2=-32767;
regA = __builtin_lac(value1,0);
regB = __builtin_lac(value2,0);
regA = __builtin_addab(regA,regB);
output = __builtin_sac(regA,0);

_SATA=1;
value1=-32766;
value2=-32767;
regA = __builtin_lac(value1,0);
regB = __builtin_lac(value2,0);
regA = __builtin_addab(regA,regB);
output = __builtin_sac(regA,0);

從watch觀查ACCA,其值確實不同,但是為何最後output值卻是相同?

Attach file:



jpg  ACCAB.jpg (113.65 KB)
400_6087f0232d8e2.jpg 1256X344 px

發表於: 2021/4/27 19:06
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 關於CORCON暫存器的SATA位元問題?(dsPIC33FJ128MC802晶片)
#3
版主
版主


查看用戶資訊
在 dsPIC 系列的運算是以 ACCA & ACCB 為主,可以查到的說明是以 dsPIC30F/33F 的組合語言裡的說明。你可以參考一下 : dsPIC30F/33F Programmer’s Reference Manual 裡的說明。請用搜尋 " saturation" 查詢書裡的說明。
https://ww1.microchip.com/downloads/en/devicedoc/70157c.pdf

如貼圖所示: 沒使用及有使用 saturation 的設定時,對 ACCA & ACCB 的數值操作是不一樣的。

Attach file:



jpg  擷取.JPG (69.26 KB)
16_60877ad23c474.jpg 747X575 px

發表於: 2021/4/27 10:45
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 關於CORCON暫存器的SATA位元問題?(dsPIC33FJ128MC802晶片)
#2
版主
版主


查看用戶資訊
最簡單的解釋是以一般使用 16 位元無符號加法為例:
非飽和演算法:0x8002 + 0x8001 = 0x0003 (發生溢位,只取後 16-bit 資料)
飽和演算法:0x8002 + 0x8001 = 0xFFFF (取最大值出來,沒有考慮溢位問題)

飽和演算法定義:當發生計算結果大於可表示的最大值或者小於可表示的最小值的時候,結果為這個最大值或者最小值
非飽和演算法:如果結果溢出 則直接去掉溢出位,剩下的就是結果。

發表於: 2021/4/27 10:39
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


關於CORCON暫存器的SATA位元問題?(dsPIC33FJ128MC802晶片)
#1
資深會員
資深會員


查看用戶資訊
CORCON暫存器的bit7-->SATA為ACCA Saturation Enable bit,在型錄解說中,設定
1 = Accumulator A saturation enabled
0 = Accumulator A saturation disabled
請問設為1時,ACCA為saturation enabled,到底實際會對累加器A有什麼影響?此設定是應用在什麼地方?

Attach file:



jpg  SATA.JPG (68.22 KB)
400_6086d77fe7781.jpg 998X331 px

發表於: 2021/4/26 23:09
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... ]

教育訓練中心

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