⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 0804_1.c

📁 51联合adc0804测电压程序。可以测0`5V电压,精确到千分位4位数码管显示。
💻 C
字号:
#include<reg52.h>
#define uchar unsigned char
#define uint unsigned int
sbit wr=P0^2;
sbit rd=P0^1;
sbit cs=P0^0;
void delay(uint z)
{
    uint t1,y;
    for(t1=z;t1>0;t1--)
        for(y=110;y>0;y--);
}
void init();
void start();
void main()
{
    init();
    while(1)
    {
        start();
        delay(20);
        rd=0;
        delay(10);
        rd=1;
		P3=P2;
        delay(1000);
    }	
}
void init()
{
    P0=0x00;
	P1=0xF0;
	P3=0x0f;
}
void start()
{
    wr=1;
    wr=0;
    wr=1;	
}
#include<reg52.h>
#define uchar unsigned char
#define uint unsigned int
sbit wr=P0^2;
sbit rd=P0^1;
sbit cs=P0^0;
uint a,xx,on,sp,bp,qp,ii,sum;
uint table0[]=
{0xc0,0xf9,0x94,0xb0,0xa9,
0xa2,0x82,0xf8,0x80,0xa0};
uint table1[]=
{0x40,0x79,0x14,0x30,0x29,
0x22,0x02,0x78,0x00,0x00};
void delay(uint z)
{
    uint t1,y;
    for(t1=z;t1>0;t1--)
        for(y=110;y>0;y--);
}
void init()
{
	P1=0x0f;
   	P3=0xff;
	cs=0;
	wr=0;
	rd=1;
	sum=0;
}
void start()
{
    wr=1;
    wr=0;
    wr=1;	
}
void fen(uint z)
{
	on=(z+1)*5/256;																				   	
	sp=(z+1)*50/256%10;
	bp=z*500/256%10;
	qp=z*5000/256%10;
}
void display(uint w,uint x,uint y,uint z)
{
	P1=0x0e;
	P3=table1[w];
	delay(5);

	P1=0x0d;
	P3=table0[x];
	delay(5);

	P1=0x0b;
	P3=table0[y];
	delay(5);

	P1=0x07;
	P3=table0[z];
	delay(5);

		start();
		delay(1);
    	rd=0;
		a=P2;
		sum+=a;
		ii++;
		if(ii==20)
		{
		xx=sum/20;
		ii=0;
		delay(1);			
		fen(xx);
		sum=0;
		}
		
}
void main()
{
    init();
    while(1)
    {	   
			display(on,sp,bp,qp);
			delay(1);	
    }
}
电子工程师应该上的网站  
http://www.cyfronika.com.pl/BDM/willem.html http://www.cyfronika.com.pl  
国外好网站 
http://www.william.com.cn/atmel/index.asp#  
ATMEL中文推广 
http://dzxx.cn-dz.com http://dzxx.mlyhs.com http://bes.8u8.com/pcb/k.htm  
热转印制板的详细过程 
http://www.teachersong.com/index1.htm  
宋容个人教学单片机  
http://www.etuni.com/index.asp  
下载,论坛,特好! 
http://www.pcbtech.net/  
中国PCB技术网 
http://allgames.gamesh.com/emu/host/ediy/dpj/mcuy10a.htm  
http://sdkh.51.net/dz/atm89.htm http://www.mcudiy.com/index.htm  
AVR开发! ***** 
http://www.szhr.com.cn/mainframe.html  
深圳市人才市场招聘  
http://shada.ocnc.net/laf/  
tc教程 http://www.89s51.com/article/ArticleShow.asp?ArticleID=26  
keil c教程  
http://lightingchina.com/  
http://www.wenrun.com/  
http://lightingchina.com/member/vipunit_cp.asp?unitid=9993  
LED  
http://www.mcu21cn.com/default.asp  
单片机  
http://www.jinjubao.com/  
聚宝盆  
http://www.fjmcu.com/  
http://www.mcustudy.com/cpld/ispexpert.pdf  
cpld  
http://www.21icbbs.com/club/bbs/ShowAnnounce.asp?v=&ID=663163  
AVR  
http://www.teachersong.com/  
pic单片机  
http://elec.51.net/cpzz.htm  
遥控  
http://www.21icsearch.com/pmcu/dpjjx/ndpjjx.htm http://www.mcustudio.com/dpjjx/cteach/learnC.htm  
学单片机了  
http://www.jlste.com.cn  
自考  
http://hjwang.xiloo.com/index2.html  
电话控制 
 http://hlbds.xiloo.com/index.htm  
电子制作***  
http://www.c51bbs.com/c51src.htm  
C51咨询网  
http://hjwang.xiloo.com/ic1/main_ic3.htm  
实用文章  
http://www.amr-system.com.cn/default.htm  
电力线载波  
http://202.117.27.64/ziliao/www.daqchina.net  
http://www.netdzb.com/zhongyao/zywz.asp  
电子报  
http://www.yxdz.com.cn/docc/yxdz9.htm  
防盗  
http://www.szintech.com/gpstech/tech2.htm  
GPS  
jdtwpublic@sina.com  
http://www.58ic.com/emccomm.asp  
IC介绍  
http://wuming.3322.net/index1.htm  
Protel入门  
http://ecad.51.net/  
Protel入门  
http://www.mcustudy.com  
单片机  
http://www.xiao-qi.com/cpld/cpld.php3  
CPLD  
http://www.atnet1000.com/  
自动化  
www.datasheetlocator.com  
世界IC资料  
http://topinc.126.com  
IC资料及制作***  
http://www.netdzb.com/bbs/listbbs.asp?boardid=8&page=27  
电子BBS***  
http://a51.nease.net/index.htm  
单片机***  
http://www.chinadz.com/index/  
资料联盟  
httt://gddq.126.com  
http://www.jimmyjun.8u8.com/dianzizhizou/j.htm  
语音识别  
http://dada.tongtu.net/  
大大电子  
http://www.jlste.com.cn/bbs/detailTable.asp?id=9208 http://www.ioor.net/hseda/main.htm ****** http://www.mcu51.com/download/digitpdf/40xx/ 
关于4000系列资料  
http://www.mcu51.com/download/digitpdf/45xx/ 
关于4500系列资料  
http://www.mcu51.com/download/digitpdf/74xx/ 
关于7400系列资料 
 http://www.mcu51.com/download/RS485note.pdf 
关于RS485的资料  
http://www.mcu51.com/download/binhex.com 
工具  
http://www.mcu51.com/download/hexbin.exe 
工具  
http://www.mcu51.com/download/c51eval.zip 
关于C51的资料  
http://www.mcu51.com/download/digitpdf/CPU/ 
关于CPU的资料  
http://www.maxim-ic.com.cn/Max1800-2690/MAX220-M.PDF 
资料  
http://www.maxim-ic.com.cn 
达拉斯公司主站  
http://etuni.com/downdata.asp?id=832&C51Tip.pdf 
关于C51的资料  
http://www.mcu-tech.com/download/c51%20user1.pdf 
关于C51的资料  
http://www.laogu.com/download/c51ctl.zip 
关于C51的资料 
 http://etuni.com/downsoft.asp?id=118&KeilC51v612.zip 
是C51中文资料  
http://www.whwave.com.cn/wsjiaocai.htm 
教材、资料  
http://www.whwave.com.cn/WWIC.htm 
部分IC资料  
http://www.whwave.com.cn/FM24CXX.htm 
关于24系列资料  
http://www.hongyan-e.com/web/dzbic.htm 
部分IC资料  
http://www.cetinet.com/downloadtemp/chuankouzsV2.1.zip 
免费串口调试器  
http://www.atmel.com/dyn/products/param_table.asp?family_id=604&OrderBy=part_no&Direction=ASC 
关于ATEML全系列资料  
1. 中国电子网 
(http://www.21ic.com/)  
2. 中国电子资料网(http://www.chinadz.com/)  
3. 广州电子技术网(http://gzdzw.51.net/)  
4. 中国电子行业信息网(http://www.ceic.gov.cn/)  
5. 电子制作天地(http://www.dzdiy.com/)  
6. 电子爱好者(http://www.etuni.com)  
7. 电子工程师(http://www.eebyte.com)  
8. 电子空间资讯(http://go.163.com/~rihuri)  
9. 老古开发网(http://www.laogu.com/)  
10. 单片机产品设计中心(http://www.syhbgs.com/)  
11. 51单片机世界(http://wwwmcu51.com/)  
12. 平凡的单片机(http://teach51.yeah.net/)  
13. 周立功单片机世界(http://www.zigmcu.com/)  
14. 嵌入开发网(http://www.embed.com.cn/)  
15. Microchip公司中文网站(http://microchip.com.cn)  
16. Atmel公司英文网站(http://www.atmel.com/)  
17. 茂林电子继承电路专页(http:/www.maolin.com.ccircuit/main.htm)  
18. 中国集成电路网(http://www.chinaicip.com/)  
19. IC交易网(http://ic.net.cn/)  
20. IC商务网(http://www.buy-ic.com/)  
21. 集成网(http://ic-net.com.cn/)  
22. 电子元器件世界(http://www.ic-world.net/)  
23. 元器件在线(http://www.56789.com/)  
24. 中华IC网(http://www.sinoic.com/)  
25. 盛名零件网(http://www.icminer.com/)  
26. 网络半导体数据库(http://www.bgs.nu/sdw/) 
27. 中国PCB技术网(http://pcbtech.net/)  
28. PCB信息网(http://www.pcbinfo.net/)  
29. EDA2000(http://www.myeda.org/cn/)  
30. EDA中国论坛(http://www.edachina.com/)  
31. 可编程逻辑器件(http://www.pld.com.cn/)  
32. 宇成设计(http://ecdesign.my163.com/)  
33. 吴鸣工作站(http://wuming.3322.net/)  
34. PCB世界(http://www.pcbworld.net/) 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -