当前位置:网站首页>基于51单片机ADC0808的proteus仿真
基于51单片机ADC0808的proteus仿真
2022-07-29 05:22:00 【半生烟火一世迷离】
使用ADC0808的IN0通道,输入CLOCK为500KHZ,采用AT89C51单片机
ADC0808的ADDA、ADDB、ADDC为000对应通道IN0
ADC0808的ADDA、ADDB、ADDC为001对应通道IN1
ADC0808的ADDA、ADDB、ADDC为010对应通道IN2以此内推。
START和ALE可以共用一个I/O口,它们是同步的。
本文采用IN0通道所以ADDA、ADDB、ADDC直接接地。
数码管显示部分代码,数码管采用共阴极显示
#include <REGX52.H>
#include "Delay.h"
sbit we1=P3^0;
sbit we2=P3^1;
sbit we3=P3^2;
sbit we4=P3^3;
//共阴极数码管段码表
unsigned char NixieTable[]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F};
//数码管显示子函数
void Nixie(float num)
{
unsigned int x,y,z,f;
x=num/1000;//取出电压的每一位值
y=(unsigned int)num%1000/100;//(unsigned int)浮点型强制转换为整形数据显示
z=(unsigned int)num%100/10;
f=(unsigned int)num%10;
we1=0;
P0=NixieTable[x]+0x80; //显示小数点和1伏
Delay(1);
we1=1;
P0=0x00;
we2=0;
P0=NixieTable[y]; //段码输出
Delay(1); //显示一段时间
we2=1;
P0=0x00; //段码清0,消影
we3=0;
P0=NixieTable[z]; //段码输出
Delay(1); //显示一段时间
we3=1;
P0=0x00; //段码清0,消影
we4=0;
P0=NixieTable[f]; //段码输出
Delay(1); //显示一段时间
we4=1;
P0=0x00; //段码清0,消影
}
ADC0808转换代码
#include <REGX52.H>
#include <Delay.h>
sbit ST=P2^0;
sbit EOC=P2^1;
sbit OE=P2^2;
unsigned int readDAC0808()
{
unsigned int ADC_NUM;
ST=1;//清空ADC0808的内部寄存器值
Delay(1);
ST=0;//下降沿开始AD转换
while(EOC==0);//判断转换是否结束
OE=1;
ADC_NUM=P1;//接收数据
return ADC_NUM;
}主函数代码
#include <REGX52.H>
#include <Delay.h>
#include <Nixie.h>
#include <DAC0808.h>
void main()
{
float num;
while(1)
{
num=readDAC0808()*(5.0/255)*1000;//读取DAC0808的转换值,并且将二进制数转换为电压值
Nixie(num);//数码管显示
}
}由于是第一次创作还不熟练仅供初学者参考

边栏推荐
- 新能源充电桩后台管理系统平台
- ML15-神经网络(1)
- 2、 During OCR training, txt files and picture data are converted to LMDB file format
- HAL库学习笔记-14 ADC和DAC
- ABSA1: Attentional Encoder Network for Targeted Sentiment Classification
- Torch. NN. Embedding() details
- tensorflow中tf.get_variable()函数详解
- 虚假新闻检测论文阅读(四):A novel self-learning semi-supervised deep learning network to detect fake news on...
- 基于AD9850的多功能信号发生器
- 迁移学习——Transfer Joint Matching for Unsupervised Domain Adaptation
猜你喜欢

1、 Usage of common loss function

ML10自学笔记-SVM

Typical case of xdfs & Aerospace Institute HPC cluster

Transformer review + understanding

迁移学习——Transitive Transfer Learning
![[target detection] generalized focal loss v1](/img/8b/458d51422df8dcda65cb6afaa10b3f.png)
[target detection] generalized focal loss v1

京微齐力:基于HMEP060的OLED字符显示(及FUXI工程建立演示)

ROS教程(Xavier)

HR面必问问题——如何与HR斗志斗勇(收集于FPGA探索者)

基于msp430f2491的proteus仿真
随机推荐
1、 Pytorch Cookbook (common code Collection)
Wechat applet source code acquisition (download with tools)
tensorflow中tf.get_variable()函数详解
fastText学习——文本分类
Migration learning notes - adaptive component analysis
Torch. NN. Parameter() function understanding
2022春招——芯动科技FPGA开发岗笔试题(原题以及心得)
Reading papers on false news detection (I): fake news detection using semi supervised graph revolutionary network
智能温度控制系统
iSCSI vs iSER vs NVMe-TCP vs NVMe-RDMA
入门到入魂:单片机如何利用TB6600高精度控制步进电机(42/57)
1、 Usage of common loss function
AttributeError: module ‘tensorflow‘ has no attribute ‘placeholder‘
NLP领域的AM模型
迁移学习笔记——Adapting Component Analysis
迁移学习——Transfer Joint Matching for Unsupervised Domain Adaptation
华为云14天鸿蒙设备开发-Day7WIFI功能开发
智慧充电桩系统由什么组成?
Hal learning notes - Basic timer of 7 timer
[network design] convnext:a convnet for the 2020s