出自flip the world 檢視Application - DS1302, RTC module的原始碼 頁面討論 閱讀檢視原始碼檢視歷史 ←Application - DS1302, RTC module 您沒有權限執行編輯此頁面,由於以下原因: 您請求的操作只有這個群組的使用者能使用:使用者 您可以檢視並複製此頁面的原始碼。 Adding a '''DS1302''' real-time clock module to a Raspberry Pi so it keeps time without a network connection. [[File:Rpi rtc.jpg|border|400px]] == Hardware == [[File:Real-time-clock-connection.jpg|border|RPi with DS1302]] * In version 2 Pi GPIO27 is in place of GPIO21 (same pin) == Software == * [http://www.hobbytronics.co.uk/download/rtc-pi.zip Real Time Clock Source Code] <pre> Modify the following GPIO definition for RPi 2 #define GPIO_ADD 0x20200000L -> #define GPIO_ADD 0x3F000000L #define SCLK_OUTPUT *(gpio+GPIO_SEL2) &= 0xFFFFFFC7L -> #define SCLK_OUTPUT *(gpio+GPIO_SEL2) &= 0xFF1FFFFFL #define SCLK_HIGH *(gpio+GPIO_SET) = 0x00200000L -> #define SCLK_HIGH *(gpio+GPIO_SET) = 0x08000000L #define SCLK_LOW *(gpio+GPIO_CLR) = 0x00200000L -> #define SCLK_LOW *(gpio+GPIO_CLR) = 0x08000000L </pre> == Reference == * [http://www.hobbytronics.co.uk/raspberry-pi-real-time-clock Raspberry Pi Real Time Clock] [[Category:Projects]] 返回到「Application - DS1302, RTC module」。