I2C Ram

I2CRam is a generic i2c Ram/Rom, with configurable size and Control Code (address). Right-Click on it and select "Properties" to set/edit properies: 

- Control Code: 
     fixed part of the slave i2 address (see explanation below).

 - Size bytes: 
     Memory size in bytes
     For memory size <= 256   i2c Ram expects 1 Ram address byte.
     For memory size  >  256   i2c Ram expects 2 Ram address bytes.

- Persistent: 
     Sets the memory persistency.
     If true, it will keep data betwen sessions (save circuit).
     If false, memory data will be deleted at circuit power-off.


 About Control Code: 

"Control code" is the fixed part of the slave i2 address, wich is part of the "control byte":

Control Byte:
X  X  X  X  A0 A1 A2 RW

Control Code:
X  X  X  X  0  0  0  

Slave_i2c_address = "control code" + A2 A1 A0
Control byte = ( Slave_i2c_address << 1 ) + RW? 1:0

Default control code in simulide i2c = 80 (decimal):
1  0  1  0  0  0  0

If A0-A2 pins are low, i2c address = control code.

In write operations control byte to send after start condition:
X  X  X  X  A0 A1 A2 0

With simulide defaults and Ax pins low:
1  0  1  0  0  0  0  0

For reading operations:
1  0  1  0  0  0  0  1

If you set A0 high in a second i2c, control byte to write:
1  0  1  0  0  0  1  0

Pins Ax set lower 3 bits, so you can choose betwen several i2c with same "control code" in same bus.
If they are unused they read as 0 in simulide.