• PUDN用户
    了解作者
  • C/C++
    开发工具
  • 119KB
    文件大小
  • rar
    文件格式
  • 0
    收藏次数
  • 1 积分
    下载积分
  • 4
    下载次数
  • 2014-01-11 13:17
    上传日期
基于STC12C5A的电子表,以sd12c887作为时钟芯片,12864作为显示器
DS12C887.rar
  • DS12C887时钟_12C5A_2
  • DS12C887.LST
    28.7KB
  • 12864.OBJ
    12.2KB
  • delay.OBJ
    1.6KB
  • DS12C887.h
    659B
  • eeprom.h
    651B
  • DHT11.h
    230B
  • STARTUP.OBJ
    749B
  • 12864.c
    7KB
  • eeprom.uvopt
    57.9KB
  • eeprom.uvproj
    14.3KB
  • eeprom_uvproj.bak
    14.3KB
  • displaycourse.LST
    11KB
  • eeprom.lnp
    170B
  • keyscan.h
    280B
  • 12864.LST
    13.1KB
  • displaycourse.OBJ
    10.4KB
  • eeprom.LST
    4.2KB
  • STARTUP.A51
    6.2KB
  • eeprom.plg
    218B
  • 12864.h
    936B
  • eeprom
    78.3KB
  • eeprom_uvopt.bak
    8.7KB
  • displaycourse.h
    200B
  • displaycourse.c
    3KB
  • main.LST
    10.5KB
  • eeprom.OBJ
    4.1KB
  • keyscan.OBJ
    21.2KB
  • eeprom.M51
    79.8KB
  • DHT11.c
    2.9KB
  • STARTUP.LST
    13.7KB
  • delay.c
    240B
  • keyscan.c
    9.2KB
  • delay.LST
    1.3KB
  • DS12C887.OBJ
    29.3KB
  • DHT11.OBJ
    8KB
  • DHT11.LST
    7.2KB
  • main.OBJ
    5.5KB
  • delay.h
    156B
  • eeprom.hex
    18.5KB
  • DS12C887.c
    10.3KB
  • eeprom.c
    2.5KB
  • eeprom.uvgui.Administrator
    74.5KB
  • keyscan.LST
    40.6KB
  • main.c
    5.4KB
