本著作为匆忙制造,考试迫临,为了敷衍比赛,用了几天时刻,整出这个一个东西交差,程序算法有待进步
如有朋友做AD方面的东西,彼此沟通
完好的源码下载:http://www.51hei.com/f/jiaoliu.rar
以下是部分代码:
#include#include #include #define nop() _nop_()#define N0 65336#define uint unsigned int#define uchar unsigned char #define ulong unsigned longuchar code xian[]={"Welcome"};uchar code xian1[]={"Designed by WJJ"};uchar tab[7];uchar tab2[7];uchar tab3[5];uchar tab4[8]={" "};sbit EOC=P2^6;sbit OE=P2^5;sbit START=P2^7;sbit lcdrs=P3^5;sbit lcdrw=P3^6;sbit lcden=P3^7;uint vmax=0; // 电压丈量运算变量uint count1; //电压丈量控制变量uint count; //频率丈量控制变量ulong mt=0; // 频率丈量运算变量ulong vs=0;ulong t;bit flag=0; //是否显现标志位 对频率void DelayNS(uint dly) { uint i;for(; dly>0; dly--)for(i=0; i<100; i++);}bit lcd_busy(){bit result;lcdrw = 1;lcdrs = 0;lcden = 1;nop();nop();nop();nop();result = (bit)(P1&0x80);lcden = 0;return(result);}void write_com(uchar com){while(lcd_busy()); //LCD忙等候lcdrs = 0;lcdrw = 0;P1 = com;DelayNS(5);lcden = 1;DelayNS(5);lcden = 0;}void write_data(uchar date){while(lcd_busy()); //LCD忙等候lcdrs = 1;lcdrw = 0;P1 = date;DelayNS(5);lcden = 1;DelayNS(5);lcden = 0;}void lcd_init(){lcden = 0;write_com(0x38);DelayNS(5);write_com(0x0c);DelayNS(5);write_com(0x04);DelayNS(5);write_com(0x01);}void timer_init() {EA = 1;EX0=1;IT0=1;TMOD = 0x11;TH0=0;TL0=0;}