• PUDN用户
    了解作者
  • C/C++
    开发工具
  • 3KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • 1 积分
    下载积分
  • 99
    下载次数
  • 2006-02-08 16:02
    上传日期
用c语言编的时钟芯片DS12C887驱动程序。
ds12c887.zip
  • www.pudn.com.txt
    218B
  • ds12c887.doc
    24KB
内容介绍
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta charset="utf-8"> <meta name="generator" content="pdf2htmlEX"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <link rel="stylesheet" href="https://static.pudn.com/base/css/base.min.css"> <link rel="stylesheet" href="https://static.pudn.com/base/css/fancy.min.css"> <link rel="stylesheet" href="https://static.pudn.com/prod/directory_preview_static/622b34b7ff7f9c46a6c07a6e/raw.css"> <script src="https://static.pudn.com/base/js/compatibility.min.js"></script> <script src="https://static.pudn.com/base/js/pdf2htmlEX.min.js"></script> <script> try{ pdf2htmlEX.defaultViewer = new pdf2htmlEX.Viewer({}); }catch(e){} </script> <title></title> </head> <body> <div id="sidebar" style="display: none"> <div id="outline"> </div> </div> <div id="pf1" class="pf w0 h0" data-page-no="1"><div class="pc pc1 w0 h0"><img class="bi x0 y0 w1 h1" alt="" src="https://static.pudn.com/prod/directory_preview_static/622b34b7ff7f9c46a6c07a6e/bg1.jpg"><div class="c x0 y1 w2 h2"><div class="t m0 x1 h3 y2 ff1 fs0 fc0 sc0 ls0 ws0">typedef unsigned char uchar<span class="_ _0"></span>,byte;</div><div class="t m0 x1 h3 y3 ff1 fs0 fc0 sc0 ls0 ws0">enum REAL_TIME_TYPE</div><div class="t m0 x1 h3 y4 ff1 fs0 fc0 sc0 ls0 ws0">{</div><div class="t m0 x1 h3 y5 ff1 fs0 fc0 sc0 ls0 ws0"> YEAR = 9,</div><div class="t m0 x1 h3 y6 ff1 fs0 fc0 sc0 ls0 ws0"> MONTH = 8,</div><div class="t m0 x1 h3 y7 ff1 fs0 fc0 sc0 ls0 ws0"> DA<span class="_ _1"></span>Y<span class="_ _0"></span> = 7,</div><div class="t m0 x1 h3 y8 ff1 fs0 fc0 sc0 ls0 ws0"> HOUR = 4,</div><div class="t m0 x1 h3 y9 ff1 fs0 fc0 sc0 ls0 ws0"> MINUTE = 2,</div><div class="t m0 x1 h3 ya ff1 fs0 fc0 sc0 ls0 ws0"> SECOND = 0,</div><div class="t m0 x1 h3 yb ff1 fs0 fc0 sc0 ls0 ws0"> WEEK = 6</div><div class="t m0 x1 h3 yc ff1 fs0 fc0 sc0 ls0 ws0">};</div><div class="t m0 x1 h3 yd ff1 fs0 fc0 sc0 ls0 ws0">typedef struct</div><div class="t m0 x1 h3 ye ff1 fs0 fc0 sc0 ls0 ws0">{</div><div class="t m0 x1 h3 yf ff1 fs0 fc0 sc0 ls0 ws0"> uchar cY<span class="_ _1"></span>ear;</div><div class="t m0 x1 h3 y10 ff1 fs0 fc0 sc0 ls0 ws0"> uchar cMon;</div><div class="t m0 x1 h3 y11 ff1 fs0 fc0 sc0 ls0 ws0"> uchar cDay;</div><div class="t m0 x1 h3 y12 ff1 fs0 fc0 sc0 ls0 ws0"> uchar cHour;</div><div class="t m0 x1 h3 y13 ff1 fs0 fc0 sc0 ls0 ws0"> uchar cMin;</div><div class="t m0 x1 h3 y14 ff1 fs0 fc0 sc0 ls0 ws0"> uchar cSec;</div><div class="t m0 x1 h3 y15 ff1 fs0 fc0 sc0 ls0 ws0"> uchar cW<span class="_ _1"></span>eek;</div><div class="t m0 x1 h3 y16 ff1 fs0 fc0 sc0 ls0 ws0">}REAL<span class="_ _1"></span>TIME;</div><div class="t m0 x1 h3 y17 ff1 fs0 fc0 sc0 ls0 ws0">SetRealT<span class="_ _0"></span>ime(REAL<span class="_ _1"></span>TIME * pRealT<span class="_ _0"></span>ime)</div><div class="t m0 x1 h3 y18 ff1 fs0 fc0 sc0 ls0 ws0">{</div><div class="t m0 x1 h3 y19 ff1 fs0 fc0 sc0 ls0 ws0"> PBYTE[0x0b] |=0x80;</div><div class="t m0 x1 h3 y1a ff1 fs0 fc0 sc0 ls0 ws0"> PBYTE[0x00] =pRealT<span class="_ _0"></span>ime-&gt; cSec;</div><div class="t m0 x1 h3 y1b ff1 fs0 fc0 sc0 ls0 ws0"> PBYTE[0x02] =pRealT<span class="_ _0"></span>ime-&gt; cMin;</div><div class="t m0 x1 h3 y1c ff1 fs0 fc0 sc0 ls0 ws0"> PBYTE[0x04] =pRealT<span class="_ _0"></span>ime-&gt; cHour;</div><div class="t m0 x1 h3 y1d ff1 fs0 fc0 sc0 ls0 ws0"> PBYTE[0x07] =pRealT<span class="_ _0"></span>ime-&gt; cDay;</div><div class="t m0 x1 h3 y1e ff1 fs0 fc0 sc0 ls0 ws0"> PBYTE[0x08] =pRealT<span class="_ _0"></span>ime-&gt; cMon;</div><div class="t m0 x1 h3 y1f ff1 fs0 fc0 sc0 ls0 ws0"> PBYTE[0x09] =pRealT<span class="_ _0"></span>ime-&gt; cY<span class="_ _1"></span>ear;</div><div class="t m0 x1 h3 y20 ff1 fs0 fc0 sc0 ls0 ws0"> PBYTE[0x06] =pRealT<span class="_ _0"></span>ime-&gt; cW<span class="_ _2"></span>eek;</div><div class="t m0 x1 h3 y21 ff1 fs0 fc0 sc0 ls0 ws0"> PBYTE[0x0b] &amp;=0x7f;</div><div class="t m0 x1 h3 y22 ff1 fs0 fc0 sc0 ls0 ws0">}</div><div class="t m0 x1 h3 y23 ff1 fs0 fc0 sc0 ls0 ws0">Init12887()</div><div class="t m0 x1 h3 y24 ff1 fs0 fc0 sc0 ls0 ws0">{</div><div class="t m0 x1 h3 y25 ff1 fs0 fc0 sc0 ls0 ws0"> PBYTE[0x0a] =0x2f;</div><div class="t m0 x1 h3 y26 ff1 fs0 fc0 sc0 ls0 ws0"> PBYTE[0x0b] =0x06;</div><div class="t m0 x1 h3 y27 ff1 fs0 fc0 sc0 ls0 ws0"> // reg b: SET<span class="_ _1"></span>,PIE,AIE,VIE,SQWE,DM,24/12,DSE</div><div class="t m0 x1 h3 y28 ff1 fs0 fc0 sc0 ls0 ws0">}</div><div class="t m0 x1 h3 y29 ff1 fs0 fc0 sc0 ls0 ws0">uchar GetT<span class="_ _0"></span>ime(uchar cID) </div><div class="t m0 x1 h3 y2a ff1 fs0 fc0 sc0 ls0 ws0">{</div><div class="t m0 x1 h3 y2b ff1 fs0 fc0 sc0 ls0 ws0"> // cID = 9 will get year<span class="_ _0"></span>, 8 will get month...</div><div class="t m0 x1 h3 y2c ff1 fs0 fc0 sc0 ls0 ws0"> uchar val;</div><div class="t m0 x1 h3 y2d ff1 fs0 fc0 sc0 ls0 ws0"> uint n = 65; // timeout counter<span class="_ _0"></span>, avoid die loop</div></div></div><div class="pi" data-data='{"ctm":[1.611850,0.000000,0.000000,1.611850,0.000000,0.000000]}'></div></div> </body> </html>
评论
  • redlike 2010-12-11 19:02:18
    程序被主人删了好几大段,太缺德了,浪费我的点数,你陪
相关推荐
  • DS12C887.rar
    该程序基于STC89C52的DS12C887时钟程序,测试通过,且能稳定运行,请放心使用。
  • ds12c887.rar
    DS12c887电子时钟,1602液晶屏显示,
  • DS12C887.rar
    ds12cr887源程序,亲测可用。可以实现精确计时,闹钟定时等功能。
  • ds12c887时钟.rar
    51单片机驱动DS12C887时钟芯片制作的LCD时钟,有温湿度,农历显示
  • ds12c887.zip
    实时时钟ds12c887驱动程序,atmega128平台测试通过
  • DS12c887.zip
    C51程序运用stc12c5a系列的单片机即可驱动,DS12c887时钟芯片的正常工作,利用共阴数码管显示。已测试完成。
  • ds12c887.rar
    ds12c887 interfacing with 8051.the code just initialises ,reads and displays it in the serial port.
  • ds12c887.rar
    ds12c887 interfacing with 8051.the code just initialises ,reads and displays it in the serial port.
  • DS12C887.zip
    DS12C887是一款时钟芯片,精度高,误差小。驱动简单。
  • DS12C887程序
    DS12C887程序.可以助你一臂之力。C语言更能懂