Re: 呼叫回傳值不正確
|
||||
---|---|---|---|---|
資深會員
|
那把VIEW中DISASSEMBLY LISTING開出來
看在展開後的組語把數值丟到哪 還有把 k = TouKey_Read(0x08, 2); 改成 k =unsigned char TouKey_Read(0x08, 2); 有的c會要求在遞回前設定送回的格式
發表於: 2010/1/28 14:03
|
|||
My name is jan,Jan是棒的
|
||||
|
Re: 呼叫回傳值不正確
|
||||
---|---|---|---|---|
新會員
|
這個動作我已做過了,
是照著流程跑的沒錯
發表於: 2010/1/28 13:52
|
|||
|
Re: 呼叫回傳值不正確
|
||||
---|---|---|---|---|
資深會員
|
把breakpoint 設在return 5 及return 0
看執行的流程是不是照你的意思走 再來分析問題吧
發表於: 2010/1/28 13:40
|
|||
My name is jan,Jan是棒的
|
||||
|
Re: 呼叫回傳值不正確
|
||||
---|---|---|---|---|
新會員
|
我試了
但結果還是0x61
發表於: 2010/1/28 13:27
|
|||
|
Re: 呼叫回傳值不正確
|
||||
---|---|---|---|---|
版主
|
將 unsigned char k; 拉出 main( ) 成 Global Variable 後再用 Watch window 監看一下其值。
發表於: 2010/1/28 13:15
|
|||
|
Re: 呼叫回傳值不正確
|
||||
---|---|---|---|---|
新會員
|
我的return 是5 or 0,
根i無關
發表於: 2010/1/28 12:45
|
|||
|
呼叫回傳值不正確
|
||||
---|---|---|---|---|
新會員
|
您好:
我目前使用APP023 v8.0 + MPLAB c18 V3.34開發, 我在main底下呼叫一個副程式, 不管副程式的回傳值如何變化,得到的值永遠是0x61, 是設定上問題嗎? void main( void ) { unsigned char k; .. TouKey_Write(0x05, i); k = TouKey_Read(0x08, 2); if (k != 0) { setcurGLCD(3,0) ; putrsGLCD( "Touch ") ; My_Temp = I2CReDa1[0]; setcurGLCD(3,3) ; itoa(My_Temp , TempASCII) ; putsGLCD(TempASCII) ; My_Temp = I2CReDa1[1]; setcurGLCD(3,5) ; itoa(My_Temp , TempASCII) ; putsGLCD(TempASCII) ; } ... } unsigned char TouKey_Read(unsigned char address, unsigned char lenth) { char i; I2CTrDa1[0] = 0x00; // Start Process2 I2CTrDa1[1] = address; // Address i = I2CByteWri1(0xE0, 2); if (i!=0) { putrsUART1( "ERROR: TouKey Read Fail") ; return 5; } I2CCurrRead1(0xE0, lenth); return 0; }
發表於: 2010/1/28 12:02
|
|||
|