Re: 呼叫過多數學函數導致 RAM overflow 請問如何解決?
|
||||
---|---|---|---|---|
版主
|
颱風大大,
佩服,佩服,泰勒展開式 - 早就還給敎工數的老師了。
發表於: 2008/4/9 17:45
|
|||
|
Re: 呼叫過多數學函數導致 RAM overflow 請問如何解決?
|
||||
---|---|---|---|---|
版主
|
用手算開根號,我只記的應該是國中的時候有教過...算一算已經30年沒用筆、紙開更號了,也許早就忘的一乾二淨了,還好有計算機一樣可以完成。
看 Heardware Stack 可以在 "view" 下找到的。
發表於: 2008/4/9 15:54
|
|||
|
Re: 呼叫過多數學函數導致 RAM overflow 請問如何解決?
|
||||
---|---|---|---|---|
資深會員
|
多謝 C_H_M 大大的秘技,誤差約小於 0.01已經夠用了,我只需要算到小數點一位就可以了。
請問一下這種程式是不是是不是將手算開根號的方式用程式來表達?如果在沒有計算機的情形下,能否用手算開根號和計算反三角函數 atan ?謝謝。
發表於: 2008/4/9 9:15
|
|||
|
Re: 呼叫過多數學函數導致 RAM overflow 請問如何解決?
|
||||
---|---|---|---|---|
中級會員
|
提供另一個開方的函數給你參考.
不過這個函數傳回的數值比較會出現誤差,但約小於 0.01
#include <PIC1687x.h>
發表於: 2008/4/8 23:43
|
|||
|
Re: 呼叫過多數學函數導致 RAM overflow 請問如何解決?
|
||||
---|---|---|---|---|
資深會員
|
謝謝版大的建議:
原來用 MPLAB SIM 配合設定中斷點除錯的方式,可以檢查堆疊所使用的層數。請問一下:要在哪個視窗中檢查呢? 我現在比較頭大的問題是,連 Compiler 都不過了,所以無法執行 MPLAB SIM ,傷腦筋。
發表於: 2008/4/4 8:31
|
|||
|
Re: 呼叫過多數學函數導致 RAM overflow 請問如何解決?
|
||||
---|---|---|---|---|
版主
|
PISR,
如果你的計算要在短時間內完成的話,可以考慮改用 PIC24FJ (16 MIPS) 或 PIC24HJ (40 MIPS) 的 16-bit PIC,而且 C30 在做數學運算也比較強。因為你是用 C 寫的程式,轉移上是很簡單的。 另外,要知道是否 Stack Overflow 了,可以用 MPLAB SIM 配合設定中斷點除錯的方式,直接檢查堆疊所使用的層數。以 PIC16F 而言,程式最多只能呼叫到七層,你必須保留一層(第八層)給中斷使用。單使用 ICD2 是無法知道使用了幾層的 Stack 的。
發表於: 2008/4/3 15:15
|
|||
|
Re: 呼叫過多數學函數導致 RAM overflow 請問如何解決?
|
||||
---|---|---|---|---|
資深會員
|
PIC24是強一些, 不是強很多, 因為只多了有號數乘法, 但卻是18MCU的相同方式, 您的應用確實24即可, 要更快, 就得33或是30, 而你用16是完全沒有乘法器, 太難為它嚕~~
發表於: 2008/3/31 17:34
|
|||
|
Re: 呼叫過多數學函數導致 RAM overflow 請問如何解決?
|
||||
---|---|---|---|---|
資深會員
|
請問一下:
PIC24系列16位元的單晶片的數學運算功能是不是強很多? 因為我一直都是用8位元的,16位元的單晶片還沒用過。
發表於: 2008/3/31 17:27
|
|||
|
Re: 呼叫過多數學函數導致 RAM overflow 請問如何解決?
|
||||
---|---|---|---|---|
資深會員
|
我說,這就像用50cc的小綿羊載一隻大豬公上街逛一般。
再說白一些,pic16「不適合」搞這種事,雖然也並非不可能… 最少也得把device設為pic24吧? 如果只是想純粹練習數學,matlab、mathematica、maple是本行業的三巨頭,選一個來用吧。 如果只是想純粹練習C語言的話,作木工起家不大又不硬公司的vs2008正免費下載供個人研究使用,花個時間裝一下,也遠比你現在用的工具強上太多了。
發表於: 2008/3/31 16:12
|
|||
|