Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Programming DS3231 RTC without Arduino

Status
Not open for further replies.

Swsean

New Member
Hi, Recently, I've began my Final Year Project.

In my project, I need to use a RTC module. However, I wasn't allowed to use Arduino UNO as a part of the project. Looking for resources online, I wasn't able to find a way to program the DS3231 module without using Arduino UNO. I want to use program and set the time for the RTC module, What is the best way/method to program it?
1587628944061.png

Any help would be very much appreciated. Thanks in advance.
 
You an program it with any processor, you don't need to use a Uno.

It's simply an I2C interface, and you need to read and write specific registers via that interface - you could do it from a PC if you have a suitable I2C interface for it. Historically these tended to be done by bit-banging the parallel port, but parallel ports have long since gone - so now you'd probably use an external processor connected via USB (or a USB serial adaptor) if you wanted to do it via a PC.

However, presumably your project has a processor? (you couldn't really use the DS3231 without one), so it's usual to program it directly from that.
 
Hi, thanks for replying. For my project, I am using PIC16F887 processor. How should I set it up to program the date and time?
 
The DS3231 data sheet will show which registers you need to write to to set various clock parameters, including settings the time, and which registers to read to determine the time and date.

The data sheet also explains the chip address, and the steps needed to write to and read from particular registers.
 
If your final year project just expects you to find the solution for you project on the web It is a very poor test of your knowledge of your subject. You don't even say what programming language you are required to use. (Or which ones you know how to use.) If you are using a high level language like "C" from what I have seen there seems to .h files that seem to do most of the work. If you find Arduino programs I think it should be possible to convert them to run on a version of "C" that runs on your PIC. (NOTE I am only guessing about "C" programming as i find it too difficult to understand. ) If you are using assembler (Which I find much easier than "C") I would start by writing code to deal with the I2C protocol. When you have done that reading and writing to registers in the DS3231 is easy. This is how I approached it when writing code to use a PIC12F1840 to read and write to a DS3231. (This is a starting point to replace the timekeeping code on a PIC16F877 event logger with a DS3231 at some time in the future.)
As this falls into the homework help category we do not give you the answer, We just guide you. Show us what you have done so far for the project.

Les.
 
Hi, Recently, I've began my Final Year Project.

In my project, I need to use a RTC module. However, I wasn't allowed to use Arduino UNO as a part of the project. Looking for resources online, I wasn't able to find a way to program the DS3231 module without using Arduino UNO. I want to use program and set the time for the RTC module, What is the best way/method to program it?
View attachment 124619
Any help would be very much appreciated. Thanks in advance.


One option is to dig into the C++ code used to write the <wire.h> library in arduino and do the same in PIC. They both work the same way (one pin turns on and off over and over again (called the clock) and the other is high for some clock cycle and low for other clock cycles depending on what information it is sending (called the data pin).

Alternatively, read a book and learn how I2C works - my son explained it to me in about 5 minutes about 15 years ago so you might find it on the datasheet from your RTC's manufacturer.
 
Status
Not open for further replies.

Latest threads

Back
Top