精选优质文档-倾情为你奉上单片机产生方波、锯齿波、三角波程序#include #define uchar unsigned char #define uint unsigned int unsigned char x=0,m=0,y=128; sbit WR_DA=P21; sbit CS_DA=P20;/DA与单片机的接口 sbit S0=P30; /波形选择,每次按下将产生不同的波形 sbit S1=P31; /频率减 sbit S2=P32; /频率加 sbit S3=P33; /调节方波的占空比 uchar code SinTab256=0x80,0x83,0x86,0x89,0x8d,0x90,0x93,0x96,0x99,0x9c,0x9f,0xa2,0xa5,0xa8,0xab,0xae,0xb1,0xb4,0xb7,0xba,0xbc,0xbf,0xc2,0xc5 ,0xc7,0xca,0xcc,0xcf,0xd1,0xd4,0xd6,0xd