Pic18F4550 und EEprom 24256

Gast #1312306
Lesenswert?
• ▲
▼
Hi Leute will ein EEprom mit der 24256.c LIB verwenden nur mein problem 
ist das der C18 Compiler von Microchip den Befehl "Byte" nicht kennt.

Ich komm nicht drauf in welcher Standartlib. das declariert ist:

Nur zu info:

//////////////////////////////////////////////////////////////////////// 
///
////   Library for a 24LC256 serial EEPROM 
////
//// 
////
////   init_ext_eeprom();    Call before the other functions are used 
////
//// 
////
////   write_ext_eeprom(a, d);  Write the byte d to the address a 
////
//// 
////
////   d = read_ext_eeprom(a);   Read the byte d from the address a 
////
//// 
////
////   The main program may define eeprom_sda 
////
////   and eeprom_scl to override the defaults below. 
////
//// 
////
//////////////////////////////////////////////////////////////////////// 
///
////        (C) Copyright 1996,2003 Custom Computer Services 
////
//// This source code may only be used by licensed users of the CCS C 
////
//// compiler.  This source code may only be distributed to other 
////
//// licensed users of the CCS C compiler.  No other use, reproduction 
////
//// or distribution is permitted without written permission. 
////
//// Derivative programs created using this software in object code 
////
//// form are not restricted in any way. 
////
//////////////////////////////////////////////////////////////////////// 
///


#ifndef EEPROM_SDA

#define EEPROM_SDA  PIN_B1
#define EEPROM_SCL  PIN_B0

#endif

#use i2c(master, sda=EEPROM_SDA, scl=EEPROM_SCL)

#define EEPROM_ADDRESS long int
#define EEPROM_SIZE   32768

void init_ext_eeprom()
{
   output_float(EEPROM_SCL);
   output_float(EEPROM_SDA);

}


void write_ext_eeprom(long int address, BYTE data) <------- Hier
{
   short int status;
   i2c_start();
   i2c_write(0xa0);
   i2c_write(address>>8);
   i2c_write(address);
   i2c_write(data);
   i2c_stop();
   i2c_start();
   status=i2c_write(0xa0);
   while(status==1)
   {
   i2c_start();
   status=i2c_write(0xa0);
   }
   i2c_stop();
}


BYTE read_ext_eeprom(long int address) {
   BYTE data;
   i2c_start();
   i2c_write(0xa0);
   i2c_write(address>>8);
   i2c_write(address);
   i2c_start();
   i2c_write(0xa1);
   data=i2c_read(0);
   i2c_stop();
   return(data);
}

Kann mir wer da helfen?
lg Gert
Gast #1312325
Lesenswert?
• ▲
▼
1.) BYTE ist kein "Befehl", sondern ein Datentyp!

2.) Du kannst ihn so definieren:
1
typedef unsigned char BYTE; // 8-bit unsigned

3.) Der Code ist für den CCS C Compiler und wird mit dem C18 nicht 
kompilierbar sein.

4.) Du hast gerade eine Copyright-Verletzung begangen:
> This source code may only be distributed to other
> licensed users of the CCS C compiler.  No other use, reproduction
> or distribution is permitted without written permission.

Antwort schreiben

Hinweis: der ursprüngliche Beitrag ist mehr als 6 Monate alt. Bitte hier nur auf die ursprüngliche Frage antworten, für neue Fragen einen neuen Beitrag erstellen.

Formatierung
  • [c]C-Code[/c]
  • [code]Code in anderen Sprachen, ASCII-Zeichnungen[/code]
  • [math]Formel in LaTeX-Syntax[/math]
  • [[Titel]] – Link zu einem Artikel
  • Verweis auf einen anderen Beitrag: Rechtsklick auf dessen Beitrags-ID (#8078628), „Adresse kopieren“, in den Text einfügen

Mehr zur Formatierung

Längeren Sourcecode als Anhang, nicht in den Text. JPG nur für Fotos und Scans; Zeichnungen und Screenshots als PNG oder GIF. Siehe Bildformate.

Schon registriert? Anmelden

Wird nicht angezeigt. Wir schicken dir einen Link; sobald du damit bestätigst, erscheint dein Beitrag.

Mit dem Abschicken legst du einen kostenlosen Account an und erkennst die Nutzungsbedingungen und die Datenschutzerklärung an.