MENU

26 DS1302时钟实验

July 26, 2020 • 51单片机

--- 当前时间: ---

26 DS1302时钟实验

芯片手册

26.1 DS1302的主要性能指标

DS1302实时时钟芯片广泛应用于电话、传真、便携式仪器等产品领域,他的主要性能指标如下:

  1. DS1302是一个实时时钟芯片,具有能计算2100年之前的秒、分、时、日、日期、星期、月、年的能力,还有闰年调整的能力,可以通过配置AM/PM来决定采用24小时格式还是12小时格式
  2. 内部含有31个字节静态RAM,可提供用户访问
  3. 采用串行数据传送方式,使得管脚数量最少,简单SPI <u>3线</u>接口
  4. DS1302的工作电压比较宽,大概是$2.0V\sim5.5V$都可以正常工作
  5. DS1302这种时钟芯片功耗一般都很低,它在工作电压$2.0V$的时候,工作电流小于$300nA$
  6. 时钟或RAM数据的读/写有两种传送方式:单字节传送多字节传送方式
  7. DS1302共有8个引脚,有两种封装形式,一种是DIP封装,另一种是<u>SOIC封装</u>
  8. 与TTL兼容,$VCC=5V$
  9. 可选工业级温度范围:$-40^\circ C\sim+85^\circ C$
  10. 具有涓流充电能力
  11. 可选工业级温度范围:$-40^\circ C\sim+85^\circ C$
  12. 具有涓流充电能力
  13. 采用双电源供电,当主电源比备用电源高$0.2V$时,由主电源供电,否则采用备用电源
  14. 备份电源可由电池(一般是一个纽扣电池)或大容量电容实现

26.2 SPI总线概念

SPI接口的全称是“Serial Peripheral Interface”,意为串行外围接口

SPI接口主要应用在E^2^PROM,FLASH,实时时钟,AD转换器,还有数字信号处理器和数字信号解码器之间

SPI接口是在<u>CPU和外围低速器件之间进行同步串行数据传输</u>,在主器件的移位脉冲下,数据按位传输,高位在前,低位在后,为全双工通信,数据传输速度总体来说比I^2^C总线要快,速度可达到几$Mbps$

SPI接口是以主从方式工作的,这种模式通常有一个主器件和一个或多个从器件,其接口包括以下四种信号(通常是四线,开发板上使用的是三线):

  1. MOSI:主器件数据输出,从器件数据输入
  2. MISO:主器件数据输入,从器件数据输出
  3. SCLK – 时钟信号,由主器件产生
  4. $\overline{CS}$:从器件使能信号,由主器件控制(片选信号)

Master的Controller中有时钟生成控制双方的八位移位寄存器SSPSR(8-bit Shift Register),

最后,SPI接口的一个缺点:没有指定的流控制,没有应答机制确认是否接收到数据

26.3 DS1302引脚功能

其中:

  • X1、X2:$32.768KHz$晶振接入引脚
  • GND:地
  • RST:复位引脚,低电平有效,操作时<u>高电平</u>
  • I/O:数据输入/输出引脚,具有三态功能
  • SCLK:串行时钟输入引脚
  • VCC1:工作电源引脚
  • VCC2:备用电源引脚,接入电池,断电时提供1302电源

26.4 DS1302的寄存器及片内RAM

DS1302有一个控制寄存器、12个日历、时钟寄存器和31个RAM,可读写

26.4.1 控制寄存器

控制寄存器用于存放DS1302的控制命令字,DS1302的RST引脚回到高电平后写入的第一个字就为控制命令,它用于对DS1302读写过程进行控制,它的格式如下:

<p style="margin-left:0in;">D7</p> <p style="margin-left:0in;">D6</p> <p style="margin-left:0in;">D5</p> <p style="margin-left:0in;">D4</p> <p style="margin-left:0in;">D3</p> <p style="margin-left:0in;">D2</p> <p style="margin-left:0in;">D1</p> <p style="margin-left:0in;">D0</p>
<p style="margin-left:0in;">1</p> <p style="margin-left:0in;"><span style="color:#f33b45;">RAM/CK</span></p> <p style="margin-left:0in;">A4</p> <p style="margin-left:0in;">A3</p> <p style="margin-left:0in;">A2</p> <p style="margin-left:0in;">A1</p> <p style="margin-left:0in;">A0</p> <p style="margin-left:0in;">RD/W</p>

