Just a quick question on ROMengine[1]...
Ravenkallen
Posts: 1,057
Hey, guys. First of i want to say thanks to whoever wrote the ROMengine[1] object...I think its was Kye, but i am not sure... Anyway, i was wondering if you could write/read more than 32 bytes at a time. I know this is the page limit of the I2C device, but it seems as if i can write/read more than that... Does the 32 byte R/W function get taken care of automatically or can it only do 32 bytes at a time... I did a test with 100 bytes and the data seemed to come out fine..ANY help will be greatly appreciated.
Comments
I included some new features and a VERY nice demo.
...
So, for reading there is no page limit. The only limit is the size of the I2C device. After you go over the size of the EEPROM you'll get roll over problems.
For writing, each EEPROM will usually have a page limit specified in its documentation. When you try to write off of a page the device will cause the written bytes to roll over to the start of the page again.
So, if the device has a page limit of lets say 32 bytes and you start writing 32 bytes at address 6. Then the next 26 bytes will get written from address 6 to address 31 and then the remaining 6 will get written to addresses 0 through 5.
So, here's how I would use the driver. First, avoid using the write and read page functions because you need to be careful with them. Life will be more carefree with the read/write byte/word/long stuff.
Then just declare all the variables you wish to have saved in the EEPROM in a DAT or VAR section. Then when you wish to save the state of that variable on the EEPROM just do writebyte(@byteSizeVar, byteSizeVar). This way you won't have to worry about alignment because the compilier will have already aligned all the addresses for you.
So you say to not use the read/write page functions. But why? How would you read in bytes at a faster speed then?
Read and write page are still the fastest functions. Read page gets 2515 bytes per second in spin.
...
The new code is not that much faster. I just improved the user interface.