السلام عليكم و رحمة الله و بركاته
انا استعمل pic 16f877A و MikroC v4.6 في مشروع شاشه LCD 16*2 و LM35 و سنسرور ضوء, و أريد تركيبهم في سياره. الكود التالي يعمل بكفاءه!
كود:
// Lcd pinout settings
sbit LCD_RS at RB4_bit;
sbit LCD_EN at RB5_bit;
sbit LCD_D7 at RB3_bit;
sbit LCD_D6 at RB2_bit;
sbit LCD_D5 at RB1_bit;
sbit LCD_D4 at RB0_bit;
// Pin direction
sbit LCD_RS_Direction at TRISB4_bit;
sbit LCD_EN_Direction at TRISB5_bit;
sbit LCD_D7_Direction at TRISB3_bit;
sbit LCD_D6_Direction at TRISB2_bit;
sbit LCD_D5_Direction at TRISB1_bit;
sbit LCD_D4_Direction at TRISB0_bit;
float x,y,m,n,i=0; char txt[12];
char txt1[12];
int a=10;
void main()
{
Lcd_Init();
Lcd_Cmd(_LCD_CURSOR_OFF);
TRISC=0;
TRISD=255;
portc.b0=0;
portc.b0=1;
Lcd_Out(1, 3, "Hello Ahmad !");
delay_ms(300);
portc.b0=0;
delay_ms(5000);
lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1, 1, "Temp=");
x=adc_read(0);
y=(x*500)/1024;
floattostr(y,txt);
lcd_out(1,6,txt);
lcd_chr_cp(223);
lcd_chr_cp('c');
if(y>=30)
{
Lcd_Out(2, 1, "I think its hot");
delay_ms(3000);
}
else
{
Lcd_Out(2, 1, "I think its cold");
delay_ms(3000);
}
if(portd.B0==1)
{
lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1, 1, "no need to turn");
Lcd_Out(2, 1, "on the lights");
delay_ms(3000);
}
else
{
lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1, 1, "Its better to");
Lcd_Out(2, 1, "turn on the ligh");
delay_ms(3000);
}
lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1, 1, "car will lock in");
for(a=10;a>=0;a--)
{
inttostr(a,txt1);
lcd_out(2,4,txt1);
delay_ms(500);
}
lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1, 4, "car locked");
}
Proteus:
و لكن عند زيادة اي سطر بعد كده يظهرلي هذا ال error:
IRP bit must be set manually for indirect access to 'txt' variable
IRP bit must be set manually for indirect access to 'txt1' variable
فأنا اريد زيادة الكود بعد كده while(1) l و اوامر اخري كثيره...
فلا اعلم اين الخطأ هل هو في كتابه الكود أو في الـ MicroC ؟؟
و شكرا مقدما