⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ds1337.h

📁 this document is source code for arm9 of atmel
💻 H
字号:
/*-----------------------------------------------------------------------------
*         ATMEL Microcontroller Software Support  -  ROUSSET  -
*------------------------------------------------------------------------------
* The software is delivered "AS IS" without warranty or condition of any
* kind, either express, implied or statutory. This includes without
* limitation any warranty or condition with respect to merchantability or
* fitness for any particular purpose, or against the infringements of
* intellectual property rights of others.
*------------------------------------------------------------------------------
* File Name           : ds1337.h
* Object              : Maxim Dallas RTC DS1337 header file definition
*
* Version | mm | dd | yy | author :
*  1.0      05   16   06    PFi   : Creation
*
*----------------------------------------------------------------------------*/

#ifndef ds1337_h
#define ds1337_h

#include <stdio.h>

#define AT91C_DS1337_I2C_ADDRESS  (0x68<<16) /* Internal addr: "110 1000" */

/* DS1337 register offset */
#define DS1337_SECONDS_REG       0x00
#define DS1337_MINUTES_REG       0x01
#define DS1337_HOURS_REG         0x02
#define DS1337_DAY_OF_WEEK_REG   0x03
#define DS1337_DATE_REG          0x04
#define DS1337_MONTH_REG         0x05
#define DS1337_YEAR_REG          0x06

/* DS1337 Unique Registers */
#define DS1337_ALM1_SECONDS_REG  0x07
#define DS1337_ALM1_MINUTES_REG  0x08
#define DS1337_ALM1_HOURS_REG    0x09
#define DS1337_ALM1_DAYDATE_REG  0x0A
#define DS1337_ALM2_MINUTES_REG  0x0B
#define DS1337_ALM2_HOURS_REG    0x0C
#define DS1337_ALM2_DAYDATE_REG  0x0D
#define DS1337_CONTROL_REG       0x0E
#define DS1337_STATUS_REG        0x0F

/* Enable Oscillator, Disable SQWV, Disable Ints */
#define DS1337_CTRL_REG_INIT_VAL 0x04

/* Clear OSF (Oscillator Stop Flag),A2F (Alarm 2 Flag),and A1F (Alarm 1 Flag) */
#define DS1337_CLEAR_STATUS_VAL  0x00

/* SQW Output rate selct bit RS1(3) & RS2 (4) */
#define DS1337_SQW_1HZ  0x0
#define DS1337_SQW_4096HZ  0x8
#define DS1337_SQW_8192HZ  0x10
#define DS1337_SQW_32768HZ  0x18

extern char DayOfWeek[][7];   /* Days of the week */
extern char Month[][6];

/* This structure defines the user's date and time data. */

struct DS1337 {
   unsigned char seconds;    /* 0 to 59 */
   unsigned char minutes;    /* 0 to 59 */
   unsigned char hours;      /* 0 to 23  (24-hour time) */
   unsigned char day;        /* 0 = Sunday, 1 = Monday, etc. */
   unsigned char date;       /* 1 to 31 */
   unsigned char month;      /* 1 to 12 */
   unsigned char year;       /* 00 to 99 */
};

/* ----------------------- External Function Prototyping --------------------*/

extern unsigned char AT91F_DS1337_Bin2Bcd(unsigned char BinValue);
extern unsigned char AT91F_DS1337_Bcd2Bin(unsigned char BcdValue);
extern void AT91F_DS1337_SetSeconds(char seconds);
extern char AT91F_DS1337_ReadSeconds(void);
extern void AT91F_DS1337_SetMinutes(char minutes);
extern char AT91F_DS1337_ReadMinutes(void);
extern void AT91F_DS1337_SetHours(char hours);
extern char AT91F_DS1337_ReadHours(void);
extern void AT91F_DS1337_SetDay(char day);
extern char AT91F_DS1337_ReadDay(void);
extern void AT91F_DS1337_SetDate(char date);
extern char AT91F_DS1337_ReadDate(void);
extern void AT91F_DS1337_SetMonth(char month);
extern char AT91F_DS1337_ReadMonth(void);
extern void AT91F_DS1337_SetYear(char year);
extern char AT91F_DS1337_ReadYear(void);

extern void AT91F_DS1337_SetDateTime(struct DS1337 *ptDS1337);
extern void AT91F_DS1337_ReadDateTime(struct DS1337 *ptDS1337);
extern void AT91F_DS1337_SetControlRegister(char ControlReg);


#endif


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -