readRAM()

[RAM]
unsigned char readRAM (unsigned short address);

Description

Reads a byte value (8 bits) from the RAM memory at the specified address.

Parameters

address: the address where the data will be read.

Returns

The data read from the RAM memory at the specified address. The data is an 8-bit value (0-255).

Example Code

The code initializes the RAM with a size of 1024 bytes and a width of 1 byte and reads the value from the RAM memory at the address 0x00 to place it in the pins 1, 2, 3, and 4.

void setup() {
    beginRAM(1024);        // initializes the RAM memory with a size of 1024 bytes and a data width of 1 byte
    writeRAM(0x00, 0x55);  // writes the value 0x55 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
    digitalWriteNibble(1, 2, 3, 4, value); // takes the 4 least significant bits
                                          // and writes them to the specified pins
}

Notes and Warnings

  • The readRAM() function can only be used after the beginRAM() function.
  • The returned value is an 8-bit value (0-255) or an unsigned char.