内容介绍
#include"DS12C887.h" #include<intrins.h> #define miaogeAD 0x07 #define miaoshiAD 0x06 #define fengeAD 0x04 #define fenshiAD 0x03 #define hourgeAD 0x01 #define hourshiAD 0x00 #define dateAD 0x88+2 #define weekAD 0x8f #define monthAD 0x88 volatile unsigned char SecondOld=70,MinuteOld=70,HourOld=25,DateOld=32,WeekOld=8,MonthOld=13; extern volatile bit Z_flag; void WriteData(unsigned char Address,Data) { CS=0; AS=1; DS=1; rw=1; // _nop_(); // _nop_(); // AS=1; // _nop_(); // _nop_(); // _nop_(); // CS=0; // AS=0; DataPort=Address; // _nop_(); // _nop_(); // _nop_(); AS=0; rw=0; DataPort=Data; // _nop_(); // _nop_(); // _nop_(); rw=1; // _nop_(); AS=1; CS=1; } unsigned char ReadData(unsigned char Address) { unsigned char ReadDat; AS=1; DS=1; // rw=0; // DS=1; rw=1; // _nop_(); // _nop_(); // AS=1; // _nop_(); // _nop_(); // _nop_(); CS=0; // AS=0; DataPort=Address; // _nop_(); // _nop_(); // _nop_(); AS=0; DS=0; // _nop_(); // _nop_(); // _nop_(); DataPort=0xff; ReadDat=DataPort; DS=1; // _nop_(); AS=1; CS=1; return ReadDat; } void set_time() { WriteData(0,0); WriteData(1,0); WriteData(2,49);//写分钟 WriteData(3,0); //闹钟分 WriteData(4,2);//写小时 WriteData(5,0); //闹钟小时 WriteData(6,1); //写星期 WriteData(7,30); //写日 WriteData(8,9); //写月 WriteData(9,13); } void DS12C887_init() { WriteData(0x0a,0x20); delayms(50); WriteData(0x0b,0x26); set_time(); } void ReadMonth() { volatile unsigned char Month,monthge,monthshi; Month=ReadData(0x08); if(MonthOld!=Month) { monthshi=Month/10; monthge=Month%10; init_12864(); write_LCD_command(monthAD); delayms(1); write_LCD_data(monthshi+48); write_LCD_data(monthge+48); MonthOld=Month; } } void ReadWeek() { volatile unsigned char Week,temp; volatile unsigned char code week[]={"一二叁四五六日"}; Week=ReadData(0x06); if(WeekOld!=Week) { temp=(Week-1)<<1; init_12864(); write_LCD_command(weekAD); write_LCD_data(*(week+temp)); write_LCD_data(*(week+temp+1)); WeekOld=Week; } } void ReadDate() { volatile unsigned char Date,datege,dateshi; Date=ReadData(0x07); if(DateOld!=Date) { dateshi=Date/10; datege=Date%10; init_12864(); write_LCD_command(dateAD); delayms(1); write_LCD_data(dateshi+48); write_LCD_data(datege+48); DateOld=Date; } ReadWeek(); ReadMonth(); } void ReadHour() { volatile unsigned char Hour,hourge,hourshi; unsigned char code sun[]={ 0x04,0x20,0x42,0x42,0x20,0x04,0x03,0xC0,0x0F,0xF0,0x8F,0xF1,0x5F,0xFA,0x1F,0xF8, 0x1F,0xF8,0x5F,0xFA,0x8F,0xF1,0x0F,0xF0,0x03,0xC0,0x20,0x04,0x42,0x42,0x04,0x20}; unsigned char code mon[]={ 0x00,0x10,0x00,0x08,0x00,0x0C,0x00,0x0E,0x00,0x0E,0x00,0x1F,0x00,0x1F,0x00,0x3F, 0x00,0x3F,0x00,0x7F,0x01,0xFF,0x87,0xFE,0x7F,0xFE,0x3F,0xFC,0x1F,0xF8,0x07,0xE0}; unsigned char code sleep[]={ 0x1E,0x10,0x04,0x08,0x08,0x0C,0x10,0x0E,0x3C,0x0E,0x00,0x1F,0x0E,0x1F,0x04,0x3F, 0x08,0x3F,0x1C,0x7F,0x00,0xFF,0x03,0xFE,0x5F,0xFE,0x3F,0xFC,0x1F,0xF8,0x07,0xE0}; Hour=ReadData(0x04); if(HourOld!=Hour) { hourshi=Hour/10; hourge=Hour%10; init_BMP(); Display(hourge,hourgeAD); Display(hourshi,hourshiAD); HourOld=Hour; if((Hour>=7)&&(Hour<=17)) { init_BMP(); display_BMP1(sun,4); } if((Hour>=18)&&(Hour<=21)) { init_BMP(); display_BMP1(mon,4); } if((Hour>=22)||(Hour<=6)) { init_BMP(); display_BMP1(sleep,4); } } ReadDate(); } void ReadMinute() { volatile unsigned char Minute,fenge,fenshi; Minute=ReadData(0x02); if(MinuteOld!=Minute) { fenshi=Minute/10; fenge=Minute%10; init_BMP(); Display(fenge,fengeAD); Display(fenshi,fenshiAD); MinuteOld=Minute; DisplayTemperture(); } ReadHour(); } void ReadSecond() { unsigned char Second,miaoge,miaoshi,Hour,NUMBER=0; Second=ReadData(0x00); if(SecondOld!=Second) { miaoshi=Second/10; miaoge=Second%10; init_BMP(); Display(miaoge,miaogeAD); Display(miaoshi,miaoshiAD); SecondOld=Second; Z_flag=~Z_flag; Hour=ReadData(0x04); if((Hour>=6)&&(Hour<=7)) { NUMBER=1; } if((Hour>=11)&&(Hour<=13)) { NUMBER=1; } if((Hour>=22)||(Hour<=1)) { NUMBER=1; } switch(NUMBER) { case 0: if(Z_flag==0) { JiariScan(); } else { init_12864(); LCD_ShowBuf(3,0,"蛇年大吉"); } break; case 1: if(Z_flag==0) { eepromscan(); } else { init_12864(); LCD_ShowBuf(3,0,"好好学习"); } break; } ReadMinute(); } } /*void ReadHour1() { unsigned char Hour,hourge,hourshi; Hour=ReadData(0x04); if(HourOld!=Hour) { hourshi=Hour/10; hourge=Hour%10; init_BMP(); Display(hourge,hourgeAD); Display(hourshi,hourshiAD); HourOld=Hour; ReadDate(); }} void ReadMinute1() { unsigned char Minute,fenge,fenshi; Minute=ReadData(0x02); { fenshi=Minute/10; fenge=Minute%10; init_BMP(); Display(fenge,fengeAD); Display(fenshi,fenshiAD); } } */ void ReadSecond1(unsigned char LedAddress,unsigned char AddressFlag) { unsigned char Second,miaoge,miaoshi; volatile bit flag; volatile unsigned char code fanbai[]={ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; Second=ReadData(0x00); if(SecondOld!=Second) { miaoshi=Second/10; miaoge=Second%10; init_BMP(); Display(miaoge,miaogeAD); Display(miaoshi,miaoshiAD); SecondOld=Second; flag=~flag; if(flag==1) { switch(AddressFlag) { case 0: init_BMP(); display_BMP(fanbai,LedAddress); display_BMP(fanbai,LedAddress+1); break; case 1: init_12864(); LCD_ShowBuf(2,LedAddress," "); break; } } else { volatile unsigned char Minute,fenge,fenshi,Hour,hourshi,hourge,Week,temp,Date,datege,dateshi,Month,monthge,monthshi; volatile unsigned char code week[]={"一二叁四五六日"}; Minute=ReadData(0x02); fenshi=Minute/10; fenge=Minute%10; init_BMP(); Display(fenge,fengeAD); Display(fenshi,fenshiAD); Hour=ReadData(0x04); hourshi=Hour/10; hourge=Hour%10; init_BMP(); Display(hourge,hourgeAD); Display(hourshi,hourshiAD); Week=ReadData(0x06); temp=(Week-1)<<1; init_12864(); write_LCD_command(weekAD); write_LCD_data(*(week+temp)); write_LCD_data(*(week+temp+1)); Date=ReadData(0x07); dateshi=Date/10; datege=Date%10; init_12864(); write_LCD_command(dateAD); delayms(1); write_LCD_data(dateshi+48); write_LCD_data(datege+48); Month=ReadData(0x08); monthshi=Month/10; monthge=Month%10; init_12864(); write_LCD_command(monthAD); delayms(1); write_LCD_data(monthshi+48); write_LCD_data(monthge+48); } } } void eepromscan() { // volatile unsigned char code course[]={"自磁通毛控信微概"}; volatile unsigned char i,DayTemp[3],CourseTemp[10],Clock_MonthTemp,Clock_DateTemp,Clock_WeekTemp,Clock_HourTemp,Eeprom_WeekTemp; volatile unsigned int DateCount=0,CourseCount=0; DateCount=0; CourseCount=0; Clock_MonthTemp=ReadData(0x08); //读时钟月 // Clock_DateTemp=ReadData(0x07); //读时钟日 // Clock_WeekTemp=ReadData(0x06); //读时钟星期 // Clock_HourTemp=ReadData(0x04); //读时钟小时 // while
评论
    相关推荐
    • ds12887.rar
      ds12c887实时时钟,驱动程序。带掉电保护。
    • STC12C5A60S2pid.rar
      详细介绍了单片机利用pid控制温度的程序,用的是STC单片机
    • 基于STC12C5A60S2的多功能测量系统设计.zip
      基于STC12C5A60S2的多功能测量系统设计
    • 基于51单片机的DS12C887 实时时钟PL2303+1602液晶系统
      时钟芯片DS12C887、51单片机、USB转串口芯片PL2303、1602液晶     系统特点介绍: 本系统通过上位机与下位机之间的通行协议,实现在三个更新周期内,上位机时间与下位机时间完全同步,适用于时间...
    • 电子时钟课程设计论文
      本作品(含protel图)是以STC89C51单片机作为主控芯片,使用12MHZ的晶振,使用专用时钟日历芯片DS12C887产生时间信息,时间精确。系统具有以下功能:年、月、日、时、分、秒显示;12小时/24小时模式切换,在12小时...
    • PIC单片机与RS-232通讯
      单片机 通讯 RS-232 1 无线射频,手机电路,电视家电,信号处理,电源电路等...3 各类电子课件,电子教材,测量仪表,嵌入式技术,制造技术收藏资料。 4 IC中文资料,IC datasheet,规则标准, 网上查不到,这里找的到。
    • 12c887电子表程序
      基于ds12c887的单片机电子表程序,可以使用按键调节时间和闹钟时间。断电可以保存设定好的时间
    • 基于STC89C52的各外设源代码(涉及51学习所需的全部源代码).rar
      基于STC89C52的各外设源代码...此外还包括基于DS12C887、DS18B20的日历时钟源代码,利用定时器写的软时钟源代码,利用AT24C02、12864液晶写的电子锁源代码,计算器源代码,秒表源代码,利用AT24C02写的闹钟源代码等。
    • HOT-51增强版开发板使用说明.zip
      东流电子HOT51开发板使用说明,包含详细的开发板资源和简单实验
    • Proteus7.12.rar
      Proteus7.12完美破解版.rar电路仿真软件很好用可以仿真单片数字模拟电路