成人午夜视频全免费观看高清-秋霞福利视频一区二区三区-国产精品久久久久电影小说-亚洲不卡区三一区三区一区

c語(yǔ)言實(shí)現(xiàn)函數(shù)信號(hào)發(fā)生器 利用函數(shù)信號(hào)發(fā)生器產(chǎn)生輸入信號(hào)

單片機(jī)C語(yǔ)言版信號(hào)發(fā)生器

單片機(jī)信號(hào)發(fā)生器,一般是通過(guò)控制單片機(jī)的IO的高低電平來(lái)實(shí)現(xiàn)的,具體為

讓客戶滿意是我們工作的目標(biāo),不斷超越客戶的期望值來(lái)自于我們對(duì)這個(gè)行業(yè)的熱愛。我們立志把好的技術(shù)通過(guò)有效、簡(jiǎn)單的方式提供給客戶,將通過(guò)不懈努力成為客戶在信息化領(lǐng)域值得信任、有價(jià)值的長(zhǎng)期合作伙伴,公司提供的服務(wù)項(xiàng)目有:域名申請(qǐng)、雅安服務(wù)器托管、營(yíng)銷軟件、網(wǎng)站建設(shè)、涇川網(wǎng)站維護(hù)、網(wǎng)站推廣。

1,可以通過(guò)先配置一個(gè)管腳為輸出,然后給這個(gè)管腳寫0,輸出就為低電平,然后寫1,這個(gè)管腳就輸出為高電平。如果你的單片機(jī)是3.3v供電的話,那么高電平一般為3.3V,低電平一般為0v。

2,如果要產(chǎn)生一個(gè)方波的話,需要先輸出1,然后延遲一段時(shí)間,然后再輸出0,然后再延遲一段時(shí)間,然后輸出1.... 要如此反復(fù)的話,可以用while(1), 然后在while(1)里面寫入你的置高,延遲,置低的代碼,具體偽代碼可以為

配置對(duì)應(yīng)輸出管腳為輸出; //因?yàn)楣苣_可以配置為輸出和輸入,所以需要先配置為輸出

while(1)

{

對(duì)對(duì)應(yīng)輸出管腳置高;

sleep(半個(gè)周期的時(shí)間);

對(duì)對(duì)應(yīng)輸出管腳置低;

sleep(半個(gè)周期的時(shí)間);

}

3, 如果你牽涉到高級(jí)應(yīng)用的話,比如要輸出一個(gè)正弦波,那么需要外加信號(hào)產(chǎn)生芯片,比如DDS芯片。

4,如果還需要更加復(fù)雜的信號(hào),任意波形的,可以用一個(gè)片內(nèi)DA按照你的意思輸出對(duì)應(yīng)的電平,或者片外DA來(lái)輸出。

求一個(gè)正確的基于51單片機(jī)的函數(shù)信號(hào)發(fā)生器的C程序

#includereg51.h

#includeabsacc.h

#includeMAX72191.h

#defineDAC XBYTE[0x7fff] //P2.7接CS

sbitkey0 = P3^2;// 增減切換鍵

sbitkey1 = P3^3;//個(gè)位,十位,百位,千位的控制切換

sbitkey2 = P3^4;// 調(diào)整位

sbitkey3 = P3^5;// 波形選擇正弦、三角、矩形波,鋸齒波

unsignedchar i,j;

unsignedint counter,step,flag;

typedefunsigned int uint;

//定時(shí)器0初始化

voidInit_Timer0(void)

{

TMOD = (TMOD 0XF0) | 0X01;//設(shè)置工作方式和定時(shí)初始值

TH0 = 0xff;

TL0 = 0x00;

TR0 =1; //啟動(dòng)定時(shí)器

ET0 =1;

}

//定義輸出波形的代碼

