完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
程序: #ifndef __ABSACC_H__ #define __ABSACC_H__ #define CBYTE ((unsigned char volatilecode *) 0) #define DBYTE ((unsigned char volatiledata *) 0) #define PBYTE ((unsigned char volatilepdata *) 0) #define XBYTE ((unsigned char volatilexdata *) 0) #define CWORD ((unsigned int volatilecode *) 0) #define DWORD ((unsigned int volatiledata *) 0) #define PWORD ((unsigned int volatile pdata*) 0) #define XWORD ((unsigned int volatile xdata*) 0) #ifdef __CX51__ #define FVAR(object, addr) (*((object volatile far *) (addr))) #define FARRAY(object, base) ((objectvolatile far *) (base)) #define FCVAR(object, addr) (*((object const far *) (addr))) #define FCARRAY(object, base) ((objectconst far *) (base)) #else #define FVAR(object, addr) (*((object volatile far *)((addr)+0x10000L))) #define FCVAR(object, addr) (*((object const far *) ((addr)+0x810000L))) #define FARRAY(object, base) ((object volatile far *) ((base)+0x10000L)) #define FCARRAY(object, base) ((objectconst far *) ((base)+0x810000L)) #endif #endif #include "adc0809.c" #define LED_Data P2 #define A 10 #define U 11 ***it LED1=P3^0; ***it LED2=P3^1; ***it LED3=P3^2; ***it LED4=P3^3; ***it dp=P3^5; #define LED_slect P3 static uchar dispdata[4]; void decodenum(float adv,uchar chn) { uint temp; temp=(uint)(adv*100); dispdata[0]=temp/100; dispdata[1]=temp/10%10; dispdata[2]=temp%10; dispdata[3]=chn; } void select(uchar LED) { switch(LED) { case 0:LED1=0;break; case 1:LED2=0;break; case 2:LED3=0;break; case 3:LED4=0;break; default: LED_slect=0xff; } } void dispone(uchar LED,bit ifpoint,uchar number) //,number 0--9 { select(LED); if(ifpoint) dp=1; else dp=0; LED_Data=num[number]|0x80; delayus(200); LED_slect=0xff; } void disp() { uchar i; bit point; for(i=0;i<4;i++) { if(i==1) point=0; else point=1; dispone(i,point,dispdata); } } #include #include #include "numcode.h" #define uchar unsigned char #define uint unsigned int #define adin XBYTE[0x7fff] void delayus(uint us) { while(us--); } uchar ad_action(uchar chn) { uchar read_data; adin=chn; delayus(6); read_data=adin; return read_data; } #ifndef __REG51_H__ #define __REG51_H__ /* BYTE Register */ sfr P0 = 0x80; sfr P1 = 0x90; sfr P2 = 0xA0; sfr P3 = 0xB0; sfr PSW = 0xD0; sfr ACC = 0xE0; sfr B = 0xF0; sfr SP = 0x81; sfr DPL = 0x82; sfr DPH = 0x83; sfr PCON = 0x87; sfr TCON = 0x88; sfr TMOD = 0x89; sfr TL0 = 0x8A; sfr TL1 = 0x8B; sfr TH0 = 0x8C; sfr TH1 = 0x8D; sfr IE = 0xA8; sfr IP = 0xB8; sfr SCON = 0x98; sfr SBUF = 0x99; /* BIT Register */ /* PSW */ ***it CY = 0xD7; ***it AC = 0xD6; ***it F0 = 0xD5; ***it RS1 = 0xD4; ***it RS0 = 0xD3; ***it OV = 0xD2; ***it P = 0xD0; /* TCON */ ***it TF1 = 0x8F; ***it TR1 = 0x8E; ***it TF0 = 0x8D; ***it TR0 = 0x8C; ***it IE1 = 0x8B; ***it IT1 = 0x8A; ***it IE0 = 0x89; ***it IT0 = 0x88; /* IE */ ***it EA = 0xAF; ***it ES = 0xAC; ***it ET1 = 0xAB; ***it EX1 = 0xAA; ***it ET0 = 0xA9; ***it EX0 = 0xA8; /* IP */ ***it PS = 0xBC; ***it PT1 = 0xBB; ***it PX1 = 0xBA; ***it PT0 = 0xB9; ***it PX0 = 0xB8; /* P3 */ ***it RD = 0xB7; ***it WR = 0xB6; ***it T1 = 0xB5; ***it T0 = 0xB4; ***it INT1 = 0xB3; ***it INT0 = 0xB2; ***it TXD = 0xB1; ***it RXD = 0xB0; /* SCON */ ***it SM0 = 0x9F; ***it SM1 = 0x9E; ***it SM2 = 0x9D; ***it REN = 0x9C; ***it TB8 = 0x9B; ***it RB8 = 0x9A; ***it TI = 0x99; ***it RI = 0x98; #endif unsigned char code num[]={ 0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x3e };
|
|
相关推荐
1个回答
|
|
错误在哪儿????
|
|
|
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
使用Keil建立完整的工程,并使用外部中断0触发数码管显示903
418 浏览 0 评论
嵌入式学习-飞凌嵌入式ElfBoard ELF 1板卡-使用AHT20进行环境监测之AHT20传感器介绍
1083 浏览 0 评论
846 浏览 0 评论
886 浏览 1 评论
基于瑞萨FPB-RA4E2智能床头灯项目——1编译环境搭建与点亮驱动ws2812全彩LED
882 浏览 0 评论
【youyeetoo X1 windows 开发板体验】少儿AI智能STEAM积木平台
11834 浏览 31 评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-1 03:20 , Processed in 0.408285 second(s), Total 43, Slave 35 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号