0436、AT89S52多功能板DXP资料及其相关资料
收藏
资源目录
压缩包内文档预览:
编号:551023
类型:共享资源
大小:3.23MB
格式:RAR
上传时间:2015-12-06
上传人:QQ28****1120
认证信息
个人认证
孙**(实名认证)
辽宁
IP属地:辽宁
6
积分
- 关 键 词:
-
毕业设计论文
- 资源描述:
-
0436、AT89S52多功能板DXP资料及其相关资料,毕业设计论文
- 内容简介:
-
#include #include #include unsigned char code table= 0xc0,0xf9,0xa4,0xb0,0x99,0x92, 0x82,0xf8,0x80,0x90,0x40; unsigned char sec; /定义计数值,每过 1 秒, sec 加 1 unsigned int tcnt; /定时中断次数 bit write=0; /写 24C08 的标志; sbit gewei=P25; /个位选通定义 sbit shiwei=P24; /十位选通定义 /24C08 读写驱动程序 / sbit scl=P34; / 24c08 SCL sbit sda=P35; / 24c08 SDA void delay1(unsigned char x) unsigned int i; for(i=0;ix;i+); ; void flash() ; ; void x24c08_init() /24c08 初始化子程序 scl=1; flash(); sda=1; flash(); void start() /启动( I 方 C)总线 sda=1; flash(); scl=1; flash(); sda=0; flash(); scl=0; flash(); void stop() /停止( I 方 C)总线 sda=0; flash(); scl=1; flash(); sda=1; flash(); void writex(unsigned char j) /写一个字节 unsigned char i,temp; temp=j; for (i=0;i8;i+) temp=temp1; scl=0; flash(); sda=CY; flash(); scl=1; flash(); scl=0; flash(); sda=1; flash(); unsigned char readx() /读一个字节 unsigned char i,j,k=0; scl=0; flash(); sda=1; for (i=0;i8;i+) flash(); scl=1; flash(); if (sda=1) j=1; else j=0; k=(k1)|j; scl=0; flash(); return(k); nts void clock() /(I 方 C)线时钟 unsigned char i=0; scl=1; flash(); while (sda=1)&(i255)i+; scl=0; flash(); /从 24c02 的地址 address 中读取一个字节数据 / unsigned char x24c08_read(unsigned char address) unsigned char i; start(); writex(0xa0); clock(); writex(address); clock(); start(); writex(0xa1); clock(); i=readx(); stop(); delay1(10); return(i); /向 24c02 的 address 地址中写入一字节数据 info/ void x24c08_write(unsigned char address,unsigned char info) EA=0; start(); writex(0xa0); clock(); writex(address); clock(); writex(info); clock(); stop(); EA=1; delay1(50); /24C08 读写驱动程序完 / void Delay(unsigned int tc) /延时程序 while( tc != 0 ) unsigned int i; for(i=0; i100; i+); tc-; void LED() /LED 显示函数 shiwei=0; P0=tablesec/10; Delay(8); shiwei=1; gewei=0; P0=tablesec%10; Delay(5); gewei=1; ntsvoid t0(void) interrupt 1 using 0 /定时中断服务函数 TH0=(65536-50000)/256; /对 TH0 TL0 赋值 TL0=(65536-50000)%256; /重装计数初值 tcnt+; /每过 250ust tcnt 加一 if(tcnt=20) /计满 20 次( 1 秒)时 tcnt=0; /重新再计 sec+; write=1; /1 秒写一次 24C08 if(sec=100) /定时 100 秒,在从零开始计时 sec=0; void main(void) TMOD=0x01; /定时器工作在方式 1 ET0=1; EA=1; x24c08_init(); /初始 化 24C08 sec=x24c08_read(2);/读出保存的数据赋于 sec TH0=(65536-50000)/256; /对 TH0 TL0 赋值 TL0=(65536-50000)%256; /使定时器 0.05 秒中断一次 T
- 温馨提示:
1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
2: 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
3.本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

人人文库网所有资源均是用户自行上传分享,仅供网友学习交流,未经上传用户书面授权,请勿作他用。