Skip to content

readRAM()

Arnd edited this page Aug 8, 2017 · 4 revisions

Function reads any data type from the MCP7940's 64 bytes of SRAM memory. Addressing outside of the 64 byte space results in undefined data being returned. The optional unsigned integer return value is the number of bytes actually read.


Example:

...
MCP7940_Class MCP7940;        // Create an instance of the MCP7940
...
  char buffer[13] = "Hello there!"; // create and fill a character buffer
  uint8_t singleByte = 123;
  MCP7940.writeRAM(10,buffer); // write it to position 10 in the buffer
  MCP7940.readRAM(10,buffer); // read it back from the MCP7940
  Serial.print("Buffer is \"");
  Serial.print(buffer);
  Serial.println("\".");
  MCP7940.writeRAM(10,singleByte); // write it to position 10 in the buffer
  MCP7940.readRAM(10,singleByte); // read it back from the MCP7940
  Serial.print("Buffer is \"");
  Serial.print(buffer);
  Serial.println("\".");
...
Clone this wiki locally