新聞中心

交流信號測量儀

作者: 時間:2016-11-29 來源:網(wǎng)絡(luò) 收藏
本作品為匆忙制作,考試逼近,為了應(yīng)付競賽,用了幾天時間,整出這個一個東西交差,程序算法有待提高

如有朋友做AD方面的東西,相互交流


完整的源碼下載:http://www.51hei.com/f/jiaoliu.rar
以下是部分代碼:

本文引用地址:http://butianyuan.cn/article/201611/323282.htm
#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; //  電壓測量運(yùn)算變量uint count1;  //電壓測量控制變量uint count;   //頻率測量控制變量ulong mt=0;    //  頻率測量運(yùn)算變量ulong vs=0;ulong t;bit flag=0;    //是否顯示標(biāo)志位  對頻率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;}				   
				
            
                
			
							
上一頁 1 2 下一頁

關(guān)鍵詞: 交流信號測量

評論


技術(shù)專區(qū)

關(guān)閉