RTC1307 - Real Time Clock

From Combustory
(Difference between revisions)
Jump to: navigation, search
Line 2: Line 2:
  
 
== Summary ==
 
== Summary ==
This code shows how to communicate with the RTC1307 Real Time Clock, which is used to set and retrieve the date/time of the chip. As a bonus there is some additional bytes of data that can be used as general purpose memory.  The main purpose for my use of this code is to be able to log events that occur in my applications.  I recommend for you to get the RTC1307 data sheet to help with understanding what was done here.  The bottom line is that I have created this program to accept commands via serial communication with a PC to instruct the Arduino to send or receive data via I2C to the storage registers of the RTC1307 chip.  
+
This code shows how to communicate with the RTC DS1307 Real Time Clock, which is used to set and retrieve the date/time of the chip. As a bonus there is some additional bytes of data that can be used as general purpose memory.  The main purpose for my use of this code is to be able to log events that occur in my applications.  I recommend for you to get the RTC1307 data sheet to help with understanding what was done here.  The bottom line is that I have created this program to accept commands via serial communication with a PC to instruct the Arduino to send or receive data via I2C to the storage registers of the RTC DS1307 chip.  
  
 
Note of gratitude to [http://www.glacialwanderer.com/hobbyrobotics Maurice Ribble - http://www.glacialwanderer.com/hobbyrobotics for the majority of the RTC DS1307 code]
 
Note of gratitude to [http://www.glacialwanderer.com/hobbyrobotics Maurice Ribble - http://www.glacialwanderer.com/hobbyrobotics for the majority of the RTC DS1307 code]
Line 21: Line 21:
  
  
==== RTC_1307_v.01 code ====
+
==== RTC_DS1307_v.01 code ====
  
 
<pre>
 
<pre>
Line 27: Line 27:
 
</pre>
 
</pre>
  
== RTC_1307_v.01 User Guide ==
+
== RTC_DS1307_v.01 User Guide ==
 
==== Commands ====
 
==== Commands ====
 
[[Category:Electronics]]
 
[[Category:Electronics]]

Revision as of 17:35, 6 February 2009

Welcome to Combustory


Any questions or comments:

  • Send them to - combustor@combustory.com

Contents

Summary

This code shows how to communicate with the RTC DS1307 Real Time Clock, which is used to set and retrieve the date/time of the chip. As a bonus there is some additional bytes of data that can be used as general purpose memory. The main purpose for my use of this code is to be able to log events that occur in my applications. I recommend for you to get the RTC1307 data sheet to help with understanding what was done here. The bottom line is that I have created this program to accept commands via serial communication with a PC to instruct the Arduino to send or receive data via I2C to the storage registers of the RTC DS1307 chip.

Note of gratitude to Maurice Ribble - http://www.glacialwanderer.com/hobbyrobotics for the majority of the RTC DS1307 code

Method

I2C

There are basically only two functions that I am after right now which are both three byte instructions:

  • Read WCR(Wiper Control Register) for the four potentiometers 0-3 (So far this is failing miserably)
    • Send 1st byte - Address (my circuit - 01011010 or 0x2D)(binary - 0101 A3 A2 A1 A0) A values are actual pins set to high or low for an address.
    • Send 2nd byte - Instruction (binary - 1001 (1/0)(1/0) 00) - The two bits are used to choose the potentiometer
    • Read WCR requested Byte
  • Write WCR for the four potentiometers 0-3 (This works)
    • Send 1st byte - Address (my circuit - 01011010 or 0x2D)(binary - 0101 A3 A2 A1 A0) A values are actual pins set to high or low for an address.
    • Send 2nd byte - Instruction (binary - 1010 (1/0)(1/0) 00) - The two bits are used to choose the potentiometer
    • Send WCR Byte - Potentiometer value (binary - 00 D5 D4 D3 D2 D1 D0) - D values are the 0-63 potentiometer positions


RTC_DS1307_v.01 code


RTC_DS1307_v.01 User Guide

Commands

Personal tools
Sponsers
Your Ad Here
Your Ad Here