Class DS1302Z


  • public class DS1302Z
    extends Object
    Driver for the DS1302Z real time clock.
    Pin 13, 14 and 15 of the TPUB are used.
    Before the first write disable the write protection with setWriteProtection(boolean).
    • Constructor Summary

      Constructors 
      Constructor Description
      DS1302Z()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int getDate()
      Reads the actual date value from the RTC.
      static int getDay()
      Reads the actual day value from the RTC.
      static int getHour()
      Read the actual hour value from the RTC.
      static int getMin()
      Read the actual minute value from the RTC.
      static int getMonth()
      Reads the actual month value from the RTC.
      static int getSec()
      Read the actual second value from the RTC.
      static int getYear()
      Reads the actual year value from the RTC.
      static void setDate​(int val)
      Set the actual date value to the RTC.
      static void setDay​(int val)
      Set the actual Day value to the RTC
      static void setHour​(int val)
      Set the actual hour value to the RTC.
      static void setMin​(int val)
      Set the actual minute value to the RTC.
      static void setMonth​(int val)
      Set the actual month value to the RTC.
      static void setSec​(int val)
      Set the actual second value to the RTC.
      static void setWriteProtection​(boolean enable)
      Enable or disable the write protection.
      static void setYear​(int val)
      Set the actual year value to the RTC.
      static boolean writeProtected()
      Returns the write protection state.
    • Constructor Detail

      • DS1302Z

        public DS1302Z()
    • Method Detail

      • getSec

        public static int getSec()
        Read the actual second value from the RTC.
        Returns:
        The actual seconds.
      • getMin

        public static int getMin()
        Read the actual minute value from the RTC.
        Returns:
        The actual minutes.
      • getHour

        public static int getHour()
        Read the actual hour value from the RTC.
        Returns:
        The actual hours.
      • getDate

        public static int getDate()
        Reads the actual date value from the RTC.
        Returns:
        The actual date.
      • getMonth

        public static int getMonth()
        Reads the actual month value from the RTC.
        Returns:
        The actual month.
      • getDay

        public static int getDay()
        Reads the actual day value from the RTC.
        Returns:
        The actual day of the week.
      • getYear

        public static int getYear()
        Reads the actual year value from the RTC.
        Returns:
        The actual year.
      • setSec

        public static void setSec​(int val)
        Set the actual second value to the RTC.
        Parameters:
        val - The actual seconds.
      • setMin

        public static void setMin​(int val)
        Set the actual minute value to the RTC.
        Parameters:
        val - The actual minutes.
      • setHour

        public static void setHour​(int val)
        Set the actual hour value to the RTC.
        Parameters:
        val - The actual hour.
      • setDate

        public static void setDate​(int val)
        Set the actual date value to the RTC.
        Parameters:
        val - The actual date.
      • setMonth

        public static void setMonth​(int val)
        Set the actual month value to the RTC.
        Parameters:
        val - The actual month.
      • setDay

        public static void setDay​(int val)
        Set the actual Day value to the RTC
        Parameters:
        val - The actual Day of the week.
      • setYear

        public static void setYear​(int val)
        Set the actual year value to the RTC.
        Parameters:
        val - The actual year.
      • writeProtected

        public static boolean writeProtected()
        Returns the write protection state.
        Returns:
        true if the write protection is enabled, false otherwise.
      • setWriteProtection

        public static void setWriteProtection​(boolean enable)
        Enable or disable the write protection.
        Parameters:
        enable - true to enable, false to disable.