Interfacing DS1307 RTC With PIC18F46K22 Microcontroller | Electronics Developer

Veröffentlicht am: 01 Januar 2022
auf dem Kanal: Electronics Developer
438
like

-------------------------
📌Introduction
-------------------------
This post shows how to build a simple real time clock/calendar using PIC18F46K22 microcontroller and DS1307 RTC chip where time and date are displayed on 20×4 LCD screen and they could be set using two push buttons connected to the PIC18F46K22 microcontroller.
The compiler used in this project is CCS PIC C.

-------------------------
📌 Circuit Design
-------------------------
All grounded terminals are connected together.The two push buttons in the circuit are used to set time and date of the real time clock, button 1 (B1) is connected to RB0 pin (#33) and button 2 (B2) is connected to RB1 pin (#34).

SCL and SDA pins of DS1307 are respectively connected to PIC18F46K22 pins RC3 (#18) and RC4 (#23) which are hardware I2C module pins (MSSP1).

The 20×4 LCD screen is connected to the PIC18F46K22 microcontroller as follows:
RS — RD0 pin
RW — RD1 pin
E — RD2 pin
D4 — RD3 pin
D5 — RD4 pin
D6 — RD5 pin
D7 — RD6 pin
VSS, D0, D1, D2, D3 and K are connected to circuit GND (ground).
VEE to the variable resistor (or potentiometer) output pin.
VDD to +5V and A to +5V through 330 ohm resistor.

VEE pin is used to control the contrast of the LCD. A (anode) and K (cathode) are the back light LED pins.In this project the PIC18F46K22 microcontroller runs with its internal oscillator @ 8 MHz, MCLR pin is configured as an input pin.

-------------------------
📌 Tags
-------------------------
#PIC18F46K22#DS1307 #Thermometer

-------------------------
📌 The Code
-------------------------
Source code Given In Comment Section , The following C code is for CCS C compiler, it was tested with version 5.051.To be able to compile the C code below, a driver (library) for DS1307 RTC is DS1307.C,

After the download, add it to project folder or CCS C drivers folder (for example C:\Program Files (x86)\CCS\Drivers).I2C Bus (using I2C1 module) is initialized in the code as shown below at clock frequency of 100kHz.

📌 Tune With us so you never miss any update
-------------------------------------------------------------------------------------------------------------------------------------------------------------
🏷️Telegram : https://t.me/electronicsdeveloper
🏷️Facebook :   / electronicsdeveloper  
🏷️Instagram :   / electronics_developer  
🏷️Tweeter : https://twitter.com/Electronics_Dev?s=09
🏷️LinkedIn :   / electronics-with-shreyash  
🏷️Pinterest :   / electronics_developer  

Copyright Disclaimer under Section 107 of the copyright act 1976
--------------------------------------------------------------------------------------------------------------------------------------------------------------
Copyright Disclaimer under Section 107 of the copyright act 1976, allowance is made for fair use for purposes such as criticism, comment, news reporting, scholarship, and research. Fair use is a use permitted by copyright statute that might otherwise be infringing. Non-profit, educational or personal use tips the balance in favour of fair use.

---------------------------------------------------------------------------------------------------------------------------------------------------------------
About Electronics Developer : YouTube certified creative essentials and asset monetization
---------------------------------------------------------------------------------------------------------------------------------------------------------------


Auf dieser Seite können Sie das Online-Video Interfacing DS1307 RTC With PIC18F46K22 Microcontroller | Electronics Developer mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Electronics Developer 01 Januar 2022 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 438 Mal angesehen und es wurde von like den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!