![数字万用表的一种设计源代码_第1页](http://file1.renrendoc.com/fileroot_temp2/2020-3/7/492cb219-034c-4ba5-bedf-adb213d02f2f/492cb219-034c-4ba5-bedf-adb213d02f2f1.gif)
![数字万用表的一种设计源代码_第2页](http://file1.renrendoc.com/fileroot_temp2/2020-3/7/492cb219-034c-4ba5-bedf-adb213d02f2f/492cb219-034c-4ba5-bedf-adb213d02f2f2.gif)
![数字万用表的一种设计源代码_第3页](http://file1.renrendoc.com/fileroot_temp2/2020-3/7/492cb219-034c-4ba5-bedf-adb213d02f2f/492cb219-034c-4ba5-bedf-adb213d02f2f3.gif)
![数字万用表的一种设计源代码_第4页](http://file1.renrendoc.com/fileroot_temp2/2020-3/7/492cb219-034c-4ba5-bedf-adb213d02f2f/492cb219-034c-4ba5-bedf-adb213d02f2f4.gif)
![数字万用表的一种设计源代码_第5页](http://file1.renrendoc.com/fileroot_temp2/2020-3/7/492cb219-034c-4ba5-bedf-adb213d02f2f/492cb219-034c-4ba5-bedf-adb213d02f2f5.gif)
已阅读5页,还剩2页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
附 录完整程序:#include#include#define uchar unsigned char#define uint unsigned intsbit start=P30; /ADC0808控制端 引脚 定义sbit eoc=P31;sbit cs=P23;sbit clock=P24sbit V=P25; /电压、电流、电阻测量换挡引脚定义sbit I=P26;sbit R=P27;sbit a=P35; /ADC0808控制输入端引脚定义sbit b=P36;sbit c=P37;sbit duan=P20; /锁存器74HC573使能端引脚定义sbit wei=P21;uchar code table=0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71; /共阴数码管代码表0-Fuchar code table1=0xbf,0x86,0xdb,0xcf,0xe6,0xed,0xfd,0x87,0xff,0xef,0xf7,0xfc,0xb9,0xde,0xf9,0xf1; /共阴数码管代码表0-F(带小数点)uchar ge=0,shi=0,bai=0,qian=0,wan=0,sw=0; /声明全局变量,用于数码管显示,分别为“个、十百、千、万、十万”void delay(uint count) /延时1ms 子程序 uint i,j; for(i=0;icount;i+) for(j=0;j120;j+);void clockf() interrupt 1clock=clock;TL0=0xfe;TH0=0xff;TF0=0;/*主函数*/void main() uint adval,adval2,adval3;/声明变量 unsigned long int temp; TL0=0xfe; TH0=0xff; IE0=1; EA=1; TR0=1; while(1) if(V=0) /选择电压档,进行电压测量 a=0;b=0;c=0; /ADC0808通道选择start=0;cs=0;delay(5);start=1;delay(5);start=0;while(1)if(eoc=1) cs=1; adval=P1;/读取数字量temp=adval* 1.0/255* 1000;/换算成具体电压值的100倍cs=0; sw=temp/100000; /取各位的具体数值wan=temp%100000/10000;qian=temp%10000/1000;bai=temp%1000/100;shi=temp%100/10;ge=temp%10;/delay(5); P0=0x00; /清除P0口的数据,方便下次赋值delay(5);wei=1;duan=0; /对数码管进行位选P0=0xdf;delay(2);wei=0;duan=1; /对数码管进行段选(下面类似)P0=tablege;delay(2);P0=0x00;wei=1;duan=0;P0=0xef; delay(2);wei=0;duan=1;P0=tableshi;delay(2); P0=0x00;wei=1;duan=0;P0=0xf7; delay(2);wei=0;duan=1;P0=table1bai;delay(2); P0=0x00;wei=1;duan=0;P0=0xfb; delay(2);wei=0;duan=1;P0=tableqian;delay(2); P0=0x00;wei=1;duan=0;P0=0xfd; delay(2);wei=0;duan=1;P0=tablewan;delay(2); P0=0x00;wei=1;duan=0;P0=0xfe; delay(2);wei=0;duan=1;P0=tablesw;delay(2); P0=0x00;start=1;start=0;delay(10);if(I=0|R=0) break; /中途换挡则退出循环 if(I=0) /选择电流档 进行电流测量 a=0;b=1;c=0;start=0;cs=0;delay(5);start=1;delay(5);start=0; while(1) if(eoc=1) cs=1; adval2=P1; temp=adval2*0.1/255*500000;cs=0; sw=temp/100000;wan=temp%100000/10000;qian=temp%10000/1000;bai=temp%1000/100;shi=temp%100/10;ge=temp%10;P0=0x00;delay(5);wei=1;duan=0;P0=0xdf;delay(2);wei=0;duan=1;P0=tablege;delay(2);P0=0x00;wei=1;duan=0;P0=0xef; delay(2);wei=0;duan=1;P0=tableshi;delay(2); P0=0x00;wei=1;duan=0;P0=0xf7; delay(2);wei=0;duan=1;P0=table1bai;delay(2); P0=0x00;wei=1;duan=0;P0=0xfb; delay(2);wei=0;duan=1;P0=tableqian;delay(2); P0=0x00;wei=1;duan=0;P0=0xfd; delay(2);wei=0;duan=1;P0=tablewan;delay(2); P0=0x00;wei=1;duan=0;P0=0xfe; delay(2);wei=0;duan=1;P0=tablesw;delay(2); P0=0x00;start=1;start=0;delay(10);if(V=0|R=0) break; if(R=0) /选择电阻档 进行电阻测量 a=1;b=0;c=0;start=0;cs=0;delay(5);start=1;delay(5);start=0; while(1) if(eoc=1) cs=1; adval3=P1;temp=adval3* 1.0/255* 100000;cs=0; sw=temp/100000;wan=temp%100000/10000;qian=temp%10000/1000;bai=temp%1000/100;shi=temp%100/10;ge=temp%10;P0=0x00;delay(5);wei=1;duan=0;P0=0xdf;delay(2);wei=0;duan=1;P0=tablege;delay(2);P0=0x00;wei=1;duan=0;P0=0xef; delay(2);wei=0;duan=1;P0=tableshi;delay(2); P0=0x00;wei=1;duan=0;P0=0xf7; delay(2);wei=0;duan=1;P0=table1bai;delay(2); P0=0x00;wei=1;duan=0;P0=0xfb; delay(2);wei=0;duan=1;P0=tableqian;delay(2); P0=0x00;wei=1;duan=0;P0=0xfd; delay(2);
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 高频机作业指导书
- 低压电器作业题
- 电气试验器材规范书
- 下肢骨折课件
- 第11课 拟人的形象(教学课件)-2023-2024学年人教版(2012)美术四年级上册
- 锌银蓄电池项目可行性报告
- 第11课 拟人的形象(教学设计)-2023-2024学年人教版(2012)美术四年级上册
- 2024年影视服务项目可行性报告
- 高压自动重合器项目可行性报告
- 《说和做-记闻一多先生言行片段-臧克家作业设计方案-2023-2024学年初中语文统编版五四学制》
- 不合格品处置记录表(标准版)
- 技能大师工作室建设项目考核细则(试行)
- 《初中生物自制教具研发及应用实践性研究》研究报告 论文
- (完整word版)表土剥离施工方案
- 航天航空科普知识竞赛考试题库及答案(共400多题)
- 河南省驻马店市2022-2023学年高二下学期期末考试生物学试题解析版
- 三年级语文下册人教版-《第三单元复习课》名师教学设计
- 推进“医防融合”-做实国家基本公卫项目
- 生物工程设备-河南科技大学中国大学mooc课后章节答案期末考试题库2023年
- 输配电及用电工程专业技术资格申请(个人技术工作总结)
- 湖北省黄冈黄石鄂州三市2022-2023学年高二下学期期末联考语文试题 (解析版)
评论
0/150
提交评论