updateRAM()
[RAM]
void updateRAM(unsigned short address, unsigned char value);Description
Updates the RAM memory with the specified byte value at the specified address.
Parameters
address: the address where the data will be written.
value: the data to be written if the data is different
from the data already stored in the RAM memory.
Returns
Nothing.
Example Code
The code initializes the RAM with a size of 1024 bytes and a width of 1 byte and updates the value in the RAM memory at the address 0x00 with a counter value, incrementing it by one each time the loop is executed.
void setup() {
beginRAM(1024); // initializes the RAM memory with a size of 1024 bytes and a data width of 1 byte
writeRAM(0x00, 0x00); // writes the value 0x00 to the RAM memory at the address 0x00
}
void loop() {
unsigned char value = readRAM(0x00); // reads the value from the RAM memory at the address 0x00
value++; // increments the value by one
updateRAM(0x00, value); // updates the value in the RAM memory at the address 0x00
}Notes and Warnings
- The
updateRAM()function can only be used after thebeginRAM()function. - The
valueparameter must be an 8-bit value (0-255) or anunsigned char.
