资源描述:
《函数发生器程序(Functiongeneratorprogram)》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、函数发生器程序(Functiongeneratorprogram)#include//containscommonheaderfiles#include#include#include#defineucharunsignedchar//definecommondatatypesVoidscankey(void);Voidtreatwithkey(void);VoidfunO(void);Voidfunl(void);Voidfun2(void);Voiddelay(intt);Voidunit(vo
2、id);Voidgiveleddata(void);Chardataseg[3]={0x7F,OxBF,OxDF};Chardatadis[10]={0x05,0xf5,0x13,0x51,Oxel,0x49,0x09,0xd5,0x01,0x41}01234567/89Unsignedcharcodesine_data[128]={0x80,0x86,0x8D,0x93,0x99,0x9F,0xA5,OxAB,OxBl,0xB7,OxBC,0xC2,0xC7,OxCC,OxDl,0xD6,OxDA,OxDF,0xE3,0xE7,OxEA,OxEE,OxFl,0xF4,0xF
3、6,0xF8,OxFA,OxFC,OxFD,OxFF,OxFF,OxFF,OxFF,OxFF,OxFF,OxFE,OxFD,OxFB,0xF9,0xF7,0xF5,0xF2,OxEF,OxEC,0xE9,0xE5,OxEl,OxDD,0xD8,0xD4,OxCF,OxCA,0xC5,OxBF,OxBA,0xB4,OxAE,OxA&0xA2,0x9C,0x96,0x90,0x89,0x83,0x80,0x79,0x72,0x6C,0x66,0x60,0x5A,0x55,0x4E,0x4&0x43,0x3D,0x3&0x33,0x2E,0x29,0x25,0x20,OxlC,0x
4、18,0x15,Oxll,OxOE,OxOB,0x09,0x07,0x05,0x03,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x02,0x04,0x06,0x08,OxOA,OxOD,OxlO,0x13,0x16,OxlA,OxlE,0x22,0x27,0x2B,0x30,0x35,0x3A,0x40,0x45,0x4C,0x51,0x57,0x5D,0x63,0x69,0x6F,0x76,0x7C};UcharKey二0,wave_way二0,adddec=l,J,n二0,m二0,k二0,1=0,leddataO,led_datal
5、,led_data2;Inti=0;(main){(unit);(give_led_data);Wh订e(1){(scan_key);If(key=0!):PZXO二oil:PZXO=OH1:0=113:O=OUI:0=013:®xo二"(P!°a)HunpioA!jq.)TLl=0xd8;TM0D=0xl2;TRO二1;ETO=1;TRI二1;ET1二1;EA=1;Voidgive_led_data(void)If(wave_way=0)Switch(adddec)Case1:Led_dataO=dis[0];Leddatal二dis[0];Led_data2=dis[8]
6、;Break;Case2:{leddataO二不[0led_datal二不[0led_data.2二不[4打破;案例3:leddataO二不[0];leddata.1二不[7];led_data.2二不[2];打破;}案例4:{leddataO二不[0];led_data.l二不[0];led_data.2二不[2];打破;}默认值:{break;}}如I果(wave_way二二1)开关(adddec)案例1:leddataO二不[0led_datal二不[6led_data2二不[1打破;案例2:led_dataO二不[3leddata.1二不[8ledda.ta2=Oxf
7、f;打破;}案例3:{leddataO二不[7];led_datal二不[5];led_data.2=Oxff;打破;案例4:led_dataO二不[2];led_data.l二不[4];led_da.ta2=Oxff;打破;默认值:{break;}如果(wave_way二二2){开关(adddec){案例1:{led_data.O二不[1];led_data.l二不[7];led_da.ta2二Oxff;打破;案例2:leddataO二不[7];leddata!二不[3];leddata2二Oxff;