DS12C887.rar

  • 佩德罗
    了解作者
  • Visual C++
    开发工具
  • 56KB
    文件大小
  • rar
    文件格式
  • 0
    收藏次数
  • 1 积分
    下载积分
  • 2
    下载次数
  • 2014-10-28 22:26
    上传日期
ds12cr887源程序,亲测可用。可以实现精确计时,闹钟定时等功能。
DS12C887.rar
  • DS12C887
  • DS12CR887.uvopt
    55.4KB
  • DS12CR887_uvproj.bak
    13.1KB
  • STARTUP.LST
    13.7KB
  • DS12CR887_uvopt.bak
    55.4KB
  • DS12CR887.hex
    9.1KB
  • DS12CR887.uvproj
    13.3KB
  • DS12CR887.LST
    38.3KB
  • STARTUP.A51
    6.2KB
  • DS12CR887.c
    11.8KB
  • DS12CR887.plg
    161B
  • DS12CR887.M51
    42.4KB
  • DS12CR887.OBJ
    34.8KB
  • STARTUP.OBJ
    749B
  • DS12cr887.h
    1.1KB
  • DS12CR887.lnp
    66B
  • DS12CR887
    30.9KB
内容介绍
#include <reg52.h> #include<intrins.h> #include<DS12cr887.h> void main() { LCD_INIT(); while(1) { keyscan(); DisplayLcd(ReadTemp()); alarm(); if(flag1==1) { didi(); } if(flag==0) //s1没摁下 { if(flag2==0) //s4没摁下 { miao = read_ds(0); fen = read_ds(2); shi = read_ds(4); nian = read_ds(9); yue = read_ds(8); ri = read_ds(7); tian = read_ds(6); Write_sfm(6,miao); Write_sfm(3,fen); Write_sfm(0,shi); Write_nyrt(3,nian); Write_nyrt(6,yue); Write_nyrt(9,ri); // Write_nyrt(12,tian); Write_week(); } } } } void keyscan() //扫描函数 { if(flag1==1) { if(s1==0||s2==0||s3==0||s4==0) //写函数,使按任意键闹钟停 { Delay_1ms(5); if(s1==0||s2==0||s3==0||s4==0) { while(!s1); while(!s2); while(!s3); while(!s4); flag1=0; } } } if(s1==0) { Delay_1ms(5); if(s1==0) { while(!s1); s1num++; flag=1; if(s1num==1) { Write_com(0x80+0x40+7); Write_com(0x0f); } if(s1num==2) { Write_com(0x80+0x40+4); } if(s1num==3) { Write_com(0x80+0x40+1); } if(s1num==4) { Write_com(0x80+10); } if(s1num==5) { Write_com(0x80+7); } if(s1num==6) { Write_com(0x80+4); } if(s1num==7) { Write_com(0x80+14); } if(s1num==8) { s1num=0; Write_com(0x0c); flag=0; write_ds(0,miao); write_ds(2,fen); write_ds(4,shi); write_ds(7,ri); write_ds(8,yue); write_ds(9,nian); write_ds(6,tian); } } } if(s1num!=0) //功能键摁下 { // Write_com(0x80+0x06); // Write_data(table[1]) ; if(s2==0) { Delay_1ms(5); if(s2==0) { while(!s2); if(s1num==1) //miao摁下 { miao++; if(miao==60) { miao=0; } Write_sfm(6,miao); Write_com(0x80+0x40+7); Write_com(0x0f); } if(s1num==2) //fen摁下 { fen++; if(fen==60) { fen=0; } Write_sfm(3,fen); Write_com(0x80+0x40+4); Write_com(0x0f); } if(s1num==3) //shi摁下 { shi++; if(shi==24) { shi=0; } Write_sfm(0,shi); Write_com(0x80+0x40+1); Write_com(0x0f); } if(s1num==4) //ri摁下 { ri++; if(ri==32) { ri=1; } Write_nyrt(9,ri); Write_com(0x80+10); Write_com(0x0f); } if(s1num==5) //yue摁下 { yue++; if(yue==13) { yue=1; } Write_nyrt(6,yue); Write_com(0x80+7); Write_com(0x0f); } if(s1num==6) //nian摁下 { nian++; if(nian==100) { nian=1; } Write_nyrt(3,nian); Write_com(0x80+4); Write_com(0x0f); } if(s1num==7) { tian++; if(tian==8) { tian=1; } write_ds(6,tian); // Write_nyrt(12,tian); Write_week(); Write_com(0x80+14); Write_com(0x0f); } } } if(s3==0) { Delay_1ms(5); if(s3==0) { while(!s3); if(s1num==1) //miao摁下 { miao--; if(miao==-1) { miao=59;} Write_sfm(6,miao); Write_com(0x80+0x40+7); Write_com(0x0f); } if(s1num==2) { fen--; if(fen==-1) { fen=59; } Write_sfm(3,fen); Write_com(0x80+0x40+4); Write_com(0x0f); } if(s1num==3) { shi--; if(shi==-1) { shi=23; } Write_sfm(0,shi); Write_com(0x80+0x40+1); Write_com(0x0f); } if(s1num==4) { ri--; if(ri==0) { ri=31; } Write_nyrt(9,ri); Write_com(0x80+10); Write_com(0x0f); } if(s1num==5) { yue--; if(yue==0) { yue=12; } Write_nyrt(6,yue); Write_com(0x80+7); Write_com(0x0f); } if(s1num==6) { nian--; if(nian==-1) { nian=99; } Write_nyrt(3,nian); Write_com(0x80+4); Write_com(0x0f); } if(s1num==7) { tian--; if(tian==0) { tian=7;; } write_ds(6,tian); // Write_nyrt(12,tian); Write_week(); Write_com(0x80+14); Write_com(0x0f); } } } } } void alarm() { if(s4==0) { Delay_1ms(5); if(s4==0) { while(!s4); s4num++; if(s4num==1) { flag2=1; Write_com(0xc0+7); Write_com(0x0f); } if(s4num==2) { Write_com(0xc0+4) ; Write_com(0x0f); } if(s4num==3) { Write_com(0xc0+1); Write_com(0x0f); } if(s4num==4) { s4num=0; flag2=0; Write_com(0x0c); write_ds(1,miao); write_ds(3,fen); write_ds(5,shi); } } } if(s4num!=0) //功能键摁下 { if(s2==0) { Delay_1ms(5); if(s2==0) { while(!s2); if(s4num==1) //miao摁下 { miao++; if(miao==60) { miao=0; } Write_sfm(6,miao); Write_com(0x80+0x40+7); Write_com(0x0f); } if(s4num==2) //fen摁下 { fen++; if(fen==60) { fen=0; } Write_sfm(3,fen); Write_com(0x80+0x40+4); Write_com(0x0f); } if(s4num==3) //shi摁下 { shi++; if(shi==24) { shi=0; } Write_sfm(0,shi); Write_com(0x80+0x40+1); Write_com(0x0f); } } } if(s3==0) { Delay_1ms(5); if(s3==0) { while(!s3); if(s4num==1) //miao摁下 { miao--; if(miao==-1) { miao=59;} Write_sfm(6,miao); Write_com(0x80+0x40+7); Write_com(0x0f); } if(s4num==2) { fen--; if(fen==-1) { fen=59; } Write_sfm(7,fen); Write_com(0x80+0x40+8); Write_com(0x0f); } if(s4num==3) { shi--; if(shi==-1) { shi=23; } Write_sfm(0,shi); Write_com(0x80+0x40+1); Write_com(0x0f); } } } } } void write_ds(uchar add,uchar dat) //往DS12CR887写数据 { dscs=0; dsas=1; dsds=1; dsrw=1; P0=add; dsas=0; //as下降沿锁存地址 dsrw=0; P0=dat; //变换数据,写数据 dsrw=1; dsas=1; dscs=1; } uchar read_ds(uchar add) { uchar ds_dat; dsas=1; dsds=1; dsrw=1; dscs=0; P0=add; dsas=0; //下降沿锁存地址 dsds=0; P0=0xff; ds_dat=P0; dsds=1; //读数据 dsas=1; dscs=1; return ds_dat; } //void set_time() //{ // write_ds(4,19); // write_ds(2,47); // write_ds(0,30); //} //void set_nyrt() //{ // write_ds(6,01); // write_ds(7,10); // write_ds(8,02); // write_ds(9,14); //} //void set_alarm(uchar ashi,uchar afen,uchar amiao) //{ // write_ds(5,ashi); // write_ds(3,afen); // write_ds(1,amiao); //} void Delay_1ms(uint c) //误差 0us { uchar a,b; for (; c>0; c--) { for (b=199;b>0;b--) { for(a=1;a>0;a--); } } } void Write_com(uchar com) { LCD_EN = 0; //使能 LCD_RS = 0; //选择发送命令 LCD_RW = 0; //选择写入 P0 = com; //放入命令 Delay_1ms(1); //等待数据稳定 LCD_EN = 1; //写入时序 Delay_1ms(5); //保持时间 LCD_EN = 0; P0 = com << 4; //发送低四位 Delay_1ms(1); LCD_EN = 1; //写入时序 Delay_1ms(5); LCD_EN = 0; } void Write_data(uchar dat) { LCD_EN = 0; //使能 LCD_RS = 1; //选择发送命令 LCD_RW = 0; //选择写入 P0 = dat; //放入命令 Delay_1ms(1); //等待数据稳定 LCD_EN = 1; //写入时序 Delay_1ms(5); //保持时间 LCD_EN = 0; P0 = dat << 4; //发送低四位 Delay_1ms(1); LCD_EN = 1; //写入时序 Delay_1ms(5); LCD_EN = 0; } void Write_sfm(uchar add,uchar dat) { u
评论
    相关推荐
    • ds12c887.rar
      这是一个基于DS18B20芯片的c程序,调试已经通过,希望对大家有用.
    • DS12C887-DS18B20.rar
      该程序可实现:以AT89S52单片机为核心,采用实时时钟芯片DS12C887计时和液晶1602作为显示输出,实现了多功能时钟。加入了DS18B20传感器,使时钟还增加了温度显示的功能。
    • DS12C887-based_real-time_calendar_clock_display_sy
      基于DS12C887的实时日历时钟显示系统设计,单片机入门。
    • ds12c887.rar
      基于51单片机的学习资料!里面有串口通信时钟ds12c887的程序资料和原理图(protel99)!程序清晰明了!注释的很清楚便于学习!
    • DS12C887.rar
      基于AT89S52的DS12C887时钟实现,比起DS1302,DS12C887有数据不掉电的功能
    • ds12c887.rar
      ds12c887的实时日历时钟显示系统设计,已经调试通过,源码可靠
    • DS12C887calendar-clock-display.zip
      第14章 基于DS12C887的实时日历时钟显示系统设计
    • 51单片机DS12C887的实时日历时钟显示系统设计.zip
      采用51单片机的时钟日历系统,采用外围芯片为DS12C887
    • DS12C887程序
      DS12C887程序.可以助你一臂之力。C语言更能懂
    • Proteus7.12.rar
      Proteus7.12完美破解版.rar电路仿真软件很好用可以仿真单片数字模拟电路