Example for Microchip 23K256

Dependencies:   mbed

Committer:
romilly
Date:
Sun Aug 15 13:15:00 2010 +0000
Revision:
0:0e31c6068b47

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
romilly 0:0e31c6068b47 1 #include "mbed.h"
romilly 0:0e31c6068b47 2 #include "Ser23K256.h"
romilly 0:0e31c6068b47 3
romilly 0:0e31c6068b47 4
romilly 0:0e31c6068b47 5 SPI spi(p5,p6,p7);
romilly 0:0e31c6068b47 6 Ser23K256 sram(spi,p14);
romilly 0:0e31c6068b47 7
romilly 0:0e31c6068b47 8
romilly 0:0e31c6068b47 9 int main() {
romilly 0:0e31c6068b47 10 char buff[50];
romilly 0:0e31c6068b47 11 sram.write(0, 'h');
romilly 0:0e31c6068b47 12 sram.write(1, 'i');
romilly 0:0e31c6068b47 13 sram.write(2, '!');
romilly 0:0e31c6068b47 14 sram.write(3, '\0');
romilly 0:0e31c6068b47 15 for (int address = 0; address < 4; address++) {
romilly 0:0e31c6068b47 16 buff[address] = sram.read(address);
romilly 0:0e31c6068b47 17 }
romilly 0:0e31c6068b47 18 printf("sram = %s\r\n", buff);
romilly 0:0e31c6068b47 19 sram.write(0, "Hello world!",12);
romilly 0:0e31c6068b47 20 sram.read(0, buff, 12);
romilly 0:0e31c6068b47 21 buff[12]='\0';
romilly 0:0e31c6068b47 22 printf("now = %s\r\n", buff);
romilly 0:0e31c6068b47 23 }