Problem with SPI + EEProm (Read and Write - How?!)

General discussion on mikroPascal.
Post Reply
Author
Message
jurizato
Posts: 6
Joined: 13 Feb 2009 00:20

Problem with SPI + EEProm (Read and Write - How?!)

#1 Post by jurizato » 26 Feb 2009 21:30

Hello !

I'm brazilien and my english is very poor, but I will try to explain my problem.

I must to do a Doubble Channel Voltimeter to measur 2 indirect electrical currents, one AC and one DC.
For this, I must to use a board with a PIC18F87J60 with a SPI EEPROM 25LC160, because I must to enable the write the max. pressets values throuth the ethernet (TCP Server). (these board was tested and works fine!)
At the moment, I made the code for read the analogies inputs and show in a LCD Display. (without Ethernet)
My code works very well! I can see the values, I can see the pressets and I can increase and decrease theses pressets. I made Bilds to say "ALARM! Real > Presset" and etc.
Now I must to save the pressets in my 25LC160. Thats my problem!!!
I'm using the sample code from MikroPascal Forum, but it don't work!
I did for several times a review of the code and I found not the mistake.
I did test my board with another aplication with ethernet, where the parameters like address, MAC, user and password are saved in the EEPROM memory (25LC160) and works. Sorry I don't have the source files from these application, only the Hex-File.
So, I think that my board (PIC and SPI EEPROM) is ok and my problem resides in the code.
I can't to say if the mistake is with the Write operation or with the Read operation, because I can't "see" in the EEPROM.

The sample code that I use is here: http://www.mikroe.com/forum/viewtopic.p ... spi+eeprom
I made only modifications in the CS - pin, because in my board is RD2 and in the size (2Kbits)
I try the code from forum and in the first line of LCD I got "ABCDEFGHIJKLMNOP"
in the second line of the LCD I get only "trash" so is: "|| || || || || || || || || || || || || || || ||"

goran.marinkovic
mikroElektronika team
Posts: 265
Joined: 25 Nov 2008 09:09

#2 Post by goran.marinkovic » 27 Feb 2009 15:41

Hi,

You should check in datasheet for your MCU,
and check which is protocol for writing data.

Probably our example does not have the same protocol as your MCU,
so probably that is the reason why that does not work.
Please check in datasheet for your MCU.

Regards

jurizato
Posts: 6
Joined: 13 Feb 2009 00:20

#3 Post by jurizato » 01 Mar 2009 20:54

Hi EveryBody!

I found my error!!!
My mistake was the size of the memory!
I make a false configuration, because my memory is 16kbits and 2kbytes, so I did invert the values.....
For Any way, my thank you very much!!!

Post Reply

Return to “mikroPascal General”