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 CCS Technical Support

Writting to atmel 24c32 eeprom

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



Joined: 04 Jun 2005
Posts: 1

View user's profile Send private message

Writting to atmel 24c32 eeprom
PostPosted: Sat Jun 18, 2005 4:56 pm     Reply with quote

Hallo .

I tried to write to external eeprom atmel 24c32 ,
but no success .
I tried this simple code just for test :

#include <16f84a.h>
#fuses HS,NOWDT
#use delay(clock=4000000)
#include <2432.c>
#define I2C_SDA PIN_A0
#define I2C_SCL PIN_A1

main(){
int d;

init_ext_eeprom();

write_ext_eeprom(0x01,0xab);

delay_ms(100);
d = read_ext_eeprom(0x01);
delay_ms(100);

write_eeprom (0, d);
}


I used 2432.c driver in ccs library.
is there some simple code just to confirm my hardvare connection.
Thanks
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Jun 18, 2005 5:13 pm     Reply with quote

1. The #define statements for the new pin assignments have to go
above the #include statement for the driver. That's the only way
the driver can know about them. Example:
Code:

#define I2C_SDA PIN_A0
#define I2C_SCL PIN_A1
#include <2432.c>     
 


2. You must not let the program fall off the end of main(), or the
PIC will go to sleep. Put a while(1); statement at the end of
your program. Example:
Code:

write_eeprom (0, d);

while(1);   // Add this line
}


3. The normal oscillator fuse setting for a 4 MHz crystal is "XT".
Example:
Code:
#fuses XT,NOWDT
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