Building digital clock using DS1307 RTC with PIC16F877A microcontroller | Digital clock part-3

แชร์
ฝัง
  • เผยแพร่เมื่อ 1 ต.ค. 2024
  • In this lecture you will acquire knowledge on interfacing DS1307 RTC with the microcontroller PIC16F877A and building digital clock with pic microcontroller ,This is a course on programming in MPLAB X IDE using XC8 compiler for the microcontroller PIC16F877A.
    Here is the Full playlist link for this course:
    MPLAB X IDE Programming Course Playlist Link: • MPLAB X IDE Programmin...
    For learning this course for free with all the documents and necessary source code for all the lectures
    visit us on : www.smtrainingacademy.com
    Embedded Courses Link: smtrainingacade...
    CONTACT US ON : smtrainingacademy@gmail.com
    Advantage of learning the course on our site is you can access all the source code and documents necessary then and there and you can track your progress in the courses. visit our site ,Register for free and login to get access to lot of courses like this for free.

ความคิดเห็น • 66

  • @ChoaibElmadi
    @ChoaibElmadi 2 หลายเดือนก่อน +1

    Thank you so much, I just completed the whole playlist. You are an amazing teacher.

  • @jacksonmgani4411
    @jacksonmgani4411 ปีที่แล้ว +2

    Your one the best teacher I have ever seen, Thank you very much for this gift.

  • @GregoriousApartment
    @GregoriousApartment 2 ปีที่แล้ว +2

    You're an amazing person, giving us knowledge for free on youtube.

  • @tamilwingsyoutube3767
    @tamilwingsyoutube3767 3 ปีที่แล้ว +2

    DS1307_read(DS1307_address,0x00); this code show error
    SSPBUF = DS1307_address; this also

  • @amarnathmathusoothanan2488
    @amarnathmathusoothanan2488 5 หลายเดือนก่อน

    sir instead of c how to convert these code into assembler language i have an assignment that is we should write the program into assembler language What can i do

  • @datdeptraitopmotthegioi
    @datdeptraitopmotthegioi 4 หลายเดือนก่อน

    You're awesome, can you give me the code that can be edited with a button?

  • @anandhums7560
    @anandhums7560 3 ปีที่แล้ว +2

    Very good explanation. You did all the basics of I2C protocol in detail

  • @amudhapriyane4534
    @amudhapriyane4534 2 ปีที่แล้ว +2

    Sir, sorry for asking continuous questions. I have some doubts in hardware mode. Should we use crystal for DS1307? If yes means, what freq should we buy? Also do we need pull up resistors between the i2c pins of pic and ds1307? Because the hardware model you showed doesnt had any of these? could you pls, share what you exactly did in hardware mode in detail sir. Thank you.

    • @SMtrainingacademy
      @SMtrainingacademy  2 ปีที่แล้ว +1

      Yes of course you have to provide crystal for ds1307 and also we need to provide pull up for i2c lines, it’s ok I can help you anytime you can ask as many questions until your doubts are cleared no issues

    • @SMtrainingacademy
      @SMtrainingacademy  2 ปีที่แล้ว +1

      Also refer the schematic I have provided for the hardware circuit

    • @amudhapriyane4534
      @amudhapriyane4534 2 ปีที่แล้ว

      @@SMtrainingacademy thanks a lot

  • @kckasun
    @kckasun 3 ปีที่แล้ว +2

    An excellent tutorial. I watched all the three parts of the I2C clock lesson.
    I have one question. I built the circuit in proteus as explained and it worked fine. but when I removed the I2C debugger the DS1307 doesn't work and the LCD was only showing zeroes in place of seconds, minutes, etc. what is the reason for this?

    • @SMtrainingacademy
      @SMtrainingacademy  3 ปีที่แล้ว +1

      Hello Kasun
      It actually happens sometimes in proteus I have also faced it,but in hardware it will work fine 😊

    • @kckasun
      @kckasun 3 ปีที่แล้ว +1

      @@SMtrainingacademy Thank you for the reply... :) it means it is a kind of a bug in proteus ?

    • @SMtrainingacademy
      @SMtrainingacademy  3 ปีที่แล้ว

      May be @Kasun

  • @siphodludlu1362
    @siphodludlu1362 3 ปีที่แล้ว +2

    The lecture is good but maybe you need to provide link for soft copy as not everything is clear from the video

    • @SMtrainingacademy
      @SMtrainingacademy  3 ปีที่แล้ว

      Ofcourse I will try

    • @prabhatkumar3547
      @prabhatkumar3547 3 ปีที่แล้ว +2

      @@SMtrainingacademy sir please provide code

    • @SMtrainingacademy
      @SMtrainingacademy  3 ปีที่แล้ว +1

      @@prabhatkumar3547 Please go to this page and click download button
      smtrainingacademy.com/course/chapter/view/eyJpdiI6ImV4eE9IUHBTZ3FCZTdIZis5WWxVNnc9PSIsInZhbHVlIjoidDZOTHhVWkFMREZGc0d4a2w2ZWkrQT09IiwibWFjIjoiMzgzNDI2ZjExYjA3ZjY5MGQ3ZDJmNGNhMGYzMTk0ZmM3MTAxMzI5Y2ExMGYxZTkzYWRlYTYxYmQ5YjQxZjYzNyJ9

    • @kundankumar-ll8in
      @kundankumar-ll8in 3 ปีที่แล้ว

      @@prabhatkumar3547 bro did you simulate this code in proteus. I did but not getting real clock..please reply ASAP possible..

    • @tamilwingsyoutube3767
      @tamilwingsyoutube3767 3 ปีที่แล้ว

      #include
      #define _XTAL_FREQ 20000000
      #define LCD PORTTD
      #define RS RB0
      #define RW RB1
      #define EN RB2
      // rtc micros for ds1317
      #define DS1317_address 0xD0
      #define second 0x00
      #define minute 0x01
      #define hour 0x02
      #define day 0x03
      #define date 0x04
      #define month 0x05
      #define year 0x06
      #define control_reg 0x07
      void DS1307_write(char sec, char min, char hr, char _day, char date_, char month_, char year_);
      void DS1307_read(char slave_address,char register_address);
      char decimal_to_bcd(unsigned char value);
      void bcd_to_ascii(unsigned char value);
      void delay(unsigned int delay);
      void lcd_cmd(unsigned char cmd);
      void lcd_data(unsigned char data);
      void lcd_Init();
      void lcd_word(const unsigned char *words);
      unsigned char __sec,__min,__hr,__day,__month,__yr,__con;
      void main(void)
      {
      TRISC = 0XFF;
      SSPCON = 0X28;
      SSPADD =49;
      TRISB=TRISD=0X00;
      PORTB=PORTD = 0X00;
      lcd_Init();
      lcd_cmd(0x80);
      lcd_word("CLOCK:");
      lcd_cmd(0xC0);
      lcd_word("DATE:");
      DS1307_write(0, 59, 2, 1, 26, 12, 19);
      __delay_ms(300);

      while(1)
      {
      __delay_ms(20);
      DS1307_read(DS1307_address,0x00);







      }
      }
      void DS1307_write(char _second, char _minute, char _hour, char _day, char _date, char _month, char _year)
      {
      SEN=1;
      while(SEN);
      SSPIF = 0;
      SSPBUF = DS1307_address;
      while(!SSPIF);
      SSPIF = 0;
      if(ACKSTAT)
      {
      PEN = 1;
      while(PEN);
      return;
      }
      SSPBUF = second;
      while(!SSPIF);
      SSPIF = 0;
      if(ACKSTAT)
      {
      PEN = 1;
      while(PEN);
      return;
      }
      SSPBUF = decimal_to_bcd(_second);
      while(SSPIF);
      SSPIF = 0;
      SSPBUF = decimal_to_bcd(_minute);
      while(!SSPIF);
      SSPIF = 0;
      SSPBUF = decimal_to_bcd(_hour);
      while(!SSPIF);
      SSPIF = 0;
      SSPBUF = decimal_to_bcd(_day);
      while(!SSPIF);
      SSPIF = 0;
      SSPBUF = decimal_to_bcd(_date);
      while(!SSPIF);
      SSPIF = 0;
      SSPBUF = decimal_to_bcd(_month);
      while(!SSPIF);
      SSPIF = 0;
      SSPBUF = decimal_to_bcd(_year);
      while(!SSPIF);
      SSPIF = 0;
      SSPBUF = 0x00;
      while(!SSPIF);
      SSPIF = 0;
      PEN=1;
      while(PEN);
      }
      void DS1307_READ(char slave_address,char register_address)
      {
      SEN = 1;
      while(SEN);
      SSPIF = 0;
      SSPBUF =slave_address;
      while(!SSPIF);
      SSPIF = 0;
      if(ACKSTAT)
      {
      PEN = 1;
      while(PEN);
      return;
      }
      SSPBUF = register_address;
      while(!SSPIF);
      SSPIF = 0;
      if(ACKSTAT)
      {
      PEN = 1;
      while(PEN);
      return;
      }
      RSEN = 1;
      while(RSEN);
      SSPIF = 0;
      SSPBUF = (slave_address + 1);
      while(!SSPIF)
      SSPIF = 0;
      if(ACKSTAT)
      {
      PEN=1;
      while(PEN);
      return;
      }
      RCEN = 1;
      while(! BF);
      __sec = SSPBUF;
      ACKDT = 0;
      ACKDT = 1;
      while(ACKEN);
      RCEN = 1;
      while(!BF)
      __min = SSPBUF;

      ACKDT = 0;
      ACKEN = 1;
      while(ACKEN);
      RCEN = 1;
      while(!BF);
      __hr = SSPBUF;

      ACKDT = 0;
      ACKDT = 1;
      while(ACKEN);

      RCEN = 1;
      while(!BF);
      __day = SSPBUF;

      ACKDT = 0;
      ACKDT = 1;
      while(ACKEN);

      RCEN = 1;
      while(!BF);
      __date = SSPBUF;

      ACKDT = 0;
      ACKDT = 1;
      while(ACKEN);
      RCEN = 1;
      while(!BF);
      __month = SSPBUF;

      ACKDT = 0;
      ACKDT = 1;
      while(ACKEN);
      RCEN = 1;
      while(!BF);
      __yr = SSPBUF;

      ACKDT = 0;
      ACKDT = 1;
      while(ACKEN);
      RCEN = 1;
      while(!BF);
      __con = SSPBUF;

      ACKDT = 0;
      ACKDT = 1;
      while(ACKEN);

      PEN = 1;
      while(PEN);

      lcd_cmd(0x88);
      bcd_to_ascii(__hr);
      lcd_data(':');
      bcd_to_ascii(__min);
      lcd_data(':');
      bcd_to_ascii(__sec);
      lcd_cmd(0xC8);
      bcd_to_ascii(__date);
      lcd_data('/');
      bcd_to_ascii(__month);
      lcd_data('/');
      bcd_to_ascii(__yr);
      }

  • @amudhapriyane4534
    @amudhapriyane4534 2 ปีที่แล้ว +1

    In hardware mode, did you used the potentiometer and the 5v source for the vss, vdd and vee for the lcd module

    • @SMtrainingacademy
      @SMtrainingacademy  2 ปีที่แล้ว +1

      Yes I just did the same as per your understanding

  • @amudhapriyane4534
    @amudhapriyane4534 2 ปีที่แล้ว +1

    And in the code part, you mentioned 1 for using 'day' register in ds1307, but why the LCD doesn't showing what day it is?

    • @SMtrainingacademy
      @SMtrainingacademy  2 ปีที่แล้ว

      Can you mention the time frame in video where you found the problem

    • @amudhapriyane4534
      @amudhapriyane4534 2 ปีที่แล้ว

      My doubt is why you are not printing the 'day' in the lcd?
      In the code part, ds1307 write function, you declared it as 1.

  • @amudhapriyane4534
    @amudhapriyane4534 2 ปีที่แล้ว +1

    Hello, why you upload a different proteus schematic in the website. But in the video you just used pic and you didnt used any crystal for pic. And you used I2C debugger here in the video and not in the proteus schematic which you uploaded in the website along with the code. Please say why you did that. Thank you

    • @SMtrainingacademy
      @SMtrainingacademy  2 ปีที่แล้ว

      Which schematic is different can you please show that ..?

    • @amudhapriyane4534
      @amudhapriyane4534 2 ปีที่แล้ว +1

      @@SMtrainingacademy I have another doubt why the LCD module Vss, Vdd and Vee are not connected to any power source? How it is running without any source? and there are no crystal connected to the pic and ds1307? why? could you explain this in detail? please!

    • @SMtrainingacademy
      @SMtrainingacademy  2 ปีที่แล้ว +1

      @@amudhapriyane4534 Notice that in simulation we don’t require to provide power source and crystal for controller but in hardware we want to provide which I have already provided to you the actual circuit in the schematic diagram.please remember simulation is quite different than hardware but code will be the same

    • @amudhapriyane4534
      @amudhapriyane4534 2 ปีที่แล้ว +1

      @@SMtrainingacademy okay. Thanks for your response sir. I understood

    • @SMtrainingacademy
      @SMtrainingacademy  2 ปีที่แล้ว

      @@amudhapriyane4534 😊

  • @amudhapriyane4534
    @amudhapriyane4534 2 ปีที่แล้ว +1

    is there anyother way to dump the code in pic16f877a board without PICkit3. I used Rs232 cable with pic isp software downloader to dump it, but is showing bad acknowledgement error. Do you how to resolve this?

    • @SMtrainingacademy
      @SMtrainingacademy  2 ปีที่แล้ว

      PIC IC with bootloader is able to program using rs232 and without bootloader you cannot perform it

    • @amudhapriyane4534
      @amudhapriyane4534 2 ปีที่แล้ว +1

      @@SMtrainingacademy Now we bought pickit3, the program works fine. We used MPLAB IPE for dumping the code. The interpreter said program was successfully uploaded. But we are not getting any output in the LCD. While using MPLAB IDE, we couldn't even upload the program. Do you know what could be the issue with out setup?

    • @SMtrainingacademy
      @SMtrainingacademy  2 ปีที่แล้ว

      @@amudhapriyane4534 what is the config bits you have used

    • @amudhapriyane4534
      @amudhapriyane4534 2 ปีที่แล้ว +1

      The above drive link has the code we used, you can refer that for the config bits.

    • @SMtrainingacademy
      @SMtrainingacademy  2 ปีที่แล้ว

      @@amudhapriyane4534 which link can you share it again

  • @tamilwingsyoutube3767
    @tamilwingsyoutube3767 3 ปีที่แล้ว +1

    how can we use alarm

    • @SMtrainingacademy
      @SMtrainingacademy  3 ปีที่แล้ว

      You have to write the logic for settings and alarm

  • @tamilwingsyoutube3767
    @tamilwingsyoutube3767 3 ปีที่แล้ว +1

    is there any error in this code
    pls help

    • @SMtrainingacademy
      @SMtrainingacademy  3 ปีที่แล้ว

      No it will work well

    • @tamilwingsyoutube3767
      @tamilwingsyoutube3767 2 ปีที่แล้ว

      @@SMtrainingacademy
      DS1307_read(DS1307_address,0x00);
      SSPBUF = DS1307_address;
      this two lines show error

    • @vijiljoy5125
      @vijiljoy5125 ปีที่แล้ว

      @@tamilwingsyoutube3767 what error is showing