求大神帮助,adc0804转换电压在12864上显示的仿真

2019-03-24 18:01发布

QQ截图20150428112103.png




//测出的电压经0804转换后在12864上显示

#include<reg52.h>

#define uchar unsigned char
#define uint unsigned int
#define port P1 //DB0~DB7数据口
sbit e=P2^0;//使能
sbit rw=P2^1;//读写
sbit rs=P2^2;//数据/命令
sbit cs2=P2^3;//片选
sbit cs1=P2^4;
sbit busy=P1^7;//检测忙




#define date  P0
sbit cs=P2^5;    //片选信号,控制芯片的启动,低电平有效
sbit rd=P2^6;   //读数据控制,低电平有效
sbit rw1=P2^7;  //AD转换启动控制,上升沿有效
sbit intr=P3^3; //AD转换结束输出低电平


uchar code hz[][16]={
{0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00},
//"0",0

{0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00},
//"1",1

{0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00},
//"2",2

{0x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,0x00,0x18,0x20,0x20,0x20,0x11,0x0E,0x00},
//"3",3

{0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00},
//"4",4

{0x00,0xF8,0x08,0x88,0x88,0x08,0x08,0x00,0x00,0x19,0x21,0x20,0x20,0x11,0x0E,0x00},
//"5",5

{0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00},
//"6",6

{0x00,0x38,0x08,0x08,0xC8,0x38,0x08,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00},
//"7",7

{0x00,0x70,0x88,0x08,0x08,0x88,0x70,0x00,0x00,0x1C,0x22,0x21,0x21,0x22,0x1C,0x00},
//"8",8

{0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x00,0x31,0x22,0x22,0x11,0x0F,0x00} //"9",9

};


//延时
void delay(uint n)
{
  uint i;
  for(;n>0;n--)
    for(i=200;i>0;i--);
}

void check()
{  
      rs=0;rw=1;
此帖出自小平头技术问答
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。