William
- 10th July 2009, 18:09
Hi
I've searched the forum for hours but can't find an answer to my question.
I'm working with a 18F97J60 and a 24FC256 serial eeprom using PBP and MPASM.The eeprom holds a database of 64 bytes per record and up to 12 fields per record. The fields can be string arrays, bytes, word or longs. Of course I always know where the fields are in the record. I am using assy lang I2C read/write routines and everything works fine.
When I want to update the 12 fields I must read each one into a properly sized variable, update the variables, then write them back. This is 12 reads and 12 writes each record update. It is slow and generates a lot of code.
What I would like to do is make a single read into aTmp[64]. Let's say that I have a long variable named lVar and its value is stored in bytes aTmp[23]...[26]. I can find out where aTmp is located with the GetAddress macro. Here's the kicker: I would like lVar mapped to the aTmp memory location + 23. Then I can just do something like lVar=lVar+1 and save aTmp. 1 read, 1 write and no unpacking/repacking.
This seems like a lot to wish for but it would sure be nice to clean up this code. Thanks in advance for any ideas.
I've searched the forum for hours but can't find an answer to my question.
I'm working with a 18F97J60 and a 24FC256 serial eeprom using PBP and MPASM.The eeprom holds a database of 64 bytes per record and up to 12 fields per record. The fields can be string arrays, bytes, word or longs. Of course I always know where the fields are in the record. I am using assy lang I2C read/write routines and everything works fine.
When I want to update the 12 fields I must read each one into a properly sized variable, update the variables, then write them back. This is 12 reads and 12 writes each record update. It is slow and generates a lot of code.
What I would like to do is make a single read into aTmp[64]. Let's say that I have a long variable named lVar and its value is stored in bytes aTmp[23]...[26]. I can find out where aTmp is located with the GetAddress macro. Here's the kicker: I would like lVar mapped to the aTmp memory location + 23. Then I can just do something like lVar=lVar+1 and save aTmp. 1 read, 1 write and no unpacking/repacking.
This seems like a lot to wish for but it would sure be nice to clean up this code. Thanks in advance for any ideas.