writeRAM()

[RAM]
void writeRAM(unsigned short address, unsigned char value);

Description

Writes a byte value (8 bits) to the RAM memory at the specified address.

Parameters

address: the address where the data will be written.

value: the data to be written.

Returns

Nothing.

Example Code

The code writes the value of a counter to the RAM memory at the address 0x00.

static unsigned char counter = 0;

void setup() {
    beginRAM(1024);        // initializes the RAM memory with a size of 1024 bytes and a data width of 1 byte
}

void loop() {
    writeRAM(0x00, counter);  // writes the value of the counter to the RAM memory at the address 0x00
    counter++;                // increments the counter by one
}

Notes and Warnings

  • The writeRAM() function can only be used after the beginRAM() function.
  • The value parameter must be an 8-bit value (0-255) or an unsigned char.