FM25C256
The FM24C256 library is a library that uses a RAMTRON SPI serial EEPROM.
Ramtron memory chips are as quick as RAM and can be overwritten almost unlimited times.
An external EEPROM is a safe alternative to the internal EEPROM. You can also increase the size of the EEPROM this way.
By using : $lib "fm25c256.lib"
The EEPROM read and write routines from the library will be used instead of the internal EEPROM.
Thus you can still use : Dim BE as ERAM Byte
And you can use READEEPROM and WRITEEEPROM, but instead of using the internal EEPROM, the external I2C EEPROM is used.
The lib is for the FM25C256. It uses SPI
For the SPI you have to define the pins. The pin named fram_so is connected to SO of the FRAM. SI is connected to SI.
A sample is shown below. The clock and, cs and SI pins need to be configured as output pins.
Fram_cs Alias Portl.7 : Const Fram_csp = 7 : Const Fram_csport = Portl
Fram_so Alias Pind.1 : Const Fram_sop = 1 : Const Fram_soport = Pind
Fram_si Alias Portd.0 : Const Fram_sip = 0 : Const Fram_siport = Portd
Fram_sck Alias Portl.6 : Const Fram_sckp = 6 : Const Fram_sckport = Portl
Of course you can also use a cheaper normal SPI EEPROM. These are slower and have less write cycles.
This library is only included in the full version. It is not included with the DEMO.
Example
Invalid language.
You need to specify a language like this: <source lang="html4strict">...</source>
Supported languages for syntax highlighting:
4cs, 6502acme, 6502kickass, 6502tasm, 68000devpac, abap, actionscript, actionscript3, ada, algol68, apache, applescript, apt_sources, arm, asm, asp, asymptote, autoconf, autohotkey, autoit, avisynth, awk, bascomavr, bash, basic4gl, bf, bibtex, blitzbasic, bnf, boo, c, c_loadrunner, c_mac, caddcl, cadlisp, cfdg, cfm, chaiscript, cil, clojure, cmake, cobol, coffeescript, cpp, cpp-qt, csharp, css, cuesheet, d, dcl, dcpu16, dcs, delphi, diff, div, dos, dot, e, ecmascript, eiffel, email, epc, erlang, euphoria, f1, falcon, fo, fortran, freebasic, freeswitch, fsharp, gambas, gdb, genero, genie, gettext, glsl, gml, gnuplot, go, groovy, gwbasic, haskell, haxe, hicest, hq9plus, html4strict, html5, icon, idl, ini, inno, intercal, io, j, java, java5, javascript, jquery, kixtart, klonec, klonecpp, latex, lb, ldif, lisp, llvm, locobasic, logtalk, lolcode, lotusformulas, lotusscript, lscript, lsl2, lua, m68k, magiksf, make, mapbasic, matlab, mirc, mmix, modula2, modula3, mpasm, mxml, mysql, nagios, netrexx, newlisp, nsis, oberon2, objc, objeck, ocaml, ocaml-brief, octave, oobas, oorexx, oracle11, oracle8, oxygene, oz, parasail, parigp, pascal, pcre, per, perl, perl6, pf, php, php-brief, pic16, pike, pixelbender, pli, plsql, postgresql, povray, powerbuilder, powershell, proftpd, progress, prolog, properties, providex, purebasic, pycon, pys60, python, q, qbasic, rails, rebol, reg, rexx, robots, rpmspec, rsplus, ruby, sas, scala, scheme, scilab, sdlbasic, smalltalk, smarty, spark, sparql, sql, stonescript, systemverilog, tcl, teraterm, text, thinbasic, tsql, typoscript, unicon, upc, urbi, uscript, vala, vb, vbnet, vedit, verilog, vhdl, vim, visualfoxpro, visualprolog, whitespace, whois, winbatch, xbasic, xml, xorg_conf, xpp, yaml, z80, zxbasic
'----------------------------------------------------------------------------------------- 'name : 25C256 simple RW test.bas 'copyright : (c) 1995-2013, MCS Electronics 'purpose : Testing Read/Write operation with external EEPROM 'micro : Mega8535 'suited for demo : no 'commercial addon needed : no '----------------------------------------------------------------------------------------- $regfile = "m8535.dat" ' specify the used micro $crystal = 8000000 ' used crystal frequency $baud = 19200 ' use baud rate $hwstack = 64 ' default use 32 for the hardware stack $swstack = 20 ' default use 10 for the SW stack $framesize = 40 ' default use 40 for the frame space ' External EEPROM Config Config Portb.4 = Output Config Portb.7 = Output Config Portb.5 = Output Fram_cs Alias Portb.4 : Const Fram_csp = 4 : Const Fram_csport = Portb Fram_so Alias Pinb.6 : Const Fram_sop = 6 : Const Fram_soport = Pinb Fram_si Alias Portb.5 : Const Fram_sip = 5 : Const Fram_siport = Portb Fram_sck Alias Portb.7 : Const Fram_sckp = 7 : Const Fram_sckport = Portb $eepromsize = &H8000 $lib "fm25c256.lib" Dim A(101) As Eram Byte Dim B As Byte Dim C As Byte Dim D As Byte Do Input "Data to write ? (0-255)" , D Print "Reading content of EEPROM (via ERAM Byte)" For C = 0 To 100 B = A(c) Print "Read " ; C ; ":" ; B ; "/" ; Hex(b) Waitms 4 Next Wait 1 Print "Writing data to EEPROM (via ERAM Byte)" For C = 0 To 100 A(c) = D Print "Write " ; C ; ":" ; D ; "/" ; Hex(d) Waitms 4 Next Wait 1 Print "Reading back data from EEPROM (via ERAM Byte)" For C = 0 To 100 B = A(c) Print "Read " ; C ; ":" ; B ; "/" ; Hex(b) Waitms 4 Next Wait 2 Input "Data to write ? (0-255)" , D Print "Reading content of EEPROM (via READEEPROM)" For C = 0 To 100 Readeeprom B , C Print "Read " ; C ; ":" ; B ; "/" ; Hex(b) Waitms 4 Next Wait 1 Print "Writing data to EEPROM (via WRITEEEPROM)" For C = 0 To 100 Writeeeprom D , C Print "Writing " ; C ; ":" ; D ; "/" ; Hex(d) Waitms 4 Next Wait 1 Print "Reading content of EEPROM (via READEEPROM)" For C = 0 To 100 Readeeprom B , C Print "Read " ; C ; ":" ; B ; "/" ; Hex(b) Waitms 4 Next Wait 2 Loop End '-------------------------------------------------------------------------------
Languages | English • Deutsch |
---|