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 #include "mbed.h" 00002 00003 //Just a couple of the outputs directly accessible for debug 00004 DigitalIn O0(p14);/* 00005 DigitalIn O1(p15); 00006 DigitalIn O2(p16); 00007 DigitalIn O3(p20);*/ 00008 DigitalIn O4(p19);/* 00009 DigitalIn O5(p18); 00010 DigitalIn O6(p17); 00011 DigitalIn O7(p21);*/ 00012 00013 DigitalOut CE(p22); 00014 DigitalOut OE(p24); 00015 00016 Serial pc(USBTX, USBRX); 00017 00018 DigitalOut led1(LED1); 00019 DigitalOut led2(LED2); 00020 DigitalOut led3(LED3); 00021 DigitalOut led4(LED4); 00022 BusIn epromdata(p14,p15,p16,p20,p19,p18,p17,p21); 00023 BusOut addressline(p13,p12,p11,p10,p9,p8,p7,p6,p27,p26,p23,p25,p5,p28); 00024 00025 00026 int main() { 00027 //CE and OE lines are inverted 00028 CE=1; 00029 OE=1; 00030 //Give me some time to set up a pipe into a file 00031 wait(8); 00032 00033 int num=16384; //number of addresses 00034 char epromcontents[num]; //char array to store data words 00035 for (int addr=0;addr<num;addr++){ 00036 addressline=addr; //set the address 00037 CE=0;//clock the chip 00038 OE=0; 00039 wait(1e-6); //wait a generous 1000ns 00040 epromcontents[addr]=epromdata.read(); //then read the data into the array 00041 //just as a sanity check, send two of the data lines to LEDs 1 and 2 00042 led1=O0; 00043 led2=O4; 00044 //bring the clock lines back up and wait for the output to go back into tristated mode 00045 CE=1; 00046 OE=1; 00047 wait(1e-6); 00048 00049 } 00050 //led3 goes on to say we're done 00051 led3=1; 00052 for(int i=0;i<num;i++) 00053 pc.printf("%d\n",epromcontents[i]);//send each byte over usbserial 00054 led4=1;//to say we're done sending 00055 } 00056
Generated on Thu Jul 14 2022 15:09:27 by
1.7.2