计的频率计范围能够达到1HZ-1MHZ(实际上51单片机达不到这个范围,不要在实验环境下进行),这个是课设来着,用Proteus仿真实现的,给有需要的同学参考一下
单片机源码:
#include #include #include typedef unsigned char uchar; typedef unsigned int uint; sbit RS=P2^5; sbit RW=P2^6; sbit E=P2^7; sbit CLK=P2^0; sbit DO=P2^1; sbit DI=P2^1; sbit CS=P2^2; sbit CLR=P3^0; sbit GATE=P3^1; sbit K1=P3^7; uint num=0; uint c=0; float d=0; uchar e=1,f=1; unsigned long int aaa=0,bbb=0; uchar LCD_wait()//LCD1602内部等待函数 { RS=0; RW=1; _nop_(); E=1; _nop_(); E=0; return P0; } void LCD_write(bit aa,uchar bb)//向LCD写入命令或数据 { E=0; RS=aa; RW=0; _nop_(); P0=bb; _nop_();//注意顺序 E=1; _nop_();//注意顺序 E=0; _nop_(); LCD_wait();//LCD1602内部等待函数 } void LCD_display(uchar temp) { LCD_write(0,0x08|temp); } void LCD_input(uchar cc) { LCD_write(0,0x04|cc); } void LCD_init()//初始化LCD { //RW=0; LCD_write(0,0x38);//8位数据端口,2行显示,5*7点阵 LCD_write(0,0x38); LCD_write(0,0x0C);//开启显示, 无光标 LCD_write(0,0x01);//清屏 LCD_write(0,0x0C);//AC递增,画面不动 } void LCD_sfj1(uchar x,uchar y) { if(y==0) LCD_write(0,0x80|x); if(y==1) LCD_write(0,0x80|(x-0x40)); } void LCD_print(uchar *p) { while(*p!='