Autor Tema: leer, escribir y guardar datos en eeprom externa  (Leído 4028 veces)

0 Usuarios y 1 Visitante están viendo este tema.

Desconectado magusito

  • PIC10
  • *
  • Mensajes: 30
leer, escribir y guardar datos en eeprom externa
« en: 29 de Marzo de 2010, 18:36:33 »
Hola .  Soy nuevo y estoy realizando un pequeño trabajo, en el cual tengo que leer, escribir y guardar  datos de tipo short, int, long, int32, y float usando un teclado, un pic 18F452 y una LCD  en  una memoria EEprom externa.  Les adjunto lo que llevo del  programa, ojala alguien pueda ayudarme.

#include <18F452.h>
#device adc=8
#FUSES NOWDT                    //No Watch Dog Timer
#FUSES WDT128                   //Watch Dog Timer uses 1:128 Postscale
#FUSES XT                       //Crystal osc <= 4mhz for PCM/PCH , 3mhz to 10 mhz for PCD
#FUSES NOPROTECT                //Code not protected from reading
#FUSES NOOSCSEN                 //Oscillator switching is disabled, main oscillator is source
#FUSES NOBROWNOUT               //No brownout reset
#FUSES BORV20                   //Brownout reset at 2.0V
#FUSES PUT                      //Power Up Timer
#FUSES STVREN                   //Stack full/underflow will cause reset
#FUSES NODEBUG                  //No Debug mode for ICD
#FUSES NOLVP                    //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOWRT                    //Program memory not write protected
#FUSES NOWRTD                   //Data EEPROM not write protected
#FUSES NOWRTB                   //Boot block not write protected
#FUSES NOWRTC                   //configuration not registers write protected
#FUSES NOCPD                    //No EE protection
#FUSES NOCPB                    //No Boot Block code protection
#FUSES NOEBTR                   //Memory not protected from table reads
#FUSES NOEBTRB                  //Boot block not protected from table reads
#use delay(clock=4000000)
#include <stdlib.h>
#include <2408.c>

#include<external_eeprom.c>
#define LCD_DATA_PORT getenv("SFR:PORTC")
#include <LCD.C>
#define use_portb_kbd TRUE
#include <KBD.C>

short   Dato_short;
int      Direccion_EEPROM_short[5];
char Caracter,Tecla;
int   Indice;
int   Direccion_EEPROM;
int   Cantidad_Datos;
int   Posicion_bit;



