Page 1 of 1

I2C for external EEPROM

Posted: Thu Sep 02, 2010 4:49 pm
by pilou8830
Hello, how to connect an EEPROM 24C256N on PIC16F877 ?
Pines of the EEPROM 1 = A0, A1 = 2, 3 = NC, 4 = GND, 5 = SDA = SCL 6, 7 = WP, 8 = VCC.
I see on the PIC16F877 pin 18 = RC3 - SCL and pin 23 = RC4 - SDA.
But when I look in C compiling, so it is used portb???
How to use the PORTC? Also when connecting the inputs A0 and A1 of the EEPROM for the example program works (I2C_EEPROM_Example.fcf)?
Flowcode V3
thank you

Re: I2C for external EEPROM

Posted: Fri Sep 03, 2010 8:31 am
by Sean
The I2C component can be configured to use either the hardware MSSP in the target device, or use software routines to transmit and receive data.

The default hardware option automatically uses the SDA and SCL pins appropriate for the target device.

The software option can be allocated to any spare pins. Software port and pin definitions are always included in the C code, even if they are not being used.

The A0 and A1 pins form the hardware selectable part of the device address that must be transmitted by the I2C component (see the device data sheet). They are usually connected to the required logic levels on the pcb. Connecting both to 0V is common if this feature is not required.

The WP (Write Protect) pin can be controlled by a microcontroller output and used as a data protection feature, or disabled by connecting it to the appropriate logic level on the pcb.

Re: I2C for external EEPROM

Posted: Sat Sep 04, 2010 12:11 pm
by pilou8830
Thank you for this clarification. A bit difficult to understand, but I'm progressing.
I made the mounting "PIC_EEPROM" Flowcode and tested with some adjustments. The LCD displays only "0,0,0,0,0," and not "0,0,0,0,0, Hi"
"Hi" is given a place in the EEPROM and get to see it. :roll:
I would show you my plan and program requirements of Flowcode but how to attach a picture? :oops:
Thank you

Re: I2C for external EEPROM

Posted: Sat Sep 04, 2010 2:16 pm
by medelec35
pilou8830 wrote: but how to attach a picture? :oops:
Thank you
To upload a file to this forum, Click 'POSTREPLY' and type message as you normally would do.
then
Click Upload attachment tab
Click 'Browse', then a new window will appear.
Within that window Browse to your picture file
Click 'Add the file'
then click 'Submit'
Note: You will not be able to send bitmaps and the max file size you can send is 256K.
So you can do the following:
If you have windows xp, Vista Or windows7 the Paint program will convert bitmap to jpeg.
If you do a screen shot (just press 'Prt Scrn' , you can then open paint, edit, crop etc then save as jpeg.
Alternatively a great freeware package that will not only save as jpeg, but will reduce picture size, crop and tons of other features is called FSViewer see:
http://www.faststone.org/FSViewerDetail.htm

Re: I2C for external EEPROM

Posted: Sat Sep 04, 2010 3:57 pm
by pilou8830
Thank you for responding so quickly. Here are pictures of mounting a PIC and EEPROM on the program Flowcode V3 with I2C.
Y there mistakes?
On my LCD it displays "0,0,0,0,0, **"
Note: * = bizare characters :cry:

thank you

Re: I2C for external EEPROM

Posted: Sat Sep 04, 2010 6:04 pm
by saschech@gmx.de
Hello
The chip is write protect.
Have a look:

http://pdf1.alldatasheet.com/datasheet- ... 4C256.html

Regards wolfgang

Re: I2C for external EEPROM

Posted: Sat Sep 04, 2010 9:30 pm
by pilou8830
Yes! I misspoke when I did the diagram to show you my setup. Which were correct, WP to 0V (GND).
Problem: why my data instead of becoming 255.255 72.103 72pour which H i and 103 for either "Hi"? Flowcode in my LCD and two odd characters (see attached images)

Re: I2C for external EEPROM

Posted: Sun Sep 05, 2010 6:45 am
by saschech@gmx.de
Hello

In simulation you must giv the ee-prom value into the queue.

Re: I2C for external EEPROM

Posted: Sun Sep 05, 2010 9:32 am
by Dan81
Hello

Lines SCL and SDA need pull up (4.7k), (they are not drawn on your schematic).

For debugging : Instead of using "Print Ascii" macro you can use "Print number"and see the received values.

Post your file, it will be easier for us to help you.

Daniel

Re: I2C for external EEPROM

Posted: Sun Sep 05, 2010 1:23 pm
by pilou8830
For Sashech : I have version V3.2 of Flowcode I hope it's good too.
For Dan81 : I added the two resistors. It's just like here? see attachment PIC_EEPROM.jpg
et je joins le fichier I2C_EEPROM_example.fcf
What is a queue? 88,77,66,55 is data or address what is here??see the program Sashech.
in my example program : In I2C DATA component where the start address and end.
Here we start at the first address? 00 and there are two data 72 and 105 for "H" and "i". As put in the queue? I do not understand.
help

thank you both.

Re: I2C for external EEPROM

Posted: Sun Sep 05, 2010 3:41 pm
by saschech@gmx.de
Hello pilou8830
queue = in german schlange....
If jou simulate write to the ee-prom , it do nothing real,only it show data in the " data window ".
The code read in the " queue window " ...if there are not data (you must input it ;click + ...) jou have a mitch match ...

Re: I2C for external EEPROM

Posted: Sun Sep 05, 2010 6:38 pm
by pilou8830
Saschech agree, is that the queue window is only used for simulation?
:oops:

Re: I2C for external EEPROM

Posted: Sun Sep 05, 2010 8:37 pm
by saschech@gmx.de
yes,thee 2 windows simulate the ee-prom (correctly the data`s on the i2c bus)

For test your real hardware yu must connect at least led`s or better a lcd display.

Regards Wolfgang

Re: I2C for external EEPROM RESOLVED

Posted: Sat Sep 11, 2010 8:32 pm
by pilou8830
After changing the port (port A to port B) Port B default because Flowcode outputs are real!
And after loading the SLC and SDA pins with resistors of 4.7 k everything works!
Thank you Thank you Thank you :P