Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
00001 /* 00002 * SPI RAM 23LC1024 (Microchip) 00003 * 1Mbit 00004 */ 00005 #include "mbed.h" 00006 #include "23LCV1024.h" 00007 00008 DigitalOut led1(LED1); 00009 00010 //LPC1769 00011 //Serial pc(USBTX, USBRX); 00012 //SPI spi(p5, p6, p7); // mosi, miso, sclk 00013 00014 // LPC11U24 00015 SPI spi(P0_9, P0_8, P1_29); 00016 Serial pc(P0_19, P0_18); 00017 00018 00019 00020 int main() { 00021 pc.baud(115200); 00022 spi.frequency(16000000); 00023 00024 led1 = 1; 00025 00026 int i; 00027 char buf[256]; 00028 00029 printf("RAM write\r\n"); 00030 SRAM23LCV1024 sram(spi, P0_2); // p8 for LPC1769 00031 00032 printf("RAM mode: %d\n", sram.getReadMode()); 00033 00034 printf("Written Hello test\n"); 00035 strcpy(buf, "Hello test!"); 00036 sram.writeBytes(0x000000, buf, 11); 00037 00038 for (i = 64; i < 125; i ++) buf[i-64] = i; 00039 00040 sram.readBytes(0x000003, buf, 5); 00041 00042 printf("reading bytes 3-5\n"); 00043 00044 for (i = 0; i < 5; i ++) { 00045 printf("%c", buf[i]); 00046 } 00047 printf("\n"); 00048 00049 led1 = 0; 00050 00051 00052 00053 }
Generated on Thu Jul 21 2022 03:21:59 by
1.7.2