ADC0809C的51单片机编程程序解答
#include <AT89X52.H>unsigned char code dispbitcode[]={0xfe,0xfd,0xfb,0xf7, 0xef,0xdf,0xbf,0x7f};unsigned char code dispcode[]={0x3f,0x06,0x5b,0x4f,0x66, 0x6d,0x7d,0x07,0x7f,0x6f,0x00};unsigned char dispbuf[8]={10,10,10,10,10,0,0,0}; //(这句什么意思?数组里的 10 .0什么意思,为什么是这样写)unsigned char dispcount;sbit ST=P3^0;sbit OE=P3^1;sbit EOC=P3^2;unsigned char channel=0xbc;//IN3unsigned char getdata;void main(void){ TMOD=0x01; TH0=(65536-4000)/256; TL0=(65536-4000)%256; TR0=1; ET0=1; EA=1; P3=channel;//这里是不是设置ABC来选择IN通道? while(1){ ST=0; ST=1; ST=0; while(EOC==0);//(这里为什么是EOC==0,如果ADC0809还没转换完EOC==0,那这样不会进入死循环吗?) OE=1; getdata=P0; OE=0; dispbuf[2]=getdata/100;/这句什么意思? getdata=getdata%10; //这句什么意思 dispbuf[1]=getdata/10; //这句什么意思 dispbuf[0]=getdata%10; //这句什么意思 }}void t0(void) interrupt 1 using 0{ TH0=(65536-4000)/256; TL0=(65536-4000)%256; P1=dispcode[dispbuf[dispcount]]; P2=dispbitcode[dispcount]; dispcount++; if(dispcount==8) { dispcount=0; }}麻烦给为大侠帮解答下,我没分,所以没办法多给还有想知道如果我把数码管改为1602液晶显示的话,怎么把ADC0809所转换的数据赋值给char code table[]=?????
更多
提问者:xue59927
发布于2010-12-14