unsignedchar code type[4][256]={

{ //正弦波代碼

0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x1, 0x1, 0x2, 0x3, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8,

0x9, 0xb,0xc, 0xd, 0xf, 0x10,0x12,0x13,0x15,0x17,0x19,0x1b,0x1d,0x1f,0x21,0x23,

0x25,0x27,0x2a,0x2c,0x2e,0x31,0x33,0x36,0x39,0x3b,0x3e,0x41,0x43,0x46,0x49,0x4c,

0x4f,0x52,0x55,0x58,0x5b,0x5e,0x61,0x64,0x67,0x6a,0x6d,0x70,0x73,0x76,0x7a,0x7d,

0x80,0x83,0x86,0x89,0x8c,0x8f,0x93,0x96,0x99,0x9c,0x9f,0xa2,0xa5,0xa8,0xab,0xae,

0xb1,0xb4,0xb6,0xb9,0xbc,0xbf,0xc1,0xc4,0xc7,0xc9,0xcc,0xce,0xd1,0xd3,0xd5,0xd8,

0xda,0xdc,0xde,0xe0,0xe2,0xe4,0xe6,0xe8,0xea,0xeb,0xed,0xef,0xf0,0xf1,0xf3,0xf4,

0xf5,0xf6,0xf8,0xf9,0xf9,0xfa,0xfb,0xfc,0xfc,0xfd,0xfd,0xfe,0xfe,0xfe,0xfe,0xfe,

0xfe,0xfe,0xfe,0xfe,0xfe,0xfd,0xfd,0xfc,0xfc,0xfb,0xfa,0xf9,0xf9,0xf8,0xf6,0xf5,

0xf4,0xf3,0xf1,0xf0,0xef,0xed,0xeb,0xea,0xe8,0xe6,0xe4,0xe2,0xe0,0xde,0xdc,0xda,

0xd8,0xd5,0xd3,0xd1,0xce,0xcc,0xc9,0xc7,0xc4,0xc1,0xbf,0xbc,0xb9,0xb6,0xb4,0xb1,

0xae,0xab,0xa8,0xa5,0xa2,0x9f,0x9c,0x99,0x96,0x93,0x8f,0x8c,0x89,0x86,0x83,0x80,

0x7d,0x7a,0x76,0x73,0x70,0x6d,0x6a,0x67,0x64,0x61,0x5e,0x5b,0x58,0x55,0x52,0x4f,

0x4c,0x49,0x46,0x43,0x41,0x3e,0x3b,0x39,0x36,0x33,0x31,0x2e,0x2c,0x2a,0x27,0x25,

0x23,0x21,0x1f,0x1d,0x1b,0x19,0x17,0x15,0x13,0x12,0x10,0xf,0xd, 0xc, 0xb, 0x9,

0x8,0x7, 0x6, 0x5, 0x4, 0x3, 0x3, 0x2, 0x1, 0x1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00

},

{ //三角波代碼

0x2,0x4, 0x6, 0x8, 0xa, 0xc, 0xe, 0x10,0x12,0x14, 0x16, 0x18, 0x1a,0x1c, 0x1e, 0x20,

0x22,0x24, 0x26, 0x28, 0x2a, 0x2c, 0x2e, 0x30,0x32, 0x34, 0x36, 0x38, 0x3a, 0x3c, 0x3e, 0x40,

0x42,0x44, 0x46, 0x48, 0x4a, 0x4c, 0x4e, 0x50,0x52, 0x54, 0x56, 0x58, 0x5a, 0x5c, 0x5e, 0x60,

0x62,0x64, 0x66, 0x68, 0x6a, 0x6c, 0x6e, 0x70,0x72, 0x74, 0x76, 0x78, 0x7a, 0x7c, 0x7e, 0x80,

0x82,0x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x4, 0x2, 0x00

},

{// 矩形脈沖波代碼

0xff,0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,0xff, 0xff, 0xff, 0xff, 0xff, 0xff,0xff, 0xff,

0xff,0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,0xff, 0xff, 0xff, 0xff, 0xff, 0xff,0xff, 0xff,

0xff,0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,0xff, 0xff, 0xff, 0xff, 0xff, 0xff,0xff, 0xff,

0xff,0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,0xff, 0xff, 0xff, 0xff, 0xff, 0xff,0xff, 0xff,

0xff,0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,0xff, 0xff, 0xff, 0xff, 0xff, 0xff,0xff, 0xff,

0xff,0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,0xff, 0xff, 0xff, 0xff, 0xff, 0xff,0xff, 0xff,

0xff,0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,0xff, 0xff, 0xff, 0xff, 0xff, 0xff,0xff, 0xff,

0xff,0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,0xff, 0xff, 0xff, 0xff, 0xff, 0xff,0xff, 0xff,

0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00,

0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00,

0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00,

0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00,

0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00,

0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00,

0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00,

0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00,

},

{//鋸齒波代碼

0x00,0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,0x08,0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,

0x10,0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,0x18,0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,

0x20,0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,0x28,0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,

0x30,0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,0x38,0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,

0x40,0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,0x48,0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,

0x50,0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,0x58,0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,

0x60,0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,0x68,0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,

0x70,0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,0x78,0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,

0x80,0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,0x88,0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,

0x90,0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,0x98,0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,

0xa0,0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,0xa8,0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,

0xb0,0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7,0xb8,0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,

0xc0,0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,0xc8,0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,

0xd0,0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7,0xd8,0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,

0xe0,0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7,0xe8,0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,

0xf0,0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,0xf8,0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff}

};

