|
#include<reg51.h>
#define uint unsigned int
#define uchar unsigned char
#define LED P0
#define out P1
sbit start=P2^1;
sbit OE=P2^7;
sbit EOC=P2^3;
sbit clock=P2^0;
sbit add_a=P2^4;
sbit add_b=P2^5;
sbit add_c=P2^6;
void main(void)
{
uchar temp;
add_a=1;add_b=0;add_c=0; //選擇ADC0809的通道0
while(1)
{
start=0;
start=1;
start=0; //啟動轉換
while(1)
{
clock=!clock;
if(EOC==1)
break;
}//等待轉換結束
OE=1; //允許輸出
temp=out; //暫存轉換結果
OE=0; //關閉輸出
LED=temp; //采樣結果通過P0口輸出到LED
}
}
附件中包含proteus仿真電路圖
|
-
-
ADC0809.rar
2020-6-12 20:41 上傳
點擊文件名下載附件
下載積分: 黑幣 -5
57.66 KB, 下載次數: 18, 下載積分: 黑幣 -5
|