I Need Help

General discussion on mikroC.
Post Reply
Author
Message
ABG91
Posts: 2
Joined: 01 Jul 2018 21:33

I Need Help

#1 Post by ABG91 » 01 Jul 2018 21:58

I'm Trying to do public lighting control using PIC 16f877 but its not working when i tried to make the circuit but the LCD display shows nothing, i used proteus to simulate the design and it told me this error


Program or EEPROM data has invalid address [2000] for this device
Program or EEPROM data has invalid address [2001] for this device
Program or EEPROM data has invalid address [2002] for this device
Program or EEPROM data has invalid address [2003] for this device
CFGWORD2 not implemented


I have no idea what is happening please i need help

Code: Select all

program pfe;
var  //declaration de variable
kp : byte;
// Lcd module connections
var LCD_RS : sbit at RB4_bit;
var LCD_EN : sbit at RB5_bit;
var LCD_D4 : sbit at RB3_bit;
var LCD_D5 : sbit at RB2_bit;
var LCD_D6 : sbit at RB1_bit;
var LCD_D7 : sbit at RB0_bit;

var LCD_RS_Direction : sbit at TRISB4_bit;
var LCD_EN_Direction : sbit at TRISB5_bit;
var LCD_D4_Direction : sbit at TRISB3_bit;
var LCD_D5_Direction : sbit at TRISB2_bit;
var LCD_D6_Direction : sbit at TRISB1_bit;
var LCD_D7_Direction : sbit at TRISB0_bit;
// End Lcd module connections
keypadPort : byte at PORTC;  //Initialize PORTD for communication with keypad


x,j,u: LONGINT;
label temp,seuil,lum ,lampe,start;
Procedure lam();
       begin
       J:=adc_read(1);
       u:=adc_read(2);
       if j>u then
       begin
       DELAY_ms(250);
       portd.0:=1;
       end
       else
       begin
       portd.0:=0;

       end ;
       end;
Procedure ADC(x:integer);
      var ch: byte;//declaration de variable
      tlong,t: longint;
      begin
      lcd_cmd(_LCD_CURSOR_OFF);//etiendre le clavier
      tlong := (x*5000);
      t    := longint(tlong shr 10);
      ch:= t div 100000;
      lcd_chr(2,3,48+ch);
      ch:= integer(t div 10000)mod 10;
      lcd_chr(2,4,48+ch);
      ch:= integer(t div 1000)mod 10;
      lcd_chr(2,5,48+ch);
      lcd_chr(2,6,'.');
      ch:= integer(t div 100)mod 10;
      lcd_chr(2,7,48+ch);
      ch:= integer(t div 100) mod 10;
      lcd_chr(2,8,48+ch);
      ch:= integer(t div 10) mod 10;
      end;
begin
lcd_init();//initialisation de l'afficheur LCDsur le portB

trisa:=$EF;//toute les broches de portA en sortie sauf  RA4
trisc:=$7F;// toute les broches de portC en sortie sauf  RA7
ADCON1:=$80;  //déclaration pour le CAN ,extrait de datasheet du Pic
Trisd:=$00;//initialisation de portd
lcd_cmd(_LCD_CURSOR_OFF);//etiendre le curseur de l'afficheur LCD
Keypad_Init();//initialiser le clavier sur le port C
Lcd_Cmd(_LCD_CLEAR);// effacer le contenu de l'afficheur
lcd_out(1,1,'projet fin d"etude');//afficher sur la 1 er  ligne et la 1 er colnne de LCD "projet fin d"etude"
portd.0:=0; //  initialiser  le pin RD0
repeat
start:
portc :=$00;//initialisation de portc
begin
kp := 0;//initialisation de kp
while kp = 0 do
kp := Keypad_Key_Click();          //lecture de clavier

// structure du clavier;
if (kp = 1) then kp := '1';
if (kp = 2) then kp := '4';
if (kp = 3) then kp := '7';
if (kp = 4) then kp := '*';
if (kp = 5) then kp := '2';
if (kp = 6) then kp := '5';
if (kp = 7) then kp := '8';
if (kp = 8) then kp := '0';
if (kp = 9) then kp := '3';
if (kp = 10) then kp := '6';
if (kp = 11) then kp := '9';
if (kp = 12) then kp := '=';
       LCD_chr(2,5,kp);
    Lcd_Cmd(_LCD_CLEAR); //effacer le contenu de l'afficheur
    if kp ='1' then goto temp  ;
    if kp ='2' then goto seuil ;
    if kp ='3' then goto lampe ;
    if kp ='4' then goto lum   ;
    lcd_out(1,1,'1-temp 2-seuil');//afficher sur la 1 er  ligne et la 1 er colnne de LCD "1-temp 2-seuil"
    lcd_out(2,1,'3-lampe 4-lum');//afficher sur la 2 eme  ligne et la 2 eme colnne de LCD "3-lampe 4-lum"
       lam();
 goto start ;
temp:
    begin
         DELAY_ms(50);//
         kp := Keypad_Key_Click();//lecture de clavier

         while kp=0 do
         begin
         x:=adc_read(0);
         lcd_out(1,1,'1-Temperature:');//afficher sur la 1 er  ligne et la 1 er colnne de LCD "1-Temperature:"
         lcd_out(2,10,' (Degre)');//afficher sur la 2 eme ligne et la 10 eme colnne de LCD " (Degre)"
         lam();
         adc(x);//
         kp := Keypad_Key_Click();//lecture de clavier

         end ;
         goto start ;//
     end ;
seuil:
    begin
         DELAY_ms(50);//
         kp := Keypad_Key_Click();//lecture de clavier

         while kp=0 do
         begin
         J:=adc_read(1);//
         lcd_out(1,1,'1-Reglage Seuil:');//afficher sur la 1 er  ligne et la 1 er colnne de LCD "1-Reglage Seuil:"
         lam();//
         adc(J);//
         kp := Keypad_Key_Click();//lecture de clavier

         end ;
         goto start ;//
     end ;
lampe:
  begin
        DELAY_ms(50);//
        kp := Keypad_Key_Click();//
        while kp=0 do//
        begin
        J:=adc_read(1);//
        u:=adc_read(2);//
        if j>u then //
        begin
        DELAY_ms(250);//
        portd.0:=1;//
        lcd_out(1,3,'lampe allume');//afficher sur la 1 er  ligne et la 3 eme colnne de LCD "lampe allume"
        end
        else
        begin
        portd.0:=0;//
        lcd_out(1,3,'lampe eteint');//afficher sur la 1 er  ligne et la 3 eme colnne de LCD "lampe eteint"
        end ;
        kp := Keypad_Key_Click();////lecture de clavier

        end;
        goto start ;
  end ;
lum:
  begin
        DELAY_ms(50);
        kp := Keypad_Key_Click();
        while kp=0 do
        begin
        u:=adc_read(2);
        lcd_out(1,1,'4-Lumiere:');//afficher sur la 1 er ligne et la 1er  colnne de LCD "4-Lumiere:"
        lcd_out(2,10,' Lum'); //afficher sur la 1 er ligne et la  10 eme colonne de LCD "Lum"
        adc(u);//
        lam(); //
        kp := Keypad_Key_Click();//lecture de clavier

        end;
        goto start ;
        end ;
end ;
until FALSE ;
end.
Attachments
Capture.PNG
Capture.PNG (68.51 KiB) Viewed 5939 times

Post Reply

Return to “mikroC General”