《初学者C51自学笔记》之DAC0832转换器

T型电阻网络D/A转换器 :

 2R与2R并联,所以为1R再串联1R总是2R,所以所有总电阻为1R;把I7下的开关与1闭合,则I7=1/2 I,其余同理;

 

 

#include <reg52.h>
#define uchar unsigned char
#define uint unsigned int
sbit cs=P3^1;
sbit wr=P3^4;

//延时函数,在12MHz的晶振频率下
//大约50us的延时
void delay_50us(uint t)
{
	uchar j;
	for(;t>0;t--)
        for(j=19;j>0;j--);
}

void main()
{
	uchar a;
	P1=0x00;
	cs=0;
	wr=0;
	P1=0;
	while(1)
	{
		P0=a;
		delay_50us(100);
		a++; //00000000
	}	
}

猜你喜欢

转载自blog.csdn.net/qq_40691438/article/details/81486591
今日推荐