I2C总线实验(实时时钟
- 格式:docx
- 大小:92.05 KB
- 文档页数:5
DS3231 高精度I2C 实时时钟(R
DS3231 是低成本、高精度I2C 实时时钟(RTC),具有集成的温补晶振(TCXO)和晶体。
该器件包含电池输入端,断开主电源时仍可保持精确的计时。
集成晶振提高了器件的长期精确度,并减少了生产线的元件数量。
DS3231 提供商用级和工业级温度范围,采用16 引脚300mil 的SO 封装。
RTC 保存秒、分、时、星期、日期、月和年信息。
少于31 天的月份,将自动调整月末的日期,包括闰年的修正。
时钟的工作格式可以是24 小时或带/AM/PM 指示的12 小时格式。
提供两个可设置的日历闹钟和一个可设置的方波输出。
地址与数据通过I²C 双向总线串行传输。
精密的、经过温度补偿的电压基准和比较器电路用来监视VCC 状态,检测电源故障,提供复位输出,并在必要时自动切换到备份电源。
另外,
/RST 监视引脚可以作为产生µP 复位的手动输入。
关键特性
0°C至+40°C范围内精度为±2ppm
-40°C至+85°C范围内精度为±3.5ppm
为连续计时提供电池备份输入。
基于I2C总线的实时时钟芯片设计
龚光松
【期刊名称】《软件导刊》
【年(卷),期】2012(011)004
【摘要】基于I2C总线的实时时钟芯片X1202具有接口简单、记时功能齐全等优点.介绍了X1202芯片的工作原理、编程方法及应用.
【总页数】4页(P97-100)
【作者】龚光松
【作者单位】咸宁职业技术学院,湖北咸宁437100
【正文语种】中文
【中图分类】TP319
【相关文献】
1.基于UAF42芯片设计通用滤波器基于UAF42芯片设计通用滤波器 [J], 陈建尹
2.基于LPC1768的多功能实时时钟系统设计 [J], 徐永毅;张燕
3.基于I2C总线的超高精度实时时钟芯片PCF2129的应用 [J], 王洪武;张戟
4.基于增强51芯片W77E516和RV8803-C7实时时钟的实现方法 [J], 韩霜
5.基于STM32的可记忆高精度实时时钟系统 [J], 孙晓峰;蒋伯华;王鹏;李广恒;刘承文
因版权原因,仅展示原文概要,查看原文内容请购买。
实时时钟实验总结一、实验目的本实验的主要目的是了解实时时钟的原理及其应用,掌握实时时钟的使用方法,以及通过实验学习如何编写驱动程序。
二、实验原理1. 实时时钟是一种能够提供时间和日期信息的芯片,它通常由一个晶体振荡器和一组计数器组成。
2. 实时时钟可以通过I2C总线与处理器进行通信,读取或设置时间和日期信息。
3. 实现实时时钟需要编写相应的驱动程序,并将其与操作系统进行集成。
三、实验设备与材料1. 实验板:STM32F407ZET6开发板;2. 模块:DS1307实时时钟模块;3. 软件:Keil uVision5开发环境。
四、实验内容1. 硬件连接:将DS1307模块与STM32F407ZET6开发板连接,包括SDA、SCL、VCC和GND等引脚。
2. 编写驱动程序:根据DS1307模块手册编写相应的驱动程序,并将其集成到操作系统中。
3. 测试程序:编写测试程序,通过读取DS1307模块返回的时间和日期信息来验证驱动程序是否正常工作。
五、实验步骤1. 连接硬件:将DS1307模块与STM32F407ZET6开发板连接。
2. 编写驱动程序:根据DS1307模块手册编写相应的驱动程序,并将其集成到操作系统中。
3. 编写测试程序:编写测试程序,通过读取DS1307模块返回的时间和日期信息来验证驱动程序是否正常工作。
4. 下载程序:使用Keil uVision5开发环境将编写好的程序下载到STM32F407ZET6开发板上。
5. 运行测试:启动STM32F407ZET6开发板,通过串口助手等工具查看DS1307模块返回的时间和日期信息,验证驱动程序是否正常工作。
六、实验结果经过测试,实时时钟模块能够正确返回当前时间和日期信息,并且能够根据需要进行设置和调整。
七、实验总结本次实验通过对实时时钟原理的学习以及编写驱动程序和测试程序的练习,加深了对嵌入式系统中硬件与软件协同工作的理解。
同时也掌握了一些基本的嵌入式系统开发技能,如硬件连接、驱动编写、调试等。
带看门狗、实时时钟的I2C总线铁电存储器FM31256摘要 FM31256是⼀种基于I2C总线、采⽤铁电体技术的多功能存储芯⽚。
除了⾮易失存储器外,该器件还具有实时时钟、低电压复位、看门狗计数器、⾮易失性事件计数器、可锁定的串⾏数字标识等多种功能。
⽂章主要介绍了FM31256的基本功能、原理,并结合实例给出了其在电磁铸轧电源控制装置中的具体应⽤⽅法。
关键词 I2C总线铁电体技术 RTC MSP430F FM31256是由Ramtron公司推出的新⼀代多功能系统监控和⾮易失性铁电存储芯⽚。
与其他⾮易失性存储器⽐较,它具有如下优点:读/写速度快,没有写等待时间;功耗低,静态电流⼩于1 mA,写⼊电流⼩于150mA;擦写使⽤寿命长,芯⽚的擦写次数为100亿次,⽐⼀般的EEPROM存储器⾼10万倍,即使每秒读/写30次,也能⽤10年;读/写的⽆限性,芯⽚擦写次数超过100亿次后,还能和SRAM⼀样读/写。
铁电存储器(FRAM)的核⼼技术是铁电晶体材料。
这⼀特殊材料使铁电存储器同时拥有随机存取存储器(RAM)和⾮易失性存储的特性。
本⽂介绍了FM31256的主要功能,并具体给出了基于嵌⼊式C语⾔编写的存储器读/写程序。
1 FM31256的基本结构及原理 FM31256由256 KB存储器和处理器配套电路(processor companion)两部分组成。
与⼀般的采⽤备份电池保存数据不同,FM31256是真正意义上的⾮易失(truly nonvolatile)存储器,并且⽤户可以选择对不同的存储区域以软件⽅式进⾏写保护。
FM31256器件将⾮易失FRAM与实时时钟(RTC)、处理器监控器、⾮易失性事件计数器、可编程可锁定的64位ID号和通⽤⽐较器相结合。
其中,通⽤⽐较器可提前在电源故障中断(NMI)时发挥作⽤或实现其他⽤途。
采⽤先进的0.35µm制造⼯艺,这些功能通过⼀个通⽤接⼝嵌⼊到14个引脚的SOIC封装中,从⽽取代系统板上的多个元件。
Real-time Clock Module (I2C Bus)Features→→→→→→→→→→→→→→→→→。
DescriptionFunction BlockNotes:1. No purposely added lead. Fully EU Directive 2002/95/EC (RoHS), 2011/65/EU (RoHS 2) & 2015/863/EU (RoHS 3) compliant.2. See https:///quality/lead-free/ for more information about Diodes Incorporated’s definitions of Halogen - and Antimony-free, "Green" and Lead-free.3. Halogen- and Antimony-free "Green” products are defined as those which contain <900ppm bromine, <900ppm chlorine (<1500ppm total Br + Cl) and <1000ppmSOMaximum RatingsDC Electrical Characteristics(Unless otherwise specified, V= 1.5 ~ 5.5 V, T = -40 °C to +85 °C.)1.After switchover (V SO), V BAT (min) can be2.0V for crystal with R S=40kΩ.2.Switch-over and deselect point.3.Valid for Ambient Operating Temperature: T A = -40 to 85°C; V CC = 2.0 to 5.5V (except where noted). VCC fall time should not exceed 5mV/μs.4.All voltages referenced to GND.5.In 3.3V application, if initial battery voltage is ≥ 3.4V, it may be necessary to reduce battery voltage (i.e., through wave soldering thebattery) in order to avoid inadvertent switchover/reselection for VCC – 10% operation.6.For rechargeable backup, V BAT (max) may be considered to be V CC.AC Electrical CharacteristicsTiming DiagramRecommended Layout for Crystal1212 the equation as below:Cpar + [(C1+C G)*(C2+C D)]/ [(C1+C G)+(C2+C D)] =C LCpar is all parasitical capacitor between X1 and X2.C L is crystal’s load capacitance.Note: The crystal, traces and crystal input pinsshould be isolated from RF generating signals.Function DescriptionOverview of Functions1.Clock function2.Interface with CPU3.Oscillator enable/disable4.Calibration functionRegisters*1. PT7C4311 uses 6 bits for address. That is if write data to 41H, the data will be written to 01H address register.*2. Stop bit. When this bit is set to 1, oscillator and time count chain are both stopped.*3. CEB: Century Enable Bit. CB: Century Bit.*4. Control FT/OUT pin output DC level when 512Hz square wave is disabled.*5. Frequency Test. 512Hz square wave output is enabled at FT/OUT pin, which is using for frequency test.*6. Sign Bit. “1” indicates positive calibration; “0”indicates negative calibration.*7. Using for modifying count frequency. If 20ppm is wanted to slow down the count frequency, 10 (01010) should be loaded. *8. Initialize the control and status register to 10000000 if calibration function is not required.Clock calibrationCalibration:3.Time Counter∙∙∙* Note 2: Do not care.* Note 3: Century Enable Bit and Century Bit.4.Days of the week Counter5.Calendar Counter∙∙Communication1.I2C Bus Interfacea)Overview of I2C-BUSb)System ConfigurationFig.1 System configurationc)Starting and Stopping I2C Bus Communications∙∙∙d)Data Transfers and Acknowledge Responses during I2C-BUS Communication∙Data transfers*Note: with caution that if the SDA data is changed while the SCL line is at high level, it will be treated as a START, RESTART, or STOP condition.Fig.2 Starting and stopping on I2C busData acknowledge response (ACK signal)e)Slave Address2.I2C Bus’s Basic Transfer FormatSCL from Master1289SDA from transmitter(sending side)SDA from receiver(receiving side)Release SDALow activeACK signala)Write via I2C busb)Read via I2C bus∙Standard read∙Simplified readNote:1.The above steps are an example of transfers of one or two bytes only. There is no limit to the number of bytes transferredduring actual communications.2.49H, 4AH are used as test mode address. Customer should not use the addresses.Part MarkingW Package ZE PackagePackaging Mechanical 8- SOIC (W)8- TDFN (ZE)Ordering Information1.No purposely added lead. Fully EU Directive 2002/95/EC (RoHS), 2011/65/EU (RoHS 2) & 2015/863/EU (RoHS 3) compliant.2.See https:///quality/lead-free/ for more information about Diodes Incorporated’s definitions of Halogen- and Antimony-free, "Green" andLead-free.3.Halogen- and Antimony-free "Green” produ cts are defined as those which contain <900ppm bromine, <900ppm chlorine (<1500ppm total Br + Cl) and<1000ppm antimony compounds.4. E = Pb-free and Green5.X suffix = Tape/ReelIMPORTANT NOTICEDIODES INCORPORATED MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARDS TO THIS DOCUMENT, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE (AND THEIR EQUIVALENTS UNDER THE LAWS OF ANY JURISDICTION).Diodes Incorporated and its subsidiaries reserve the right to make modifications, enhancements, improvements, corrections or other changes without further notice tothis document and any product described herein. Diodes Incorporated does not assume any liability arising out of the application or use of this document or any product described herein; neither does Diodes Incorporated convey any license under its patent or trademark rights, nor the rights of others. Any Customer or user of this document or products described herein in such applications shall assume all risks of such use and will agree to hold Diodes Incorporated and all the companies whose products are represented on Diodes Incorporated website, harmless against all damages.Diodes Incorporated does not warrant or accept any liability whatsoever in respect of any products purchased through unauthorized sales channel.Should Customers purchase or use Diodes Incorporated products for any unintended or unauthorized application, Customers shall indemnify and hold Diodes Incorporated and its representatives harmless against all claims, damages, expenses, and attorney fees arising out of, directly or indirectly, any claim of personal injuryor death associated with such unintended or unauthorized application.Products described herein may be covered by one or more United States, international or foreign patents pending. Product names and markings noted herein may also be covered by one or more United States, international or foreign trademarks.This document is written in English but may be translated into multiple languages for reference. Only the English version of this document is the final and determinative format released by Diodes Incorporated.LIFE SUPPORTDiodes Incorporated products are specifically not authorized for use as critical components in life support devices or systems without the express written approval of the Chief Executive Officer of Diodes Incorporated. As used herein:A. Life support devices or systems are devices or systems which:1. are intended to implant into the body, or2. support or sustain life and whose failure to perform when properly used in accordance with instructions for use provided in the labeling can be reasonably expected to result in significant injury to the user.B. A critical component is any component in a life support device or system whose failure to perform can be reasonably expected to cause thefailure of the life support device or to affect its safety or effectiveness.Customers represent that they have all necessary expertise in the safety and regulatory ramifications of their life support devices or systems, and acknowledge andagree that they are solely responsible for all legal, regulatory and safety-related requirements concerning their products and any use of Diodes Incorporated products in such safety-critical, life support devices or systems, notwithstanding any devices- or systems-related information or support that may be provided by Diodes Incorporated. Further, Customers must fully indemnify Diodes Incorporated and its representatives against any damages arising out of the use of Diodes Incorporated products in such safety-critical, life support devices or systems.Copyright © 2020, Diodes Incorporated。
图8-6流程图C51程序:#include<reg51.h>sbit SDA=P3^7;sbit SCL=P3^6;sbit reset=P3^3;//函数声明unsigned char LED_seg[10]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90}; //共阳unsigned char LED_bit[4]={0x01,0x02,0x04,0x08}; //数码unsigned LED_buf[6]={0,0,0,0}; //数码unsigned char i2c_read(unsigned char);void i2c_write(unsigned char,unsigned char);void i2c_send8bit(unsigned char);unsigned char i2c_receive8bit(void);void i2c_start(void);void i2c_stop(void);bit i2c_ack(void);void delay(unsigned int j) //延时{while(j--);}void convert(unsigned long n){unsigned char i=0;while(i<4){LED_buf[i]=(unsigned char)(n%10);n=n/10;i++;}}//======================================================= void main(void){unsigned char dd,i,j;dd=i2c_read(0x00);dd++;j=dd;i2c_write(0x00,dd);while(1){convert(dd);for(i=0;i<2;i++){P0=LED_seg[LED_buf[i]];P1=LED_bit[i];delay(500);}if(reset==0){dd=0x00;i2c_write(0x00,dd);//写入0x00}}}/*======================================================= i2c_write(地址,数据),写一个字节=======================================================*/ void i2c_write(unsigned char Address,unsigned char Data){do{i2c_start();i2c_send8bit(0xA0);}while(i2c_ack());i2c_send8bit(Address);i2c_ack();i2c_send8bit(Data);i2c_ack();i2c_stop();}/*=======================================================i2c_read(地址,数据),读一个字节=======================================================*/ unsigned char i2c_read(unsigned char Address){unsigned char c;do{i2c_start();i2c_send8bit(0xA0);}while(i2c_ack()); //=1,表示无确认,再次发送i2c_send8bit(Address);i2c_ack();do{i2c_start();i2c_send8bit(0xA1);}while(i2c_ack());c=i2c_receive8bit();i2c_ack();i2c_stop();return(c);}//======================================================= //发送开始信号void i2c_start(void){SDA=1;SCL=1;SDA=0;SCL=0;//return;}//发送结束信号void i2c_stop(void){SCL=0;SDA=0;SCL=1;SDA=1;//return;}//发送接收确认信号bit i2c_ack(void){bit ack;SDA = 1;SCL = 1;delay(200);if(SDA==1)ack = 1;else ack = 0;SCL = 0;return(ack);}//送八位数据void i2c_send8bit(unsigned char b){unsigned char i=8;while(i--){SCL=0;SDA=(bit)(b&0x80); b<<=1;SCL=1;}SCL=0;}//i2c接收八位数据unsigned char i2c_receive8bit(void){unsigned char i=8;unsigned char dat=0;SDA=1;while(i--){dat<<=1;SCL=0;SCL=1;dat|=SDA;}SCL=0;return(dat);}四、实验仪器和设备Keil软件;A T89S52实验平台;ISP在线编程软件;五、实验结果和数据分析问题:1.说明IIC总线操作过程;2.说明24C04的操作过程。
I2C 总线实验(实时时钟、EEPROM 和ZLG7290 的实验)一.实验目的加深用户对I2C 总线的理解,熟悉I2C 器件的使用,提供用户实际开发的能力。
二.实验设备及器件IBM PC 机一台DP-51PROC 单片机综合仿真实验仪一台三.实验内容进行I2C 总线控制的实时时钟、EEPROM、ZLG7290 键盘LED 控制器实验。
四.实验要求熟练掌握I2C 总线的控制,灵活运用I2C 主控器软件包,深刻理解实时时钟、EEPROM、ZLG7290 键盘LED 控制的各种功能。
五.实验步骤1.使用导线连接D5 区的SCL、SDA 到A2 区的P16、P17(SCL~P16、SDA~P17),连接D5 区的RST_L、INT_KEY 到A2 区的P10、INT0(RST_L~P10、INT_KEY~INT0),短接D5 区的JP1 跳线。
2.把模拟I2C 软件包“VIIC_C51.C”文件加入到Keil C51 的项目中,程序源文件的开头包含“VIIC_C51.H”头文件。
修改VIIC_C51.C 文件中的sbit SDA=P1^7;和sbit SCL=P1^6;。
图3.21 RTC原理图3.使用函数ISendStr(uchar sla,uchar suba,uchar *s,uchar no)对PCF8563T实时时钟进行设置初始时间,再使用IRcvStr(uchar sla,uchar suba,uchar*s,uchar no)对PCF8563T 实时时钟的时间进行读取。
EEPROM 原理图4.使用函数ISendStr(uchar sla,uchar suba,uchar *s,uchar no);对24WC02EEPROM 进行写入,再使用IRcvStr(uchar sla,uchar suba,uchar *s,uchar no);对24WC02 EEPROM 进行读取。
ZLG7290 原理图5.对ZLG7290 键盘LED 控制器的操作也同理,只是在程序开始的地方增加复位操作和程序中间增加查询是否有键按下。
HYM1307HYM1307带56字节RAM 的I 2C 串行实时时钟芯片特点■基于32.768kHz 的石英晶体,可对秒,分,时,日,月,周以及带闰年补偿的年进行计数■带备用电池的56字节非易失性RAM ■I 2C 串行总线接口■可编程方波输出■自动掉电检测及电源切换电路■电池供电下,振荡器工作时的消耗小于500nA ■可选的工业温度范围:-40℃至+85℃■封装形式:DIP8和SOP8应用■、IC 卡水表、IC 卡煤气表■移动电话■便携仪器■传真机■电池电源产品■电视机概述HYM1307是一款低功耗、带56个字节用户非易失性SRAM (NV SRAM )、全BCD 码的时钟/日历电路。
地址和数据通过串行I 2C 总线传递。
时钟/日历提供秒、分、小时、周、日、月和年信息。
对小于31天的月,月末的日期自动进行调整,还具有闰年校正的功能。
时钟可以工作在24小时格式或带AM/PM 标志的12小时格式。
HYM1307有一个内置的电压判断电路,具有检测电源掉电功能,在电源掉电时,可自动切换到由备用电源(电池)供电。
定购信息型号工作温度范围封装类型HYM1307DIP8HYM1307Z 0℃~70℃SOP8HYM1307N DIP8HYM1307ZN-40℃~+85℃SOP8付费率电度表方框图和管脚功能方框图图1内部方框图管脚图DIP8SOP8管脚说明序号符号描述1X132.768kHz晶体引脚2X232.768kHz晶体引脚3V BAT+3V电池输入4GND地5SDA串行数据输入/输出。
SDA是I2C串行接口的输入/输出线,此引脚为漏极开路6SCL串行时钟。
SCL是I2C串行接口的时钟线,此引脚为漏极开路7SQW/OUT方波输出驱动脚,此引脚为漏极开路8V CC电源输入引脚绝对最大额定值参数名称额定值单位所有引脚到地的电压-0.5~+7.0V贮存温度-55~+125℃DIP8,10秒260℃焊接温度SOP8,10sec260推荐直流工作条件参数符号最小值典型值最大值单位注释电源电压V CC 4.5 5.0 5.5V逻辑1电压V IH 2.2V CC+0.3V逻辑0电压V IL-0.5+0.8V电池电压V BAT 2.0 3.5V直流电气特性参数符号最小值典型值最大值单位注释输入漏电流(SCL)I LI1µAI/O漏电流(SDA&SQW/OUT)I LO1µA逻辑0输出(I OL=5mA)V OL0.4V电源工作电流I CCA 1.5mA7静态电流I CCS200µA1电池电流(OSC ON);I BAT1300500nA2 SQW/OUT OFF电池电流(OSC ON);I BAT2480800nASQW/OUT ON(32kHz)电源失效电压V PF 1.216×V BAT 1.25×V BAT 1.284×V BAT V8交流电气特性参数符号最小值典型值最大值单位注释SCL时钟频率f SCL0100kHzSTOP条件和START条件t BUF 4.7µs之间总线的空闲时间START条件的保持时间t HDSTA 4.0µs3SCL低周期t LOW 4.7µsSCL高周期t HIGH 4.0µsSTART条件的建立时间t SUSTA 4.7µs数据保持时间t HDDAT0µs4,5数据建立时间t SUDAT250nsSDA和SCL的上升时间t R1000nsSDA和SCL的下降时间t F300nsSTOP条件的建立时间t SUSTO 4.7µs每个总线上的容性负载C B400pF6I/O电容(T A=25℃)C I/O10pF指定晶体负载电容(T A=25℃)12.5pF注:1、V CC,SDA和SCL都为5.0V。
Moisture Sensitivity Level: MSL=1• Smart cards • Wireless sensors and tags • Medical/Healthcare electronics • Sports and fitness electronics • Smart Utility meters • Data loggers • Appliances • Tracking systems • Home security systems • Industrial and Consumer electronics • Communications equipment Absolute Maximum RatingsNotesPower Supply Voltage (V DD ) -0.3 3.8 V Backup Supply voltage (V BACKUP )-0.33.8V Input Voltage (V I )V DD Power state-0.3 V DD + 0.3 V V BACKUP Power State-0.3 V BACUUP + 0.3V Output Voltage (V O ) V DD Power state -0.3V DD + 0.3 V V BACKUP Power State-0.3V BACUUP + 0.3V Input Current (I I A m 01 01- )Output Current (I O )-20 20 mA PSW Output Continuous Current (I OPC )50 mA PSW Output Pulsed Current (I OPP )150 mA 1 second pulse ESD Voltage (V ESD )CDM±500 V Charged Device Model HBM±4000 V Human Body ModelLatch-up Current (I LU )100 mA Operating Temperature Range (T OP ) -40+85 ºCStorage Temperature (T STG ) -55+125 ºC Stored as bare product Lead Temperature (T SLD )+300 ºC Hand soldering for 10s Reflow Soldering Temperature (T REF )+260ºCReflow profile per JEDEC J-STD-020D• Ultra-Low current consumption:*************************************************************************• RTC module with built-in crystal oscillating at 32.768 kHz• Operating voltage: 1.5 – 3.6V• Operating temperature range: -40 to +85°C• Factory calibrated Time accuracy ±2.0ppm typ. @ 25°C• Automatic Battery Switchover• Trickle Charger, Power Management & Power Switch Function• Programmable CLKOUT frequencies• I 2C Bus Interface (fast mode 400kHz)• Time keeping mode down to 1.5 V • Programmable Alarm, Timer and INT • Up to 512 Bytes of general purpose RAM• Small and compact package size: 3.7 x 2.5 x 0.9 mm. RoHS-compliant and 100% lead freeN RNDPower Supply and Switchover ParametersT A = -40 to +85°C, Typ. values at +25°C Parameters Type Power State Test ConditionsMin. Typ. Max.Units System Power Voltage (V DD ) Static V DD Power Clocks operating and RAM and registersretained1.53.6V V DD I2C Interface Voltage (V DDIO )StaticV DD PowerI 2C operation1.53.6 V V DD Start-up Voltage (V DDST ) (1)RisingPOR->V DD Power1.6 V V DD Reset Voltage(V DDRST )FallingV DD Power ->PORV BACKUP < V BACKUP, MINor no V BACKUP1.3 1.5 V V DD Rising Switch-overThreshold Voltage(V DDSWR )Rising V BACKUP Power->V DD PowerV BACKUP ≥ V BACKRST1.6 1.7 V V DD Falling Switch-overThreshold Voltage (V DDSWF )FallingV DD Power ->V BACKUP PowerV BACKUP ≥ V BACKSW, MIN1.2 1.5 V V DD Switch-overThreshold Hysteresis (V DDSWH ) (2)Hyst.V DD Power <->V BACKUP Power70 mV V DD Falling Slew Rate toSwitch to V BACKUP State (V DDFS ) (4)FallingV DD Power ->V BACKUP PowerV DD < V DDSW, MAX0.7 1.4 V Backup Voltage (V BACKUP )StaticV BACKUP PowerClocks operating and RAM and registersretained1.4 3.6 V Backup SwitchoverVoltage Range(V BACKSW ) (5)Static V DD Power ->V BACKUP Power1.6 3.6 V Falling Backup PORVoltage (V BACKRST ) (7)Falling V BACKUP Power -> POR V DD < V DDSWF1.1 1.4 V V BACK Margin above V DD(V BMRG ) (3)Static V BACKUP Power200 mV V BACK Supply SeriesResistance (R BACKESR ) (6)Static V BACKUP Power1.01.5kΩN RND(1) V DD must be above V DDST to exit the POR state, independent of the V BACKUP voltage. (2) Difference between V DDSWR and V DDSWF .(3) V BACKUP must be higher than V DD by at least this voltage to insure the AB-RTCMC-32.768kHz-IBO5-S3 remains in the V BACKUP Power state.(4) Maximum V DD falling slew rate to guarantee correct switchover to V BACKUP Power state. There is no V DD falling slew rate requirement if switching to the V BACKUP power source is not required. (5) V BACKUP voltage to guarantee correct transition to V BACKUP Power state when V DD falls.(6) Total series resistance of the power source attached to the V BACKUP pin. The optimal value is 1.5 kΩ, which may require an external resistor. V BACKUP power source ESR (Equivalent Series Resistance) + external resistor value = 1.5 kΩ.(7) V BACKRST is also the static voltage required on V BACKUP for register data retention.Operating ParametersT A = -40 to +85°C, Typ. values at +25°CPositive-going Input Threshold Voltage (V T+) 3.0V1.52.0 V 1.8V1.1 1.25 Negative-going InputThreshold Voltage (V T-)3.0V0.8 0.9V1.8V 0.50.6Input Leakage Current (I ILEAK)3.0V0.02 80 nA Input Capacitance (C I )3pF PSW Output Resistance toV DD (R DSON )PSW enabled1.7V1.75.8 Ω1.8V 1.6 5.4 3.0V 1.1 3.8 3.6V1.053.7 Output Leakage Current (I OLEAK)1.7V – 3.6V0.0280nAOscillator ParametersT A = -40 to +85°C unless otherwise indicated. V DD = 1.7 to 3.6V, Typ. values at +25°C and 3.0VCrystal Frequency (F XT ) 32.768 kHzXT Oscillator FailureDetection Frequency (F OF )8 kHz Calibrated RC Oscillator Frequency (F RCC ) (1)Factory calibrated at +25°C,V DD = 2.8V 64 Hz Uncalibrated RC Oscillator Frequency (F RCU ) Calibration disabled (OFFSETR=0) – 128Hz level89 122 200 Hz Uncalibrated RC Oscillator Cycle-to-Cycle Jitter, |Median| (J RCCC )Calibration disabled (OFFSETR=0) – 128Hz level2000 ppmCalibration disabled (OFFSETR=0) – 1Hz level 500 RC Oscillator Cycle-to-Cycle Jitter, MIN, MAX (J RCCC ) 128Hz level at +25°C -11 %128Hz level -10 to +70°C -3.5 3.5 128Hz level -40 to +85°C -10 10 XT Mode Digital Calibration Accuracy (A XT ) (1)Calibrated at an initial temperature and voltage. Factory calibrated at +25°C,V DD = 3.0V-2+2ppmN RND(Continued)UnitsAutocalibration Mode Timing Accuracy, 512 second period, T A= -10 to +60°C (A AC ) (1) 24 hour run time 35ppm1 week run time20 1 month run time 10 1 year run time3 Autocalibration Mode OperatingTemperature (T AC ) (2)-10+60°C(1) Timing accuracy is specified at 25°C after digital calibration of the internal RC oscillator and digital calibration of the 32.768 kHz crystal. The 32.768 kHz tuning fork crystal has a negative temperature coefficient with a parabolic frequency deviation, which can result in a change of up to 150 ppm across the entire operating temperature range of -40°C to 85°C in XT mode. Autocalibration mode timing accuracy is specified relative to XT mode timing accuracy from -10°C to 60°C.(2) Outside of this temperature range, the RC oscillator frequency change due to temperature may be outside of the allowable RC digital calibration range (+/-12%) for autocalibration mode. When this happens, an autocalibration failure will occur and the ACF interrupt flag is set. The AB-RTCMC-32.768kHz-IBO5-S3 should be switched to use the XT oscillator as its clock source when this occurs. Please see the AUTOCALIBRATION FAILURE section in the application manual for more details.XT Frequency CharacteristicsT A = -40 to +85°C unless otherwise indicated. V DD = 1.7 to 3.6V, Typ. values at +25°C and 3.0V, f OSC = 32.768kHzUnits Frequency Accuracy (∆F/F) T A = +25°C; Calibration disabled (OFFSETX=0)±100 (1)ppm Frequency vs. Temperature Characteristics (∆F/F 0) T OPR = -40 to +85°C-0.035ppm /°C 2 * (T OPR -T 0)2 ±10%ppm Turnover Temperature (T 0)+20 +25+30 °C Aging First YearT A = +25°C±3 ppmOscillator Start-up Voltage T A = -40 to +85°C 1.6V Oscillator Start-up Time V DD = 1.7V – 3.6V 1.0 s CLKOUT Duty CycleF CLKOUT = 32.768kHz;T A = +25°C506070%(1) The XT mode digital calibration accuracy is +/-2 ppm, see OSCILLATOR PARAMETERS.A = -40 to +85°C unless otherwise indicated. V DD = 1.7 to 3.6V, Typ. values at +25°C and 3.0V T N RNDXT Frequency vs. Temperature CharacteristicsV DD Supply CurrentD(1) Excluding external peripherals and pull-up resistor current. All other inputs (besides SDA and SCL) are at 0V or V DD . Test conditions: Continuous burst read/write, 55h data pat tern, 25 μs between each dat a byte, 20 pF load on each bus pin. (2) All inputs and outputs are at 0V or V DD .(3) All inputs and outputs except CLK /INT are at 0V or V DD . 15 pF load on CLK /INT , pull-up resistor current not included.V BACKUP Supply CurrentT A = -40 to +85°C. Typ. values at +25°C, Max. values at +85°C. V BACKUP power state Max. Units V BACKUP Supply Current in XT Oscillator Mode (I VBACK:XT) Time keeping mode with XT oscillator running (1)<V DDSWF 3.0V 63 330 nA 1.8V 60 290 V BACKUP Supply Current in RC Oscillator Mode(I VBACK:RC) Time keeping mode with only the RC oscillator running (XT oscillator is off) (1) <V DDSWF 3.0V19220nA1.8V 16 170 Average V BACKUP Supply Current in Autocalibrated RC Oscillator Mode (I VBACK:ACAL ) Time keeping mode with only the RC oscillator running andAutocalibration enabled. ACP=512 seconds (1) <V DDSWF3.0V25235 nA1.8V21190 V BACKUP Supply Current in V DD powered mode (I VBACK:VDD )V DD powered mode (1)1.7-3.6V3.0V-5 0.6 20 nA1.8V-100.516(1) Test conditions: All inputs and outputs are at 0V or V DD .BREF Electrical CharacteristicsDDT A = -20 to +70°C. Typ. values at +25°C, V = 1.7 to 3.6V. UnitsV BACKUP Falling Threshold (V BRF )0111 2.3 2.5 3.3 V1011 1.9 2.1 2.8 11011.6 1.82.5 1111 1.4 V BACKUP Rising Threshold (V BRR )01112.63.0 3.4 V 1011 2.1 2.5 2.9 1101 1.9 2.2 2.7 11111.6N RND(Continued)T A = -20 to +70°C. Typ. values at +25°C, V DD = 1.7 to 3.6V.UnitsV BACKUP Threshold Hysteresis (V BRH ) 0111 0.5 V1011 0.4 1101 0.4 1111 0.2 BREF/BPOL Change to BBOD Valid (t BREF ) All valid BREF values 1000 ms V BACKUPAnalog ComparatorRecommended OperatingTemperature Range (T BR )All valid BREF Values -20+70°CI 2C AC Electrical Characteristics T A = -40 to +85°C. Typ. values at +25°C Units SCL Input Clock Frequency (f SCL ) 1.7 – 3.6V10400 kHz Low Period of SCL Clock (t LOW ) 1.7 – 3.6V 1.3µs High Period of SCL Clock (t HIGH ) 1.7 – 3.6V 600ns Rise Time of SDA and SCL (t RISE ) 1.7 – 3.6V 300 ns Fall Time of SDA and SCL (t FALL ) 1.7 – 3.6V300 ns START Condition Hold Time (t HD:STA ) 1.7 – 3.6V 600 ns START Condition Setup Time (t SU:STA ) 1.7 – 3.6V 600 ns SDA Setup Time (t SU:DAT V 6.3 – 7.1 ) 100 ns SDA Hold Time (t HD:DAT V 6.3 – 7.1 ) 0 ns STOP Condition Setup Time (t SU:STO ) 1.7 – 3.6V 600 ns Bus Free Time before a New Transmission (t BUF ) 1.7 – 3.6V1.3µsN RNDPower-on AC Electrical CharacteristicsN RRST AC Electrical CharacteristicsRecommended Land PatternBLOCK DIAGRAM: NRN3.7 x 2.5 x 0.9 mm Pb RoHS/RoHS II compliant AB-RTCMC-32.768kHz-IBO5-S32TAPE & REEL:T = 1000pcs/reel Dimensions: mmAbracon Corporation’s products are COTS – Commercial-Off-The-Shelf products; suitable for Commercial, Industrial and, where designated, Automotive Applica-tions. Abracon’s products are not specifically designed for Military, Aviation, Aerospace, Life-dependant Medical applications or any application requiring high reliability where component failure could result in loss of life and/or property. For applications requiring high reliability and/or presenting an extreme operating environment, written consent and authorization from Abracon Corporation is required. Please contact Abracon Corporation for more information.LLC ABRACON IS ISO9001-2015CERTIFIED 5101 Hidden Creek Ln Spicewood TX 78669Phone: 512-371-6159 | Fax: 512-351-8858For terms and conditions of sales, please visit: REVISED : 01.08.2019N R N D。
实时时钟显示例程设计目录1.需求分析 (2)1.1实验目的 (2)1.2实验内容 (2)1.3实验要求 (2)2.实验设备 (2)2.1实验仪器 (2)2.2主要芯片简介 (3)2.2.1 CH451芯片 (3)2.2.2 89S52芯片 (4)2.2.3 CD4052芯片 (5)2.2.4 PCF8563芯片(实验原理) (7)3. I2C协议 (12)4. 实验步骤 (15)4.1硬件连接 (15)4.2软件设计 (17)5. 主程序 (18)5.1主程序流程图 (18)5.2主程序源代码 (18)6.实际测试 (22)7.实验心得 (22)8. 参考文献 (26)1.需求分析1.1实验目的●掌握IO口操作;●掌握显示及键盘芯片的运用;●了解中断的运用;●了解I2C 总线操作。
1.2实验内容●学习使用ZG211硬件综合实验平台,程序设计集成开发环境;●查阅和学习需要的接口芯片资料,掌握接口芯片的使用方法和编程要领,查阅和学习课程设计题目需要的辅助芯片以及器件资料;●设计接口芯片和辅助芯片以及器件与8051单片机连接硬件电路原理图●设计与硬件电路原理图对应的C语言程序(或8051汇编语言)。
给出程序流程图。
在集成开发环境中调试程序。
给出程序的详细注释。
能够解释使用程序模拟电路时序信号和数据。
1.3实验要求●能正常操作LED 数码显示●能通过中断方式接收按键信息●能通过I2C 总线方式与PCF8563 芯片交换数据●能正确解释并显示从PCF8563 芯片取出的日期和时间数据2.实验设备2.1实验仪器●PC机一台;●ZG-211单片机系统实验板一块;●实验连接线若干●芯片:CH451,89S52,CD4052,PCF8563●配套并口编程线一根●配套电源一2.2主要芯片简介2.2.1 CH451芯片CH451是一个整合了数码管显示驱动和键盘扫描控制以及μP 监控的多功能外围芯片。
CH451内置RC 振荡电路,可以动态驱动8位数码管或者64 位LED,具有BCD 译码、闪烁、移位等功能;同时还可以进行64 键的键盘扫描;CH451 通过可以级联的串行接口与单片机等交换数据;并且提供上电复位和看门狗等监控功能。
I2C 总线实验(实时时钟、EEPROM 和ZLG7290 的实验)
一.实验目的
加深用户对I2C 总线的理解,熟悉I2C 器件的使用,提供用户实际开发的能力。
二.实验设备及器件
IBM PC 机一台
DP-51PROC 单片机综合仿真实验仪一台
三.实验内容
进行I2C 总线控制的实时时钟、EEPROM、ZLG7290 键盘LED 控制器实验。
四.实验要求
熟练掌握I2C 总线的控制,灵活运用I2C 主控器软件包,深刻理解实时时钟、EEPROM、ZLG7290 键盘LED 控制的各种功能。
五.实验步骤
1.使用导线连接D5 区的SCL、SDA 到A2 区的P16、P17(SCL~P16、SDA~P17),
连接D5 区的RST_L、INT_KEY 到A2 区的P10、INT0(RST_L~P10、INT_KEY~INT0),短接D5 区的JP1 跳线。
2.把模拟I2C 软件包“VIIC_C51.C”文件加入到Keil C51 的项目中,程序源文件
的开头包含“VIIC_C51.H”头文件。
修改VIIC_C51.C 文件中的sbit
SDA=P1^7;
和sbit SCL=P1^6;。
图3.21 RTC原理图
3.使用函数ISendStr(ucharsla,ucharsuba,uchar *s,uchar no)对
PCF8563T
实时时钟进行设置初始时间,再使用IRcvStr(ucharsla,ucharsuba,uchar
*s,uchar no)对PCF8563T 实时时钟的时间进行读取。
EEPROM 原理图
4.使用函数ISendStr(ucharsla,ucharsuba,uchar *s,uchar no);对
24WC02EEPROM 进行写入,再使用IRcvStr(ucharsla,ucharsuba,uchar *s,uchar
no);对24WC02 EEPROM 进行读取。
ZLG7290 原理图
5.对ZLG7290 键盘LED 控制器的操作也同理,只是在程序开始的地方增加复位操
作和程序中间增加查询是否有键按下。
另外还要增加ZLG7290 软件包“ZLG7290.C”文件加入到Keil C51 的项目中,程序源文件的开头包含“ZLG7290.H”头文件。
六.实验预习要求
认真阅读PCF8563T、24WC02、ZLG7290 的数据手册和模拟I2C 软件包使用
手册,理解硬件结构,还可以先把程序编好,然后在Keil C51 环境下进行软件仿真。
(如果没有在C 语言环境下进行过调试仿真,可以阅读本书的2.5 节关于C 语言环境
进行仿真的设置)
七.实验参考程序
实时时钟程序:
#include "reg52.h"
#include "VIIC_C51.H" //包含VI2C 软件包
#define PCF8563 0xA2 //定义器件地址
#define WRADDR 0x00 //定义写单元首地址
#define RDADDR 0x02 //定义读单元首地址
unsigned char DelayNS(unsigned char no)
{
unsigned char i,j; //延时参数
for(; no>0; no--)
{
for(i=0; i<100; i++)
for(j=0; j<100; j++);
}
return 0;
}
void main()
{
unsigned char td[5]={0x00,0x12,0x00,0x30,0x12};//定义初始化字unsigned char rd[5]; //定义接收缓冲区
//初始化PCF8563,如果需要的话可以去掉
ISendStr(PCF8563,WRADDR,td,0x5);
DelayNS(10);
while(1)
{
IRcvStr(PCF8563,RDADDR,rd,0x3); //读现在的时、分、秒
DelayNS(10);
}
}
EEPROM 程序:
#include "REG52.h"
#include "VIIC_C51.h"
#define CSI24WC02 0XA0
#define uint8 unsigned char
unsigned char delay(unsigned char j)
{
unsigned char k,l; //延时参数
for(l=0;l<=j;l++)
for(k=0;k<=250;k++);
return 0;
}
void main()
{
/*定义发送缓冲区*/
uint8 td[5]={0x00,0x12,0x55,0x30,0x12}; uint8 rd[5]; /*定义接收缓冲区*/
ISendStr(CSI24WC02,0,td,0x5); /*发送数据*/ delay(100);
while(1)
{
IRcvStr(CSI24WC02,0,rd,0x5); /*读取数据*/ delay(100);
while(1);
}
}
ZLG7290 程序:
#include "reg52.h"
#include "VIIC_C51.H" //包含VI2C 软件包
#include "zlg7290.h"
sbit RST=P1^0;
sbit KEY_INT=P3^2;
unsigned char DelayNS(unsigned char no) {
unsigned char i,j; //延时参数
for(; no>0; no--)
{
for(i=0; i<100; i++)
for(j=0; j<10; j++);
}
return 0;
}
void main()
{
unsigned char i,KEY;
RST=0; //zlg7290复位
DelayNS(1);
RST=1;
DelayNS(10);
while(1)
{
if(KEY_INT==0)
{
KEY=ZLG7290_GetKey(); //读键
DelayNS(10);
for(i=0;i<8;i++)
{
ZLG7290_SendCmd(0x60+i,KEY);//显示键值
DelayNS(1);
}
}
}
}
八.实验思考题
(1)请用户再思考一下,I2C 的从设备控制程序应该如何编写。