//顯示子函數(shù)

Disp7219(unsignedlong dat)

{

unsigned char i;

unsigned char led[8];

led[7]=dat%10;

led[6]=dat/10%10;

led[5]=dat/100%10;

led[4]=dat/1000%10;

led[3]=dat/10000%10;

led[2]=dat/100000%10;

led[1]=dat/1000000%10;

led[0]=dat/10000000%10;

for(i=0;i8;i++)

{

max_7219(i+1, led[i]);

}

}

//延時(shí)約1m秒

voiddelay_ms(uint n)

{

uchar j;

while(n--)

for(j=0;j120;j++);

}

//主函數(shù)

main()

{

unsigned int f,n,j;

delay_ms(500);

Init_Max7219();//初始化7219

Disp7219(000);

Init_Timer0();

step=18;

EA = 1;

while(1)

{

if(key0 == 0) n=n+1;

if(n==2)n=0;

if(key1==0) j=j+1;

if(j==4) j=0;

if(n==0 j == 0 key2 == 0) if(step180) step+=18; //個(gè)位增

if(n==1 j == 0 key2 == 0) if(step18) step-=18; //個(gè)位減

if(n==0 j == 1 key2 == 0) if(step1800) step+=180;//十位增

if(n==1 j == 1 key2 == 0) if(step180) step-=180; //十位減

if(n==0 j == 2 key2 == 0) if(step18000) step+=1800;//百位增

if(n==1 j == 2 key2 == 0) if(step1800) step-=1800;//百位減

if(n==0 j == 3 key2 == 0) if(step54000) step+=18000;//千位增

if(n==1 j == 3 key2 == 0) if(step18000) step-=18000;//千位減

if(key3==0)flag=flag+1;if(flag==4)flag=0;

while((!key0)||(!key1)||(!key2)||(!key3));

f=step/18;

Disp7219(f);}//顯示頻率

}

// 定時(shí)中斷服務(wù)

voidTimer0(void) interrupt 1 using 2

{

TH0 = 0xff;

TL0 = 0x00;

counter = counter + step;

DAC=type[flag][(unsignedint)counter8];

}

跪求單片機(jī)大神幫我解析下面函數(shù)信號(hào)發(fā)生器的代碼(C語(yǔ)言)

你貼的代碼里那幾個(gè)數(shù)組沒(méi)有用到啊,暫時(shí)不知道干什么的,初步猜測(cè)估計(jì)是液晶的點(diǎn)陣數(shù)據(jù),main函數(shù)里也就是初始化了定時(shí)器和lcd液晶屏,不停的掃描按鍵鍵值,定時(shí)中斷里應(yīng)該還有很多東西,這里看不到。

需要問(wèn)具體的話可以把程序發(fā)我郵箱吧:cxz1088cxz@vip.qq.com

簡(jiǎn)易函數(shù)信號(hào)發(fā)生器C語(yǔ)言編寫

我沒(méi)做過(guò)正弦波和三角波,我認(rèn)為正弦波做的話用帶DA功能的單片機(jī),但是你沒(méi)說(shuō)正弦波的頻率和賦值,三角波也可以用DA做,方波就很簡(jiǎn)單了用拉高活拉低口線就可以了。你直接用單片機(jī)做,不用外圍電路嗎??

文章標(biāo)題:c語(yǔ)言實(shí)現(xiàn)函數(shù)信號(hào)發(fā)生器 利用函數(shù)信號(hào)發(fā)生器產(chǎn)生輸入信號(hào)
標(biāo)題網(wǎng)址:http://jinyejixie.com/article48/ddccgep.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站策劃、域名注冊(cè)商城網(wǎng)站、響應(yīng)式網(wǎng)站、網(wǎng)站內(nèi)鏈、網(wǎng)站營(yíng)銷

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

h5響應(yīng)式網(wǎng)站建設(shè)
治县。| 黄大仙区| 册亨县| 新源县| 湄潭县| 丰台区| 安陆市| 县级市| 怀仁县| 郑州市| 眉山市| 专栏| 汉阴县| 太和县| 阳朔县| 恭城| 石阡县| 禹州市| 漳平市| 进贤县| 桓台县| 高邑县| 沅陵县| 兰西县| 万荣县| 田东县| 临西县| 鹤山市| 临潭县| 上饶县| 营山县| 依安县| 咸宁市| 收藏| 赞皇县| 湘潭县| 芒康县| 灵寿县| 卢湾区| 太谷县| 应用必备|