شكرا لردك السريع أخ عبد الله جزاك الله خيرا .
أنا جعلت المكثفات 18 بيكو لأنني لم أجد مكثفات 22 في السوق
ولكن هل يكون السبب مكثف
بصراحة أنا أشعر ان الشريحة فيها مشكلة حيث أن جميع الأرجل b في حال تخريج دائم على ما يبدو
إذا كنت تعتقد أن الموضوع هو بسبب الكريستالة ممكن تساعدين كيف أستغني عنها أو اعدلها ....
بالنسبة لأحد الأكواد التي جربتها
كود:
int temp_res;
char temp[12];
unsigned int rtemp=10;
char ntemp[10];
sbit LCD_RS at RB2_bit;
sbit LCD_EN at RB3_bit;
sbit LCD_D4 at RB4_bit;
sbit LCD_D5 at RB5_bit;
sbit LCD_D6 at RB6_bit;
sbit LCD_D7 at RB7_bit;
sbit LCD_RS_Direction at TRISB2_bit;
sbit LCD_EN_Direction at TRISB3_bit;
sbit LCD_D4_Direction at TRISB4_bit;
sbit LCD_D5_Direction at TRISB5_bit;
sbit LCD_D6_Direction at TRISB6_bit;
sbit LCD_D7_Direction at TRISB7_bit;
Lcd_Cmd(_LCD_FIRST_ROW);
void adc()
{
temp_res = ADC_Read(2); // Get 10-bit results of AD conversion
temp_res = (temp_res *5)/10;
IntToStr(temp_res,temp);
}
void print()
{
Lcd_Cmd(_LCD_CLEAR);
lcd_out(1,1,"Now temp") ;
lcd_out(2,1,"Ref temp") ;
}
void test()
{
if(temp_res>rtemp)
{
PORTC=0b00000101; //cool
}
if(temp_res<rtemp)
{
PORTC=0b00001010;//hot
}
if(temp_res==rtemp)
{
PORTC=0x00;
}
}
void main()
{
TRISA =0b10;
TRISD =0x11;
TRISC =0x00;
Lcd_Init();
Lcd_Cmd(_LCD_CURSOR_OFF);
////////////////////////////////
lcd_out(1,4,"Temperature") ;
lcd_out(2,3,"System Control") ;
delay_ms(2000);
Lcd_Cmd(_LCD_CLEAR);
lcd_out(1,3,"Designed By") ;
lcd_out(2,3,"Fouz Martini") ;
delay_ms(2500);
print();
do
{
IntToStr(rtemp,ntemp);
lcd_out(2,10,ntemp);
delay_ms(200);
lcd_out(1,10,temp) ;
delay_ms(200);
test();
if(portd.f1==0 && rtemp>0)
{
rtemp--;
delay_ms(200);
}
if(portd.f0==0&&rtemp<=100)
{
rtemp++;
delay_ms(200);
}
adc();
}
while(1);
return;
}
بالنسبة للشريحة لدي هي 16f877A
سأشتري غدا شريحة جديدة للتجريب إن شاء الله ...