其中:

  • D7:<u>固定</u>为1
  • D6:RAM/CK位

    • RAM/CK = 1:片内RAM
    • RAM/CK = 0:日历、时钟寄存器选择位
  • D5~D1:地址位,用于选择进行读写的日历、时钟寄存器或片内RAM,对日历、时钟寄存器或片内RAM的选择<u>见下表</u>
  • D0: RD/W读写选择位

    • RD/W = 0:写
    • RD/W = 1:读
<p style="margin-left:0in;"><span>寄存器名称</span></p> <p style="margin-left:0in;">D7</p> <p style="margin-left:0in;">D6</p> <p style="margin-left:0in;">D5</p> <p style="margin-left:0in;">D4</p> <p style="margin-left:0in;">D3</p> <p style="margin-left:0in;">D2</p> <p style="margin-left:0in;">D1</p> <p style="margin-left:0in;">D0</p>
<p style="margin-left:0in;">1</p> <p style="margin-left:0in;">RAM/CK</p> <p style="margin-left:0in;">A4</p> <p style="margin-left:0in;">A3</p> <p style="margin-left:0in;">A2</p> <p style="margin-left:0in;">A1</p> <p style="margin-left:0in;">A0</p> <p style="margin-left:0in;">RD/W</p>
<p style="margin-left:0in;">秒寄存器</p> <p style="margin-left:0in;">1</p> <p style="margin-left:0in;">0</p> <p style="margin-left:0in;">0</p> <p style="margin-left:0in;">0</p> <p style="margin-left:0in;">0</p> <p style="margin-left:0in;">0</p> <p style="margin-left:0in;">0</p> <p style="margin-left:0in;">0或1</p>
<p style="margin-left:0in;">分寄存器</p> <p style="margin-left:0in;">1</p> <p style="margin-left:0in;">0</p> <p style="margin-left:0in;">0</p> <p style="margin-left:0in;">0</p> <p style="margin-left:0in;">0</p> <p style="margin-left:0in;">0</p> <p style="margin-left:0in;">1</p> <p style="margin-left:0in;">0或1</p>
<p style="margin-left:0in;">小时寄存器</p> <p style="margin-left:0in;">1</p> <p style="margin-left:0in;">0</p> <p style="margin-left:0in;">0</p> <p style="margin-left:0in;">0</p> <p style="margin-left:0in;">0</p> <p style="margin-left:0in;">1</p> <p style="margin-left:0in;">0</p> <p style="margin-left:0in;">0或1</p>
<p style="margin-left:0in;">日寄存器</p> <p style="margin-left:0in;">1</p> <p style="margin-left:0in;">0</p> <p style="margin-left:0in;">0</p> <p style="margin-left:0in;">0</p> <p style="margin-left:0in;">0</p> <p style="margin-left:0in;">1</p> <p style="margin-left:0in;">1</p> <p style="margin-left:0in;">0或1</p>
<p style="margin-left:0in;">月寄存器</p> <p style="margin-left:0in;">1</p> <p style="margin-left:0in;">0</p> <p style="margin-left:0in;">0</p> <p style="margin-left:0in;">0</p> <p style="margin-left:0in;">1</p> <p style="margin-left:0in;">0</p> <p style="margin-left:0in;">0</p> <p style="margin-left:0in;">0或1</p>
<p style="margin-left:0in;">星期寄存器</p> <p style="margin-left:0in;">1</p> <p style="margin-left:0in;">0</p> <p style="margin-left:0in;">0</p> <p style="margin-left:0in;">0</p> <p style="margin-left:0in;">1</p> <p style="margin-left:0in;">0</p> <p style="margin-left:0in;">1</p> <p style="margin-left:0in;">0或1</p>
<p style="margin-left:0in;">年寄存器</p> <p style="margin-left:0in;">1</p> <p style="margin-left:0in;">0</p> <p style="margin-left:0in;">0</p> <p style="margin-left:0in;">0</p> <p style="margin-left:0in;">1</p> <p style="margin-left:0in;">1</p> <p style="margin-left:0in;">0</p> <p style="margin-left:0in;">0或1</p>
<p style="margin-left:0in;"><span style="color:#f33b45;">写保护寄存器</span></p> <p style="margin-left:0in;"><span style="color:#f33b45;">1</span></p> <p style="margin-left:0in;"><span style="color:#f33b45;">0</span></p> <p style="margin-left:0in;"><span style="color:#f33b45;">0</span></p> <p style="margin-left:0in;"><span style="color:#f33b45;">0</span></p> <p style="margin-left:0in;"><span style="color:#f33b45;">1</span></p> <p style="margin-left:0in;"><span style="color:#f33b45;">1</span></p> <p style="margin-left:0in;"><span style="color:#f33b45;">1</span></p> <p style="margin-left:0in;"><span>0或1</span></p>
<p style="margin-left:0in;">慢充电寄存器</p> <p style="margin-left:0in;">1</p> <p style="margin-left:0in;">0</p> <p style="margin-left:0in;">0</p> <p style="margin-left:0in;">1</p> <p style="margin-left:0in;">0</p> <p style="margin-left:0in;">0</p> <p style="margin-left:0in;">0</p> <p style="margin-left:0in;">0或1</p>
<p style="margin-left:0in;">时钟突发模式</p> <p style="margin-left:0in;">1</p> <p style="margin-left:0in;">0</p> <p style="margin-left:0in;">1</p> <p style="margin-left:0in;">1</p> <p style="margin-left:0in;">1</p> <p style="margin-left:0in;">1</p> <p style="margin-left:0in;">1</p> <p style="margin-left:0in;">0或1</p>
<p style="margin-left:0in;">RAM0</p> <p style="margin-left:0in;">1</p> <p style="margin-left:0in;">1</p> <p style="margin-left:0in;">0</p> <p style="margin-left:0in;">0</p> <p style="margin-left:0in;">0</p> <p style="margin-left:0in;">0</p> <p style="margin-left:0in;">0</p> <p style="margin-left:0in;">0或1</p>
<p style="margin-left:0in;">1</p> <p style="margin-left:0in;">1</p> <p style="margin-left:0in;">0或1</p>
<p style="margin-left:0in;">RAM30</p> <p style="margin-left:0in;">1</p> <p style="margin-left:0in;">1</p> <p style="margin-left:0in;">1</p> <p style="margin-left:0in;">1</p> <p style="margin-left:0in;">1</p> <p style="margin-left:0in;">1</p> <p style="margin-left:0in;">0</p> <p style="margin-left:0in;">0或1</p>
<p style="margin-left:0in;">RAM突发模式</p> <p style="margin-left:0in;">1</p> <p style="margin-left:0in;">1</p> <p style="margin-left:0in;">1</p> <p style="margin-left:0in;">1</p> <p style="margin-left:0in;">1</p> <p style="margin-left:0in;">1</p> <p style="margin-left:0in;">1</p> <p style="margin-left:0in;">0或1</p>

