Romilly Cocking
/
Ser23K256Example
Example for Microchip 23K256
Diff: main.cpp
- Revision:
- 0:0e31c6068b47
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun Aug 15 13:15:00 2010 +0000 @@ -0,0 +1,23 @@ +#include "mbed.h" +#include "Ser23K256.h" + + +SPI spi(p5,p6,p7); +Ser23K256 sram(spi,p14); + + +int main() { + char buff[50]; + sram.write(0, 'h'); + sram.write(1, 'i'); + sram.write(2, '!'); + sram.write(3, '\0'); + for (int address = 0; address < 4; address++) { + buff[address] = sram.read(address); + } + printf("sram = %s\r\n", buff); + sram.write(0, "Hello world!",12); + sram.read(0, buff, 12); + buff[12]='\0'; + printf("now = %s\r\n", buff); +} \ No newline at end of file