24c02 pic interface problem

General discussion on mikroBasic.
Post Reply
Author
Message
hannan
Posts: 13
Joined: 21 Jan 2010 18:04

24c02 pic interface problem

#1 Post by hannan » 03 Oct 2015 22:46

Hi.
For ex. the eeprom is set to A8 hex address, but It responds to every adrs!
also when I use two memories with dif. adrs both of them respond to every adrs and grab same data in same adrs in same call from micro!
How I can solve it? :(

User avatar
Aleksandar.Mitrovic
mikroElektronika team
Posts: 1697
Joined: 11 Mar 2015 12:48

Re: 24c02 pic interface problem

#2 Post by Aleksandar.Mitrovic » 07 Oct 2015 14:51

Hi hannan,

Did you take a look at our example for EEPROM in mikroBasic PRO for PIC compiler folder:
...\Mikroelektronika\mikroBasic PRO for PIC\Examples\Development Systems\EasyPic7\EEPROM (I2C)\I2C Advanced

Best regards,
Aleksandar

hannan
Posts: 13
Joined: 21 Jan 2010 18:04

Re: 24c02 pic interface problem

#3 Post by hannan » 13 Oct 2015 08:54

yes.
I saw many ex. programs.
all of them was written in same way.
I tested my program on 34c02 and everything was ok. but when I want to work with 24c02 my code isn't applicable!

User avatar
biljana.nedeljkovic
mikroElektronika team
Posts: 1043
Joined: 30 Jun 2015 15:15

Re: 24c02 pic interface problem

#4 Post by biljana.nedeljkovic » 13 Oct 2015 10:55

Hello Hannan,

I suggest to do side by side comparison of those EEPROM modules:
http://www.farnell.com/datasheets/656901.pdf
http://www.atmel.com/Images/doc0180.pdf

In this example in the compiler, we used 24C02 EEPROM with PIC18F45K22:
...\Mikroelektronika\mikroBasic PRO for PIC\Examples\Development Systems\EasyPic7\EEPROM (I2C)\I2C Simple

Can you explain further how did you develop your project, which hardware do you use with it?
You can also attach the small project to help us detect the possible problem in your code.

Kind regards,
Biljana

hannan
Posts: 13
Joined: 21 Jan 2010 18:04

Re: 24c02 pic interface problem

#5 Post by hannan » 14 Oct 2015 15:34

pic18f452
At24c02
At34c02

the brief code:
//////////////////////////
....
main:
...
setBit(SSPSTAT, 7)
setBit(SSPCON1, 5) 'Synchronous Serial Port Enabled
ClearBit(SSPCON1, 0)
ClearBit(SSPCON1, 1)
ClearBit(SSPCON1, 2)
setBit(SSPCON1, 3) 'Master mode
SSPADD=$1A
....
sub procedure bwrt
setBit(SSPCON2, 0)
Delay_ms(10)
SSPBUF=$A6
Delay_ms(10)
SSPBUF=xxx
Delay_ms(10)
SSPBUF=xxx
Delay_ms(10)
setBit(SSPCON2, 2)
Delay_ms(10)
end sub
....
/////////////////////////////////////
in this code the device with A6 adrs was called but all 24c02 devices responded and exact 34c02 responded.

User avatar
biljana.nedeljkovic
mikroElektronika team
Posts: 1043
Joined: 30 Jun 2015 15:15

Re: 24c02 pic interface problem

#6 Post by biljana.nedeljkovic » 16 Oct 2015 16:05

Hello,

would it be a problem for you to attach the project from the compiler, so I get properly see the configuration and reproduce the same behavior?

Kind regards,
Biljana

hannan
Posts: 13
Joined: 21 Jan 2010 18:04

Re: 24c02 pic interface problem

#7 Post by hannan » 18 Oct 2015 08:18

All of the config. mentioned in previous reply.
In fact remain code includes set port , reset port etc.
xtal=11.0592Mhz
LVP=disable
WDT=dis.
HS=en.

User avatar
biljana.nedeljkovic
mikroElektronika team
Posts: 1043
Joined: 30 Jun 2015 15:15

Re: 24c02 pic interface problem

#8 Post by biljana.nedeljkovic » 20 Oct 2015 15:32

Hello,

this way I am not able to reproduce the same situation as you did. Please, apologize and try to understand that I would need it in order to reproduce the behavior.
How have you tested your code?

At this moment, I can't really see the problem with your settings. If you would put the compiler project that would be great.

Kind regards,
Biljana

Post Reply

Return to “mikroBasic General”