writeRAM16()
[RAM]
void writeRAM16(unsigned short address, unsigned short value);Description
Writes a short value (16 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 initializes the RAM with a size of 1024 and a width of 2 bytes and writes the value of a counter to the RAM memory at the address 0x00.
static unsigned short counter = 0;
void setup() {
beginRAM(1024, 2); // initializes the RAM memory with a size of 1024 * 2 bytes
}
void loop() {
writeRAM16(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
writeRAM16()function can only be used after thebeginRAM()function. - The
valueparameter must be a 16-bit value (0-65535) or anunsigned short. - If the programmer initializes the RAM with a width lower than 2 bytes, the function will write only 8 bits of the data.