26.4.2 日历、时钟寄存器

DS1302共有12个寄存器,其中有7个与日历、时钟相关,存放的数据为BCD码形式

日历、时钟寄存器的格式如表:

<p style="margin-left:0in;"><span>寄存器名称</span></p> <p style="margin-left:0in;"><span>取值范围</span></p> <p style="margin-left:0in;"><span>D7</span></p> <p style="margin-left:0in;"><span>D6</span></p> <p style="margin-left:0in;"><span>D5</span></p> <p style="margin-left:0in;"><span>D4</span></p> <p style="margin-left:0in;"><span>D3</span></p> <p style="margin-left:0in;"><span>D2</span></p> <p style="margin-left:0in;"><span>D1</span></p> <p style="margin-left:0in;"><span>D0</span></p>
<p style="margin-left:0in;"><span>秒寄存器</span></p> <p style="margin-left:0in;"><span>00~59</span></p> <p style="margin-left:0in;"><span style="color:#f33b45;">CH</span></p> <p style="margin-left:0in;"><span>秒的十位</span></p> <p style="margin-left:0in;"><span>秒的个位</span></p>
<p style="margin-left:0in;"><span>分寄存器</span></p> <p style="margin-left:0in;"><span>00~59</span></p> <p style="margin-left:0in;"><span>0</span></p> <p style="margin-left:0in;"><span>分的十位</span></p> <p style="margin-left:0in;"><span>分的个位</span></p>
<p style="margin-left:0in;"><span>小时寄存器</span></p> <p style="margin-left:0in;"><span>01~12或00~23</span></p> <p style="margin-left:0in;"><span>12/24</span></p> <p style="margin-left:0in;"><span>0</span></p> <p style="margin-left:0in;"><span>A/P</span></p> <p style="margin-left:0in;"><span>HR</span></p> <p style="margin-left:0in;"><span>小时的个位</span></p>
<p style="margin-left:0in;"><span>日寄存器</span></p> <p style="margin-left:0in;"><span>01~31</span></p> <p style="margin-left:0in;"><span>0</span></p> <p style="margin-left:0in;"><span>0</span></p> <p style="margin-left:0in;"><span>日的十位</span></p> <p style="margin-left:0in;"><span>日的个位</span></p>
<p style="margin-left:0in;"><span>月寄存器</span></p> <p style="margin-left:0in;"><span>01~12</span></p> <p style="margin-left:0in;"><span>0</span></p> <p style="margin-left:0in;"><span>0</span></p> <p style="margin-left:0in;"><span>0</span></p> <p style="margin-left:0in;"><span>1或0</span></p> <p style="margin-left:0in;"><span>月的个位</span></p>
<p style="margin-left:0in;"><span>星期寄存器</span></p> <p style="margin-left:0in;"><span>01~07</span></p> <p style="margin-left:0in;"><span>0</span></p> <p style="margin-left:0in;"><span>0</span></p> <p style="margin-left:0in;"><span>0</span></p> <p style="margin-left:0in;"><span>0</span></p> <p style="margin-left:0in;"><span>星期几</span></p>
<p style="margin-left:0in;"><span>年寄存器</span></p> <p style="margin-left:0in;"><span>01~99</span></p> <p style="margin-left:0in;"><span>年的十位</span></p> <p style="margin-left:0in;"><span>年的个位</span></p>
<p style="margin-left:0in;"><span>写保护寄存器</span></p> <p style="margin-left:0in;"> </p> <p style="margin-left:0in;"><span>WP</span></p> <p style="margin-left:0in;"><span>0</span></p> <p style="margin-left:0in;"><span>0</span></p> <p style="margin-left:0in;"><span>0</span></p> <p style="margin-left:0in;"><span>0</span></p> <p style="margin-left:0in;"><span>0</span></p> <p style="margin-left:0in;"><span>0</span></p> <p style="margin-left:0in;"><span>0</span></p>
<p style="margin-left:0in;"><span>慢充电寄存器</span></p> <p style="margin-left:0in;"> </p> <p style="margin-left:0in;"><span>TCS</span></p> <p style="margin-left:0in;"><span>TCS</span></p> <p style="margin-left:0in;"><span>TCS</span></p> <p style="margin-left:0in;"><span>TCS</span></p> <p style="margin-left:0in;"><span>DS</span></p> <p style="margin-left:0in;"><span>DS</span></p> <p style="margin-left:0in;"><span>RS</span></p> <p style="margin-left:0in;"><span>RS</span></p>
<p style="margin-left:0in;"><span>时钟突发寄存器</span></p> <p style="margin-left:0in;"> </p> <p style="margin-left:0in;"> </p> <p style="margin-left:0in;"> </p> <p style="margin-left:0in;"> </p> <p style="margin-left:0in;"> </p> <p style="margin-left:0in;"> </p> <p style="margin-left:0in;"> </p> <p style="margin-left:0in;"> </p> <p style="margin-left:0in;"> </p>

