Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

PIC16F877A strcmp lecture depuis EEPROM comparaison

Status
Not open for further replies.

chiheb01

New Member
Bonjour,
j'ai un problème à comparer un tableau d'entier avec un chaine d'entier j'ai essayer d'utiliser la fonction atoi pendant le parcours mais ca sert a rien.
je construit un tableau depuis l'EEPROM puis je le compare avec la chaine (chz) en entrée.
la fonction retourne 1 si la chaine existe dans l'EEPROM. 0 sinon.

Merci bien,
C:
int existe (char chz[9]) {
int chh[12];char vv[9];   int v=0,ex = 1; char azerty;
unsigned int adres=(0x00);char az;unsigned int k;int f =0; int t;
while ((adres < 256) && (v==0))
  {
    f = 0;
//   memset(chh, 0, sizeof(chh));
     for( k=adres; k < (adres+(0x08)); k++) {
     //Delay_ms(20);
     //UART1_Write(';');
       chh[f]=EEPROM_Read(k);
       UART1_Write(chh[f]);
       Delay_ms(20);
       chh[f] = az;
       f++;
    }
   UART1_Write('*');
     f = 0; ex =1;

   while( (f<8) && (ex==1))
     {
      if(chh[f] != atoi(&(chz[f])))
           { ex=0;
             UART1_Write('e');
      }
             else {UART1_Write('v');}
     f++;
     }
     v=(ex);
     Delay_ms(20);
  adres=(adres+(0x10));
}
 
Last edited by a moderator:
English:
Hello,
I have a problem comparing an entire table with a chain around I try to use the atoi function during the course but it is useless.
I built a table from the EEPROM and then I compare it with the chain (chz) input.
the function returns 1 if the string is in the EEPROM. 0 otherwise.

Thank you very much,
 
Hello,
I have a problem comparing an entire table with a string of integer.
I try to use the atoi() function during the for() but it is useless.
I built a table from the EEPROM and then I compare it with the string chz input. existe();
the function returns 1 if the string is in the EEPROM. 0 otherwise.
My Program is an RFID Reader who Read a Card string of 8 character. the string is composed of char between '0' .. '9'.
I verify if the string is already exist in the EEPROM or Not.
Every string is Written in a Line 0x00 0x10 0x20 .. it reserve the 8 first address;

Thank you very much,
 
I'm Really Sorry,
that was unused chh[f] = az ;
is eliminated from the code.
chh[f]=EEPROM_Read(k); is used to compose the table;
and i'm sure that chh is composed correctly.
all UART1_Write(); are used just to verify the result;
i need to return 1 if the chz exist in the EEPROM;
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top