Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

I2C ERAM 24C256 - A little help needed

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR
View previous topic :: View next topic  
Author Message
twenty13

Bascom Member



Joined: 05 Jul 2011
Posts: 12

australia.gif
PostPosted: Wed May 03, 2017 10:09 am    Post subject: I2C ERAM 24C256 - A little help needed Reply with quote

The code below does not work. I am not sure how to configure for ERAM with XMEGA. I have changed the EEPROM address in the lib file to suit that of my EEPROM. I have also tried "Open "twic" For Binary As #1" The EEPROM is working fine with the normal routines. Any help will be much appreciated

Regards,

Code:


$regfile = "xm128a1def.dat"
$crystal = 32000000
$hwstack = 512
$swstack = 512
$framesize = 512
Config Osc = Enabled , 32mhzosc = Enabled
Config Sysclock = 32mhz
Config Priority = Static , Vector = Application , Lo = Enabled

Config Com1 = 56000 , Mode = Asynchroneous , Parity = None , Stopbits = 1 , Databits = 8
Open "COM1:" For Binary As #1

$eepromsize = &H8000

Config Submode = New
Config Base = 0
Config Eeprom = Mapped

Dim Twi_start As Byte
Dim D As Byte
Dim C As Byte
Dim E As Byte
Dim B As Byte
Dim A(10 , 10) As Eram Byte

$lib "fm24c64_256.lib"

Config Scl = Portc.1                                        ' we need to provide the SCL pin name
Config Sda = Portc.0                                        ' we need to provide the SDA pin name


Config Twi = 4000000
I2cinit

Do
  Print#1 , "Write Eram"
   For C = 0 To 1
       For D = 0 To 23
       E = D * 2
       A(c , D) = E
       Next D
   Next C
   Print#1 , "Eram written..."


   Print#1 , "Read eram"
   For C = 0 To 1
       For D = 0 To 23
       B = A(c , D)
       Print#1 , B
       Waitms 100
       Next D
   Next C
   Print#1 , "Eram read..."

Loop

End
 
[/list]

(BASCOM-AVR version : 2.0.7.8 )
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum