Ive been using a system for external memory for a while now and was just wondering if anybody else had any other ideas on how to approach it, I think my system could do with some improvement.
1 x PIC18f4550
2 x i/o epander
1 x 32 mb 40pin sram
The setup works like this, the 2 i/o expanders are controlled by the PIC using an i2c bus. They then set the registers and data on the sram.
The way that I currently use the sram is to use the beginning 1mb as a name list. I use a "*" following by a "B" for a byte or "*" followed by "I" for an int then another "*" then 4 bytes for a variable name (meaning that external sram varible names can be only 4 characters long and not include a *) Then the address where the bytes are stored (which is 3 bytes in total) So each entry is like 10 bytes long.
When I want to read a value, an i2c function runs from the micro and tries to find the requested variable name in the list then finds the corresponding address value. It goes to that address and reads the value.
Similarly to declare a variable, it adds the name to the list and finds the next available data space as its address.
Im sure you can guess how writing works.
Currently I have it limited to bytes and ints, i currently have no need to store long data files, and also realise that it makes processing difficult.
downsides to this are:
- Any operation on sram has to go through i2c which can make slow going in the grand scheme of things
- Before you can act on a variable, youve got to search a list. Also using i2c
- Then youve got to go to the address (again using i2c)
So does anybody have any suggestions on improving this type of system. Maybe on how the data is stored etc... (its got to remain a dynamic memory/variable allocation system). I know the obvious solution is to use a controller with more i/o pins so i dont need to use i2c expanders but i really want to try and keep with a 40 pin low end controller.