选用1602液晶来显现转化成果,端口能够很便利的自己修正的
#include#include #include #define uchar unsigned char#define uint unsigned int#include #define uchar unsigned char#define uint unsigned intuchar vol[3]={000},channel[11]={0x0c,0x1c,0x2c,0x3c,0x4c,0x5c,0x6c,0x7c,0x8c,0x9c,0xac};/* 端口界说*/#define LCD_data P0 //数据口sbit inter_0=P3^2;sbit LCD_RS = P2^7; //寄存器挑选输入sbit LCD_RW = P2^6; //液晶读/写操控sbit LCD_EN = P2^5; //液晶使能操控sbit LCD_PSB = P2^4; //串/并方法操控sbit eoc=P1^0;sbit clock=P1^1;sbit in=P1^2;sbit out=P1^3;sbit cs=P1^4;uint din;void delay(uint x){uint i,j;for(j=0;j >=4;num=din/4096.0*5.0;num1[0]=(uint)(num)%10+48;num1[1]=46;num1[2]=((uint)(num*10))%10+48;num1[3]=((uint)(num*100))%10+48;lcd_pos(k/3,k%3*3);delay(5);write_dat(num1[0]);delay(5);write_dat(num1[1]);delay(5);write_dat(num1[2]);delay(5);write_dat(num1[3]);delay(5);k++;}}}/*************************************/