• slider image 514
  • slider image 516
  • slider image 517
  • slider image 518
  • slider image 519
:::


Browsing this Thread:   4 Anonymous Users






Re: PIC24H 除法讀值錯誤
#8
初級會員
初級會員


查看用戶資訊
原來要加判斷OV旗號~了解 3Q~

發表於: 2009/12/31 13:35
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: PIC24H 除法讀值錯誤
#7
版主
版主


查看用戶資訊
參考一下 C:\Program Files\Microchip\MPLAB C30\docs\MPLAB_C_Compiler_PIC24_dsPIC_UG_51284H.pdf 裡有關 __builtin Function 的方式及使用說明。Page 141 & Page 146:


__builtin_divud
Description
Computes the quotient num denA math error exception occurs if den
is zero
. Function arguments are unsigned, as is the function resultThe
command
-line option -Wconversions can be used to detect unexpected
sign conversions
.
Prototypeunsigned int __builtin_divud(const unsigned
long num
, const unsigned int den);

發表於: 2009/12/29 10:08
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: PIC24H 除法讀值錯誤
#6
資深會員
資深會員


查看用戶資訊
引述 dspic reference manual 的一段,24f 應該差不多:

This instruction must be executed 18 times using the REPEAT instruction
(with an iteration count of 17) to generate the correct quotient and
remainder. The N flag will be set if the remainder is negative and cleared
otherwise. The OV flag will be set if the divide operation resulted in an
overflow and cleared otherwise. The Z flag will be set if the remainder is
‘0’ and cleared otherwise. The C flag is used to implement the divide
algorithm and its final value should not be used.

簡單地說,

1)叫你用組語去搞!
2)花時間,別call。

……退一百步地說,使用別人寫好的lib應該不錯,可以找找有沒有?

發表於: 2009/12/29 0:23
The Answer to Life, the Universe, and Everything.
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: PIC24H 除法讀值錯誤
#5
初級會員
初級會員


查看用戶資訊
我知道商值最大=FFFFh,但如果數值如下(或類似),我該如何處理?
被除數=0001 0000h
除數=0001h

我要如何判斷不能這樣除,否則的得到的是錯誤商值~

發表於: 2009/12/28 23:05
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: PIC24H 除法讀值錯誤
#4
版主
版主


查看用戶資訊
參照:

wmg01 寫道:
附帶一點:asm30組譯時出現"pic30-coff-as.exe發生錯誤........" 無法組譯,這是什麼問題?


請把錯誤的訊息整個貼上來,我不曉得你的意思。

發表於: 2009/12/21 15:18
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: PIC24H 除法讀值錯誤
#3
版主
版主


查看用戶資訊
參照:

wmg01 寫道:
我在設計程式中,使用到32bit/16bit除法時發現,當商值大於FFFFh時,WREG0讀到的商值就是錯誤的,我該如何解決這個問題,煩請版大址點一下迷津~~謝謝!!


商值大於FFFFh? 32bit/16bit 最大值就只到 0xFFFF 而已。不明瞭你的問題所在。

發表於: 2009/12/21 15:16
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: PIC24H 除法讀值錯誤
#2
初級會員
初級會員


查看用戶資訊
附帶一點:asm30組譯時出現"pic30-coff-as.exe發生錯誤........" 無法組譯,這是什麼問題?

發表於: 2009/12/18 15:39
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


PIC24H 除法讀值錯誤
#1
初級會員
初級會員


查看用戶資訊
我在設計程式中,使用到32bit/16bit除法時發現,當商值大於FFFFh時,WREG0讀到的商值就是錯誤的,我該如何解決這個問題,煩請版大址點一下迷津~~謝謝!!

發表於: 2009/12/18 15:28
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... ]

教育訓練中心

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