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

I2C EEPROM Simulation

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



Joined: 28 Apr 2004
Posts: 10

View user's profile Send private message Send e-mail

I2C EEPROM Simulation
PostPosted: Fri Jun 30, 2006 2:30 am     Reply with quote

Hi, I want to simulate 24C32 I2C EEPROM with Proteus, unfortunately it doesnt work :( . I write 12 to 5. address and when I read the 5. address it is allways 255.
Where is the mistake ? In my code or my circuit ?


here is my circuit,

and here is my code,

Code:

/////////////////////////////////////////////////////////////////////////
////                            MAIN.C                               ////
////                                                                 ////
/////////////////////////////////////////////////////////////////////////


#include <18F452.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP,NOPUT,NOBROWNOUT
#use delay(clock=4000000)

#include <lcd.c>
#include <2432.c>

void main()
{
    BYTE data;
    BYTE data2;
    long int addr;
    init_ext_eeprom();
    lcd_init();
    lcd_gotoxy(1,1);

    data = 12;
    data2 = 12;
    addr=5;
    // write 12 to 5. byte
    write_ext_eeprom(addr, data);
    printf(lcd_putc,"write ad.\%02Lu data \%02u", addr, data);
    delay_ms(40);

    while (1)
    {
    lcd_gotoxy(1,2);

    // read 5. byte
    data2 = read_ext_eeprom(addr);
    lcd_gotoxy(1,2);
    printf(lcd_putc,"read  ad.\%02Lu data \%02u", addr, data2);
    delay_ms(1000);
    }
   
}



i use 2432 driver..


Last edited by birumher on Fri Jun 30, 2006 4:20 am; edited 1 time in total
Ttelmah
Guest







PostPosted: Fri Jun 30, 2006 3:14 am     Reply with quote

First of all, use the group edit function, and remove the CCS code from your post. Note that this group is available for 'public' viewing, and that you are in breach of the distribution terms by posting it...

The code looks as thogh it ought to work. There is a slight 'oddity', in the circuit, in that you show the MCLR line pulling to Vcc, while the I2C lines pull to Vdd. Do you have a Vcc line, or a Vdd line?.

Best Wishes
birumher



Joined: 28 Apr 2004
Posts: 10

View user's profile Send private message Send e-mail

PostPosted: Fri Jun 30, 2006 4:48 am     Reply with quote

OK Ttelmah thank you for your warning. I changed Vcc and Vdd lines according eeprom and pic pins. But it is still the same result. Now I think that it is a simulation problem. I will build the circuit...
rberek



Joined: 10 Jan 2005
Posts: 207
Location: Ottawa, Canada

View user's profile Send private message

PostPosted: Fri Jun 30, 2006 5:26 am     Reply with quote

Plus, look at the sim log for the I2C device. It's fairly verbose and gives you alot of detail about what it's processing.
birumher



Joined: 28 Apr 2004
Posts: 10

View user's profile Send private message Send e-mail

PostPosted: Sun Jul 02, 2006 6:35 am     Reply with quote

I builded the circuit. It works fine Smile.
(I think that proteus can't simulate 24c32.)
rberek



Joined: 10 Jan 2005
Posts: 207
Location: Ottawa, Canada

View user's profile Send private message

PostPosted: Sun Jul 02, 2006 2:13 pm     Reply with quote

Proteus simulates a 24C32A or a 24LC32A just fine.
birumher



Joined: 28 Apr 2004
Posts: 10

View user's profile Send private message Send e-mail

PostPosted: Sun Jul 02, 2006 2:47 pm     Reply with quote

rberek wrote:
Proteus simulates a 24C32A or a 24LC32A just fine.


Could you please post an example?

Maybe my version has some problems.
I am using 6.9 sp4...
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