DS1307 Ram

Information and discussion regarding Firewing shields

DS1307 Ram

Postby AndrewB » Wed Jan 22, 2014 4:57 pm

Am I correct that the DS1307 has ram that I can write to.
I would like to use it to save two variables.

How would I access this?

Thanks
AndrewB
 
Posts: 94
Joined: Thu Jan 02, 2014 3:38 pm

Re: DS1307 Ram

Postby AndrewB » Wed Jan 22, 2014 5:17 pm

Would it be
Code: Select all
DS1307.writebyte(8,variable or value) ' first byte
DS1307.writebyte(9,variable or value) ' second byte
DS1307.readbyte(8,variable or value)  ' first byte
DS1307.readbyte(9,variable or value)  ' second byte
AndrewB
 
Posts: 94
Joined: Thu Jan 02, 2014 3:38 pm

Re: DS1307 Ram

Postby David John Barker » Wed Jan 22, 2014 6:12 pm

I think this routine already offsets the address by RTC_NVRAM, see the WriteByte() and ReadByte() implementations by clicking on the DS1307 in the explorer window. Keep us informed of your progress...
User avatar
David John Barker
 
Posts: 491
Joined: Thu Nov 08, 2012 12:21 pm

Re: DS1307 Ram

Postby AndrewB » Wed Jan 22, 2014 6:28 pm

Have it working...

Code: Select all
DS1307.Writebyte(&H08,14)
DS1307.Writebyte(&H09,50)
temp = DS1307.readbyte(&H08)
temp = DS1307.readbyte(&H09)
AndrewB
 
Posts: 94
Joined: Thu Jan 02, 2014 3:38 pm

Re: DS1307 Ram

Postby David John Barker » Wed Jan 22, 2014 6:49 pm

Great - don't forget though, the routines are automatically offset by RTC_NVRAM, so you can use
Code: Select all
' import modules...
Imports DS1307         

' main program entry point...
Sub Main()
   DS1307.WriteByte(0,10)
   DS1307.WriteByte(1,20)
   Console.Write("Addr(0) = ", cstr(DS1307.ReadByte(0)),13,10) 
   Console.Write("Addr(1) = ", cstr(DS1307.ReadByte(1)),13,10)
End Sub
User avatar
David John Barker
 
Posts: 491
Joined: Thu Nov 08, 2012 12:21 pm

Re: DS1307 Ram

Postby AndrewB » Wed Jan 22, 2014 7:32 pm

Oh Ok thanks
AndrewB
 
Posts: 94
Joined: Thu Jan 02, 2014 3:38 pm


Return to Shields

Who is online

Users browsing this forum: No registered users and 2 guests

cron

x