 |
:: مشرف منتدى الهندسة الكهربائية ::
تاريخ التسجيل: Mar 2005
الدولة: IRAQ
المشاركات: 9,848
|
|
نشاط [ حيدر علاج حسن ]
قوة السمعة:
|
|
07-09-2010, 08:58 AM
المشاركة 53
|
|
عندما اصلحت باقي الاخطاء يبدو ان الكود اصبح بدون اخطاء .
لكن ضهرت هذه الرسالة الغريبة . و هي لا ترشد الى اي شيء
الكود
كود:
char m=0,ww=0,result=0,result_t=0;
char number[]={'x',' ','9','8','7','x','6','5','4','x','3','2','1','x','x','0','x'};
char number2[]={'x',' ',9,8,7,'x',6,5,4,'x',3,2,1,'x','x',0,'x'};
char tens=0,ones=0;
char tens1=0,ones1=0;
unsigned long temp,aa;
int kk; int x;
char txt[14];
///////////////////////////////// Controlling the relay according to the degree:
void on()
{ result=(tens*10)+ones;
result_t=(tens1*10)+ones1;
if(result>99 || result<1)
{Lcd_Cmd(Lcd_Clear);lcd_out_cp("error");
delay_ms(1000);
return;}
x=result_t/60;
while(1)
{ for(x=0; x<result_t; x--)
{ delay_ms(1000);
temp=adc_read(0);
temp=(temp*5000)>>10;
temp=temp/10;
longToStr(temp,txt);
lcd_out(1,1,"temp = "); lcd_out(2,1,txt);
lcd_chr_cp('C');
delay_ms(500); lcd_cmd(lcd_clear);
if(temp<result) { portd.f0=1; }
else {portd.f0=0;} } } }
void main() {
adcon1=0b00001110; // using Port A as analog to digital converting
trisa=0xff;// using Port A as in put
trisd=0;
Keypad_Init(&PORTC); // Using Port C for Keypad
lcd_init(&portb); // Using POrt B for LCD
lcd_cmd(LCD_CURSOR_OFF); lcd_out(1,1,"Enter the Degree");
lcd_out(2,1," C");
/////////////////////////////////////Entering Degree
loop: //testing the first pushing down
m=keypad_read();
if(m==0) {goto loop;}
else if(m==14){goto loop;}
else if(m==16){Lcd_Cmd(Lcd_Clear);
goto loop;}
else {Lcd_Cmd(Lcd_Clear);
tens=number2[m];lcd_chr_cp(number[m]);
delay_ms(500);}
test: //testing the second pushing down
m=keypad_read();
if(m==0) {goto test;}
else if(m==14)
{ones=tens;tens=0;on();goto testt;}
else if(m==16)
{Lcd_Cmd(Lcd_Clear);goto loop;}
else
{ones=number2[m];lcd_chr_cp(number[m]);delay_ms(500);}
testt: //testing the third pushing down
m=keypad_read();
if(m==0) {goto testt;}
else if(m==14){goto loop2;}
else if(m==16){Lcd_Cmd(Lcd_Clear);goto loop;}
else {goto testt;}
/////////////////////////////// Entering Time by mints
loop2: //testing the first pushing down
lcd_cmd(lcd_clear); lcd_out(1,1,"Enter the Time");
ww=keypad_read();
if(ww==0) {goto loop2;}
else if(ww==14){goto loop2;}
else if(ww==16){Lcd_Cmd(Lcd_Clear);goto loop;}
else {Lcd_Cmd(Lcd_Clear);
tens1=number2[m];
lcd_chr_cp(number[m]);delay_ms(500);}
tesst: //testing the second pushing down
ww=keypad_read();
if(ww==0) {goto tesst;}
else if(ww==14){ones1=tens;tens1=0;on();goto testt;}
else if(ww==16){Lcd_Cmd(Lcd_Clear);goto loop;}
else {ones=number2[m];lcd_chr_cp(number[m]);delay_ms(500);}
testt1: //testing the third pushing down
ww=keypad_read();
if(ww==0) {goto testt1;}
else if(ww==14){on();}
else if(ww==16){Lcd_Cmd(Lcd_Clear);goto loop;}
else {goto testt1;}
}
رسالة الخطأ
|