说明:

  1. 数据都是BCD码形式存放的
  2. 小时寄存器的D7位为12小时制/24小时制的选择位

    • 当为1时选12小时制,此时

      • D5位为1是上午
      • D5位为0是下午

    D4为小时的十位

    • 当为0时选24小时制,此时,D5、D4位为小时的十位
  3. 秒寄存器中的CH位为时钟暂停位

    • 当为1时钟暂停
    • 为0时钟开始启动
  4. 写保护寄存器中的WP为写保护位

    • WP = 1写保护,当对日历、时钟寄存器或片内RAM进行时WP一般置1
    • WP = 0未写保护,当对日历、时钟寄存器或片内RAM进行时WP应清零
  5. 慢充电寄存器的TCS位为控制慢充电的选择,当它为1010才能使慢充电工作

DS为二极管选择位:

  • DS为01选择一个二极管
  • DS为10选择二个二极管
  • DS为11或00充电器被禁止,与TCS无关

RS用于选择连接在VCC2与VCC1之间的电阻,RS为00,充电器被禁止,与TCS无关,电阻选择情况见表:

<p style="margin-left:0in;"><span>RS位</span></p> <p style="margin-left:0in;"><span>电阻器</span></p> <p style="margin-left:0in;"><span>阻值</span></p>
<p style="margin-left:0in;"><span>00</span></p> <p style="margin-left:0in;"><span></span></p> <p style="margin-left:0in;"><span></span></p>
<p style="margin-left:0in;"><span>01</span></p> <p style="margin-left:0in;"><span>R1</span></p> <p style="margin-left:0in;"><span>2K</span></p>
<p style="margin-left:0in;"><span>10</span></p> <p style="margin-left:0in;"><span>R2</span></p> <p style="margin-left:0in;"><span>4K</span></p>
<p style="margin-left:0in;"><span>11</span></p> <p style="margin-left:0in;"><span>R3</span></p> <p style="margin-left:0in;"><span>8K</span></p>