void Teclado_Libre()
{
   do   {
         Tecla = kbd_getc();
      }
      while(Tecla!='\0');
}
void Recibe_Tecla()
{
   do
   {
      Caracter=kbd_getc();
   }while(Caracter==0);

}
void main()
{
   set_tris_a(0x3F);//0011 1111
   set_tris_b(0xE0);//1110 0000
   set_tris_c(0x00);//0000 0000
   set_tris_d(0x00);//0000 0000
   set_tris_e(0x07);//0000 0111

   setup_adc_ports(NO_ANALOGS);
   setup_adc(ADC_OFF);
   setup_psp(PSP_DISABLED);
   setup_spi(SPI_SS_DISABLED);
   setup_wdt(WDT_OFF);
   setup_timer_0(RTCC_INTERNAL);
   setup_timer_1(T1_DISABLED);
   setup_timer_2(T2_DISABLED,0,1);
   lcd_init();
   kbd_init();
   port_b_pullups(TRUE);
   lcd_putc('\f');
   lcd_gotoxy(1,1);
   lcd_putc("1) Escribir Dato");
   lcd_gotoxy(1,2);
   lcd_putc("2) Leer Dato");
   Indice=0;
   while(TRUE)
   {
      Recibe_Tecla();
      if(Caracter!=0)
      {
         if(Caracter=='1')
         {
            Teclado_Libre();
            lcd_putc('\f');
            lcd_gotoxy(1,1);
            lcd_putc("1)Short 2)Int 3)Long");
            lcd_gotoxy(1,2);
            lcd_putc("4)int32 5)Float");
A1:
            Recibe_Tecla();
            if( (Caracter>='1') && (Caracter<='5') )
            {
               if(Caracter=='1')
               {
                  lcd_putc('\f');
                  lcd_gotoxy(1,1);
                  lcd_putc("Ingrese  Dato short");
                  lcd_gotoxy(1,2);
                  lcd_putc("y presione *");
A2:
                  Recibe_Tecla();
                  if( (Caracter>='0') && (Caracter<='1') )
                  {
                     lcd_putc('\f');
                     lcd_gotoxy(1,1);
                     printf(LCD_PUTC"Dato: %c",Caracter);
                     if(Caracter=='1')
                     {
                        Dato_short=True;
                     }
                     else
                     {
                        Dato_short=False;
                     }
A3:
                     Recibe_Tecla();
                     if(Caracter=='*')
                     {
                        lcd_putc('\f');
                        lcd_gotoxy(1,1);
                        lcd_putc("Ingrese  Direccion");
                        lcd_gotoxy(1,2);
                        lcd_putc("EEPROM: ");
                        Cantidad_Datos=0;
                        do
                        {
                           Recibe_Tecla();
                           printf(LCD_PUTC"%c",Caracter);
                           Direccion_EEPROM_short[Cantidad_Datos]=Caracter;
                           Cantidad_Datos++;
                        }while(Cantidad_Datos<=2);
                        Direccion_EEPROM=atoi(Direccion_EEPROM_short);
                        delay_ms(2000);
                        lcd_putc('\f');
                        lcd_gotoxy(1,1);
                        lcd_putc("Ingrese  Posicion");
                        lcd_gotoxy(1,2);
                        lcd_putc("del bit: ");
A4:
                        Recibe_Tecla();
                        if( (Caracter>='0') && (Caracter<='7') )
                        {
                           printf(LCD_PUTC"%c",Caracter);
                           Posicion_bit=Caracter-0x30;
                           write_int1_ext_eeprom(Direccion_EEPROM, Posicion_bit, Dato_short);
                           lcd_putc('\f');
                           lcd_gotoxy(1,1);
                           lcd_putc("Dato short Escrito");
                           delay_ms(2000);
                        }
                        else
                        {  
                           goto A4;
                        }
  
  
                     }
                     else
                     {
                        goto A3;
                     }
                    
                  }
                  else
                  {
                     goto A2;
                  }
            
               }
            }
            else
            {
               goto A1;
            }
              
         }
         if(Caracter=='2')
         {

         }
      }  
   }
}

Desconectado migsantiago

  • Colaborador
  • DsPIC33
  • *****
  • Mensajes: 8257
    • Sitio de MigSantiago
Re: leer, escribir y guardar datos en eeprom externa
« Respuesta #1 en: 29 de Marzo de 2010, 18:38:18 »
Tu duda ya se está tratando en este tema...

http://www.todopic.com.ar/foros/index.php?topic=30033.0

Desconectado magusito

  • PIC10
  • *
  • Mensajes: 30
Re: leer, escribir y guardar datos en eeprom externa
« Respuesta #2 en: 12 de Abril de 2010, 21:08:45 »
buenas, aca les respondo o publico el programa que hice para leer, escribir y guardar datos en eeprom externa, por si a alguien le sirve. y si alguien tiene alguna correccion que la haga saver, o depronto una manera mas corta de hacer el programa. me quedo algo largo!

#include <18F452.h>
#device adc=8
#FUSES NOWDT                    //No Watch Dog Timer
#FUSES WDT128                   //Watch Dog Timer uses 1:128 Postscale
#FUSES XT                       //Crystal osc <= 4mhz for PCM/PCH , 3mhz to 10 mhz for PCD
#FUSES NOPROTECT                //Code not protected from reading
#FUSES NOOSCSEN                 //Oscillator switching is disabled, main oscillator is source
#FUSES NOBROWNOUT               //No brownout reset
#FUSES BORV20                   //Brownout reset at 2.0V
#FUSES PUT                      //Power Up Timer
#FUSES STVREN                   //Stack full/underflow will cause reset
#FUSES NODEBUG                  //No Debug mode for ICD
#FUSES NOLVP                    //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOWRT                    //Program memory not write protected
#FUSES NOWRTD                   //Data EEPROM not write protected
#FUSES NOWRTB                   //Boot block not write protected
#FUSES NOWRTC                   //configuration not registers write protected
#FUSES NOCPD                    //No EE protection
#FUSES NOCPB                    //No Boot Block code protection
#FUSES NOEBTR                   //Memory not protected from table reads
#FUSES NOEBTRB                  //Boot block not protected from table reads
#use delay(clock=4000000)
#include <stdlib.h>
#include <2408.c>
#include<external_eeprom.c>
#define LCD_DATA_PORT getenv("SFR:PORTD")
#include <LCD.C>
#define use_portb_kbd TRUE
#include <KBD.C>

