Using EEPROM on an RTC Board

lbenson

Senior Member
#3
The DS3231 modules which I have all address the EEPROM at %10101110. So, for instance

#picaxe 08M2
hi2csetup i2cmaster,%10101110, i2cslow, i2cword
hi2cout 0, ("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O")
hi2cin 0, (b0,b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15)
sertxd (b0,b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15,cr,lf)

This works in the PE6 simulator.
 

lbenson

Senior Member
#4
Last edited:
#5
Hippy--the link is to this thread, not to the one the question was moved from. When corrected, please remove this post.
hippys links are working fine as I see it. Post 2 links to the thread title:
"Getting Started with the DS3232 RTC and a brief comparison of some other RTC chips"
where he copied the 1st post from

and at that other thread hippy left a link to this thread - indicate the post was moved to here.
 

hippy

Technical Support
Staff member
#7
The links should be correct. The forum can automatically leave a redirect ( mostly for OP's ) when a thread is moved but not for a moved post so I added those manually.

I was surprised post #3 had the same time stamp as #2 so it could be the post was being made in the old thread and the forum adjusted it to come here ? Browser caching may also confuse things at times.

Whatever happened, apologies for any confusion caused.
 

hippy

Technical Support
Staff member
#8
Does work in the simulator but not when accessing the DS3231 module
It could be that the board uses a different address; what does the product datasheet say ?

It should be possible to write a test program which writes $AA and $55 to various I2C Device Addresses, reads the results to determine which one gives the correct responses and report that.

Untested on real hardware ...

Code:
Pause 2000
SerTxd( "Starting", CR, LF )
For b0 = $A0 To $AF Step 2
  HI2cSetup I2CMASTER, b0, I2CSLOW, I2CWORD
  HI2cOut 0, ($AA)
  Pause 20
  HI2cIn 0, (b1)
  If b1 = $AA Then
    HI2cOut 0, ($55)
    Pause 20
    HI2cIn 0, (b1)
    If b1 = $55 Then
      b1 = b0 /  16 + "0" : If b1 > "9" Then : b1 = b1 + 7 : End If
      b2 = b0 // 16 + "0" : If b2 > "9" Then : b2 = b2 + 7 : End If
      SerTxd( "Found at $", b1, b2, CR, LF )
    End If
  End If
Next
SerTxd( "Done", CR, LF )
 
Last edited:
#9
Right on hippy, the address is really $AE, the only thing missing in the other program was the pause in between the write and the read.
Big thanks to you and Ibenson for the help, i will be able to fully experiment with that nice unit.
 
Top