FM24C16

Aus MCS Wiki AVR
(Unterschied zwischen Versionen)
Wechseln zu: Navigation, Suche
(Created page with "<div style="height: 790px" class="nonscroll" id="idcontent"><div id="innerdiv"> The FM24C16 library is a library that uses a RAMTRON I2C serial EEPROM. Ramtron memory chips a...")
 
 
(Eine dazwischenliegende Version von einem Benutzer wird nicht angezeigt)
Zeile 1: Zeile 1:
<div style="height: 790px" class="nonscroll" id="idcontent"><div id="innerdiv">
+
<div id="idcontent"><div id="innerdiv">
 
The FM24C16 library is a library that uses a RAMTRON I2C serial EEPROM.
 
The FM24C16 library is a library that uses a RAMTRON I2C serial EEPROM.
  
Zeile 10: Zeile 10:
 
&nbsp;
 
&nbsp;
  
By using : $lib "fm24c16.lib"
+
By using&nbsp;: $lib "fm24c16.lib"
  
 
The EEPROM read and write routines from the library will be used instead of the internal EEPROM.
 
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
+
Thus you can still use&nbsp;: 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.
 
And you can use READEEPROM and WRITEEEPROM, but instead of using the internal EEPROM, the external I2C EEPROM is used.
Zeile 24: Zeile 24:
 
&nbsp;
 
&nbsp;
  
[[File:Notice.jpg|left]]This library is only included in the full version. It is not included with the DEMO.
+
[[File:Notice.jpg|left|Notice.jpg]]This library is only included in the full version. It is not included with the DEMO.
  
  
  
{{Languages}}
 
  
[[Category:ASM_Libraries_and_Add-Ons]]
+
 
 +
= <span style="font-size: 19px; font-weight: bold;">Example</span> =
 +
 
 +
<source lang="bascomavr">
 +
'-----------------------------------------------------------------------------------------
 +
'name : 24C256 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
 +
 +
$lib "i2c_twi.lbx" ' we do not use software emulated I2C but the TWI
 +
 +
Config Scl = Portc.0 ' we need to provide the SCL pin name
 +
Config Sda = Portc.1 ' we need to provide the SDA pin name
 +
 +
I2cinit ' we need to set the pins in the proper state
 +
 +
Config Twi = 100000 ' wanted clock frequency
 +
 +
' External EEPROM Config
 +
$eepromsize = &H8000
 +
$lib "fm24c64_256.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
 +
'-------------------------------------------------------------------------------
 +
</source>
 +
 
 +
{{Languages}}
 
</div></div>
 
</div></div>
 +
[[Category:ASM Libraries and Add-Ons]]

Aktuelle Version vom 24. August 2013, 12:35 Uhr

The FM24C16 library is a library that uses a RAMTRON I2C 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.

 

By using : $lib "fm24c16.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 FM24C16. It uses I2C/TWI.

 

 

Notice.jpg
This library is only included in the full version. It is not included with the DEMO.



Example

'-----------------------------------------------------------------------------------------
'name : 24C256 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
 
$lib "i2c_twi.lbx" ' we do not use software emulated I2C but the TWI
 
Config Scl = Portc.0 ' we need to provide the SCL pin name
Config Sda = Portc.1 ' we need to provide the SDA pin name
 
I2cinit ' we need to set the pins in the proper state
 
Config Twi = 100000 ' wanted clock frequency
 
' External EEPROM Config
$eepromsize = &H8000
$lib "fm24c64_256.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  
Meine Werkzeuge
Namensräume
Varianten
Aktionen
Navigation
In anderen Sprachen
Sprache