char    suelta,recibe;
char   lee,lee2;
short   dato_s;
int      shortmemo[5],intmemo[5],longmemo[5],int32memo[5],floatmemo[20];
int      contador,contador2,bitpos,datos;
int      intdato[5],longdato[5],int32dato[10],floatdato[20];
long   posmemo,datoe2,lee3;
long long     datoe3,datoe5,lee4;
float   datoe4,datoe7,lee5;

void main()
{
   setup_adc_ports(NO_ANALOGS);
   setup_adc(ADC_OFF);
   setup_psp(PSP_DISABLED);
   setup_spi(SPI_SS_DISABLED);
   setup_wdt(WDT_OFF);
   setup_timer_0(RTCC_INTERNAL);
   setup_timer_1(T1_DISABLED);
   setup_timer_2(T2_DISABLED,0,1);
   setup_timer_3(T3_DISABLED|T3_DIV_BY_1);
   set_tris_a(0b00111111);
   set_tris_b(0b11111111);
   set_tris_c(0b11100111);
   set_tris_d(0b11111111);
   set_tris_e(0b00000000);
   init_ext_eeprom();
   lcd_init();
   kbd_init();
   port_b_pullups(TRUE);
in:   lcd_gotoxy(1,1);
   lcd_putc('\f');
   lee=0;
   lcd_putc("1 Escribir Dato");
   lcd_gotoxy(1,2);
   lcd_putc("2 leer Dato");
   
   
   

      while(true)
      {
         
         
                  
         do
   {
      recibe=kbd_getc();
   }while(recibe==0);
         if(recibe!=0)
         {
            if(recibe=='1')
primo:            {
               do   
   {
      suelta=kbd_getc();
   }
      while(suelta!='\0');
               lcd_putc('\f');
               lcd_gotoxy(1,1);
               lcd_putc("1)Short2)Int3)Long");
               lcd_gotoxy(1,2);
               lcd_putc("4)int32 5)Float");
            

               do
   {
      recibe=kbd_getc();
   }while(recibe==0);
               if( (recibe>='1') && (recibe<='5') )
               {



               
                  if(recibe=='1')
primo2:                  {
                     lcd_putc('\f');
                     lcd_gotoxy(1,1);
                     lcd_putc(" Ingrese Dato");
                     

                     do
   {
      recibe=kbd_getc();
   }while(recibe==0);
                     if( (recibe>='0') && (recibe<='1') )
                     {
                        lcd_putc('\f');
                        lcd_gotoxy(1,1);
                        printf(LCD_PUTC"Dato: %c",recibe);
                        if(recibe=='1')
                        {
                           dato_s=True;
                        }
                        else
                        {
                           dato_s=False;
                        }
                        lcd_gotoxy(1,2);
                        lcd_putc("y presione *");
primo3:
                        do
   {
      recibe=kbd_getc();
   }while(recibe==0);
                        if(recibe=='*')
                        {
primo4:                        lcd_putc('\f');
                           lcd_gotoxy(1,1);
                           lcd_putc("Ingrese Direccion");
                           lcd_gotoxy(1,2);
                           lcd_putc("EEPROM  ");
                           contador=0;
                           do
                           {
                              do
   {
      recibe=kbd_getc();
   }while(recibe==0);
                              
                              printf(LCD_PUTC"%c",recibe);
                              shortmemo[contador]=recibe;
                              contador++;
                           }
                           while(contador<=3);
                              posmemo=atol(shortmemo);
                              if( (posmemo>=0) && (posmemo<=1024) )
                              {
                              
                              delay_ms(1000);
primo5:                              lcd_putc('\f');
                              lcd_gotoxy(1,1);
                              lcd_putc("Ingrese Posicion");
                              lcd_gotoxy(1,2);
                              lcd_putc(" del bit: ");

                              do
   {
      recibe=kbd_getc();
   }while(recibe==0);
                              if( (recibe>='0') && (recibe<='7') )
                              {
                                 printf(LCD_PUTC"%c",recibe);
                                 delay_ms(1000);
                                 bitpos=recibe-0x30;;
                                 write_int1_ext_eeprom(posmemo,bitpos,dato_s);
                                 lcd_putc('\f');
                                 lcd_gotoxy(1,1);
                                 lcd_putc("Dato short Escrito");
                                 delay_ms(2000);
                                 goto in;
                              }
                              else
                              {   
                                 
                                 goto primo5;
                              }
                              }
                              else
                              {
                                 
                                 goto primo4;
                              }
   
   
                        }
                        else
                        {
                           goto primo3;
                        }
                     
                     }
                     else
                     {
                        
                        goto primo2;
                     }
            
                  }


   

                  if(recibe=='2')
                  {
primo6:                     lcd_putc('\f');
                     lcd_gotoxy(1,1);
                     lcd_putc("Escribir Dato");
                     contador2=0;
                           do
                           {
                              do
   {
      recibe=kbd_getc();
   }while(recibe==0);
                              if(recibe!=0)
                              {
                                    
                                 intdato[contador2]=recibe;
                                 printf(LCD_PUTC"%c",recibe);
                                 contador2++;
                              
                              }
                              
                           }
                           
                           while(contador2<=2);
                           datoe2=atol(intdato);
                           if( (datoe2>=0) && (datoe2<=255) )
                           {
                           lcd_gotoxy(1,2);
                           lcd_putc("presione *");
primo7:
                        do
   {
      recibe=kbd_getc();
   }while(recibe==0);
                        if(recibe=='*')
                        {
primo8:                        lcd_putc('\f');
                           lcd_gotoxy(1,1);
                           lcd_putc("Ingrese Direccion");
                           lcd_gotoxy(1,2);
                           lcd_putc("EEPROM  ");
                           contador=0;
                           do
                           {
                              do
   {
      recibe=kbd_getc();
   }while(recibe==0);
                              
                              printf(LCD_PUTC"%c",recibe);
                              intmemo[contador]=recibe;
                              contador++;
                           }
                           while(contador<=3);
                                 posmemo=atol(intmemo);
                              if( (posmemo>=0) && (posmemo<=1024) )
                                 {
                                 delay_ms(1000);
                                 datos=atoi(intdato);
                                 write_ext_eeprom(posmemo,datos);
                                 lcd_putc('\f');
                                 lcd_gotoxy(1,1);
                                 lcd_putc("CORRECTO");
                                 delay_ms(2000);
                                 goto in;
                                 }
                              else
                              {
                                 
                                 goto primo8;
                              }
   
   
                        }
                        else
                        {
                           goto primo7;
                        }
                     
                     
                           }
                           else
                           {
                              
                              goto primo6;
                           }
                  }
            
                  


                  if(recibe=='3')
                  {
primo9:                     lcd_putc('\f');
                     lcd_gotoxy(1,1);
                     lcd_putc("Ingrese Dato:");
                     contador2=0;
                           do
                           {
                              do
   {
      recibe=kbd_getc();
   }while(recibe==0);
                              if(recibe!=0)
                              {
                                 
                                 longdato[contador2]=recibe;
                                 printf(LCD_PUTC"%c",recibe);
                                 contador2++;
                              }
                           }
                           while(contador2<=4);
                           datoe3=atoi32(longdato);
                           if( (datoe3>=0) && (datoe3<=65535) )
                           {
                           lcd_gotoxy(1,2);
                           lcd_putc("Presione *");
primo10:
                        do
   {
      recibe=kbd_getc();
   }while(recibe==0);
                        if(recibe=='*')
                        {
primo11:                           lcd_putc('\f');
                           lcd_gotoxy(1,1);
                           lcd_putc("Ingrese Direccion");
                           lcd_gotoxy(1,2);
                           lcd_putc("EEPROM: ");
                           contador=0;
                           do
                           {
                              do
   {
      recibe=kbd_getc();
   }while(recibe==0);
                              
                              printf(LCD_PUTC"%c",recibe);
                              longmemo[contador]=recibe;
                              contador++;
                           }
                           while(contador<=3);
                                 posmemo=atol(longmemo);
                              if( (posmemo>=0) && (posmemo<=1024) )
                                 {
                                 
                                 delay_ms(1000);
                                 datoe2=atol(longdato);
                                 write_int16_ext_eeprom(posmemo,datoe2);
                                 lcd_putc('\f');
                                 lcd_gotoxy(1,1);
                                 lcd_putc("CORRECTO");
                                 delay_ms(1000);
                                 goto in;
                                 }
                              else
                              {
                                 
                                 goto primo11;
                              }
   
   
                        }
                        else
                        {
                           goto primo10;
                        }
                     
                     
                           }
                           else
                           {
                              
                              goto primo9;
                           }
                  }
                  



                     if(recibe=='4')
                  {
primo12:                     lcd_putc('\f');
                     lcd_gotoxy(1,1);
                     lcd_putc("Ingrese Dato:");
                     lcd_gotoxy(1,2);
                     contador2=0;
                           do
                           {
                              do
   {
      recibe=kbd_getc();
   }while(recibe==0);
                              if(recibe!=0)
                              {
                                 if(recibe=='*')
                                    {
                                       contador2=9;
                                    }
                                 int32dato[contador2]=recibe;
                                 printf(LCD_PUTC"%c",recibe);
                                 contador2++;
                              }
                           }
                           while(contador2<=9);
                           datoe3=atoi32(int32dato);
                           if( (datoe3>=0) && (datoe3<=4294967295) )
                           {
                           lcd_gotoxy(1,2);
                           lcd_putc("Presione *");
primo13:
                        do
   {
      recibe=kbd_getc();
   }while(recibe==0);
                        if(recibe=='*')
                        {
primo14:                        lcd_putc('\f');
                           lcd_gotoxy(1,1);
                           lcd_putc("Ingrese Direccion");
                           lcd_gotoxy(1,2);
                           lcd_putc("EEPROM: ");
                           contador=0;
                           do
                           {
                              do
   {
      recibe=kbd_getc();
   }while(recibe==0);
                              
                              printf(LCD_PUTC"%c",recibe);
                              int32memo[contador]=recibe;
                              contador++;
                           }
                           while(contador<=3);
                                 posmemo=atol(int32memo);
                              if( (posmemo>=0) && (posmemo<=1024) )
                                 {
                                 delay_ms(1000);
                                 datoe5=atoi32(int32dato);
                                 write_int32_ext_eeprom(posmemo,datoe5);
                                 lcd_putc('\f');
                                 lcd_gotoxy(1,1);
                                 lcd_putc("CORRECTO");
                                 delay_ms(1000);
                                 goto in;
                                 }
                              else
                              {   
                                 
                                 goto primo14;
                              }
   
   
                        }
                        else
                        {
                           goto primo13;
                        }
                     
                     
                           }
                           else
                           {
                              
                              goto primo12;
                           }
                  }



                  if(recibe=='5')
                  {
                     
primo15:               lcd_putc('\f');
                     lcd_gotoxy(1,1);
                     lcd_putc("Ingrese Dato:");
                     lcd_gotoxy(1,2);
                     contador2=0;
                           do
                           {
                              do
   {
      recibe=kbd_getc();
   }while(recibe==0);
                              if(recibe!=0)
                              {
                              
                                 
                                 if(recibe=='*')
                                    {
                                       contador2=15;
                                    }
                                 if(recibe=='#')
                                 {
                                    recibe='.';
                                 }
                                 floatdato[contador2]=recibe;
                                 printf(LCD_PUTC"%c",recibe);
                                 contador2++;
                              }
                           }
                           while(contador2<=15);
                           datoe4=atof(floatdato);
                           if((datoe4>=-1.5)&&(datoe4<=3.4))
                           {
                           lcd_putc('\f');
                           lcd_gotoxy(1,2);
                           lcd_putc("Presione *");
primo16:
                        do
   {
      recibe=kbd_getc();
   }while(recibe==0);
                        if(recibe=='*')
                        {
primo17:                           lcd_putc('\f');
                           lcd_gotoxy(1,1);
                           lcd_putc("Ingrese Direccion");
                           lcd_gotoxy(1,2);
                           lcd_putc("EEPROM: ");
                           contador=0;
                           do
                           {
                              do
   {
      recibe=kbd_getc();
   }while(recibe==0);
                              
                              printf(LCD_PUTC"%c",recibe);
                              floatmemo[contador]=recibe;
                              contador++;
                           }
                           while(contador<=3);
                                 posmemo=atol(floatmemo);
                              if( (posmemo>=0) && (posmemo<=1024) )
                                 {
                                 delay_ms(1000);
                                 datoe7=atof(floatdato);
                                 write_float_ext_eeprom(posmemo,datoe7);
                                 lcd_putc('\f');
                                 lcd_gotoxy(1,1);
                                 lcd_putc("CORRECTO");
                                 delay_ms(1000);
                                 goto in;
                                 }
                              else
                              {
                                 
                                 goto primo17;
                              }
   
   
                        }
                        else
                        {
                           goto primo16;
                        }
                     
                     
                           }
                           else
                           {
                              
                              goto primo15;
                           }
                     
                  
                     }      
                  }
                  else
                           {
                              
                              goto primo;
                           }   
               }
         
            
            
            if(recibe=='2')   
            {
               do   
   {
      suelta=kbd_getc();
   }
      while(suelta!='\0');
               lcd_putc('\f');
               lcd_gotoxy(1,1);
               lcd_putc("1)Short2)Int3)Long");
               lcd_gotoxy(1,2);
               lcd_putc("4)int32 5)Float");
               delay_ms(1000);
            
primo18:
               do
   {
      recibe=kbd_getc();
   }while(recibe==0);
               if( (recibe>='1') && (recibe<='5') )
               {


                  if(recibe=='1')
                  {
                     

                        
primo19:                           lcd_putc('\f');
                           lcd_gotoxy(1,1);
                           lcd_putc("Ingrese Direccion");
                           lcd_gotoxy(1,2);
                           lcd_putc(": ");
                           contador=0;
                           do
                           {
                              do
   {
      recibe=kbd_getc();
   }while(recibe==0);
                              
                              printf(LCD_PUTC"%c",recibe);
                              shortmemo[contador]=recibe;
                              contador++;
                           }
                           while(contador<=3);
                              posmemo=atol(shortmemo);
                              if( (posmemo>=0) && (posmemo<=1024) )
                              {
                              delay_ms(2000);
primo20:                              lcd_putc('\f');
                              lcd_gotoxy(1,1);
                              lcd_putc("Ingrese Posicion");
                              lcd_gotoxy(1,2);
                              lcd_putc("BIT: ");
                              
                              do
   {
      recibe=kbd_getc();
   }while(recibe==0);
                              
                              if( (recibe>='0') && (recibe<='7') )
                              {
                                 printf(LCD_PUTC"%c",recibe);
                                 delay_ms(1000);
                                 bitpos=recibe-0x30;;
                                 lcd_putc('\f');
                                 lcd_gotoxy(1,1);
                                 
                                 lee=read_int1_ext_eeprom(posmemo,bitpos);
                              
                                 printf(LCD_PUTC"Dato=%u",lee);                  
                                 delay_ms(2000);
                                 goto in;
                              }
                              else
                              {
                                 
                                 goto primo20;
                              }
                              }
                              else
                              {
                                    
                                 goto primo19;
                              }
   
                  }



                     if(recibe=='2')
                     {
                     
primo21:                           lcd_putc('\f');
                           lcd_gotoxy(1,1);
                           lcd_putc("Ingrese Direccion");
                           lcd_gotoxy(1,2);
                           lcd_putc(": ");
                           contador=0;
                           do
                           {
                              do
   {
      recibe=kbd_getc();
   }while(recibe==0);
                              
                              printf(LCD_PUTC"%c",recibe);
                              intmemo[contador]=recibe;
                              contador++;
                           }
                           while(contador<=3);
                              posmemo=atol(intmemo);
                              if( (posmemo>=0) && (posmemo<=1024) )
                              {
                              
                              delay_ms(1000);
                              lcd_putc('\f');
                              lcd_gotoxy(1,1);
                              lee2=read_ext_eeprom(posmemo);
                              printf(LCD_PUTC"Dato=%u",lee2);                  
                              delay_ms(2000);
                              goto in;
                              }
                              else
                              {
                                    
                                 goto primo21;
                              }
   
                  }



                     if(recibe=='3')
                     {
                     
primo22:                           lcd_putc('\f');
                           lcd_gotoxy(1,1);
                           lcd_putc("Ingrese Direccion");
                           lcd_gotoxy(1,2);
                           lcd_putc(": ");
                           contador=0;
                           do
                           {
                              do
   {
      recibe=kbd_getc();
   }while(recibe==0);
                              
                              printf(LCD_PUTC"%c",recibe);
                              longmemo[contador]=recibe;
                              contador++;
                           }
                           while(contador<=3);
                              posmemo=atol(longmemo);
                              if( (posmemo>=0) && (posmemo<=1024) )
                              {
                              delay_ms(1000);
                              lcd_putc('\f');
                              lcd_gotoxy(1,1);
                              lcd_putc("Dato");
                              lcd_gotoxy(1,2);
                              lee3=read_int16_ext_eeprom(posmemo);
                              printf(LCD_PUTC"=%Lu",lee3);                  
                              delay_ms(2000);
                              goto in;
                              }
                              else
                              {
                                 
                                 goto primo22;
                              }
   
                  }




                  if(recibe=='4')
                     {
                     
primo23:                        lcd_putc('\f');
                           lcd_gotoxy(1,1);
                           lcd_putc("Ingrese Direccion");
                           lcd_gotoxy(1,2);
                           lcd_putc(": ");
                           contador=0;
                           do
                           {
                              do
   {
      recibe=kbd_getc();
   }while(recibe==0);
                              
                              printf(LCD_PUTC"%c",recibe);
                              int32memo[contador]=recibe;
                              contador++;
                           }
                           while(contador<=3);
                              posmemo=atol(int32memo);
                              if( (posmemo>=0) && (posmemo<=1024) )
                              {
                              delay_ms(1000);
                              lcd_putc('\f');
                              lcd_gotoxy(1,1);
                              lcd_putc("Dato");
                              lcd_gotoxy(1,2);
                              lee4=read_int32_ext_eeprom(posmemo);
                              printf(LCD_PUTC"=%Lu",lee4);                  
                              delay_ms(2000);
                              goto in;
                              }
                              else
                              {
                                    
                                 goto primo23;
                              }
   
                  }



                  if(recibe=='5')
                     {
                     
primo24:                           lcd_putc('\f');
                           lcd_gotoxy(1,1);
                           lcd_putc("Ingrese Direccion");
                           lcd_gotoxy(1,2);
                           lcd_putc(": ");
                           contador=0;
                           do
                           {
                              do
   {
      recibe=kbd_getc();
   }while(recibe==0);
                              
                              printf(LCD_PUTC"%c",recibe);
                              floatmemo[contador]=recibe;
                              contador++;
                           }
                           while(contador<=3);
                              posmemo=atol(floatmemo);
                              if( (posmemo>=0) && (posmemo<=1024) )
                              {
                              delay_ms(1000);
                              lcd_putc('\f');
                              lcd_gotoxy(1,1);
                              lcd_putc("Dato=");
                              lcd_gotoxy(1,2);
                              lee5=read_float_ext_eeprom(posmemo);
                              printf(LCD_PUTC"%1.5f",lee5);                  
                              delay_ms(2000);
                              goto in;
                              }
                              else
                              {   
                                 
                                 goto primo24;
                              }
   
                  }
                  
               }
               else
               {
                  
                  goto primo18;
               }
            }
                  
         }            
      }
                  
         
      
}


 

anything