PDA

View Full Version : confuse page write??



MINHLE
- 21st April 2010, 15:41
i have a confusion of understanding on page write can people help, really thanks,

for 24lc 256

64 bytes are writable on 1 page @ 1 shot.
but a boundary page is 256 bytes (EEprom in the pic?)
the 24lc256 is 32k bytes, so there are 500 pages in the 24lc256? just simple calculation, i do not understand much,

thanks in advance for your explaination

MInh Le

aratti
- 21st April 2010, 17:49
Array Var Byte [100]
AA Var Byte
Address Var Word

I2CWRITE DataPin, ClockPin, Control, Address, [Str Array\64]
'This command will write one page of 64 bytes starting from address position

I2CWRITE DataPin, ClockPin, Control, Address, [Str Array\10]
'This command will write 10 bytes starting from address position


I2CWRITE DataPin, ClockPin, Control, Address, [Str Array\100]
'This command will NOT write 100 bytes starting from address position

'If you need to write 100 bytes then you will need two write instruction:

'First

I2CWRITE DataPin, ClockPin, Control, Address, [Str Array\64]
'This command will write one page of 64 bytes starting from address position

Address = Address + 64
For AA = 0 to 35
Array[AA]=Array[AA+63]
next AA

' Moving remaing bytes in the low side of the array

I2CWRITE DataPin, ClockPin, Control, Address, [Str Array\36]
[COLOR="Red"]'This command will write the remaining 36 bytes starting from
address but in the following page.


In the last example, since 100 is not a multiple of 63 will give you a lot of problem in writing the remaining pages since in the second page after the two writing sequence the space left in the second page is 64-36 = 28 Bytes.

Hoping now is sligtly more clear.

Al.

MINHLE
- 21st April 2010, 22:21
many thanks Aratti

how about the page boundary 256 bytes is this located in the pic?
if so, when i use LOOKUP, the boundary is 256 bytes

LOOKUP I, [1st.......255th], BUFFER ;( i go 0 to 255)

I = 0 to 255
K = 1 TO 4 ; loop for 4 pages
IF I = K*63 THEN ; loop for 1 page of writing
I2CWRITE ...... I, [STR BUFFER\64]
PAUSE 15
( i preload data into LOOKUP then write them on the External eeprom

I confuse BUFFER in the LOOKUP it should be BUFFER[1000] for example ?
thanks again,
Minh LE

.......

aratti
- 21st April 2010, 23:05
Hi MINHLE, I have to admit that I did understand what you are trying to do!


how about the page boundary 256 bytes is this located in the pic?
if so, when i use LOOKUP, the boundary is 256 bytes

You should not worry PBP will take care of the pic internal page boundary.

The code you have posted for tranferring 256 byte from your lookup table to the serial eeprom will not work. Here a working snippet:



AA var Word
KK var Byte
II var Byte
Buffer Var Byte [64]

For KK = 0 to 192 step 64

For II = 0 to 63

AA = II + KK

Lookup AA,[1st.......255th], Buffer[II]

Next II

AA = AA - 63

I2CWRITE DataPin, ClockPin, Control, AA, [Str Buffer\64]

Next KK



Al.

MINHLE
- 21st April 2010, 23:24
Thanks a lot Aratti,


I see clearly now,

the data loaded into a pic is limited. in case of the volume of external Eeprom is bigger than that of internal eeprom? but i do not have a eeprom programmer


thanks a gain Aratti,
Minh LE

MINHLE
- 22nd April 2010, 03:34
Hello Aratti,
thanks a lot for your help,
i realize that i should not have to use an external eeprom. the pic 16f877a containes an 8k bytes, a lot of space to be written on. the problem now is how to write data on these pages (FLASH MEMORY), use DATA , EEPROM or other PBP commands; or copy the code from data sheet?

but,,, not sure i understand all.

aratti
- 22nd April 2010, 07:22
the pic 16f877a containes an 8k bytes, a lot of space to be written on

Be carefull because 8Kb are code space ram. Available eeprom is 256 bytes ( see table attached)

Read PEEKCODE and POKECODE commands @ pag 113 & 115 of PBP manual.

Al.

MINHLE
- 22nd April 2010, 11:20
thanks a lot Aratti,

i see now, and will try it later,