?lang_form? ?lang_select? ?lang_submit? ?lang_endform?
{HEADER END}
{FILE START}

library

?curdirlinks? - Rev 3

?prevdifflink? - Blame - ?getfile?

////////////////////////////////////////////////////////////////
// Program pro otestovani funkci knihovny 24XX.C
////////////////////////////////////////////////////////////////
//
// (c) PEFI 2003
// Verze 0.00     - uvodni verze
//
////////////////////////////////////////////////////////////////
#include <16F876.h>
#include <16f877_reg.h>
#include <stdlib.h>
#use delay (clock=4000000)
#use rs232 (baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7)
#fuses XT,NOWDT,NOBROWNOUT,NOPROTECT,NOLVP


#define EXTEE_HW              1                  /* zapne(1) / vypne(0) HW podporu i2c */
#include <24XX.c>


void main()
{
  char Adr[4];
  int16 Adr_eeprom;
  int8 Data_eeprom;
  int16 Len;
  int16 i;
  char c;
  int8   buf[64];


   ExtEE_init();
  for(;;)
  {
    printf("Cteni(r) Zapis(w) Blok.cteni(e) Blok.zapis(q) Prubezne cteni(t) ?\n\r");
    if((c=getc())=='w')
     {
      printf("ZAPIS\n\r");
      printf("Zadej adresu(dekadicky)\n\r");
      gets(Adr);
      Adr_eeprom=atol(Adr);
      printf("Zadej data(dekadicky)\n\r");
      gets(Adr);
      Data_eeprom=atol(Adr);
      ExtEE_write_byte(Adr_eeprom,Data_eeprom);
      printf("Zapsano\n\r");
     }
    else if(c=='r')
     {
      printf("CTENI\n\r");
      printf("Zadej adresu(dekadicky)\n\r");
      gets(Adr);
      Adr_eeprom=atol(Adr);
      Data_eeprom=ExtEE_read_byte(Adr_eeprom);
      printf("Precteno %d\n\r",Data_eeprom);
     }
    else if(c=='t')
     {
      printf("PRUBEZNE CTENI\n\r");
      Data_eeprom=ExtEE_read_byte_inc();
      printf("Precteno %d\n\r",Data_eeprom);
     }
    else if(c=='e')
     {
     printf("BLOK.CTENI\n\r");
      printf("Zadej adresu(dekadicky)\n\r");
      gets(Adr);
      Adr_eeprom=atol(Adr);
      printf("Zadej delku bloku\n\r");
      gets(Adr);
      len=atol(Adr);
      ExtEE_read_array(Adr_eeprom,buf,len)   ;
      i=0;
      do
       printf("%d ",buf[i++]);
      while(--len);
     }
    else if(c=='q')
     {
     printf("BLOK.ZAPIS\n\r");
      printf("Zadej adresu(dekadicky)\n\r");
      gets(Adr);
      Adr_eeprom=atol(Adr);
      printf("Zadej delku bloku\n\r");
      gets(Adr);
      len=atol(Adr);
      for(i=0;i<len;i++)
      {
       buf[i]=i;
      }
      ExtEE_write_array(Adr_eeprom,buf,len);
      printf("Zapsano\n\r");
     }
    else printf("SPATNA VOLBA\n\r");
  }
}
// End of File
{FILE END}
{FOOTER START}

Powered by WebSVN v2.8.3