【什么是8421BCD码】——类十六进制(HEX)转二进制(BIN)

BCD码是通过4位二进制码来表示1位十进制中的0~9这10个数码,4位二进制的权值分别为8、4、2、1

二进制码转换为BCD码的方式为:4位二进制码大于1001时,加6

如:BCD码00001100的二进制码为:$0000\,\,1100+6=0001\,\,0010$

DEC8421BCDDEC8421BCD
0000050101
1000160110
2001070111
3001181000
4010091001

26.4.3 片内RAM

DS1302片内有31个RAM单元,对片内RAM的操作有两种方式:单字节方式多字节方式

  • 当控制命令字为C0H~FDH时为单字节读写方式

命令字中的D5~D1用于选择对应的RAM单元,其中奇数为读操作,偶数为写操作

  • 当控制命令字为FEH、FFH时为多字节操作(表中的RAM突发模式),多字节操作可一次把所有的RAM单元内容进行读写

FEH为操作,FFH为操作

26.5 数据输入输出(I/O)

在控制指令字输入后的下一个SCLK时钟的上升沿时,数据被<u>写入</u>DS1302,数据输入从低位即<u>位0</u>开始

同样,在紧跟8位的控制指令字后的下一个SCLK脉冲的下降沿<u>读出</u>DS1302的数据,读出数据时从低位0位到高位7

【单字节读写】

DS1302是通过SPI串行总线跟单片机通信的,当进行一次读写操作时最少得读写两个字节

  • 第一个字节是控制字节,就是一个命令,告诉DS1302是读还是写操作,是对RAM还是对CLOK寄存器操作
  • 第二个字节就是要读或写的数据了

单字节读写:只有在SCLK为低电平时,才能将CE置为高电平

所以在进行操作之前先将SCLK置低电平,然后将CE置为高电平,接着开始在IO上面放入要传送的电平信号,然后跳变SCLK

数据在SCLK上升沿时,DS1302读写数据,在SCLK下降沿时,DS1302放置数据到IO上

26.6 DS1302模块电路

26.7 实例代码

clock.h

#ifndef _CLOCK_H_
#define _CLOCK_H_

#include<reg52.h>
#include<intrins.h>

#ifndef uchar
#define uchar unsigned char
#endif
 
#ifndef uint 
#define uint  unsigned int
#endif

sbit DSIO = P3^4;
sbit RST  = P3^5;
sbit SCLK = P3^6;
 
// Global functions
void  DS1302Write(uchar addr, uchar dat);
uchar DS1302Read(uchar addr);
void  DS1302Init();
void  DS1302ReadTime();
 
// Global variable
extern uchar TIME[7];
 
#endif

clock.c

#include "clock.h"

//                              sec , min , hr  , day , mon , week, year
uchar code READ_RTC_ADDR[7]  = {0x81, 0x83, 0x85, 0x87, 0x89, 0x8b, 0x8d}; 
uchar code WRITE_RTC_ADDR[7] = {0x80, 0x82, 0x84, 0x86, 0x88, 0x8a, 0x8c};
 
// Init TIME: Wednesday, 01/01/2020 12:00:00 
uchar TIME[7]                = {0x00, 0x00, 0x12, 0x01, 0x01, 0x03, 0x20};
 
