Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Is RTC DS1307 can wok as both SPI or I2C?

Status
Not open for further replies.

jay_3189

Banned
Joined
Sep 19, 2013
Messages
104
Helped
0
Reputation
0
Reaction score
0
Trophy points
16
Location
Ahmedabad
Activity points
0
Hello everyone

I am using DS1307 RTC in my project and doing C lang. Code to display time and date in Hyper terminal using RS232. but there I have found a lot problem in programming.

Now I comes to know that DS1307 also work SPI.

Is that true? then how I can use it as SPI and which pin I have to connect of it with controller.
and also please give suggestion related to code of SPI in C lang. for DS1307.
 

hello,
DS1307 works with I2C protocole
DS1302 works with SPI protocole
see datasheets in details.
 

DS1307 works only with i2c protocol. for DS1307 programming in C see the attached file. Change the extension of files accordingly. which microcontroller are you using? UART and other files will be sent accordingly.

enjoy!!
 

Attachments

  • ds1307.h.txt
    529 bytes · Views: 78
  • ds1307.c.txt
    3.3 KB · Views: 68

DS1307 works only with i2c protocol. for DS1307 programming in C see the attached file. Change the extension of files accordingly. which microcontroller are you using? UART and other files will be sent accordingly.

enjoy!!

Using at89c51 with Keil IDE and using st232n with RS232.
 

at89c51 does not have an i2c interface. What you have to do is make a soft i2c by dedication two pins. Read start, stop, ack and NACK signals in i2c. then you would be able to interface DS1307.

Enjoy!!!
 
...and the DS1302 isn't SPI, it uses a single data line bidirectionally. (lovely IC, it has the backup charger built in)

Brian.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top