Simple example of how to use the device library for RAMTRON FM25W256.

Dependencies:   mbed FM25W256

Files at this revision

API Documentation at this revision

Comitter:
elmicro
Date:
Thu Apr 05 10:18:19 2012 +0000
Commit message:
Initial Revision

Changed in this revision

FM25W256.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r fa25ccf0bf62 FM25W256.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/FM25W256.lib	Thu Apr 05 10:18:19 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/elmicro/code/FM25W256/#2290931492e7
diff -r 000000000000 -r fa25ccf0bf62 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Apr 05 10:18:19 2012 +0000
@@ -0,0 +1,45 @@
+#include "mbed.h"
+#include "fm25w256.h"
+
+Serial pc(USBTX, USBRX);
+
+int main() 
+{
+    unsigned char cRX[16];
+    unsigned char cTX[16];
+    int x;
+    
+    for(x=0; x<16; x++) cRX[x]=0;
+    for(x=0; x<16; x++) cTX[x]=0;
+    
+    FM25W_SSP1_Init();
+  
+    pc.printf("\nOut of reset, memory contained:\n");
+    FM25W_ReadBlock(0,cRX,16);                          //read 16 bytes
+    for(x=0; x<16; x++) pc.printf("%02X ", cRX[x]);     //display them
+    
+    FM25W_WriteBlock(0, cTX, 16);                       //clear memory addresses
+    
+    for(x=0; x<16; x++) cTX[x]=x;                       //prepare sample bytes
+    
+    pc.printf("\nMemory 'before' contains:\n");
+    FM25W_ReadBlock(0,cRX,16);                          //read 16 bytes
+    for(x=0; x<16; x++) pc.printf("%02X ", cRX[x]);     //display them
+    
+    pc.printf("\nWriting data to memory...");
+    FM25W_WriteBlock(0,cTX,16);                         //write 16 bytes
+    
+    for(x=0; x<16; x++) cRX[x]=0;                       //clear RX buffer
+    
+    pc.printf("\nReading data from memory...");
+    FM25W_ReadBlock(0,cRX,16);                          //read 16 bytes
+    
+    pc.printf("\nMemory 'after' contains:\n");
+    for(x=0; x<16; x++) pc.printf("%02X ", cRX[x]);     //display bytes
+    
+
+    while(1) 
+    {
+
+    }
+}
diff -r 000000000000 -r fa25ccf0bf62 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Apr 05 10:18:19 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/737756e0b479