DIY_51单片机_+_ADC0809_示波器 通过对两个单片机的控制实现电压信号的采集以及显示波形,可以调整显示频率... 主单片机控制12864的显示,从单片机实现对ADC0809的驱动转换... 下面是该系统的程序: 主单片机: #include #include #define uchar unsigned char #define uint unsigned int #define dataIO P1 #define ADdataIO P0 unsigned char p[]={0xf7,0xfb,0xfd,0xfe}; int num; static int count=20; sbit RS=P2^5; sbit RW=P2^4; sbit E=P2^3; sbit PSB=P2^2; sbit NC=P2^1; sbit BF=P1^7; sbit EOC=P3^4; sbit EN=P3^5; static unsigned char DATA[128]=0; void delay(long int x) { long int i; for(i=0;i } void checkbusy() { RS=0; RW=1; E=1; while(BF); E=0; } void transfer(uchar word ,bit a ,bit b) //数据交换, a:1数据, 0指令 b:1读,0写。// { checkbusy(); RS=a; RW=b; E=1; dataIO = word; delay(2); E=0; RS=~RS; RW=~RW; } uchar readRAM(bit a)//a:1.data 2.cmd// { uchar x; checkbusy(); dataIO=0xff; RS=a; ……