所需E币: 5
时间: 2019-12-25 01:56
大小: 34KB
DIY_51单片机_+_ADC0809_示波器通过对两个单片机的控制实现电压信号的采集以及显示波形,可以调整显示频率...主单片机控制12864的显示,从单片机实现对ADC0809的驱动转换...下面是该系统的程序:主单片机:#include#include#defineucharunsignedchar#defineuintunsignedint#definedataIOP1#defineADdataIOP0unsignedcharp[]={0xf7,0xfb,0xfd,0xfe};intnum;staticintcount=20;sbitRS=P2^5;sbitRW=P2^4;sbitE=P2^3;sbitPSB=P2^2;sbitNC=P2^1;sbitBF=P1^7;sbitEOC=P3^4;sbitEN=P3^5;staticunsignedcharDATA[128]=0;voiddelay(longintx){longinti;for(i=0;i}voidcheckbusy(){RS=0;RW=1;E=1;while(BF);E=0;}voidtransfer(ucharword,bita,bitb) //数据交换,a:1数据,0指令 b:1读,0写。//{checkbusy();RS=a;RW=b;E=1;dataIO=word;delay(2);E=0;RS=~RS;RW=~RW;}ucharreadRAM(bita)//a:1.data2.cmd//{ucharx;checkbusy();dataIO=0xff;RS=a;……