Re: do while 輸出問題
|
||||
---|---|---|---|---|
新會員
|
引言: 瘋曰:「屁股那去了?」
抱歉聽不懂 我發現第三回圈input輸入要快,才能夠跑第三回圈的程式,感謝各位的指教
發表於: 2009/10/22 12:06
|
|||
|
Re: do while 輸出問題
|
||||
---|---|---|---|---|
資深會員
|
瘋曰:「屁股那去了?」
發表於: 2009/10/22 11:17
|
|||
The Answer to Life, the Universe, and Everything.
|
||||
|
Re: do while 輸出問題
|
||||
---|---|---|---|---|
資深會員
|
參照:
對ㄝ,那個分號不能少 抱歉,一時不察
發表於: 2009/10/21 21:37
|
|||
|
Re: do while 輸出問題
|
||||
---|---|---|---|---|
版主
|
" int input_1,input_2; "
插花一下,PORTC & PORTD 都是 unsigned char 的資料型態,所以 input_1 & input_2 最好也是 unsigned char 的型態。
發表於: 2009/10/20 9:13
|
|||
|
Re: do while 輸出問題
|
||||
---|---|---|---|---|
新會員
|
do
{ input_2= PORTC & 0x0f; } while(input_2 != 0x0c); PORTD=0X06; 改成 do { input_2= PORTC & 0x0f; } while(input_2 != 0x06); PORTD=0X06;
發表於: 2009/10/20 8:57
|
|||
|
Re: do while 輸出問題
|
||||
---|---|---|---|---|
資深會員
|
while(input_2 != 0x0c); <==把 ; 拿掉吧
發表於: 2009/10/18 12:37
|
|||
|
Re: do while 輸出問題
|
||||
---|---|---|---|---|
資深會員
|
參照:
發表於: 2009/10/18 6:13
|
|||
|
do while 輸出問題
|
||||
---|---|---|---|---|
新會員
|
各位好,我使用的是 pic16f877 用hi-tech compiler
我想利用程式做兩個do while迴圈讀portc資料作判斷,再將資料由portd顯示 我在mplab跑時,沒發現問題 但在實際板子上做時,第一迴圈可以按照我的程式跑出0x03,但是第二個回圈卻無法跳出做0x06 我懷疑是portc的問題,但又不知從何改起 懇請大家幫幫忙 以下程式 #include<pic.h> main() { TRISD=0B00000000; TRISC=0B11111111; int input_1,input_2; do { input_1= PORTC & 0x0f; } while(input_1 != 0x03); PORTD=input_1; do { input_2= PORTC & 0x0f; } while(input_2 != 0x0c); PORTD=0X06; }
發表於: 2009/10/11 10:03
|
|||
|