Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

storing and reading back data from external eeprom using PIC16f627a

Status
Not open for further replies.

farhanauu

Junior Member level 1
Joined
Aug 25, 2013
Messages
18
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
129
im new to micro controller programming
i have written a code that stores data to eeprom and get back data to blink leds accordingly but its not working on proteus.
Kindly help me i have to submit this project this weekend.

thanks

my code is


sbit Soft_I2C_Scl at RA0_bit; //i2c clock line
sbit Soft_I2C_Sda at RA1_bit; //ic2 data line
sbit Soft_I2C_Scl_Direction at TRISA0_bit;
sbit Soft_I2C_Sda_Direction at TRISA1_bit;
unsigned char read,i;
unsigned short data_,L ;
unsigned short error;

void main ()
{
TRISB=0;
//TRISA.RA0=0;
//TRISA.RA1=0;
PORTA.RA0=1;
PORTA.RA1=1;
TRISA.RA3=1;
if(PORTA.RA3=1){
PORTB=5;

for(i=0;i<255;i++)
{
Soft_I2C_Init();
Soft_I2C_Start();
Soft_I2C_write(i);
Soft_I2C_Write(i);


Soft_I2C_stop();}}
i=0;
while(1)
{

for(i=0;i<255;i++)
{
Soft_I2C_Init();
Soft_I2C_start();
Soft_I2C_Write(i);
L =Soft_I2C_Read(1);
//if(L){
PORTB=L;
//PORTB.RB7=0;
Soft_I2C_Stop();
//lay_ms(500);
}

}




}




and proteus file is
 

Attachments

  • proteus.jpg
    proteus.jpg
    422.7 KB · Views: 146

pull up for i2c should be near about 1.8k or 2.2k and which eeprom u r using ?
 

eeprom is 24lc02b with 10 k pull up
 

Have you created eeprom data file for Proteus? If you use mikroC PRO then create a eeprom file and save it as .ihex file. Then rename the file to .hex file and use hex2bin.exe from Keil to convert the file to .bin file. Load this file to uC in Proteus by opening its properties and selecting this file for initial eeprom data.
 
no i havent created data file for proteus...
is it compulsory???
and please tell how to create data file for proteus??
how to code that file???
 

Open eeprom data editor in mikroC and if initially eeprom data is blank then just save the file with .ihex extension and then rename to .hex extension and then use keil hex2bin to convert this file to .bin file and load it in Proteus uC for Option Initial eeprom data. This file is needed by Proteus to write and read data to eeprom while simulating.
 
thanks a lot dear i have made the file...
but LED is not blinking...
 

ok i check the code...

- - - Updated - - -

means I have to make functions for reading and writing to eeprom using I2C library???
 

hello sir is this pull up is correct?
because most of the time when i use 4k7 or 10k for pull up then I2C not working properly.
thank you
 
Even if the data is blank initially you need to create the .bin file for it to load in Proteus. Without it it will not work. Proteus write and reads data to and from this .bin file.
 

10k worked all the time with pic 16f877a and 24LC64, and I worked on the EEPROM without creating any binary file and It worked as it was i written....
 
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top