السلام عليكم
اساتذتنا الافاضل
احتاج مساعدة في البرمجة لجعل البك ينفذ برنامجين معا
مثلا ان يختبر درجة الحرارة بشكل دائم وينفذ بعض الاشياء للمحافظة عليها وبنفس الوقت يقوم بتشغيل حمل في وقت معين مثلا كل ساعتين
وهذا الكود الذي كتبته
// LCD module connections
sbit LCD_RS at RD2_bit;
sbit LCD_EN at RD3_bit;
sbit LCD_D4 at RD4_bit;
sbit LCD_D5 at RD5_bit;
sbit LCD_D6 at RD6_bit;
sbit LCD_D7 at RD7_bit;
sbit LCD_RS_Direction at TRISD2_bit;
sbit LCD_EN_Direction at TRISD3_bit;
sbit LCD_D4_Direction at TRISD4_bit;
sbit LCD_D5_Direction at TRISD5_bit;
sbit LCD_D6_Direction at TRISD6_bit;
sbit LCD_D7_Direction at TRISD7_bit;
// End LCD module connections
int temp; int i ; char txt[7];
void main()
{
trisc.B1=0; portc.B1=0;
trisc.B0=0; portc.B0=0;
ADC_Init(); Lcd_Init();
Lcd_Cmd(_LCD_CURSOR_OFF);
Lcd_Out(1,1,"Hatchery eggs");
delay_ms(1000);
Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1,1,"designd by");
delay_ms(1000);
Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1,1,"abo hosen");
delay_ms(1000);
Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1,1,"Temp=");
while(1)
{
temp = ADC_Read(0);
temp=temp*500.0/1023.0;
IntToStr(temp, txt);
Lcd_Out(1,8,txt);
if(temp>38)
{
portc.B0=0;
Lcd_out (2,1,"Overheat");
}
else
{
PORTC.B0=1;
Lcd_out (2,1,"Normal " );
delaY_ms(500);
}
if(temp<36)
{
portc.B1=0;
Lcd_out (2,10,"fan off");
}
else
{
PORTC.B1=1;
Lcd_out (2,10,"fan on " );
}
}
}