欢迎来到天天文库
浏览记录
ID:39464296
大小:51.00 KB
页数:3页
时间:2019-07-03
《ADC0808运用总线》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、程序#include#include#include#include#include#include#include#defineADC08080xf000unsignedcharAdbuf[8];floatDy[8];floatT[8];codecharLEDTAB[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,};voidDelayms(unsignedintms){whil
2、e(ms){unsignedchari;for(i=0;i<240;i++);ms--;}}voidex0int()interrupt0{}unsignedcharAd(charloop){charc;XBYTE[ADC0808]=loop;Delayms(1);c=XBYTE[ADC0808];XBYTE[ADC0808]=loop;Delayms(1);c=XBYTE[ADC0808];returnc;}voidAds(){chari;for(i=0;i<8;i++){Adbuf[i]=Ad(i);Dy[i]=Adbuf[i]*5.0/255.0;T[i]=Adbu
3、f[i]*100.0/255.0;}P1=Adbuf[0];P2=Adbuf[7];}voidmain(){while(1){Ads();}}仿真
此文档下载收益归作者所有