基于51单片机函数信号发生器设计.

write_com(0x38; write_com(0x0c; write_com(0x06; write_com(0x01; write_com(0x80+0x00; write_data(0x77; //写wave: write_data(0x61; write_data(0x76; write_data(0x65; write_data(0x3a;

write_com(0x80+0x40; //写 f: write_data(0x66; write_data(0x3a; }

void write_f(uint date //写频率 {

uchar qian,bai,shi,ge; qian=date/1000; bai=date/100; shi=date/10; ge=date;

write_com(0x80+0x42; write_data(0x30+qian;

write_data(0x30+bai; write_data(0x30+shi; write_data(0x30+ge; write_data(0x48; write_data(0x5a; }

void xsf( //显示频率 {

if(s1num==1 {

fre=(1000/(9+3*ys; write_f(fre; }

if(s1num==2 {

fre=(100000/(3*ys; write_f(fre; }

if(s1num==3 {

fre=(1000/(15+3*ys; write_f(fre; }

}

void keyscanf( { d=0; if(s1==0 { delay(5; if(s1==0 {

while(!s1; s1num++; if(s1num==1 { ys=0;

write_com(0x80+0x05; write_data(0x73; //写sine: write_data(0x69; write_data(0x6e; write_data(0x65; write_data(0x20; write_data(0x20; }

if(s1num==2

{ ys=10;

write_com(0x80+0x05; write_data(0x73; //写squrae write_data(0x71; write_data(0x75; write_data(0x61; write_data(0x72; write_data(0x65; }

if(s1num==3 { ys=0;

write_com(0x80+0x05; //train write_data(0x74; write_data(0x72; write_data(0x61; write_data(0x69; write_data(0x6e; write_data(0x20; }

if(s1num==4 {

联系客服:779662525#qq.com(#替换为@) 苏ICP备20003344号-4