// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Simple test program just using the basic address read write interface // see the About.htm file under using stage 1. // This showes how to initialis the card and read a block from it // The chip select pin is p0.3 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // REQUIRES: // #URL-lib "http://pin1.org/forthlib/flb/General/soft1.flb" sid=99 // #URL-lib "http://pin1.org/forthlib/flb/General/pinsel.flb" sid=100 // #URL-lib "http://pin1.org/forthlib/flb/General/SPI.flb" sid=101 // #URL-lib "http://pin1.org/forthlib/flb/SD-Card/MMC.flb" sid=102 // dump is used for debug and so is included in its entirity // #URL-lib "http://pin1.org/forthlib/flb/General/dump.flb" sid=103 // CONSTANTS: integer buf // set up a buffer here => buf // use this bit of dic 514 allot // make room align // just in case : start 400000 spi.speed // default speed is very slow 3 mmc.start // set cs pin and initialise card 0 > // should return a value > 0 if cr ." okay" else cr ." problem initialising card" then ; // supply a physical card address, eg 0 , 1024 and this // will dump the contents : read { address -- } buf 512 address mmc.read // get contents if buf bdump bdump drop // display else cr ." problem reading card" then ;