SHIFTIN/SHIFTOUT should work for the 25aa1024. You will need to look at the data sheet for the correct modes and all of that stuff.
This page has a few example about SHIFTIN/OUT and SPI.
http://www.melabs.com/resources/samples.htm
SHIFTIN/SHIFTOUT should work for the 25aa1024. You will need to look at the data sheet for the correct modes and all of that stuff.
This page has a few example about SHIFTIN/OUT and SPI.
http://www.melabs.com/resources/samples.htm
Last edited by mackrackit; - 29th March 2010 at 05:26.
Dave
Always wear safety glasses while programming.
Thanks for the heads up! I don't know how I missed that sample ,the "spix.bas" to begin with. I guess I just had to scroll down a little more :/SHIFTIN/SHIFTOUT should work for the 25aa1024. You will need to look at the data sheet for the correct modes and all of that stuff.
This page has a few example about SHIFTIN/OUT and SPI.
http://www.melabs.com/resources/samples.htm
Seeing how I dont have the time to find this out for a few days... what chip should I expect to be quicker the I2C or the SPI? Both will be running off of a 4 MHz clock.
I do not know which is faster, never did a side by side or studied the specs for that.
Let us know what you find. It will be interesting to see.
Dave
Always wear safety glasses while programming.
I made my address a WORD because the 24AA1025 (1024K I2C™ CMOS Serial EEPROM) has a 2 byte address. So in theory this should work but as you can see the output is reading "0" in every address when it should be reading "5"
Does my code look right?
I am unsure of the PAUSE 10ms as I can't find any specs in the data sheet for the amount of time needed after each WRITE cycle. I tried commenting out the delay but still the same results. One would think if the delay was wrong I would still get a "5" in Addr0 at the very least.
Here is the schematic I used to wire up the 24AA1025 to my 16F88:
http://melabs.com/resources/pbpmanual/5_30-5_31.htm
Here is the code:
And here is what I get on Hyperterm:Code:SO con 0 ' Define serial output pin T2400 con 0 ' Set serial mode DPIN var PORTA.0 ' I2C data pin CPIN var PORTA.1 ' I2C clock pin B0 var WORD ' Address B1 var byte ' Data from first address read B2 var byte ' Data from second address read B3 var byte ' Second Address For B0 = 0 To 15 ' Loop 16 times I2CWRITE DPIN,CPIN,$A0,B0,[5] ' Write a "5" to each location Pause 10 ' Delay 10ms after each write Next B0 loop: For B0 = 0 To 15 step 2 ' Loop 8 times high 3 ' LED on to signify a Read in progress I2CREAD DPIN,CPIN,$A0,B0,[B1,B2] ' Read 2 locations in a row B3 = B0 + 1 ' Create second address for print Serout SO,T2400,["Addr",#B0,":",#B1,13,10,"Addr",#B3,":",#B2,13,10] ' Print 2 locations B3 = 0 ' Zero out B3 Variable low 3 ' LED off to signify no read in progress Next B0 Serout SO,T2400,[13,10] ' Print linefeed Goto loop
Code:Addr0:0 Addr1:0 Addr2:0 Addr3:0 Addr4:0 Addr5:0 Addr6:0 Addr7:0 Addr8:0 Addr9:0 Addr10:0 Addr11:0 Addr12:0 Addr13:0 Addr14:0 Addr15:0
Last edited by wolwil; - 3rd April 2010 at 19:30. Reason: added link to schematic
I simplified everything and have tried everything (even tried swapping out the chip) but I cant get this EEPROM to write anything to it. Here is the new simplified code:
Correct me if I'm wrong but the above code should work but it still just reads "0" in hyperterm like this: "Addr7:0"Code:SO con 0 ' Define serial output pin T2400 con 0 ' Define serial mode cont CON %10100000 ' Define Control byte addr CON %0000000000000111 ' 2 Byte Address of 7 B1 VAR BYTE ' Var for data being read I2CWRITE PORTA.0,PORTA.1,cont,addr,[1] ' Send the byte 1 to address 7 PAUSE 10 ' Wait 10ms for write to complete I2CREAD PORTA.0,PORTA.1,cont,addr,[B1] ' Read address 7 into B1 Serout SO,T2400,["Addr",#addr,":",#B1,13,10] ' Print B1's Value in DEC
I am reading 4.97V from pins 4-8 and I get 4.82V from 4-5 and 4-6 on the 24FC1025 EEPROM so my voltage is within specs. I have checked all continuity on the circuit and they all tone out.
I don't know what else to do. Please help.
Pin A2 needed to be tied to VCC not VSS in order for the chip to be enabled. This however has not fixed my problem I am still getting nothing written to it.
I believe I have the SDA and SCL pins going to the wrong pins on the 16F88. I have them right now going to PORTA.0 for SDA and PORTA.1 for SCL. I believe they need to be set as PORTB.1 for SDA and PORTB.4 for SCL with the 16F88. I will try this tonight and post my findings.
Bookmarks