ABCDEFGHIJKLM*NOPQRSTUVWXYZ
成都創(chuàng)新互聯(lián)公司長期為千余家客戶提供的網(wǎng)站建設(shè)服務(wù),團(tuán)隊(duì)從業(yè)經(jīng)驗(yàn)10年,關(guān)注不同地域、不同群體,并針對不同對象提供差異化的產(chǎn)品和服務(wù);打造開放共贏平臺,與合作伙伴共同營造健康的互聯(lián)網(wǎng)生態(tài)環(huán)境。為建平企業(yè)提供專業(yè)的成都做網(wǎng)站、網(wǎng)站建設(shè),建平網(wǎng)站改版等技術(shù)服務(wù)。擁有十多年豐富建站經(jīng)驗(yàn)和眾多成功案例,為您定制開發(fā)。
BCDEFGHIJKLM*NOPQRSTUVWXY
CDEFGHIJKLM*NOPQRSTUVWX
DEFGHIJKLM*NOPQRSTUVW
EFGHIJKLM*NOPQRSTUV
FGHIJKLM*NOPQRSTU
GHIJKLM*NOPQRST
HIJKLM*NOPQRS
IJKLM*NOPQR
JKLM*NOPQ
KLM*NOP
LM*NO
M*N
int T=1000;
主要算法:
double time=(1/fs)/T;
double d[1000];
for(int i=1;i=1000;i++)
{
time*=i;
d[i]=sin(2*PI*fs*time);
}
把fs換成f0就可得第二個(gè)波形數(shù)組。
public class Program
{
static void Main(string[] args)
{
ListPoint range = new ListPoint(5 * 5);
for (int i = 0; i 5; i++)
{
for (int j = 0; j 5; j++)
{
range.Add(new Point { X = j, Y = i });
}
}
//移動(dòng)方向的順序
MoveDirection[] md = new[]
/**************************************/
/* 信號發(fā)生器 (正弦波,方波,三角波) */
/*************************************/
#includereg52.h
#include intrins.h
#define uchar unsigned char
#define uint unsigned int
sbit cs=P2^0; //tlc5615片選端口
sbit clk=P2^1; //tlc5615時(shí)鐘線
sbit din=P2^2; //tlc5615傳輸端口
sbit key1=P1^0;
sbit key2=P1^1; //按鍵的單片機(jī)接口
uchar keydat;
uchar flag; //波形發(fā)生終止信號的標(biāo)志位 一旦被置零立馬停止發(fā)信號
uchar flagsqu; //方波高低電平控制為(運(yùn)用定時(shí)器1中斷控制)
uchar m,num;
uchar dat=0xff;
uchar code tosin[141]={ //正弦波的編碼
0x00,0x01,0x02,0x02,0x03,0x04,0x05,0x06,0x07,0x08,
0x09,0x0a,0x0b,0x0d,0x0e,0x10,0x11,0x13,0x15,0x16,
0x18,0x1a,0x1c,0x1e,0x20,0x22,0x25,0x27,0x29,0x2b,
0x2e,0x30,0x33,0x35,0x38,0x3a,0x3d,0x40,0x43,0x45,
0x48,0x4c,0x4e,0x51,0x55,0x57,0x5a,0x5d,0x60,0x63,
0x66,0x69,0x6c,0x6f,0x70,0x71,0x72,0x73,0x74,0x75,
0x76,0x77,0x78,0x79,0x7a,0x7b,0x7c,0x7d,0x7e,0x7e,
0x7f,0x80,0x7f,0x7e,0x7e,0x7d,0x7c,0x7b,0x7a,0x79,
0x78,0x77,0x76,0x75,0x74,0x73,0x72,0x6f,0x6c,0x69,
0x66,0x63,0x60,0x5d,0x5a,0x57,0x55,0x51,0x4e,0x4c,
0x48,0x45,0x43,0x40,0x3d,0x3a,0x38,0x35,0x33,0x30,
0x2e,0x2b,0x29,0x27,0x25,0x22,0x20,0x1e,0x1c,0x1a,
0x18,0x16,0x15,0x13,0x11,0x10,0x0e,0x0d,0x0b,0x0a,
0x09,0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x02,0x01,
0x00};
void delay(uchar z) //延時(shí)函數(shù)
{
uchar x,y;
for(x=0;x110;x++)
for(y=z;y0;y--);
}
void prepare() //tlc5615的初始化
{
cs=1;
din=1;
clk=0;
cs=0; //cs的上升沿和下降沿必須在clk為低時(shí)進(jìn)?
}
/* 用中斷來產(chǎn)生方波
void Squtranslator()
{
TR1=1; //啟動(dòng)定時(shí)器1 控制高低電平的持續(xù)時(shí)間 占空比
do{
do{
_wave=0;
}while((!flagsqu) flag==1);//如果一旦終止信號的
//產(chǎn)生可以立馬退出循環(huán)
flagsqu=0;
do{
_wave=1;
}while((!flagsqu) flag==1);
flagsqu=0;
}while(flag);
flag=1;
TR1=0;
}
*/
void Squtranslator() //方波函數(shù)
{
uchar j;
uchar dat1=0x7f;
while(flag)
{
do{
prepare();
dat=dat1;
for(j=0;j12;j++)
{
din=(bit)(dat7); //將數(shù)據(jù)的最高位賦給din
clk=1;
dat=dat1; //一位位的傳輸
clk=0;
}
cs=1; //cs的上升沿和下降沿必須在clk為低時(shí)進(jìn)行
delay(200); //使高低電平持續(xù)一段時(shí)間
if(dat1==0)
dat1=0x7f; //完成了0和0x7f之間的替換
else
dat1=0;
}while(flag);
}
}
void Tratranslator() //鋸齒波的發(fā)生函數(shù)
{
uchar j;
uchar dat1=0x7f;
while(flag)
{
do{
prepare();
dat=dat1;
for(j=0;j12;j++)
{
din=(bit)(dat7); //將數(shù)據(jù)的最高位賦給din
clk=1;
dat=dat1; //一位位的傳輸
clk=0;
}
cs=1; //cs的上升沿和下降沿必須在clk為低時(shí)進(jìn)行
delay(2); //稍加延時(shí)
dat1--;
}while(flag dat1); //一旦有終止信號就可以停止
do{
prepare();
dat=dat1;
for(j=0;j12;j++)
{
din=(bit)(dat7); //將數(shù)據(jù)的最高位賦給din
clk=1;
dat=dat1; //一位位的傳輸
clk=0;
}
cs=1; //cs的上升沿和下降沿必須在clk為低時(shí)進(jìn)行
delay(2); //稍加延時(shí)
dat1++;
}while(flag (!(dat1==0x7f)));
}
}
void Sintranslator(uchar wave[],uchar num )//正弦波的轉(zhuǎn)換函數(shù)
{
uchar i,j;
uchar dat1;
do{
for(i=0;inum;i++)
{
prepare();
dat1=wave[i]; //打開片選 開始工作
for(j=0;j12;j++)
{
din=(bit)(dat17); //將數(shù)據(jù)的最高位賦給din
clk=1;
dat1=dat11; //一位位的傳輸
clk=0;
if(flag==0)break;
}
cs=1; //cs的上升沿和下降沿必須在clk為低時(shí)進(jìn)行
delay(1); //稍加延時(shí)
if(flag==0)break;
}
}while(flag); //等待控制鍵的暫停
}
void keyscan() //切換功能按鍵返回鍵值函數(shù)
{
uchar i;
for(i=0;i4;i++)
{
if(key1==0)
{
delay(10);
if(key1==0)
{
keydat++;
do{}while(!key1); //松手檢測
if(keydat==4)keydat=1;//加滿回零處理
}
}
}
}
void keycountrl() //切斷輸出控制函數(shù)
{
if(key2==0)
{
delay(10);
if(key2==0)
{
flag=0;
do{}while(!key2); //松手檢測
}
}
}
void main ()
{
uchar temp;
TMOD=0x01; //確定定時(shí)器的工作方式
TH0=(65536-50000)/256; //給定時(shí)器0賦予初值
TL0=(65536-50000)%256;
EA=1; //開總中斷
ET0=1; //開啟定時(shí)器0中斷
TR0=1;
while(1)
{
do{
switch(keydat)
{
case