void DS1302Write(uchar addr, uchar dat)
{
    uchar n;
    
    RST = 0;
    _nop_();
    SCLK = 0;
    _nop_();
    
    RST = 1;
    _nop_();
 
    for(n = 0; n < 8; n++)    // address
    {
        DSIO = addr & 0x01;
        addr >>= 1;
        
        SCLK = 1;
        _nop_();
        
        SCLK = 0;
        _nop_();
    }
    
    for (n = 0; n < 8; n++)    // data
    {
        DSIO = dat & 0x01;
        dat >>= 1;
        
        SCLK = 1;
        _nop_();
        
        SCLK = 0;
        _nop_();    
    }    
         
    RST = 0;
    _nop_();
}

uchar DS1302Read(uchar addr)
{
    uchar n, dat, dat1;
    
    RST = 0;
    _nop_();
    SCLK = 0;
    _nop_();
    
    RST = 1;
    _nop_();
 
    for(n = 0; n < 8; n++)    // address
    {
        DSIO = addr & 0x01;
        addr >>= 1;
        
        SCLK = 1;
        _nop_();
        
        SCLK = 0;
        _nop_();
    }
    
    _nop_();
    
    for(n = 0; n < 8; n++)    // data
    {
        dat1 = DSIO;
        dat = (dat >> 1) | (dat1 << 7);
        
        SCLK = 1;
        _nop_();
        
        SCLK = 0;
        _nop_();
    }
 
    RST = 0;
    _nop_();    
    
    // The following is the stable time of DS1302 reset, which is required
    SCLK = 1;
    _nop_();
    DSIO = 0;
    _nop_();
    DSIO = 1;
    _nop_();
    
    return dat;    
}

void DS1302Init()
{
    uchar n;
    
    // Turn write protection off
    DS1302Write(0x8e, 0X00);
    
    // Write TIME
    for (n = 0; n < 7; n++)
    {
        DS1302Write(WRITE_RTC_ADDR[n], TIME[n]);
    }
    
    // Turn write protection on
    DS1302Write(0x8e, 0x80);
}

void DS1302ReadTime()
{
    uchar n;
    
    for (n = 0; n < 7; n++)
    {
        TIME[n] = DS1302Read(READ_RTC_ADDR[n]);
    }    
}

main.c

#include <reg52.h>
#include "clock.h"
 
typedef unsigned char u8;    // 1 byte: 0 ~ 255
typedef unsigned int u16;    // 2 byte: 0 ~ 65535 

sbit LSA = P2^2;
sbit LSB = P2^3;
sbit LSC = P2^4;

u8 DisplayData[8];
// 0 ~ 9
u8 code segDis_cat[10]={0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07, 0x7f, 0x6f};

void delay(u16 i)
{
    while(i--);    
}

void Datapros()
{
       DS1302ReadTime();
    DisplayData[0] = segDis_cat[TIME[2] / 16];        // hour
    DisplayData[1] = segDis_cat[TIME[2] & 0x0f];    // or "% 16"             
    DisplayData[2] = 0x40;                            // "-"
    DisplayData[3] = segDis_cat[TIME[1] / 16];        // minute
    DisplayData[4] = segDis_cat[TIME[1] & 0x0f];    
    DisplayData[5] = 0x40;
    DisplayData[6] = segDis_cat[TIME[0] / 16];        // second
    DisplayData[7] = segDis_cat[TIME[0] & 0x0f];
}

void DigDisplay()
{
    u8 i;
    for(i = 0; i < 8; i++)
    {
        switch(i)
        {
            case 0:
                LSA = 0; LSB = 0; LSC = 0; break;    // 0 0 0
            case 1:
                LSA = 1; LSB = 0; LSC = 0; break;    // 0 0 1
            case 2:
                LSA = 0; LSB = 1; LSC = 0; break;    // 0 1 0
            case 3:
                LSA = 1; LSB = 1; LSC = 0; break;    // 0 1 1
            case 4:
                LSA = 0; LSB = 0; LSC = 1; break;    // 1 0 0
            case 5:
                LSA = 1; LSB = 0; LSC = 1; break;    // 1 0 1
            case 6:
                LSA = 0; LSB = 1; LSC = 1; break;    // 1 1 0
            case 7:
                LSA = 1; LSB = 1; LSC = 1; break;    // 1 1 1
        }
        P0 = DisplayData[i];
        delay(100);
        P0 = 0x00;                                    // REMEMBER to clear!
    }        
}

void main()
{
    DS1302Init();
    while(1)
    {
        Datapros();
        DigDisplay();    
    }        
}
Last Modified: August 21, 2020
Archives QR Code
QR Code for this page
Tipping QR Code