CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

24lc256

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
morebudwiser



Joined: 17 Oct 2005
Posts: 26

View user's profile Send private message

24lc256
PostPosted: Wed Mar 01, 2006 8:12 am     Reply with quote

hi iam about to try and connect a 24lc256 to my pic 16f877a and am going to use the ccs 24256 driver but i have a copule of questions as this is my first a temp using this ic.

(1) using the ccs driver can i use port e by changing the pins defined at the top of the 24256 driver .

(2)can anyone point me in the right direction for some schematics to connect it up as the datasheet does not seem to give any appliction notes

many thanks for any help
sjbaxter



Joined: 26 Jan 2006
Posts: 141
Location: Cheshire, UK

View user's profile Send private message Visit poster's website

PostPosted: Wed Mar 01, 2006 10:16 am     Reply with quote

The driver should work by redefining the PIN_xx used for each of the control and data lines.

For a schematic, have a look at the microchip application note:

http://ww1.microchip.com/downloads/en/appnotes/01018a.pdf
_________________
Regards,
Simon.
King Virus



Joined: 02 Mar 2006
Posts: 14
Location: Italy

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Fri Mar 03, 2006 12:13 pm     Reply with quote

Use this pice of code !

Code:
///////////////////////////////////////////////////////////////////////////
////   Library for a 24FC515 serial EEPROM                             ////
////                                                                   ////
////   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                          ////
////                                                                   ////
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////

#define EEPROM_ADDRESS long int
#define EEPROM_SIZE   65535

// Change this variables !!!

const int Write_Adress_24AA515 = 0xA0;
const int Read_Adress_24AA515 = 0xA1;

BOOLEAN Ext_Eeprom_Ready() {
   int1 ack;
   i2c_start();                                                                 // If the write command is acknowledged,
   ack = i2c_write(Write_Adress_24AA515);                                       // then the device is ready.
   i2c_stop();
   return !ack;
}

void Write_Ext_Eeprom(long int address, int data) {

   i2c_start();
   if (!i2c_write(Write_Adress_24AA515)) {
      if (!i2c_write(address>>8)) {
         if (!i2c_write(address)) {
            if (!i2c_write(data)) {
            }
         }
      }
   }
   i2c_stop();

   while (!Ext_Eeprom_Ready());
}

int Read_Ext_Eeprom(long int address) {

   int data;
   //while (!Ext_Eeprom_Ready());
   Delay_ms(1);

   i2c_start();
   if (!i2c_write(Write_Adress_24AA515)) {
      if (!i2c_write(address>>8)) {
         if (!i2c_write(address)) {
            i2c_start();
               if (!i2c_write(Read_Adress_24AA515)) {
               data=i2c_read(0);
               i2c_stop();
               }
         }
      }
   }
   return(data);
}

_________________
*** A good forum is a forum where people respect eatch other ! ***
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group