#include
sbit wr=P3^6;
sbit rd=P3^2;
sbit key0=P1^0; //定义P1.0脚的按键为正弦波键key0
sbit key1=P1^1; //定义P1.1脚的按键为方波键key1
sbit key2=P1^2; //定义P1.2脚的按键为三角波键key2
unsigned char flag; //flag为1、2、3是对应的正弦波、方波、三角波
unsigned char const code //为正弦波采样点数组的256个数据
SIN_code[256]={0x80,0x83,0x86,0x89,0x8c,0x8f,0x92,0x95,0x98,0x9c,0x9f,0xa2,
0xa5,0xa8,0xab,0xae,0xb0,0xb3,0xb6,0xb9,0xbc,0xbf,0xc1,0xc4,0xc7,0xc9,0xcc,0xce,
0xd1,0xd3,0xd5,0xd8,0xda,0xdc,0xde,0xe0,0xe2,0xe4,0xe6,0xe8,0xea,0xec,0xed,0xef,
0xf0,0xf2,0xf3,0xf4,0xf6,0xf7,0xf8,0xf9,0xfa,0xfb,0xfc,0xfc,0xfd,0xfe,0xfe,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfe,0xfe,0xfd,0xfc,0xfc,0xfb,
0xfa,0xf9,0xf8,0xf7,0xf6,0xf5,0xf3,0xf2,0xf0,0xef,0xed,0xec,0xea,0xe8,0xe6,0xe4,
0xe3,0xe1,0xde,0xdc,0xda,0