well it's suppose to work... can you send your data to your PC or on a PORT and monitor that??? have you put 1k - 4k7 pull-ups on SDA & SCL pins ?!? Is by any chance you revert SDA & SCL pins?!?
well it's suppose to work... can you send your data to your PC or on a PORT and monitor that??? have you put 1k - 4k7 pull-ups on SDA & SCL pins ?!? Is by any chance you revert SDA & SCL pins?!?
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Be sure you have the WP (pin #7) tied to ground, and pull-up
resistors on SDA & SCL (pins #4 & #5)
A0, A1 and A2 are not used on the 24LC16B, so you can leave
these pins (#1,#2,#3) floating.
The control byte consists of a 4-bit control code of %1010 which
remains constant.
The next 3-bits in the control byte are the "block select bits".
These can be from %000 to %111 for blocks 0 to 7 (8 blocks total).
Note that these 3-bits are the high-order "address" bits, so you do
not follow the control byte with a word sized variable for the address
of this EEPROM. The upper 3-bits of the word address are the lower
nibble bits 1,2,3 in the control byte.
The last bit of the control byte is for read or write, but PBP will
automatically flip this bit for you.
So, the control byte can be from %1010 000 0 to %1010 111 0 to
access blocks 0 to 8. The low-order address byte can be from 0-255.
Code:B0 var byte B1 var byte B2 var byte Cont con %10100110 ' Control 1010 + block #3 address 011 SYMBOL SDA = PORTB.4 ' Data pin SYMBOL SCL = PORTB.5 ' Clock pin Main: FOR B0=0 to 63 ' Locations 0 to 63 = 64 bytes B1=B0+4 ' Write address + 4 to each location I2cWrite SDA,SCL,Cont,B0,[B1] ' Cont + B0 = word address PAUSE 10 ' Pause for writes NEXT B0 FOR B0=0 to 63 ' Locations 0 to 63 = 64 bytes I2cRead SDA,SCL,Cont,B0,[B2] ' Cont + B0 = word address WRITE B0,B2 NEXT B0 Display: FOR B0 = 0 to 63 READ B0,B2 HSEROUT ["ADD: ",DEC B0," VAL: ",DEC B2,13,10] NEXT B0 Here: GOTO Here
Hi again!
Thank you for your code example.
But it still don't works.Sorry for that!
Here is a Picture of my connections:
http://www.xg-midifiles.de/24LC16B.jpg
I use OSC=RC in my programmer settings.
I can't understand wy it don't works.
By'e
RON
we already told it but...you didn't place any pull-up resistor on the SDA and SCL pin...1.8k-4.7k
the internal one will never give you good results if you're using them.
Last edited by mister_e; - 8th March 2005 at 00:55.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Hi!
I have WP on Ground and pull up SDA and SCL.
Here a picture:
http:www.xg-midifiles.de/24LC16B.jpg
But nothing happen's!
When i write the serial Eeprom with the loader.hex then it works great.
But with your(my) program it doesn't.(WHY?)
By'e
Ron
O.K.... your connections are not correct.
A pull-up resistor must be connected between the EEPROM pin and +5V.
look to your PBP manual in the I2Cread and i2CWRITE section.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Hi again!
Sorry,i have tested my connections and they must be correct.
Because i have found a hexfile(loader.hex).
And when i burn it in my Pic,My Pic read 's and write's the 24LC16B perfect.
Here are my original Connections:
http://www.xg-midifiles.de/24LC16B.jpg
(I have made an Error,sorry for that)
So it MUST be a Software Error!
My Problem is,i have only this hexfile(that work's perfect).
But i want to write my own Program with PBP.
I have try many Sample Codes not only your's.
And i have read many Tutorials also the Datasheed's(but if you think,
then i will read them again)
My Question is:
Wy work's this hexfile perfect and all sample Code written with PBP
does not?
By'e
RON
Bookmarks