บทความประกอบการเรียนรู้ => ไมโครคอนโทรลเลอร์ (MCS51) => ข้อความที่เริ่มโดย: admin ที่ พฤศจิกายน 18, 2009, 12:17:40 PM

หัวข้อ: งานครั้งที่ 12 การประกอบวงจรและเขียนโปรแกรมสร้างความถี่เสียง
เริ่มหัวข้อโดย: admin ที่ พฤศจิกายน 18, 2009, 12:17:40 PM
ใช้วงจรบัฟเฟอร์ตัวเดิมของใบงานที่ 1 เพียงแต่ต่อเพิ่มเติมตามรูป
ปลดโหลดอื่นออกก่อนไม่เช่นนั้นเสียงที่ได้จะเบา

(http://image.free.in.th/v/2013/ij/lab7_9_sch-1.png)

วงจรสำหรับการทดลอง (ปลดกราวด์ที่ LED ออกก่อน)
(http://image.free.in.th/v/2013/if/lab7_9_sch-2.png)

โน้ตเพลงสามารถค้นหาในอินเตอร์เน็ตได้  หรือในเวป
http://www.wichai.net/thaisong/main.htm (http://www.wichai.net/thaisong/main.htm)
หัวข้อ: Re: วงจรใบงานที่ 4
เริ่มหัวข้อโดย: admin ที่ พฤศจิกายน 18, 2009, 09:29:44 PM
Speaker
(http://www.es.co.th/Picture/MSS-57M-103A.jpg)
http://www.es.co.th/detail.asp?Prod=51000029 (http://www.es.co.th/detail.asp?Prod=51000029)

Capacitor
(http://www.es.co.th/Picture/GS-SAMXON.jpg)
(220uF)
http://www.es.co.th/detail.asp?Prod=56600141 (http://www.es.co.th/detail.asp?Prod=56600141)
(1uF)
http://www.es.co.th/detail.asp?Prod=56601357 (http://www.es.co.th/detail.asp?Prod=56601357)
หัวข้อ: Re: งานครั้งที่ 12 การประกอบวงจรและเขียนโปรแกรมสร้างความถี่เสียง
เริ่มหัวข้อโดย: admin ที่ มีนาคม 28, 2012, 09:14:16 AM
ตัวอย่างโค้ดเพลง "เดือนเพ็ญ"

โค๊ด: [Select]
#include<reg52.h>
void sound(int f,t);
code unsigned char sfh[]={0x00,0xF9,0xF9,0xFA,0xFA,0xFB,0xFB,0xFC,0xFC,0xFC,0xF7};
code unsigned char sfl[]={0x00,0x1F,0xDF,0x8A,0xD9,0x68,0xE9,0x5B,0x8F,0xEF,0xD1};
sbit spk=P0^0;

void main (void)
{ TMOD=0x11;
  while(1)
  { sound(6,4);sound(0,1); //668542
  sound(6,5);sound(0,1);
  sound(8,2);sound(0,1);
  sound(5,4);sound(0,1);
  sound(4,2);sound(0,1);
  sound(5,2);sound(0,1);
  sound(2,5);sound(0,1);
//-------------------------
  sound(4,2);sound(0,1);
  sound(1,2);sound(0,1);
  sound(10,2);sound(0,1); //6 low
  sound(1,2);sound(0,1);
  sound(2,2);sound(0,1);
  sound(4,2);sound(0,1);
  sound(5,2);sound(0,1);
  sound(6,2);sound(0,1);
  sound(8,2);sound(0,1);
  sound(5,2);sound(0,1);
  sound(6,2);sound(0,1);
  sound(8,2);sound(0,1);
  sound(9,2);sound(0,1);
  sound(6,8);sound(0,1);
//---------------------
  sound(8,5);sound(0,1);
  sound(6,2);sound(0,1);
  sound(5,4);sound(0,1);
  sound(4,2);sound(0,1);
  sound(5,2);sound(0,1);
  sound(2,3);sound(0,1);
//---------------------------
  sound(4,2);sound(0,1);
  sound(1,2);sound(0,1);
  sound(10,2);sound(0,1); //6 low
  sound(1,2);sound(0,1);
  sound(2,2);sound(0,1);
  sound(4,2);sound(0,1);
  sound(5,2);sound(0,1);
  sound(6,2);sound(0,1);
  sound(8,2);sound(0,1);
  sound(5,2);sound(0,1);
  sound(4,2);sound(0,1);
  sound(5,1);sound(0,1);
  sound(4,1);sound(0,1);
  sound(2,2);sound(0,1);
  sound(4,8);sound(0,10);

 
}
}
void sound(int f,t)
{
int n,l;
l=t*3;
for(n=0;n<l;n++)
{
TH0=0x4c;
TL0=0x00;
TF0=0;
TR0=1;
loop:
if (f>0)
{
TH1=sfh[f];
TL1=sfl[f];
TF1=0;
TR1=1;
spk=!spk;
}
else
{
spk=0;
}

while(TF1==0)
{}
if(TF0==0)
goto loop;
else
{
TR0=0;
TR1=0;
}


}

}

หัวข้อ: Re: งานครั้งที่ 12 การประกอบวงจรและเขียนโปรแกรมสร้างความถี่เสียง
เริ่มหัวข้อโดย: admin ที่ กุมภาพันธ์ 15, 2013, 01:07:21 PM
http://www.buttonbeats.com/images/pianoB.swf

(http://image.free.in.th/z/iq/lpkey.png)

http://www.bgfl.org/custom/resources_ftp/client_ftp/ks2/music/piano/flash/piano.swf
ใช้คีย์แถว ASDFGH.....

ตัวอย่างโน๊ต
(http://www.siamzone.com/board/upload/0437/437315-0001.jpg)

(http://www.chaoprayanews.com/wp-content/uploads/2009/02/e0b89ee0b8a3e0b89be0b8b5e0b983e0b8abe0b8a1e0b988-httpwwwsupremeartistorgthaimusicnotemusic13html.gif)

(http://3.bp.blogspot.com/_0fTe0TcGkrI/TB9coTRE5bI/AAAAAAAAB8Q/yy2F5QToZLA/s1600/%E0%B8%AB%E0%B8%99%E0%B8%B6%E0%B9%88%E0%B8%87%E0%B8%A1%E0%B8%B4%E0%B8%95%E0%B8%A3%E0%B8%8A%E0%B8%B4%E0%B8%94%E0%B9%83%E0%B8%81%E0%B8%A5%E0%B9%89+-+%E0%B8%AD%E0%B8%B1%E0%B8%AA%E0%B8%99%E0%B8%B5+%E0%B8%A7%E0%B8%AA%E0%B8%B1%E0%B8%99%E0%B8%95%E0%B9%8C0001.jpg)

(http://1.bp.blogspot.com/_0fTe0TcGkrI/TB0DYlXfcWI/AAAAAAAAB74/UCUJIMfDjb0/s1600/%E0%B9%80%E0%B8%81%E0%B9%87%E0%B8%9A%E0%B8%95%E0%B8%B0%E0%B8%A7%E0%B8%B1%E0%B8%99+-+%E0%B8%AD%E0%B8%B4%E0%B8%97%E0%B8%98%E0%B8%B4+%E0%B8%9E%E0%B8%A5%E0%B8%B2%E0%B8%87%E0%B8%81%E0%B8%B9%E0%B8%A30001.jpg)

(http://www.noomlamoon.com/images/fbfiles/images/fullmoon.jpg)

เพลงเดือนเพ็ญ โน๊ตขลุ่ยเพียงออ
โค๊ด: [Select]
ล ล ดํ ซ ฟ ร ( หรือ ล ล ดํ ซ ฟ ซฟร ) 
ฟ ด ล ด ร ฟ
ซ ล ดํ ซ ล ดํ รํ ล
ดํ ล ซ ฟ ร
ฟ ด ล ด ร ฟ
ซ ล ดํ ซ ฟ ร ด ฟ ( หรือ ซ ล ดํ ซ ฟ ร ดรฟ )

(http://www.noomlamoon.com/images/fbfiles/images/namtasangtai20110518.GIF)