资源简介
DS3231官方资料,采用官方的8051微控制器DS2250作为主控芯片,资源中提供官方例程、电路原理图、中文数据手册,开发者可以方便的修改程序

代码片段和文件信息
/***************************************************************************/
/* DEMO3231.C */
/***************************************************************************/
#include /* Prototypes for I/O functions */
#include /* Register declarations for DS5000 */
/************************* bit definitions ****************************/
sbit scl = P0^0; /* I2C pin definitions */
sbit sda = P0^1;
sbit E = P1^0; /* DCM LCD module control signal definitions */
sbit RS = P1^1;
sbit RW = P1^2;
sbit CLK = P2^5; /* DS1267 control signal definitions */
sbit RSTb = P2^6;
sbit DQ = P2^7;
sbit int0 = P3^2;
/**************************** defines *******************************/
#define ADDRTC 0xd0 /* DS3231 slave address (write) */
#define ACK 0
#define NACK 1
/*********************** Function Prototypes **************************/
void start();
void stop();
uchar i2cwrite(uchar d);
uchar i2cread(char);
void wr_dsp_dat(uchar);
void wr_dsp_ins(uchar);
uchar rd_dsp_ins();
void hex2asc(uchar);
void dsp_adj(uchar pos);
void init_dsp();
void writebyte();
void initialize_DS3231();
void disp_regs();
void rd_temp();
void frq_out_tog();
void init_alrm();
void comm_init();
/************************* Global Variables ***************************/
xdata uchar sec min hr dy dt mn yr;
/**************************** functions ******************************/
void start() /* --------- Initiate start condition ---------- */
{
sda = 1; scl = 1;
sda = 0;
}
void stop() /* ---------- Initiate stop condition ----------- */
{
sda = 0; sda = 0;
scl = 1; scl = 1; sda = 1;
}
uchar i2cwrite(uchar d) /* ----------------------------- */
{
uchar i;
scl = 0;
for (i = 0;i < 8; i++)
{
if (d & 0x80)
sda = 1; /* Send the msbits first */
else
sda = 0;
scl = 0;
scl = 1;
d = d << 1; /* do shift here to increase scl high time */
scl = 0;
}
sda = 1; /* Release the sda line */
scl = 0;
scl = 1;
i = sda;
if (i) printf(“Ack bit missing %02X\n“(unsigned int)d);
scl = 0;
return(i);
}
uchar i2cread(char b) /* ----------------------------------- */
{
uchar i d;
d = 0;
sda = 1; /* Let go of sda line */
scl = 0;
for (i = 0; i < 8; i++) /* read the msb first */
{
scl = 1;
d = d << 1;
d = d | (unsigned char)sda;
scl = 0;
}
sda = b; /* low for ack high for nack */
scl = 1;
scl = 0;
sda
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 37376 2014-08-17 23:41 应用笔记3506.doc
文件 108638 2014-08-17 23:35 3506Fig02.pdf
文件 15325 2014-08-17 23:32 AN3506_software.c
文件 1484415 2014-08-17 23:37 DS3231_cn.pdf
----------- --------- ---------- ----- ----
1645754 4
相关资源
- STC8951系列单片机中方指南
- labview编程软件滤波器以及编写程序设
- 电力系统潮流计算程序集合
- 仿知乎界面小程序源代码
- 基于MCS_51单片机的工业屏柜散热方案
- 清翔电子MCS51开发板资料_新版 01_开发
- MCS_51单片机与8255A的接口设计
- STM32蓝牙和串口程序
- elantech触控板驱动程序 v13.6.11 官方最
- 根据硬件ID和程序ID生成注册码
- Rtx51_tiny_RTOS中文版.pdf
- 用python编写的移动彩信的发送程序
- TCL-S1916 ,1924交换机管理程序
- 51单片机PWM程序,占空比、周期可调整
- 嵌入式图形界面MiniGUI的示例程序9例
- 数字频率合成dds正弦波基于FPGA的DDS产
- 28335CAN调试程序
- 导线测量平差程序 很实用
- 51单片机多功能自行车测速仪
- USB转串口驱动,FT232R驱动程序,最新
- 改进的BP神经网络算法
- 通风网络解算程序 fortran90
- proteus仿真 AT89C51输出各种波形
- 编写简单的RMI程序 多线程web 服务器
- 图论软件包(图论里的程序)
- 00
- A星算法_原理讲解_例子
- MFC程序-碰撞的小球
- 德卡D3读卡器测试程序驱动文件
- 用51单片机实现G代码翻译
评论
共有 条评论