PERTUNJUKAN LASER DIGITAL TUGAS AKHIR Diajukan untuk memenuhi salah satu syarat memperoleh gelar Sarjana Teknik Program Studi Teknik Elektro Disusun oleh: LEO AGUNG CAHYONO NIM: 005114036 JURUSAN TEKNIK ELEKTRO FAKULTAS TEKNIK UNIVERSITAS SANATA DHARMA YOGYAKARTA 2007
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
PERTUNJUKAN LASER DIGITAL
TUGAS AKHIR
Diajukan untuk memenuhi salah satu syarat memperoleh gelar Sarjana Teknik
Program Studi Teknik Elektro
Disusun oleh:
LEO AGUNG CAHYONO
NIM: 005114036
JURUSAN TEKNIK ELEKTRO
FAKULTAS TEKNIK
UNIVERSITAS SANATA DHARMA
YOGYAKARTA
2007
DIGITAL LASER SHOW
FINAL PROJECT
Presented as partial fulfillment of the requirements to obtain The Sarjana Teknik Degree
Didi Vitaraga, “mother” Amrta, Ista, mbak Sita dan mas Taufik, Mahadeva,
mas Suman, Aravinda, Prabha, dan Baskar atas dukungan, kasih, dan
pengertiannya selama ini. Terus berjuang teman-teman.
8. Serta berbagai pihak yang tidak bisa disebutkan satu persatu di sini.
vii
Penulis menyadari bahwa dalam karya tulis ini masih terdapat banyak
kekurangan dan masih jauh dari sempurna. Oleh akrena itu segala bentuk masukan,
baik berupa kritik maupun saran yang membangun sangat penulis harapkan dari
pembaca, demi perbaikan dan kesempurnaan skripsi ini.
Terima kasih Tuhan.
Yogyakarta, 27 Maret 2007
Penulis
viii
PERTUNJUKAN LASER DIGITAL
Disusun oleh: Leo Agung Cahyono
005114036
INTISARI Sinar laser telah digunakan secara luas dalam berbagai bidang kehidupan, seperti: medis, teknologi elektronika dan komunikasi, militer, serta hiburan. Sebagai sarana hiburan, sinar laser dapat digunakan untuk membangkitkan pola-pola geometris tertentu dengan cara memantulkannya ke sebuah atau beberapa cermin yang diputar dengan kecepatan dan arah putaran tertentu. Dalam penelitian ini, digunakan dua buah motor DC untuk memutar cermin yang akan digunakan sebagai sasaran pantulan sinar laser. Untuk mengendalikan kecepatan motor digunakan suatu metode pengendalian tegangan yang disebut PWM (Pulse Width Modulation). PWM dihasilkan oleh perangkat mikrokontroler AT89S51 dengan derajat kenaikan duty cycle sebesar 1%. Untuk dapat menghasilkan putaran yang dapat berputar ke dua arah, baik searah maupun berlawanan jarum jam, digunakan driver berupa jembatan H, yang terintegrasi dalam IC L293D. Masukan untuk pengendalian kecepatan dan arah tersebut dapat dilakukan melalui tombol push-button ataupun menggunakan remote control. Pola-pola yang dihasilkan pada penelitian ini menunjukkan bahwa bentuk dan arah gerakan pola-pola tersebut ditentukan oleh kecepatan dan arah putar cermin pemantulnya. Kata kunci : Laser, PWM, remote control, jembatan H, motor DC
ix
DIGITAL LASER SHOW
By: Leo Agung Cahyono
005114036
ABSTRACT Laser has been widely use in many fields, such as: medic, communication and electronic technology, military and also entertainment. As an entertainment tool, laser can be used to generate several geometrical patterns by reflecting it to one or some mirrors which is rotated with a particular speed and direction. In this research, two DC motors are used to rotate two mirrors which are going to be used as a target of the laser reflection. To controlled the speed of the motors, a voltage-controlling methoed called Pulse Width Modulation (PWM) is implemented. The PWM is generated with 1% duty cycle increment or decrement by AT89S51 microcontroller. To obtain a rotation which can turn in two directions, clock and counter clock wise, an H-Bridge driver which is integrated in L293D driver is used. The inputs to control the speed and direction use push-button and remote control. The patterns that are generated in this research show that the shapes and the movement directions of those patterns are determined by the speed and the rotation direction of the reflecting mirrors. Keywords : Laser, PWM, remote control, H-Bridge, DC Motors
x
DAFTAR ISI
Halaman Judul ........................................................................................................... i
Halaman Persetujuan ................................................................................................. iii
Halaman Pengesahan ................................................................................................. iv
Halaman Pernyatan Keaslian Karya .......................................................................... v
Halaman Persembahan............................................................................................... vi
Kata Pengantar ........................................................................................................... vii
Intisari ....................................................................................................................... ix
Abstract ...................................................................................................................... x
Daftar Isi .................................................................................................................... xi
Daftar Gambar ........................................................................................................... xiv
Daftar Tabel ............................................................................................................... xvi
Daftar Lampiran......................................................................................................... xvii
BAB I. PENDAHULUAN
1.1. Latar Belakang Masalah ................................................................................. 1
1.2. Perumusan Masalah ........................................................................................ 1
Gambar 4.6. Hubungan kecepatan putar berlawanan jarum jam (CCW) motor 2
terhadap presentase PWM.................................................................. 60
Gambar 4.7. Bentuk fisik alat .................................................................................. 66
Gambar 4.8. Penempatan mekanis motor, cermin, dan laser................................... 67
xv
DAFTAR TABEL
Tabel 2.1. Jenis-jenis laser besera panjng gelombang dan penggunaannya .............. 10
Tabel 2.2. Mode kerja timer....................................................................................... 15
Tabel 2.3. Tabel kebenaran IC L293D....................................................................... 30
Tabel 3.1. Arah putaran motor DC ............................................................................ 38
Tabel 3.2. Interupsi yang digunakan pada program Digital Laser Show................... 41
Tabel 3.3. Perancangan fungsi dari tombol remote control yang ditekan ................. 50
Tabel 4.1. Fungsi dari tombol remote control yang ditekan ...................................... 57
Tabel 4.2. Data pengamatan duty cycle PWM .......................................................... 58
Tabel 4.3. Kecepatan motor 1 saat berputar searah jarum jam (CW)........................ 60
Tabel 4.4. Kecepatan motor 1 saat berputar berlawanan jarum jam (CCW)............. 61
Tabel 4.5. Kecepatan motor 2 saat berputar searah jarum jam (CW)........................ 62
Tabel 4.6. Kecepatan motor 2 saat berputar berlawanan jarum jam (CCW)............. 63
Tabel 4.7. Pola yang terbentuk saat kedua motor berputar searah............................. 64
Tabel 4.8. Pola yang terbentuk saat kedua motor berputar berlawanan arah............. 65
xvi
DAFTAR LAMPIRAN
Lampiran I Rangkaian Digital Laser Show
Lampiran II Source code program Digital Laser Show
Lampiran III Kode tombol remote control SONY RM-687C
Lampiran IV Datasheet mikrokontroler Atmel AT89S51
Lampiran V Datasheet IC L293D
Lampiran VI Datasheet Transistor BC516
Lampiran VII Datasheet Seven-segment MAN5750
xvii
BAB I
PENDAHULUAN
1.1. Latar Belakang
Sejak pertama kali berhasil diujicobakan pada tahun 1960 oleh fisikawan
Amerika Serikat, Theodore Harold Maiman (Microsoft, 2005), teknologi dan aplikasi
laser terus berkembang dengan pesat. Hal ini mengakibatkan berbagai bidang yang
mengaplikasikan laser dalam sistemnya seperti medis, teknologi elektronika dan
komunikasi, militer, serta hiburan juga mendapat berbagai kemajuan yang cukup
berarti.
Dalam bidang hiburan, laser digunakan untuk mendapatkan efek-efek visual
yang biasanya mengiringi sebuah pertunjukan kembang api. Efek-efek sinar laser
telah memancing rasa keingintahuan banyak orang tentang apa sebenarnya sinar laser
itu dan bagaimana caranya menghasilkan pola-pola yang indah tersebut.
Seperangkat alat profesional akan menjadi terlalu berlebihan apabila hanya
akan digunakan untuk memuaskan rasa keingintahuan tersebut. Karena selain mahal,
tentu juga membutuhkan sumber daya listrik dan standar operasional yang tinggi.
Untuk itu, diperlukan suatu miniatur yang lebih sederhana namun tetap dapat
digunakan sebagai sarana hiburan sekaligus pembelajaran.
1.2. Perumusan Masalah
Dari latar belakang masalah tersebut diatas, dapat dirumuskan menjadi
beberapa masalah sebagai berikut:
1. Bagimana menghasilkan suatu perangkat keras laser show yang kompak dan
portable namun tetap dapat menghasilkan berbagai pola-pola visual?
2. Bagaimana membuat program untuk mendukung perangkat tersebut?
3. Bagaimana menghasilkan perangkat laser show yang user friendly?
4. Bagaimana menghasilkan perangkat laser show yang dapat dikendalikan dari
jauh menggunakan remote control?
1.3. Pembatasan Masalah
Dalam pembuatan peralatan laser show digital ini dilakukan beberapa batasan
sebagai berikut:
1
1. Metode untuk mendapatkan berbagai efek visual adalah dengan memantulkan
sinar laser pada cermin yang berputar.
2. Pengaturan kecepatan putaran cermin dilakukan dengan metode Pulse Width
Modulation (PWM) secara digital.
3. Besaran kenaikan atau penurunan duty cycle adalah 1%.
4. Isyarat masukan diberikan dengan menekan push button atau menggunakan
remote control infra merah.
5. Motor yang digunakan merupakan motor dc sebanyak dua buah.
6. Mikrokontoler yang digunakan adalah AT89S51 buatan ATMEL.
7. Sumber cahaya laser yang digunakan berasal dari laser pointer.
1.4. Tujuan dan Manfaat Penelitian
Tujuan penelitian ini adalah menghasilkan suatu perangkat digital laser show
yang mampu menghasilkan berbagai pola visual akibat pantulan sinar laser terhadap
dua buah cermin yang berputar. Kedua cermin tersebut diputar pada titik tengahnya
menggunakan dua buah motor DC, dan kecepatannya akan diatur menggunakan
metode PWM atau Pulse Width Modulation.
Manfaat yang didapat user dari penelitian ini adalah peralatan ini dapat
digunakan sebagai sarana hiburan untuk berbagai kalangan pengguna, serta dapat
dijadikan sarana pembelajaran bagi mereka yang tertarik untuk mengembangkan teori
dan aplikasi PWM serta laser dalam dunia sehari-hari khususnya sebagai sarana
hiburan.
Manfaat yang didapatkan penulis dari penelitian ini adalah:
1. Sebagai sarana pembelajaran teori maupun aplikasi sinar laser.
2. Sebagai sarana pembelajaran teori maupun aplikasi PWM.
3. Sebagai sarana pembelajaran teori maupun aplikasi mikrokontroler AT89S51.
4. Sebagai sarana pembelajaran pembuatan penelitian yang terstruktur dan baik.
1.5. Metodologi Penelitian
1. Studi pustaka tentang teknik pengendalian kecepatan dan arah putar untuk
laser show, serta pengiriman sinyal melalui remote control.
2. Perancangan schematic digital laser show.
3. Perancangan software pengendalian kecepatan dan arah putar menggunakan
metode PWM dalam diagram alir (flowchart).
2
4. Perancangan layout PCB digital laser show.
5. Implementasi flowchart digital laser show dalam bentuk progam yang
terstruktur.
6. Pengambilan dan analisis data dari perangkat yang berhasil diperoleh.
1.6. Sistematika Penulisan
BAB I
PENDAHULUAN
Memuat gambaran secara umum mengenai isi tugas akhir
BAB II DASAR TEORI
Memuat tinjauan kepustakaan yang merupakan landasan teori dari
masalah yang akan dibahas
BAB III PERANCANGAN
Memuat penjelasan mengenai perancangan alat, baik secara hardware
maupun software.
BAB IV PENGAMATAN DAN PEMBAHASAN
Memuat data-data peralatan yang dibuat disertai pembahasannya
BAB V KESIMPULAN dan SARAN
3
BAB II
DASAR TEORI
Laser show pada dasarnya merupakan suatu hiburan yang dihasilkan dari
manipulasi sinar laser untuk mendapatkan pola-pola geometris tertentu. Secara sederhana,
hal ini dapat dilakukan dengan memantulkan sinar laser terhadap satu atau beberapa
cermin yang berputar sebelum akhirnya dipantulkan ke dinding atau layar. Tampilan pada
layar inilah yang kemudian dapat diamati sebagai pola-pola geometris (Harsono, 2005).
Gambar 2.1 mengilustrasikan bagaimana hal ini dilakukan.
2
1
3
4
5
Gambar 2.1. Prinsip dasar operasi laser show (Harsono, 2005)
Keterangan gambar:
1. Laser pointer
2. Pantulan sinar laser
3. Cermin
4. Motor DC
5. Pola yang dihasilkan
2.1. Pola-Pola Dasar Hasil Tampilan Perangkat Laser Show
Pola-pola dasar hasil tampilan perangakat laser show berdasarkan kondisi putaran
motor adalah sebagai berikut (Harsono, 2005):
1. Pola dasar saat kedua motor tidak berputar adalah berupa titik sinar laser yang diam.
2. Pola dasar saat salah satu motor berputar sedangkan motor yang lain diam adalah
berbentuk lingkaran seperti diperlihatkan pada gambar 2.2(a)
4
3. Pola dasar saat kedua motor berputar dengan arah yang sama adalah berbentuk seperti
gambar 2.2(b).
4. Pola dasar saat kedua motor berputar dengan arah yang berlawanan yakni CW dan
CCW adalah berbentuk seperti gambar 2.2(c).
(a) (b) (c)
Gambar 2.2. Pola dasar hasil tampilan perangkat laser show (Harsono, 2005) (a) Salah satu berputar (b) Dua motor berputar searah (c) Dua motor berputar berlawanan
2.2. Kurva Lissajous
Dalam matematika, kurva Lissajous (Gambar Lissajous atau Kurva Bowditch)
merupakan grafik dari sistem persamaan parametris seperti ditunjukkan pada persamaan
2.1. Persamaan ini menjelaskan gerakan harmonik kompleks. Keluarga kurva-kurva
semacam ini diteliti oleh Nathaniel Bowditch pada 1815, dan diteliti lebih lanjut oleh
Jules Antoine Lissajous pada 1857 (---, 2007).
(2.1)
Tampilan kurva sangat dipengaruhi oleh perbandingan a/b. Untuk hasil
perbandingan sama dengan satu, grafiknya akan berbentuk elips, dengan kasus khusus
meliputi bentuk lingkaran (untuk A = B, δ = π/2 radian), dan garis (untuk δ = 0). Bentuk
sederhana lissajous yang lain adalah parabola (untuk a/b = 2, δ = π/2). Perbandingan yang
lain akan menghasilkan kurva yang lebih kompleks, yang akan berupa kurva tertutup bila
a/b menghasilkan bilangan rasional (---, 2007).
Sebelum tercipta komputer grafis modern, Lissajous biasanya dihasilkan
menggunakan osiloskop. Dua masukan sinusoidal berbeda fase dihubungkan pada
osiloskop dalam mode X-Y dan perbedaan fase antara keduanya akan ditampilkan dalam
bentuk kurva Lissajous. Lissajous juga dapat dihasilkan secara mekanis dengan
5
menggunakan harmonograph. Dalam osiloskop, diandaikan x adalah Ch1, dan y adalah
Ch2. A merupakan amplitudo Ch1, dan B merupakan amplitudo Ch2. Sedangkan a
merupakan frekuensi Ch1, dan b merupakan frekuensi Ch2 sehingga a/b merupakan
perbandingan frekuensi dari kedua channel, dan δ merupakan beda fase dari kurva sinus
Ch1. Gambar 2.3 memeperlihatkan beberapa kurva Lissajous dengan δ = π/2, a bilangan
ganjil, b bilangan genap, dan |a - b| = 1. (---, 2007).
a = 1, b = 2 (a:b = 1:2)
a = 3, b = 2 (a:b = 3:2)
a = 3, b = 4 (a:b = 3:4)
a = 5, b = 4 (a:b = 5:4)
a = 5, b = 6 (a:b = 5:6)
a = 9, b = 8 (a:b = 9:8)
Gambar 2.3. Beberapa contoh kurva Lissajous (---, 2007)
2.3. Hypotrochoid
Hypotrochoid merupakan suatu roulette yang tercitrakan dari sebuah titik P yang
terhubung dengan sebuah lingkaran dengan radius b, yang bergerak mengelilingi bagian
dalam lingkaran lain dengan radius a, dengan P merupakan jarak h, dari titik pusat
lingkaran yang di dalam. Ilustrasi dari definisi hypotrochoid diperlihatkan pada gambar
2.4. Persamaan parametrik dari sebuah hypotrochoid ditunjukkan seperti pada persamaan
2.2 dan 2.3 (Weisstein, 2006).
Gambar 2.4. Ilustrasi definisi hypotrochoid (Weisstein, 2006)
6
⎟⎠⎞
⎜⎝⎛ −
+−= tb
bahtbax coscos)( (2.2)
⎟⎠⎞
⎜⎝⎛ −
−−= tt
bahtbay coscos)( (2.3)
Bentuk-bentuk khusus dari hypotrochoid antara lain adalah: hypocycloid dengan h
= b, ellipse dengan a = 2b, dan rose dengan nilai a dan b sesuai persamaan berikut
(Weisstein, 2006):
12+
=n
hna , dan 1)1(
+−
=n
hnb (2.4)
2.3.1. Hypocyloid
Hypocycloid merupakan kurva yang dihasilkan dari sebuah titik tetap P yang
berada pada keliling sebuah lingkaran kecil ber-radius b, yang berputar mengelilingi
bagian dalam lingkaran yang lebih besar dengan radius a, dengan a > b. Oleh karena itu
hypocycloid merupakan hypotrochoid dengan h = b. Ilustrasi dari definisi tersebut
diperlihatkan pada gambar 2.5. (Weisstein, 2006).
Gambar 2.5. Ilustrasi definisi hypocycloid (Weisstein, 2006)
Sebuah hypocycloid berpetal n, mempunyai persamaan . Untuk
adalah bilangan integer, dan x(0) = a, maka nilai x dan y hypocycloid
ditunjukkan pada persamaan 2.5 dan 2.6. Beberapa gambar hypocycloid dengan n bernilai
integer diperlihatkan pada gambar 2.6 (Weisstein, 2006).
ban /=
ban /≡
7
x =
(2.5)
y =
(2.6)
Gambar 2.6. Hypocycloid dengan n berupa bilangan integer (Weisstein, 2006).
Apabila ban /≡ merupakan bilangan rasional, maka kurvanya akan tertutup dan
mempunyai a petal. Beberapa ilustrasi hypocycloid dengan bernilai rasional
diperlihatkan pada gambar 2.7. Sedangkan apabila merupakan bilangan irrasional
maka kurvanya tidak akan pernah menutup. Hypocycloid dengan berupa bilangan
irrasional ditunjukkan pada gambar 2.8 (Weisstein, 2006).
ba /
ba /
ba /
Gambar 2.7. Hypocycloid dengan berupa bilangan rasional (Weisstein, 2006). ba /
Gambar 2.8. Hypocycloid dengan berupa bilangan irrasional (Weisstein, 2006). ba /
8
2.3.2. Rose
Rose merupakan sebuah kurva yang berbentuk seperti kelopak bunga. Kurva ini
diberi nama rhodonea oleh seorang matematikawan Italia bernama Guido Grandi antara
tahun 1723 dan 1728 karena bentuknya yang menyerupai mawar. Persamaan polar untuk
rose diperlihatkan pada persamaan 2.7. Apabila n merupakan bilangan ganjil maka rose
akan memiliki kelopak sebanyak n. Sedangkan apabila n genap maka kelopaknya
berjumlah 2n. Beberapa gambar rose dengan n ganjil dan genap diperlihatkan pada
gambar 2.9 (Weisstein, 2006).
atau (2.7)
Gambar 2.9. Rose dengan n berupa bilangan ganjil dan genap (Weisstein, 2006)
Seandainya merupakan bilangan rasional, maka kurvanya akan menutup
pada sudut polar , dengan jika adalah ganjil, dan jika adalah
genap. Sedangkan apabila n merupakan bilangan irrasional maka jumlah kelopaknya
adalah tak terhingga. Bentuk rose dengan n berupa bilangan rasional diperlihatkan pada
gambar 2.10, sedangkan untuk n berupa bilangan irrasional diperlihatkan pada gambar
2.11 (Weisstein, 2006).
Gambar 2.10. Rose dengan n berupa bilangan rasional (Weisstein, 2006)
9
Gambar 2.11. Rose dengan n berupa bilangan irrasional (Weisstein, 2006)
2.4. Laser
Tabel 2.1. Jenis-jenis laser beserta panjang gelombang dan kegunaannya (Matsuda, 1987) Nama laser Panjang gelombang
(dalam mikron) Kegunaan Keterangan
Laser excimer Argon-fluorine 0,193 Reaksi optika
Laser excimer Krypton-fluorine 0,248 Belum diketahui
Laser excimer Xenon-chlorine 0,308 Belum diketahui
Laser Argonion 0,33 dan 0, 36 Belum diketahui
Laser Nitrogen 0,337 Belum diketahui
Daerah cahaya yang tidak tampak oleh mata manusia.
Sinar X (0,0001 mikron) dan sinar Ultraungu
(0,2 sampai 0,38 mikron)
Laser berwarna 0,32 sampai 1 Analisis spektroskopi
Laser Argonion 0,488 Pertunjukan
Laser uap tembaga 0,51 dan 0,578 Simulasi laser berwarna
Laser Helium-Neon 0,633 Peralatan yang teliti (presisi)
Laser ruby 0,694 Radar laser
Daerah cahaya yang tampak oleh mata manusia (0,38 sampai 0,77 mikron)
Laser semikonduktor 0,83 Disk laser
Laser gelas 1,06 Penyatuan nuklir menggunakan laser
YAG laser 1,06 Pemrosesan laser
Laser semikonduktor 1,3 Komunikasi optika
Laser Iodine 1,315 Komunikasi optika (jarak jauh)
Laser karbondioksida 10,6 Pemrosesan laser
Daerah cahaya yang tidak tampak oleh mata manusia.
Sinar inframerah (0,8 sampai 1000 mikron)
10
Laser yang merupakan kependekan dari Light Amplification by Stimulated
Emission of Radiation adalah paket berkas cahaya yang gelombang-gelombang
puncaknya terdapat pada kedudukan panjang yang sama, pada waktu yang sama, serta
pada arah gerakan yang sama pula, atau secara sederhana dapat dikatakan sebagai suatu
berkas cahaya yang terdiri atas gelombang-gelombang yang sama dan sebangun. Pada
berkas cahaya ini tidak dijumpai adanya beberapa panjang gelombang yang berbeda
seperti pada berkas cahaya matahari (Matsuda, 1987).
Panjang gelombang laser tergantung dari mediumnya, atau lebih tepatnya lagi
pada tipe atom dan molekul yang terdapat di dalam medium itu. Sebagai contoh adalah
laser ruby, laser tersebut dibuat dari cahaya yang dipancarkan oleh atom-atom khrom dan
memiliki panjang gelombang 0,6943 mikron (Matsuda, 1987). Beberapa jenis laser
beserta panjang gelombang dan kegunaannya dapat dilihat pada tabel 2.1
2.5. Keunggulan Utama Laser
Laser mempunyai empat kelebihan utama yang menonjol yang tidak dijumpai
dalam cahaya matahari maupun cahaya yang berasal dari listrik, yaitu: (Matsuda, 1987)
1. Sifatnya yang monokromatis atau dengan perkataan lain laser hanya memiliki satu
warna cahaya (panjang gelombang) saja. Sehingga apabila laser dilewatkan pada
prisma, sinarnya tidak akan terurai.
2. Arah sorotnya yang sangat baik. Laser menyorot menurut garis lurus dan hampir tidak
menyebar sehingga hampir tidak mengalami penurunan energi.
3. Energinya memiliki kerapatan (densitas) yang tinggi sehingga tenaganya yang luar
biasa besar itu dapat dipusatkan pada sebuah titik yang sangat kecil menggunakan
lensa. Pemusatan energi ini dapat menghasilkan energi yang cukup besar dan
temperatur yang tinggi.
4. Sifat koherennya (pertaliannya) yang baik. Sifat koheren ini dapat dilihat apabila laser
dilewatkan pada serangkaian lubang kecil maka gelombang cahaya keluarannya akan
bertumpuk membentuk pola-pola garis yang sangat rapi. Hal ini dikarenakan sinar
laser mempunyai gelombang yang sebangun dan sama. Aplikasi dari tingginya sifat
koherensi laser adalah penggunaan laser pada holografi tiga dimensi dan juga sebagai
alat pengukur dimensi suatu objek dengan tingkat ketelitian tinggi.
11
2.6. Mikrokontroler AT89S51
2.6.1. Pengenalan Mikrokontroler
Mikrokontroler atau biasa disingkat MCU adalah suatu keping komputer tunggal
yang bertugas mengeksekusi program yang digunakan oleh user untuk mengontrol satu
atau beberapa peralataan. Program ini dapat disimpan di dalam keping memori EEPROM
eksternal atau dalam memori EEPROM internal di dalam mikrokontroler itu sendiri.
Mikrokontroler dapat ditemukan di dalam peralatan-peralatan seperti oven mirowave,
mobil, keyboard, pemutar CD, telepon genggam, VCR, sistem keamanan, dan sebagainya
(Steiner, 2004).
Mikrokontroler digunakan dalam sistem-sistem yang membutuhkan kemampuan
berkomputasi yang tidak sekompleks komputasi pada komputer sekelas 486 atau pentium.
Sistem-sistem berbasiskan mikrokontroler secara umum lebih kecil, lebih handal, dan
lebih murah. Mereka ideal untuk digunakan pada aplikasi-aplikasi seperti tersebut diatas,
dimana ukuran dan biaya adalah pertimbangan yang sangat diutamakan (Steiner, 2004).
Mikrokontroler AT89S51 adalah mikrokontroler keluaran Atmel dengan 4K byte
Seperti terlihat pada gambar 3.6, dalam perancangan terdapat lebih dari empat
buah seven-segment (sesuai jumlah port paralel mikrokontroler), oleh karena itu
digunakan metode scanning untuk mengaktifkan seluruh seven-segment. Metode
scanning merupakan metode untuk menyalakan seven-segment secara bergantian
dengan waktu yang sangat cepat. Penyala-padaman yang sangat cepat ini akan
menyebabkan ilusi pandangan pada mata sehingga akan terlihat seluruh seven-
segment menyala pada saat bersamaan. Hal ini dikarenakan mata tidak mampu
mengikuti frekuensi nyala-padam yang sangat cepat. Metode scanning ini akan
dijelaskan lebih lanjut pada bagian perancangan perangkat lunak.
39
Transistor yang akan digunakan sebagai saklar adalah transistor PNP
darlington seri BC516 yang mampu menyuplai arus kolektor IC hingga 1000 mA.
Nilai resistor RC dapat dihitung sesuai persamaan 2.15 dengan menambahkan
tegangan komponen LED.
LED
LED)sat(ECEEC I
VVVR
−−=
Dengan menggunakan nilai VEE = 5 V, VLED = 2,4 V, dan VCE(sat) = 1 V dari
datasheet, serta menentukan ILED = 10 mA maka dapat dicari nilai RC:
310.104,215
−
−−=CR
RC = 160 Ω, karena nilai ini tidak terdapat di pasaran maka dibulatkan menjadi:
RC = 180 Ω
Sementara untuk menentukan nilai RB dilakukan dengan mencari nilai IBmin
terlebih dahulu menggunakan persamaan 2.16.
DC
)sat(C(min)B
IIβ
=
Dengan menggunakan nilai βDC = 30.000 dari datasheet, dan arus LED seven-segment
sebesar 10 mA sebagai IC(sat) maka dapat dihitung nilai IB(min):
3
3
(min) 10.3010.10 −
=BI
IB(min) = 0,33 μA.
Untuk memastikan bahwa transistor benar-benar berada dalam kondisi saturasi maka
ditetapkan nilai IB yang akan digunakan adalah 2 mA. Dengan mengetahui nilai IB dan
VBE(sat) = 1,4 V dari datasheet maka nilai RB dapat dihitung menggunakan persamaan
2.17.
B
RBB I
VR = ,
dengan VRB = VEE – VBE(sat) maka:
310.24,15−
−=BR
RB = 1800 Ω, dan dibulatkan menjadi
RB = 2200 Ω
40
3.6. Perancangan Perangkat Lunak
3.6.1. Diagram Alir Utama
Gambar 3.7. Diagram alir utama
Seperti diperlihatkan pada gambar 3.7, diagram alir utama diawali dengan
proses inisialisasi kemudian diikuti dengan pengesetan kondisi awal PWM motor
serta pengesetan kondisi awal arah putar. Selanjutnya program akan melakukan
looping terus-menerus menunggu adanya sinyal interupsi.
Pada rantai program utama terlihat bahwa tidak ada instruksi yang dikerjakan
pada saat looping, hal ini dimaksudkan untuk mendapatkan tingkat efisiensi yang
tinggi sehingga program utama bisa dikembangkan untuk melakukan tugas-tugas
lainnya. Penulis mencoba untuk memaksimalkan fasilitas interupsi yang diberikan
oleh mikrokontroler sehingga program digital laser show ini dapat digunakan sebagai
add-on (tambahan) saja seandainya diinginkan pengembangan lebih lanjut dengan
mengisi looping program utama. Interupsi-interupsi yang digunakan untuk
menjalankan program dapat dilihat pada tabel 3.2.
Tabel 3.2. Interupsi yang digunakan pada program Digital Laser Show Jenis interupsi Interupt handler Fungsi
Interupsi penekanan
tombol
Interupsi eksternal 0 Interupsi untuk mendeteksi tombol masukan
Interupsi remote
control
Interupsi eksternal 1 Interupsi untuk mendekodekan sinyal remote control
Interupsi scanning
7-segment
Interupsi timer 0 Interupsi untuk melakukan scanning untuk
menampilkan data ke 7-segment
Interupsi PWM Interupsi timer 1 Interupsi untuk menghasilkan sinyal PWM tiap 1% duty
cycle
41
3.6.2. Diagram Alir Proses Inisialisasi Utama
Seperti terlihat pada gambar 3.9, diagram alir inisialisasi mikrokontroler
diawali dengan pendeklarasian konstanta-konstanta dan variabel-variabel pada RAM
internal, serta pendefinisian vektor-vektor interupsi. Kemudian dilakukan pengesetan
bagi timer, pengesetan aktivasi transisi negatif bagi interupsi eksternal, serta
pengaktifan semua interupsi eksternal dan timer.
Gambar 3.8. Diagram alir inisialisasi mikrokontroler
3.6.3 Interupsi Generator PWM
Pada penelitian ini kedua motor dirancang untuk dapat berputar dengan PWM
yang berbeda pada saat bersamaan. Program akan dimulai dengan mengurangi
counter sebesar satu poin dari nilai sebelumnya. Apabila counter telah bernilai nol,
maka counter akan di set ke nilai 100 yang merupakan nilai maksimal PWM dan
sinyal PWM akan dimatikan. Apabila belum, maka nilainya akan dibandingkan
dengan nilai PWM1 dan PWM2 yang ditentukan oleh user. Apabila nilainya sama,
maka sinyal sinyal PWM akan dinyalakan. Apabila tidak, maka sinyal PWM akan
mengikuti kondisi sebelumnya. Diagram alir interupsi timer sebagai pembangkit pulsa
PWM diperlihatkan pada gambar 3.9.
42
Gambar 3.9 Diagram alir interupsi timer 1: PWM
3.6.4. Interupsi penekanan tombol
Interupsi penekanan tombol terdeteksi dengan berubahnya kondisi bit 0INT
yang telah di-set untuk aktif karena terpicu transisi negatif (negative edge). Seperti
terlihat pada gambar 3.10, langkah pertama program adalah menonaktifkan semua
interupsi eksternal diikuti penyimpanan SFR ke stack pointer. Kemudian program
akan mendeteksi tombol mana yang ditekan dengan mendeteksi lokasi pin mana pada
port 0 yang berubah menjadi ”0”. Selanjutnya dilakukan penundaan untuk mengatasi
efek bouncing selama 20 mS.
Setelah itu dilakukan pengecekan kembali apakah tombol yang sama masih
ditekan? Apabila tidak maka program akan keluar dari proses interupsi. Apabila ya,
maka program akan menunggu sampai tombol dilepas sebelum menjalankan subrutin
yang sesuai dengan tombol yang ditekan. Sebagai langkah akhir program akan
mengambil kembali SFR dari stack pointer serta mengaktifkan kembali interupsi
eksternal.
43
Gambar 3.10 Diagram alir interupsi penekanan tombol
44
3.6.4.1. Diagram Alir Subrutin Tunda Untuk Mengatasi Efek Bouncing
Gambar 3.11 Diagram alir subrutin tunda bouncing
Seperti diperlihatkan pada gambar 3.11, diagram alir subrutin tunda untuk
mengatasi efek bouncing digunakan untuk menghasilkan tunda waktu sebesar 20 mS
dengan menggunakan timer0. Tunda maksimal yang dapat dihasilkan oleh 16 bit
timer apabila menggunakan kristal berfrekuensi 11,0592 MHz yang dihitung sesuai
persamaan 2.8 pada bab II adalah:
65535x11059200
12Tunda max =
Tunda max = 71,1 mS
Karena besarnya tunda 20 mS yang ingin dihasilkan masih di bawah tunda
maksimal maka waktu tunda dapat langsung dihasilkan dalam satu kali siklus putaran
timer. Jumlah step, serta nilai TL0 dan TH0 supaya timer0 dapat menghasilkan tunda
20 mS yang dihitung sesuai persamaan 2.3 dan 2.4 adalah:
12kristal_frek*delaystep_Jumlah =
1211059200x10.20step_Jumlah
3−=
45
Jumlah _step ≈ 18432d atau 4800h
THx/TLx = FFFFh – Jumlah_step (hexa) + 1h
TH0/TL0 = FFFFh – 4800h +1h
TH0/TL0 = B800h
3.6.4.2. Diagram Alir Subrutin Pengubahan Arah Putar Motor
Subrutin pengubahan arah putar motor digunakan untuk mengubah arah
putaran motor dari CW (searah jarum jam) menjadi CCW (berlawanan arah jarum
jam) atau sebaliknya. Seperti terlihat pada gambar 3.12, pengubahan arah cukup
dilakukan dengan mengkomplemenkan kondisi bit arah1. Karena pengubahan motor
dapat dilakukan ketika motor sedang berputar maka kecepatan motor perlu dikurangi
secara perlahan-lahan sampai akhirnya berhenti, sebelum dibalik arah putarnya.
Setelah itu, kecepatan motor juga perlu dinaikkan kembali secara perlahan-lahan
sampai mencapai nilai PWM yang diinginkan user. Hal ini dilakukan untuk
mengurangi sentakan akibat motor berhenti dan berakselerasi secara mendadak.
Gambar 3.12 Diagram alir subrutin pengubahan arah putar motor
46
3.6.5. Interupsi Pendeteksian Remote Control
Hal utama yang harus diperhatikan dalam pendeteksian remote control adalah
sinyal yang diterima oleh mikrokontroler dari IR receiver module merupakan
komplemen atau kebalikan dari sinyal yang dipancarkan oleh remote control. Selain
itu, pengkodean yang digunakan oleh remote control Sony adalah pengkodean lebar
pulsa atau pulse width codification. Pada pengkodean ini, bit ”1” direpresentasikan
dengan pulsa high selama 1200 μS diikuti pulsa low selama 600 μS. Sementara bit ”0”
direpresentasikan dengan dengan pulsa high selama 600 μS diikuti pulsa low selama
600 μS seperti terlihat pada gambar 2.20.
Protokol SIRC yang digunakan oleh remote control Sony untuk mengirimkan
data terdiri atas start bit yang berupa pulsa high selama 2,4 mS diikuti oleh jeda pulsa
low selama 600 μS, diikuti data yang berupa 7-bit command, dan 5-bit device address
seperti terlihat pada gambar 2.21. Pada gambar 3.13 diperlihatkan diagram alir
pendeteksian remote control.
Untuk menangkap kedua belas data yang dikirimkan, mikrokontroler
menggunakan dua buah variabel yakni var1 dan var2. Variabel var1 diset dengan nilai
00001000b, dan var2 dengan nilai 00000000b. Data yang diterima akan digeser ke
kanan satu per satu ke var1 + var2. Mikrokontroler akan mengetahui bahwa data yang
diterima telah berjumlah 12 dengan melihat kondisi bit carry. Setelah 12 kali
pergeseran maka bit carry akan berlogika ”1” karena bit ke tiga var1 yang diset high
telah masuk ke carry setelah bergeser melalui var1 + var2 sebanyak 12 kali.
Proses pendeteksian dipicu oleh terjadinya perubahan kondisi logika 1INT
dari kondisi idle-nya yaitu high, menjadi low, yang disebabkan adanya transmisi data
dari remote control. Kondisi picuan transisi negatif (negative edge) tersebut diset
dengan cara memberi logika high bit IT1 pada saat inisialisasi program. Perubahan
kondisi dari high menjadi low juga merupakan pertanda sedang dikirimkannya start
bit selama 2,4 mS dari remote control. Oleh karena itu mikrokontroler perlu
menunggu selama kira-kira 2,45 mS sebelum melakukan pengecekan ulang kondisi
bit 1INT atau pin 3.3. Apabila tidak maka langsung keluar dari subrutin dan kembali
ke program utama sementara apabila sinyal naik maka lanjutkan ke langkah
selanjutnya.
Langkah berikutnya, program akan menunggu sampai sinyal kembali turun.
Pada saat sinyal turun inilah saat yang paling penting dalam pendeteksian.
47
Mikrokontroler akan menunggu selama 900 μS atau 1,5 x 600 μS sebelum mengecek
kembali kondisi pin 3.3. Apabila kondisinya berubah menjadi high maka data yang
dikirimkan adalah ”0”. Sementara apabila kondisinya tetap low maka data yang
dikirimkan adalah ”1”.
Gambar 3.13 Diagram alir interupsi pendeteksian remote control
48
Gambar 3.13 (lanjutan) Diagram alir interupsi pendeteksian remote control
49
Untuk menuliskan ke dalam memori bahwa kondisi pin INT1 berubah menjadi
high yang berarti mikrokontroler menerima data ”0”, maka mikrokontroler akan
melakukan urutan langkah sebagai berikut:
1. Clear-kan bit carry, yang menunjukkan data yang diterima adalah ”0”.
2. Rotasikan ke kanan dengan menyertakan carry (Rotate right with carry) variabel
var1. Akibat dari instruksi ini maka carry akan masuk ke MSB var1, dan LSB
var1 akan masuk ke carry.
3. Rotasikan ke kanan dengan menyertakan carry (Rotate right with carry) variabel
var2. Akibat dari instruksi ini maka carry dari LSB var1 akan masuk ke MSB
var2, dan LSB var2 akan masuk ke carry.
4. Kemudian dilakukan pengecekan bit carry apakah telah bernilai ”1”, yang berarti
telah menerima 12 data? Apabila ya, maka program akan merotasikan ke kanan
var1 + var2 untuk menempatkan 7 bit command di var2, dan 5 bit device address
di var1. Apabila tidak, maka program akan kembali untuk mengecek kondisi
sinyal di 3.3 apakah telah berubah menjadi low.
Sementara untuk menuliskan ke dalam memori bahwa kondisi pin 3.3 tetap
low yang berarti mikrokontroler menerima data ”1”, maka mikrokontroler akan
melakukan urutan langkah yang hampir sama dengan apabila kondisi pin 3.3 berubah
high. Perbedaan antara keduanya adalah pada bagian ini carry diset high untuk
mengindikasikan data yang diterima adalah”1”, serta branching program saat total
data yang diterima belum mencapai 12 bit. Program akan mengarah setingkat lebih
tinggi dari penjelasan algoritma sebelumnya yakni program harus mengecek apakah
kondisi pin 3.3 telah berubah menjadi high kembali.
Tabel 3.3. Perancangan fungsi dari tombol remote control yang ditekan
Tombol Command code Fungsi
Vol + 12h Naikkan PWM1 sebesar 1%
Vol - 13h Turunkan PWM1 sebesar 1%
Normal 16h Ubah arah motor 1
Prog + 10h Naikkan PWM2 sebesar 1%
Prog - 11h Turunkan PWM2 sebesar 1%
Select - 75h Ubah arah motor 2
Setelah ketujuh bit command tersimpan di dalam variabel var1 maka
dilakukan pendeteksian tombol mana yang ditekan oleh user. Pada perancangan ini
50
hanya 6 tombol yang akan digunakan. Keenam tombol beserta fungsinya dapat dilihat
pada tabel 3.3. Kemudian dilakukan pemanggilan subrutin kirim data ke
mikrokontroler sekunder. Setelah itu dilakukan kembali pengaktifan kembali fungsi
interupsi eksternal yang pada awal proses pendeteksian ini dinonaktifkan.
3.6.5.1 Diagram Alir Subrutin Tunda 2,45 mS
Diagram alir subrutin tunda 2,45 mS diperlihatkan pada gambar 3.14. Karena
besarnya tunda 2,45 mS yang ingin dihasilkan masih dibawah tunda maksimal sebesar
71,7 mS maka tunda dapat langsung dihasilkan dalam satu kali siklus putaran timer.
Dengan menggunakan persamaan 2.9 dan 2.10, dapat dihitung jumlah step, serta nilai
TL0 dan TH0 yang harus dimasukkan supaya timer0 dapat menghasilkan tunda
sebesar 2,45 mS , yaitu:
12kristal_frek*delaystep_Jumlah =
1211059200x10.45,2step_Jumlah
3−=
Jumlah _step ≈ 2257d atau 08D1h
THx/TLx = FFFFh – Jumlah_step + 1h
TH0/TL0 = FFFFh – 08D1h +1h
TH0/TL0 = F72Fh
Gambar 3.14 Diagram alir subrutin tunda 2,45 mS
51
Subrutin diagram alir untuk menghasilkan tunda 0,9 mS hampir sama dengan
diagram alir subrutin tunda 2,45 mS. Perbedaan hanya terdapat pada hasil perhitungan
untuk menentukan nilai TL0 dan TH0, yaitu: C3h untuk TL0, dan FCh untuk TH0.
3.6.6. Interupsi Scanning Seven-Segment
Seperti ditunjukkan pada gambar 3.15, diagram alir interupsi scanning seven-
segment diawali dengan mematikan semua seven-segment. Kemudian diikuti dengan
menunjuk alamat data yang akan ditampilkan dan mengkonversikannya sesuai dengan
posisi pin seven-segment. Setelah itu, tunjuk dan aktifkan seven-segment yang sesuai.
Seandainya ini merupakan data terakhir, maka alamat data dan posisi seven-segment
perlu di reset ke alamat awal, kalau tidak maka alamat data dan posisi baru harus
disimpan. Proses scanning ini akan dipicu oleh interupsi timer1 yang terjadi setiap 2,5
mS.
Gambar 3.15 Diagram alir tampilan seven-segment
52
3.6.6.1 Diagram alir Subrutin Pengubahan Data dari Heksa Desimal Menjadi
BCD
Subrutin pengubahan data dari bilangan heksa desimal menjadi BCD (Binary
Coded Decimal) dilaksanakan oleh mikrokontroler setiap kali mikrokontroler selesai
menerima data masukan, baik dari tombol push-button maupun dari remote control.
Diagram alirnya diperlihatkan pada gambar 3.16. Pada bagian ini data yang akan
diubah menjadi bilangan BCD adalah data yang tersimpan pada PWM1 dan PWM2
yang tersimpan pada alamat memori 30h dan 31h. Nilai BCD ini kemudian akan
digunakan sebagai nilai indexed addressing pada look-up table yang menunjukkan
tampilan seven- segment yang sesuai.
Setelah itu data arah_mtr yang tersimpan pada alamat 32H akan dicek untuk
untuk mengetahui arah putar motor pertama dan kedua. Apabila arah putar motor
adalah CW maka nilai indexed adressing-nya adalah 10 yang akan menampilkan
tulisan pada seven-segment. Sedangkan apabila arah putarnya adalah CCW maka
nilai indexed adressing-nya adalah 11 yang akan menampilkan tulisan pada seven-
segment .
Prinsip pengubahan bilangan heksa desimal menjadi BCD adalah sebagai
berikut (pada perancangan ini, proses dibatasi hanya untuk bilangan desimal antara 0d
sampai 100d atau 00h sampai 64h pada bilangan heksa desimal) :
1. Cek apakah nibble (4 bit) bawah sama atau lebih besar dari 10d? Apabila ya
tambahkan dengan 6 dan set carry, kemudian simpan sebagai digit satuan. Apabila
tidak maka langsung disimpan tanpa perlu dilakukan penambahan.
2. Ambil nibble atas dan cek apakah terdapat carry dari proses sebelumnya? Kalau
ya maka tambahkan satu dan apabila tidak maka tidak perlu ditambah. Kemudian
cek apakah nilai setelah penambahan lebih besar atau sama dengan 10d? Apabila
ya tambahkan dengan 6 dan set carry, kemudian simpan sebagai digit puluhan.
Apabila tidak maka langsung disimpan tanpa perlu dilakukan penambahan.
Diagram alir proses pengecekan dan pengubahan tiap nibble dapat dilihat pada
gambar 3.17.
53
Gambar 3.16 Diagram alir subrutin pengubahan data dari heksa desimal menjadi BCD
54
Gambar 3.17 Diagram alir subrutin pengecekan dan pengubahan nibble.
55
BAB IV
PENGAMATAN DAN PEMBAHASAN
Pengamatan secara keseluruhan menunjukkan bahwa alat yang dibuat mampu
bekerja sesuai dengan yang diharapkan, yaitu alat mampu menghasilkan dua buah
gelombang PWM secara simultan dengan duty cycle yang dapat diatur melalui tombol
push-button ataupun remote control. Data duty cycle dalam satuan persen dapat
ditampilkan oleh penampil seven-segment dengan baik. Selain itu motor juga dapat
berputar dua arah, clock wise (CW) maupun counter clock wise (CCW).
4.1. Pengamatan Terhadap Sinyal Keluaran IR Receiver Module.
Sinyal keluaran IR Receiver Module merupakan kebalikan atau inverse dari
sinyal remote control yang berupa rentetan data serial yang terdiri dari start bit, 7-bit
command, dan 5-bit address. Gambar 4.1 menunjukkan salah satu bentuk gelombang
keluaran IR Receiver Module.
Gambar 4.1. Sinyal keluaran IR Receiver Module
Dari hasil pengukuran didapatkan data untuk start bit berupa sinyal “0” selama
2,4 mS, sementara data “1” direpresentasikan dengan sinyal low selama 1,2 mS, dan
data “0” direpresentasikan dengan sinyal low selama 0,6 mS. Sedangkan sinyal-sinyal
56
high selama 0,6 mS merupakan sinyal idle. Pengamatan ini menunjukkan bahwa data
yang dikeluarkan oleh IR Receiver Module sesuai dengan pengkodean lebar pulsa
SIRC SONY yang tertulis di dasar teori. Tabel 4.1 memperlihatkan fungsi-fungsi
tombol remote control untuk mengendalikan perangkat digital laser show.
Tabel 4.1. Fungsi dari tombol remote control yang ditekan
Tombol Command code Fungsi Keterangan
Vol + 12h Naikkan PWM1 sebesar 1% Sesuai perancangan
Vol - 13h Turunkan PWM1 sebesar 1% Sesuai perancangan Normal 16h Ubah arah motor 1 Sesuai perancangan Prog + 10h Naikkan PWM2 sebesar 1% Sesuai perancangan Prog - 11h Turunkan PWM2 sebesar 1% Sesuai perancangan
Select - 75h Ubah arah motor 2 Sesuai perancangan
4.2. Pengamatan terhadap pulsa PWM
Pulsa PWM diamati pada bagian keluaran non-inverting buffer 74hc541 yang
dihubungkan ke ground melalui sebuah resistor 1kΩ. Masukan dari buffer berasal dari
port 1.0 dan 1.1 mikrokontroler AT89S51 yang difungsikan sebagai output. Bentuk
gelombang sinyal PWM dengan duty cycle 63% dapat diamati pada gambar 4.2.
Gambar 4.2 Bentuk pulsa PWM dengan duty cycle 63%
Dari hasil pengamatan gambar diatas terlihat bahwa bentuk gelombang
keluaran sinyal PWM berupa gelombang kotak dengan frekuensi yang berkisar antara
91,75 Hz sampai 92,65 Hz. Duty cycle yang terukur dari osiloskop digital
57
menunjukkan range data antara 62, 65% sampai 63,76%. Frekuensi dan duty cycle
yang berubah-ubah tersebut dikarenakan interupsi timer 0 untuk melakukan scanning
seven-segment.
Pada tabel 4.2 disajikan data pengamatan terhadap beberapa contoh pulsa
PWM dengan duty cycle yang berbeda-beda. Dari tabel dapat terlihat bahwa range
error untuk duty cycle PWM yang berbeda-beda memiliki nilai yang hampir sama. Ini
menunjukkan bahwa penginterupsian oleh program scanning seven-segment
dilakukan secara periodis dan teratur. Perbedaan yang terjadi disebabkan oleh
kekurangtelitian alat pengukur saat mencuplik data. Rerata range error PWM pertama
adalah sebesar 0,77%. Sedangkan rerata untuk PWM kedua adalah sebesar 0,71%.
Tabel 4.2. Data pengamatan duty cycle PWM
Motor 1 Motor 2
PWM teramati
(%)
PWM teramati
(%)
PWM
set point
(%) Batas
bawah
Batas
atas
Range Error
(%) Batas
bawah
Batas
atas
Range Error
(%)
0 0 0 0 0 0 0
1 0,90 1,1 0,2 0,91 1,2 0,29
10 9,58 10,35 0,77 9,28 10,11 0,83
20 19,65 20,45 0,8 19,48 20,35 0,87
30 29,73 30,56 0,83 29,61 30,38 0,77
40 39,73 40,55 0,82 39,80 40,37 0,58
50 49,67 50,38 0,71 49,58 50,48 0,9
60 59,51 60,45 0,94 59,58 60,61 1,03
70 69,65 70,63 0,98 69,71 70,37 0,66
80 79,52 80,61 1,09 79,65 80,54 0,89
90 89,45 90,62 1,17 89,84 90,68 0,84
99 98,34 99,28 0,94 98,21 99,11 0,9
Rerata range error 0,77 Rerata range error 0,71
Ket: Range error didapatkan dengan mengurangkan batas atas dengan batas bawah.
Range error = batas atas - batas bawah
Rerata range error didapatkan dengan menjumlahkan semua sample data range
error dan membaginya dengan jumlah sample.
58
4.3. Hubungan kecepatan putar motor dengan presentase PWM
Kecepatan putar masing-masing motor diukur dengan menggunakan
tachometer baik pada saat berputar searah (CW) maupun berlawanan (CCW) jarum
jam. Metodenya adalah dengan menempelkan kertas berwarna gelap (hitam) ke
sekeliling cermin sehingga menyerupai tabung, kemudian pada salah satu bagian
tabung tersebut ditempelkan selapis kertas reflektor untuk memantulkan kembali sinar
yang dipancarkan tachometer yang akan digunakan sebagai input counter tachometer.
Hasil pengukuran menggunakan tachometer terhadap kecepatan motor
disajikan dalam tabel 4.3 sampai 4.6. Sedangkan tampilan grafiknya disajikan mulai
gambar 4.3 sampai 4.6. Dari hasil pengukuran dapat diamati bahwa peningkatan
kecepatan motor berupa kurva logaritmis dibandingkan dengan kenaikan presentase
PWM yang linear. Hal ini diakibatkan oleh karakteristik motor yang tidak linear.
Pada pengamatan kecepatan minimal motor dapat dilihat bahwa motor dapat
masih dapat berputar pada tingkat PWM 6% apabila kecepatannya diturunkan dari
kecepatan yang lebih tinggi. Sedangkan apabila dari diam, motor akan mulai berputar
pada presentase PWM sebesar 9%. Perbedaan ini dikarenakan gaya kelembaman,
yaitu suatu gaya yang menyebabkan suatu benda akan cenderung mempertahankan
kondisi terakhirnya sehingga diperlukan energi yang lebih besar untuk merubah
kondisi tersebut. Secara umum dapat dianalisa bahwa karakteristik starting point
motor cukup bagus karena berada pada titik yang cukup rendah.
Pengamatan untuk membandingkan karakteristik kedua motor menunjukkan
bahwa kedua motor memiliki karakteristik yang hampir sama dilihat dari starting
point minimum, maupun grafik perubahan kecepatannya. Perbedaan antara kedua
motor terletak pada kecepatan maksimal motor pertama yang lebih rendah daripada
motor kedua.
Sedangkan pengamatan untuk melihat perbedaan kecepatan saat motor
berputar searah (CW) dan berlawanan (CCW) jarum jam memperlihatkan bahwa
kecepatan motor saat berputar searah jarum jam sedikit lebih cepat dibanding
sebaliknya. Hal ini dikarenakan kedua motor yang digunakan adalah jenis motor CW,
yang berarti didesain untuk bekerja lebih optimal saat berputar searah jarum jam.
Namun sesuai karakteristik motor DC yang akan berubah arah apabila polaritas
tegangannya dibalik, motor-motor ini juga mampu berputar CCW dengan cukup baik.
59
Tabel 4.3 Kecepatan motor 1 saat berputar searah jarum jam (CW)
707 036E POP TL0 708 0370 POP TH0 709 0372 RET 713 0373 TUNDA_DEBOUNCE: ;TUNDA 20 mS 714 0373 CLR TR0 715 0375 CLR F0 716 0377 PUSH TH0 717 0379 PUSH TL0 718 037B MOV TH0,#0B1H 719 037E MOV TL0,#0E0H 720 0381 SETB TR0 721 0383 JNB TF0,$ 722 0386 CLR TF0 723 0388 POP TL0 724 038A POP TH0 725 038C RET 728 038D TUNDA_REMOTE: ;Tunda 170 mS 729 038D MOV R2,#0FFh 730 038F ULANG1: 731 038F MOV R3,#0FFh 732 0391 DJNZ R3,$ 733 0393 DJNZ R2,ULANG1 734 0395 RET 738 0396 ;*****************************************************; 739 0396 ;----------KONVERSI TAMPILAN DARI HEX KE BCD----------; 740 0396 ;*****************************************************; 743 0396 UBAH_BCD: 744 0396 MOV B,#2H ;Ada 2 PWM 745 0399 MOV R0,#30H ;Tunjuk alamat data sumber (Hex) 746 039B MOV R1,#50H ;Tunjuk alamat penampungan sementara (BCD) 748 039D BCD_LAGI: 749 039D MOV R6,#00H ;Data puluhan 750 039F MOV R5,#00H ;Data satuan 751 03A1 MOV A,@R0 ;Ambil data PWM sumber (Hex) 752 03A2 PUSH B ;Simpan B 753 03A4 MOV B,#10 ;Angka pembagi: 10 754 03A7 DIV AB ;PWM dibagi 10 755 03A8 MOV R6,A ;Hasil bagi (puluhan) simpan ke R6 756 03A9 MOV R5,B ;Sisa bagi (satuan) simpan ke R5 758 03AB MOV A,R5 ;Copy R5 ke penampungan sementara 759 03AC MOV @R1,A 760 03AD INC R1 ;Tunjuk alamat penampungan sementara (BCD) berikutnya 761 03AE MOV A,R6 ;Copy R6 ke penampungan sementara 762 03AF MOV @R1,A 764 03B0 POP B ;Keluarkan B 765 03B2 INC R0 ;Tunjuk alamat data sumber (Hex) berikutnya 766 03B3 INC R1 ;Tunjuk alamat penampungan sementara (BCD) berikutnya 767 03B4 DJNZ B,BCD_LAGI ;Sudah 2 PWM? Belum, konversi lagi 769 03B7 MOV PWM2_PULUHAN,53H ;Ya, pindahkan ke alamat data sebenarnya 770 03BA MOV PWM2_SATUAN,52H 771 03BD MOV PWM1_PULUHAN,51H 772 03C0 MOV PWM1_SATUAN,50H 774 03C3 ;********************CEK ARAH MOTOR*******************; 776 03C3 JB ARAH1,M1_CCW ;ARAH1 = 1? Ya, jump to M1_CCW 777 03C6 MOV ARAH_MTR1,#10 ;Tidak, isi ARAH_MTR1 dgn 10d (tampilan C) 778 03C9 SJMP CEK_ARAH2 ;Jump to CEK_ARAH2 779 03CB M1_CCW: 780 03CB MOV ARAH_MTR1,#11 ;Isi ARAH_MTR1 dengan 11d (tampilan mirror-C)
L2-11
782 03CE CEK_ARAH2: 783 03CE JB ARAH2,M2_CCW ;ARAH2 = 1? Ya, jump to M2_CCW 784 03D1 MOV ARAH_MTR2,#10 ;Tidak, isi ARAH_MTR2 dgn 10d (tampilan C) 785 03D4 SJMP UBAH_BCD_SELESAI ;Jump to UBAH_BCD_SELESAI 786 03D6 M2_CCW: 787 03D6 MOV ARAH_MTR2,#11 ;Isi ARAH_MTR2 dengan 11d (tampilan mirror-C) 789 03D9 UBAH_BCD_SELESAI: ;Selesai dan kembali 790 03D9 RET 794 03DA ;*****************************************************; 795 03DA ;---------------LOOK UP TABLE TAMPILAN----------------; 796 03DA ;*****************************************************; 798 03DA ; URUTAN KAKI DARI 1 - 10 799 03DA ; 800 03DA ;1:E, 2:D, 3:COMMON, 4:C, 5:DP, 6:B, 7:A, 8;COMMON,9:F, 10:G; 801 03DA ;PORT 2.7:DP, 2.6:G, 2.5:F, 2.4:E, 2.3:D, 2.2:C, 2.1:B, P2.0:A. 802 03DA ; 0 = AKTIF, 1 = MATI; 803 03DA ;*****************************************************; 805 03DA TABEL_SEGMENT: 806 03DA DB 11000000B, 11111001B, 00100100B, 10110000B, 10011001B ;0,1,2,3,4 807 03DF DB 10010010B, 10000010B, 11111000B, 10000000B, 10010000B ;5,6,7,8,9 808 03E4 DB 11000110B, 11110000B ;C, mirror-C
L2-12
Kode remote control SONY RM-687C
Tombol Address code (Hex) Command code (Hex) Fungsi pada alat
Key 1 01h 00h -
Key 2 01h 01h -
Key 3 01h 02h -
Key 4 01h 03h -
Key 5 01h 04h -
Key 6 01h 05h -
Key 7 01h 06h -
Key 8 01h 07h -
Key 9 01h 08h -
Key 10 01h 09h -
Key 0 01h 0Ah -
PROG + 01h 10h Naikkan 1% PWM 2
PROG - 01h 11h Naikkan 1% PWM 2
Vol + 01h 12h Naikkan 1% PWM1
Vol - 01h 13h Turunkan 1% PWM1
Mute 01h 14h -
Standby 01h 15h -
Display 01h 3Ah -
Sleep 01h 36h -
Select 01h 7Ch -
Normal 01h 16h Ubah arah motor 1
Select + 01h 74h -
Select - 01h 75h Ubah arah motor 2
TV/video 01h 25h -
1- 01h 0Ch -
2- 01h 0Dh -
L3
8-bit Microcontroller with 4K Bytes In-System Programmable Flash
AT89S51
Rev. 2487A–10/01
Features• Compatible with MCS-51® Products• 4K Bytes of In-System Programmable (ISP) Flash Memory
– Endurance: 1000 Write/Erase Cycles• 4.0V to 5.5V Operating Range• Fully Static Operation: 0 Hz to 33 MHz• Three-level Program Memory Lock• 128 x 8-bit Internal RAM• 32 Programmable I/O Lines• Two 16-bit Timer/Counters• Six Interrupt Sources• Full Duplex UART Serial Channel• Low-power Idle and Power-down Modes• Interrupt Recovery from Power-down Mode• Watchdog Timer• Dual Data Pointer• Power-off Flag• Fast Programming Time• Flexible ISP Programming (Byte and Page Mode)
DescriptionThe AT89S51 is a low-power, high-performance CMOS 8-bit microcontroller with 4Kbytes of in-system programmable Flash memory. The device is manufactured usingAtmel’s high-density nonvolatile memory technology and is compatible with the indus-try-standard 80C51 instruction set and pinout. The on-chip Flash allows the programmemory to be reprogrammed in-system or by a conventional nonvolatile memory pro-grammer. By combining a versatile 8-bit CPU with in-system programmable Flash on amonolithic chip, the Atmel AT89S51 is a powerful microcontroller which provides ahighly-flexible and cost-effective solution to many embedded control applications.
The AT89S51 provides the following standard features: 4K bytes of Flash, 128 bytes ofRAM, 32 I/O lines, Watchdog timer, two data pointers, two 16-bit timer/counters, a five-vector two-level interrupt architecture, a full duplex serial port, on-chip oscillator, andclock circuitry. In addition, the AT89S51 is designed with static logic for operationdown to zero frequency and supports two software selectable power saving modes.The Idle Mode stops the CPU while allowing the RAM, timer/counters, serial port, andinterrupt system to continue functioning. The Power-down mode saves the RAM con-tents but freezes the oscillator, disabling all other chip functions until the next externalinterrupt or hardware reset.
Port 0 Port 0 is an 8-bit open drain bidirectional I/O port. As an output port, each pin can sink eightTTL inputs. When 1s are written to port 0 pins, the pins can be used as high-impedanceinputs.
Port 0 can also be configured to be the multiplexed low-order address/data bus duringaccesses to external program and data memory. In this mode, P0 has internal pull-ups.
Port 0 also receives the code bytes during Flash programming and outputs the code bytesduring program verification. External pull-ups are required during program verification.
Port 1 Port 1 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 1 output buffers cansink/source four TTL inputs. When 1s are written to Port 1 pins, they are pulled high by theinternal pull-ups and can be used as inputs. As inputs, Port 1 pins that are externally beingpulled low will source current (IIL) because of the internal pull-ups.
Port 1 also receives the low-order address bytes during Flash programming and verification.
Port 2 Port 2 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 2 output buffers cansink/source four TTL inputs. When 1s are written to Port 2 pins, they are pulled high by theinternal pull-ups and can be used as inputs. As inputs, Port 2 pins that are externally beingpulled low will source current (IIL) because of the internal pull-ups.
Port 2 emits the high-order address byte during fetches from external program memory andduring accesses to external data memory that use 16-bit addresses (MOVX @ DPTR). In thisapplication, Port 2 uses strong internal pull-ups when emitting 1s. During accesses to externaldata memory that use 8-bit addresses (MOVX @ RI), Port 2 emits the contents of the P2 Spe-cial Function Register.
Port 2 also receives the high-order address bits and some control signals during Flash pro-gramming and verification.
Port 3 Port 3 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 3 output buffers cansink/source four TTL inputs. When 1s are written to Port 3 pins, they are pulled high by theinternal pull-ups and can be used as inputs. As inputs, Port 3 pins that are externally beingpulled low will source current (IIL) because of the pull-ups.
Port 3 receives some control signals for Flash programming and verification.
Port 3 also serves the functions of various special features of the AT89S51, as shown in thefollowing table.
Port Pin Alternate Functions
P1.5 MOSI (used for In-System Programming)
P1.6 MISO (used for In-System Programming)
P1.7 SCK (used for In-System Programming)
4 AT89S512487A–10/01
AT89S51
RST Reset input. A high on this pin for two machine cycles while the oscillator is running resets thedevice. This pin drives High for 98 oscillator periods after the Watchdog times out. The DIS-RTO bit in SFR AUXR (address 8EH) can be used to disable this feature. In the default stateof bit DISRTO, the RESET HIGH out feature is enabled.
ALE/PROG Address Latch Enable (ALE) is an output pulse for latching the low byte of the address duringaccesses to external memory. This pin is also the program pulse input (PROG) during Flashprogramming.
In normal operation, ALE is emitted at a constant rate of 1/6 the oscillator frequency and maybe used for external timing or clocking purposes. Note, however, that one ALE pulse isskipped during each access to external data memory.
If desired, ALE operation can be disabled by setting bit 0 of SFR location 8EH. With the bit set,ALE is active only during a MOVX or MOVC instruction. Otherwise, the pin is weakly pulledhigh. Setting the ALE-disable bit has no effect if the microcontroller is in external executionmode.
PSEN Program Store Enable (PSEN) is the read strobe to external program memory.
When the AT89S51 is executing code from external program memory, PSEN is activatedtwice each machine cycle, except that two PSEN activations are skipped during each accessto external data memory.
EA/VPP External Access Enable. EA must be strapped to GND in order to enable the device to fetchcode from external program memory locations starting at 0000H up to FFFFH. Note, however,that if lock bit 1 is programmed, EA will be internally latched on reset.
EA should be strapped to VCC for internal program executions.
This pin also receives the 12-volt programming enable voltage (VPP) during Flashprogramming.
XTAL1 Input to the inverting oscillator amplifier and input to the internal clock operating circuit.
XTAL2 Output from the inverting oscillator amplifier
Port Pin Alternate Functions
P3.0 RXD (serial input port)
P3.1 TXD (serial output port)
P3.2 INT0 (external interrupt 0)
P3.3 INT1 (external interrupt 1)
P3.4 T0 (timer 0 external input)
P3.5 T1 (timer 1 external input)
P3.6 WR (external data memory write strobe)
P3.7 RD (external data memory read strobe)
52487A–10/01
Special Function Registers
A map of the on-chip memory area called the Special Function Register (SFR) space is shownin Table 1.
Note that not all of the addresses are occupied, and unoccupied addresses may not be imple-mented on the chip. Read accesses to these addresses will in general return random data,and write accesses will have an indeterminate effect.
Table 1. AT89S51 SFR Map and Reset Values
0F8H 0FFH
0F0HB
000000000F7H
0E8H 0EFH
0E0HACC
000000000E7H
0D8H 0DFH
0D0HPSW
000000000D7H
0C8H 0CFH
0C0H 0C7H
0B8HIP
XX0000000BFH
0B0HP3
111111110B7H
0A8HIE
0X0000000AFH
0A0HP2
11111111AUXR1
XXXXXXX0WDTRST
XXXXXXXX0A7H
98HSCON
00000000SBUF
XXXXXXXX9FH
90HP1
1111111197H
88HTCON
00000000TMOD
00000000TL0
00000000TL1
00000000TH0
00000000TH1
00000000AUXR
XXX00XX08FH
80HP0
11111111SP
00000111DP0L
00000000DP0H
00000000DP1L
00000000DP1H
00000000PCON
0XXX000087H
6 AT89S512487A–10/01
AT89S51
User software should not write 1s to these unlisted locations, since they may be used in futureproducts to invoke new features. In that case, the reset or inactive values of the new bits willalways be 0.
Interrupt Registers: The individual interrupt enable bits are in the IE register. Two prioritiescan be set for each of the five interrupt sources in the IP register.
Dual Data Pointer Registers: To facilitate accessing both internal and external data memory,two banks of 16-bit Data Pointer Registers are provided: DP0 at SFR address locations 82H-83H and DP1 at 84H-85H. Bit DPS = 0 in SFR AUXR1 selects DP0 and DPS = 1 selects DP1.The user should always initialize the DPS bit to the appropriate value before accessing therespective Data Pointer Register.
Table 2. AUXR: Auxiliary Register
AUXR Address = 8EH Reset Value = XXX00XX0B
Not Bit Addressable
– – – WDIDLE DISRTO – – DISALE
Bit 7 6 5 4 3 2 1 0
– Reserved for future expansion
DISALE Disable/Enable ALE
DISALEOperating Mode
0 ALE is emitted at a constant rate of 1/6 the oscillator frequency
1 ALE is active only during a MOVX or MOVC instruction
DISRTO Disable/Enable Reset out
DISRTO
0 Reset pin is driven High after WDT times out
1 Reset pin is input only
WDIDLE Disable/Enable WDT in IDLE mode
WDIDLE
0 WDT continues to count in IDLE mode
1 WDT halts counting in IDLE mode
72487A–10/01
Power Off Flag: The Power Off Flag (POF) is located at bit 4 (PCON.4) in the PCON SFR.POF is set to “1” during power up. It can be set and rest under software control and is notaffected by reset.
Memory Organization
MCS-51 devices have a separate address space for Program and Data Memory. Up to 64Kbytes each of external Program and Data Memory can be addressed.
Program Memory If the EA pin is connected to GND, all program fetches are directed to external memory.
On the AT89S51, if EA is connected to VCC, program fetches to addresses 0000H throughFFFH are directed to internal memory and fetches to addresses 1000H through FFFFH aredirected to external memory.
Data Memory The AT89S51 implements 128 bytes of on-chip RAM. The 128 bytes are accessible via directand indirect addressing modes. Stack operations are examples of indirect addressing, so the128 bytes of data RAM are available as stack space.
Watchdog Timer (One-time Enabled with Reset-out)
The WDT is intended as a recovery method in situations where the CPU may be subjected tosoftware upsets. The WDT consists of a 14-bit counter and the Watchdog Timer Reset(WDTRST) SFR. The WDT is defaulted to disable from exiting reset. To enable the WDT, auser must write 01EH and 0E1H in sequence to the WDTRST register (SFR location 0A6H).When the WDT is enabled, it will increment every machine cycle while the oscillator is running.The WDT timeout period is dependent on the external clock frequency. There is no way to dis-able the WDT except through reset (either hardware reset or WDT overflow reset). WhenWDT overflows, it will drive an output RESET HIGH pulse at the RST pin.
Using the WDT To enable the WDT, a user must write 01EH and 0E1H in sequence to the WDTRST register(SFR location 0A6H). When the WDT is enabled, the user needs to service it by writing 01EHand 0E1H to WDTRST to avoid a WDT overflow. The 14-bit counter overflows when it reaches16383 (3FFFH), and this will reset the device. When the WDT is enabled, it will incrementevery machine cycle while the oscillator is running. This means the user must reset the WDTat least every 16383 machine cycles. To reset the WDT the user must write 01EH and 0E1Hto WDTRST. WDTRST is a write-only register. The WDT counter cannot be read or written.When WDT overflows, it will generate an output RESET pulse at the RST pin. The RESETpulse duration is 98xTOSC, where TOSC=1/FOSC. To make the best use of the WDT, it
Table 3. AUXR1: Auxiliary Register 1
AUXR1Address = A2H
Reset Value = XXXXXXX0B
Not Bit Addressable
– – – – – – – DPS
Bit 7 6 5 4 3 2 1 0
– Reserved for future expansion
DPS Data Pointer Register Select
DPS
0 Selects DPTR Registers DP0L, DP0H
1 Selects DPTR Registers DP1L, DP1H
8 AT89S512487A–10/01
AT89S51
should be serviced in those sections of code that will periodically be executed within the timerequired to prevent a WDT reset.
WDT During Power-down and Idle
In Power-down mode the oscillator stops, which means the WDT also stops. While in Power-down mode, the user does not need to service the WDT. There are two methods of exitingPower-down mode: by a hardware reset or via a level-activated external interrupt, which isenabled prior to entering Power-down mode. When Power-down is exited with hardware reset,servicing the WDT should occur as it normally does whenever the AT89S51 is reset. ExitingPower-down with an interrupt is significantly different. The interrupt is held low long enough forthe oscillator to stabilize. When the interrupt is brought high, the interrupt is serviced. To pre-vent the WDT from resetting the device while the interrupt pin is held low, the WDT is notstarted until the interrupt is pulled high. It is suggested that the WDT be reset during the inter-rupt service for the interrupt used to exit Power-down mode.
To ensure that the WDT does not overflow within a few states of exiting Power-down, it is bestto reset the WDT just before entering Power-down mode.
Before going into the IDLE mode, the WDIDLE bit in SFR AUXR is used to determine whetherthe WDT continues to count if enabled. The WDT keeps counting during IDLE (WDIDLE bit =0) as the default state. To prevent the WDT from resetting the AT89S51 while in IDLE mode,the user should always set up a timer that will periodically exit IDLE, service the WDT, andreenter IDLE mode.
With WDIDLE bit enabled, the WDT will stop to count in IDLE mode and resumes the countupon exit from IDLE.
UART The UART in the AT89S51 operates the same way as the UART in the AT89C51. For furtherinformation on the UART operation, refer to the ATMEL Web site (http://www.atmel.com).From the home page, select ‘Products’, then ‘8051-Architecture Flash Microcontroller’, then‘Product Overview’.
Timer 0 and 1 Timer 0 and Timer 1 in the AT89S51 operate the same way as Timer 0 and Timer 1 in theAT89C51. For further information on the timers’ operation, refer to the ATMEL Web site(http://www.atmel.com). From the home page, select ‘Products’, then ‘8051-Architecture FlashMicrocontroller’, then ‘Product Overview’.
Interrupts The AT89S51 has a total of five interrupt vectors: two external interrupts (INT0 and INT1), twotimer interrupts (Timers 0 and 1), and the serial port interrupt. These interrupts are all shown inFigure 1.
Each of these interrupt sources can be individually enabled or disabled by setting or clearing abit in Special Function Register IE. IE also contains a global disable bit, EA, which disables allinterrupts at once.
Note that Table 4 shows that bit position IE.6 is unimplemented. In the AT89S51, bit positionIE.5 is also unimplemented. User software should not write 1s to these bit positions, since theymay be used in future AT89 products.
The Timer 0 and Timer 1 flags, TF0 and TF1, are set at S5P2 of the cycle in which the timersoverflow. The values are then polled by the circuitry in the next cycle
92487A–10/01
.
Figure 1. Interrupt Sources
Table 4. Interrupt Enable (IE) Register
(MSB) (LSB)
EA – – ES ET1 EX1 ET0 EX0
Enable Bit = 1 enables the interrupt.
Enable Bit = 0 disables the interrupt.
Symbol Position Function
EA IE.7 Disables all interrupts. If EA = 0, no interrupt is acknowledged. If EA = 1, each interrupt source is individually enabled or disabled by setting or clearing its enable bit.
– IE.6 Reserved
– IE.5 Reserved
ES IE.4 Serial Port interrupt enable bit
ET1 IE.3 Timer 1 interrupt enable bit
EX1 IE.2 External interrupt 1 enable bit
ET0 IE.1 Timer 0 interrupt enable bit
EX0 IE.0 External interrupt 0 enable bit
User software should never write 1s to reserved bits, because they may be used in future AT89 products.
IE1
IE0
1
1
0
0
TF1
TF0
INT1
INT0
TIRI
10 AT89S512487A–10/01
AT89S51
11
Oscillator Characteristics
XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier that can beconfigured for use as an on-chip oscillator, as shown in Figure 2. Either a quartz crystal orceramic resonator may be used. To drive the device from an external clock source, XTAL2should be left unconnected while XTAL1 is driven, as shown in Figure 3. There are no require-ments on the duty cycle of the external clock signal, since the input to the internal clockingcircuitry is through a divide-by-two flip-flop, but minimum and maximum voltage high and lowtime specifications must be observed.
Figure 2. Oscillator Connections
Note: C1, C2 = 30 pF ± 10 pF for Crystals = 40 pF ± 10 pF for Ceramic Resonators
Figure 3. External Clock Drive Configuration
Idle Mode In idle mode, the CPU puts itself to sleep while all the on-chip peripherals remain active. Themode is invoked by software. The content of the on-chip RAM and all the special functionregisters remain unchanged during this mode. The idle mode can be terminated by anyenabled interrupt or by a hardware reset.
Note that when idle mode is terminated by a hardware reset, the device normally resumes pro-gram execution from where it left off, up to two machine cycles before the internal resetalgorithm takes control. On-chip hardware inhibits access to internal RAM in this event, butaccess to the port pins is not inhibited. To eliminate the possibility of an unexpected write to aport pin when idle mode is terminated by a reset, the instruction following the one that invokesidle mode should not write to a port pin or to external memory.
Power-down Mode
In the Power-down mode, the oscillator is stopped, and the instruction that invokes Power-down is the last instruction executed. The on-chip RAM and Special Function Registers retaintheir values until the Power-down mode is terminated. Exit from Power-down mode can be ini-tiated either by a hardware reset or by activation of an enabled external interrupt into INT0 orINT1. Reset redefines the SFRs but does not change the on-chip RAM. The reset should notbe activated before VCC is restored to its normal operating level and must be held active longenough to allow the oscillator to restart and stabilize.
C2XTAL2
GND
XTAL1C1
XTAL2
XTAL1
GND
NC
EXTERNALOSCILLATOR
SIGNAL
2487A–10/01
Program Memory Lock Bits
The AT89S51 has three lock bits that can be left unprogrammed (U) or can be programmed(P) to obtain the additional features listed in the following table.
When lock bit 1 is programmed, the logic level at the EA pin is sampled and latched duringreset. If the device is powered up without a reset, the latch initializes to a random value andholds that value until reset is activated. The latched value of EA must agree with the currentlogic level at that pin in order for the device to function properly.
Programming the Flash – Parallel Mode
The AT89S51 is shipped with the on-chip Flash memory array ready to be programmed. Theprogramming interface needs a high-voltage (12-volt) program enable signal and is compati-ble with conventional third-party Flash or EPROM programmers.
The AT89S51 code memory array is programmed byte-by-byte.
Programming Algorithm: Before programming the AT89S51, the address, data, and controlsignals should be set up according to the Flash programming mode table and Figures 13 and14. To program the AT89S51, take the following steps:
1. Input the desired memory location on the address lines.
2. Input the appropriate data byte on the data lines.
3. Activate the correct combination of control signals.
4. Raise EA/VPP to 12V.
5. Pulse ALE/PROG once to program a byte in the Flash array or the lock bits. The byte-write cycle is self-timed and typically takes no more than 50 µs. Repeat steps 1 through 5, changing the address and data for the entire array or until the end of the object file is reached.
Data Polling: The AT89S51 features Data Polling to indicate the end of a byte write cycle.During a write cycle, an attempted read of the last byte written will result in the complement ofthe written data on P0.7. Once the write cycle has been completed, true data is valid on all out-puts, and the next cycle may begin. Data Polling may begin any time after a write cycle hasbeen initiated.
Table 5. Status of External Pins During Idle and Power-down Modes
Mode Program Memory ALE PSEN PORT0 PORT1 PORT2 PORT3
Idle Internal 1 1 Data Data Data Data
Idle External 1 1 Float Data Address Data
Power-down Internal 0 0 Data Data Data Data
Power-down External 0 0 Float Data Data Data
Table 6. Lock Bit Protection Modes
Program Lock Bits
LB1 LB2 LB3 Protection Type
1 U U U No program lock features
2 P U U MOVC instructions executed from external program memory are disabled from fetching code bytes from internal memory, EA is sampled and latched on reset, and further programming of the Flash memory is disabled
3 P P U Same as mode 2, but verify is also disabled
4 P P P Same as mode 3, but external execution is also disabled
12 AT89S512487A–10/01
AT89S51
Ready/Busy: The progress of byte programming can also be monitored by the RDY/BSY out-put signal. P3.0 is pulled low after ALE goes high during programming to indicate BUSY. P3.0is pulled high again when programming is done to indicate READY.
Program Verify: If lock bits LB1 and LB2 have not been programmed, the programmed codedata can be read back via the address and data lines for verification. The status of the individ-ual lock bits can be verified directly by reading them back.
Reading the Signature Bytes: The signature bytes are read by the same procedure as a nor-mal verification of locations 000H, 100H, and 200H, except that P3.6 and P3.7 must be pulledto a logic low. The values returned are as follows.
Chip Erase: In the parallel programming mode, a chip erase operation is initiated by using theproper combination of control signals and by pulsing ALE/PROG low for a duration of 200 ns -500 ns.
In the serial programming mode, a chip erase operation is initiated by issuing the Chip Eraseinstruction. In this mode, chip erase is self-timed and takes about 500 ms.
During chip erase, a serial read from any address location will return 00H at the data output.
Programming the Flash – Serial Mode
The Code memory array can be programmed using the serial ISP interface while RST ispulled to VCC. The serial interface consists of pins SCK, MOSI (input) and MISO (output). AfterRST is set high, the Programming Enable instruction needs to be executed first before otheroperations can be executed. Before a reprogramming sequence can occur, a Chip Eraseoperation is required.
The Chip Erase operation turns the content of every memory location in the Code array intoFFH.
Either an external system clock can be supplied at pin XTAL1 or a crystal needs to be con-nected across pins XTAL1 and XTAL2. The maximum serial clock (SCK) frequency should beless than 1/16 of the crystal frequency. With a 33 MHz oscillator clock, the maximum SCK fre-quency is 2 MHz.
Serial Programming Algorithm
To program and verify the AT89S51 in the serial programming mode, the following sequenceis recommended:
1. Power-up sequence:
Apply power between VCC and GND pins.
Set RST pin to “H”.
If a crystal is not connected across pins XTAL1 and XTAL2, apply a 3 MHz to 33 MHzclock to XTAL1 pin and wait for at least 10 milliseconds.
2. Enable serial programming by sending the Programming Enable serial instruction to pin MOSI/P1.5. The frequency of the shift clock supplied at pin SCK/P1.7 needs to be less than the CPU clock at XTAL1 divided by 16.
3. The Code array is programmed one byte at a time in either the Byte or Page mode. The write cycle is self-timed and typically takes less than 0.5 ms at 5V.
4. Any memory location can be verified by using the Read instruction that returns the con-tent at the selected address at serial output MISO/P1.6.
5. At the end of a programming session, RST can be set low to commence normal device operation.
132487A–10/01
Power-off sequence (if needed):
Set XTAL1 to “L” (if a crystal is not used).
Set RST to “L”.
Turn VCC power off.
Data Polling: The Data Polling feature is also available in the serial mode. In this mode, dur-ing a write cycle an attempted read of the last byte written will result in the complement of theMSB of the serial output byte on MISO.
Serial Programming Instruction Set
The Instruction Set for Serial Programming follows a 4-byte protocol and is shown in Table 8on page 18.
Programming Interface – Parallel Mode
Every code byte in the Flash array can be programmed by using the appropriate combinationof control signals. The write operation cycle is self-timed and once initiated, will automaticallytime itself to completion.
All major programming vendors offer worldwide support for the Atmel microcontroller series.Please contact your local programming vendor for the appropriate software revision.
Notes: 1. Each PROG pulse is 200 ns - 500 ns for Chip Erase.2. Each PROG pulse is 200 ns - 500 ns for Write Code Data.3. Each PROG pulse is 200 ns - 500 ns for Write Lock Bits.4. RDY/BSY signal is output on P3.0 during programming.5. X = don’t care.
Table 7. Flash Programming Modes
Mode VCC RST PSEN
ALE/
PROG
EA/
VPP P2.6 P2.7 P3.3 P3.6 P3.7
P0.7-0
Data
P2.3-0 P1.7-0
Address
Write Code Data 5V H L(2)
12V L H H H H DIN A11-8 A7-0
Read Code Data 5V H L H H L L L H H DOUT A11-8 A7-0
Write Lock Bit 1 5V H L(3)
12V H H H H H X X X
Write Lock Bit 2 5V H L(3)
12V H H H L L X X X
Write Lock Bit 3 5V H L(3)
12V H L H H L X X X
Read Lock Bits
1, 2, 35V H L H H H H L H L
P0.2,P0.3,P0.4
X X
Chip Erase 5V H L(1)
12V H L H L L X X X
Read Atmel ID 5V H L H H L L L L L 1EH 0000 00H
Read Device ID 5V H L H H L L L L L 51H 0001 00H
Read Device ID 5V H L H H L L L L L 06H 0010 00H
14 AT89S512487A–10/01
AT89S51
Figure 4. Programming the Flash Memory (Parallel Mode)
Figure 5. Verifying the Flash Memory (Parallel Mode)
P1.0-P1.7
P2.6
P3.6
P2.0 - P2.3
A0 - A7ADDR.
0000H/FFFH
SEE FLASHPROGRAMMINGMODES TABLE
3-33 MHz
P0
V
P2.7
PGMDATA
PROG
V /VIH PP
VIH
ALE
P3.7
XTAL2 EA
RST
PSEN
XTAL1
GND
VCC
AT89S51
P3.3
P3.0RDY/BSY
A8 - A11
CC
P1.0-P1.7
P2.6
P3.6
P2.0 - P2.3
A0 - A7ADDR.
0000H/FFFH
SEE FLASHPROGRAMMINGMODES TABLE
3-33 MHz
P0
P2.7
PGM DATA(USE 10KPULLUPS)
VIH
VIH
ALE
P3.7
XTAL2 EA
RST
PSEN
XTAL1
GND
VCC
AT89S51
P3.3
A8 - A11
VCC
152487A–10/01
Figure 6. Flash Programming and Verification Waveforms – Parallel Mode
Flash Programming and Verification Characteristics (Parallel Mode)TA = 20°C to 30°C, VCC = 4.5 to 5.5V
Symbol Parameter Min Max Units
VPP Programming Supply Voltage 11.5 12.5 V
IPP Programming Supply Current 10 mA
ICC VCC Supply Current 30 mA
1/tCLCL Oscillator Frequency 3 33 MHz
tAVGL Address Setup to PROG Low 48tCLCL
tGHAX Address Hold After PROG 48tCLCL
tDVGL Data Setup to PROG Low 48tCLCL
tGHDX Data Hold After PROG 48tCLCL
tEHSH P2.7 (ENABLE) High to VPP 48tCLCL
tSHGL VPP Setup to PROG Low 10 µs
tGHSL VPP Hold After PROG 10 µs
tGLGH PROG Width 0.2 1 µs
tAVQV Address to Data Valid 48tCLCL
tELQV ENABLE Low to Data Valid 48tCLCL
tEHQZ Data Float After ENABLE 0 48tCLCL
tGHBL PROG High to BUSY Low 1.0 µs
tWC Byte Write Cycle Time 50 µs
tGLGHtGHSL
tAVGL
tSHGL
tDVGLtGHAX
tAVQV
tGHDX
tEHSH tELQV
tWC
BUSY READY
tGHBL
tEHQZ
P1.0 - P1.7P2.0 - P2.3
ALE/PROG
PORT 0
LOGIC 1LOGIC 0EA/VPP
VPP
P2.7(ENABLE)
P3.0(RDY/BSY)
PROGRAMMINGADDRESS
VERIFICATIONADDRESS
DATA IN DATA OUT
16 AT89S512487A–10/01
AT89S51
Figure 7. Flash Memory Serial Downloading
Flash Programming and Verification Waveforms – Serial Mode
Figure 8. Serial Programming Waveforms
P1.7/SCK
DATA OUTPUT
INSTRUCTIONINPUT
CLOCK IN
3-33 MHz
P1.5/MOSI
VIH
XTAL2
RSTXTAL1
GND
VCC
AT89S51
P1.6/MISO
VCC
7 6 5 4 3 2 1 0
172487A–10/01
Notes: 1. The signature bytes are not readable in Lock Bit Modes 3 and 4.2. B1 = 0, B2 = 0 → Mode 1, no lock protection
After Reset signal is high, SCK should be low for at least 64 system clocks before it goes high to clock in the enable databytes. No pulsing of Reset signal is necessary. SCK should be no faster than 1/16 of the system clock at XTAL1.
For Page Read/Write, the data always starts from byte 0 to 255. After the command byte and upper address byte arelatched, each byte thereafter is treated as data until all 256 bytes are shifted in/out. Then the next instruction will be ready tobe decoded.
Read data from Program memory in the Page Mode (256 bytes)
Write Program Memory(Page Mode)
0101 0000 xxxx Byte 0 Byte 1... Byte 255
Write data to Program memory in the Page Mode (256 bytes)
Each of the lock bits needs to be activated sequentially before Mode 4 can be executed.
D7
D6
D5
D4
D3
D2
D1
D0
A7
A6
A5
A4
A3
A2 A1
A0
A11
A10 A
9A
8B
2B
1
A11
A10 A
9A
8
A7
A6
A5
A4
A3
A2 A1
A0
D7
D6
D5
D4
D3
D2
D1
D0
LB3
LB2
LB1
A5
A4
A3
A2
A1
A11
A10 A
9A
8
A11
A10 A
9A
8
A0
18 AT89S512487A–10/01
AT89S51
192487A–10/01
Serial Programming Characteristics
Figure 9. Serial Programming Timing
MOSI
MISO
SCK
tOVSH
tSHSL
tSLSHtSHOX
tSLIV
Table 9. Serial Programming Characteristics, TA = -40° C to 85° C, VCC = 4.0 - 5.5V (Unless Otherwise Noted)
Symbol Parameter Min Typ Max Units
1/tCLCL Oscillator Frequency 0 33 MHz
tCLCL Oscillator Period 30 ns
tSHSL SCK Pulse Width High 8 tCLCL ns
tSLSH SCK Pulse Width Low 8 tCLCL ns
tOVSH MOSI Setup to SCK High tCLCL ns
tSHOX MOSI Hold after SCK High 2 tCLCL ns
tSLIV SCK Low to MISO Valid 10 16 32 ns
tERASE Chip Erase Instruction Cycle Time 500 ms
tSWC Serial Byte Write Cycle Time 64 tCLCL + 400 µs
Notes: 1. Under steady state (non-transient) conditions, IOL must be externally limited as follows:Maximum IOL per port pin: 10 mAMaximum IOL per 8-bit port:Port 0: 26 mA Ports 1, 2, 3: 15 mAMaximum total IOL for all output pins: 71 mAIf IOL exceeds the test condition, VOL may exceed the related specification. Pins are not guaranteed to sink current greaterthan the listed test conditions.
2. Minimum VCC for Power-down is 2V.
Absolute Maximum Ratings*Operating Temperature.................................. -55°C to +125°C *NOTICE: Stresses beyond those listed under “Absolute
Maximum Ratings” may cause permanent dam-age to the device. This is a stress rating only and functional operation of the device at these or any other conditions beyond those indicated in the operational sections of this specification is not implied. Exposure to absolute maximum rating conditions for extended periods may affect device reliability.
Storage Temperature ..................................... -65°C to +150°C
Voltage on Any Pinwith Respect to Ground .....................................-1.0V to +7.0V
Maximum Operating Voltage ............................................ 6.6V
DC Output Current...................................................... 15.0 mA
DC CharacteristicsThe values shown in this table are valid for TA = -40°C to 85°C and VCC = 4.0V to 5.5V, unless otherwise noted.
Symbol Parameter Condition Min Max Units
VIL Input Low Voltage (Except EA) -0.5 0.2 VCC-0.1 V
VIL1 Input Low Voltage (EA) -0.5 0.2 VCC-0.3 V
VIH Input High Voltage (Except XTAL1, RST) 0.2 VCC+0.9 VCC+0.5 V
VIH1 Input High Voltage (XTAL1, RST) 0.7 VCC VCC+0.5 V
VOL
Output Low Voltage(1) (Ports 1,2,3) IOL = 1.6 mA
0.45 V
VOL1
Output Low Voltage(1)
(Port 0, ALE, PSEN) IOL = 3.2 mA0.45 V
VOH
Output High Voltage(Ports 1,2,3, ALE, PSEN)
IOH = -60 µA, VCC = 5V ± 10% 2.4 V
IOH = -25 µA 0.75 VCC V
IOH = -10 µA 0.9 VCC V
VOH1
Output High Voltage(Port 0 in External Bus Mode)
IOH = -800 µA, VCC = 5V ± 10% 2.4 V
IOH = -300 µA 0.75 VCC V
IOH = -80 µA 0.9 VCC V
IIL
Logical 0 Input Current (Ports 1,2,3) VIN = 0.45V
-50 µA
ITL
Logical 1 to 0 Transition Current (Ports 1,2,3) VIN = 2V, VCC = 5V ± 10%
CIO Pin Capacitance Test Freq. = 1 MHz, TA = 25°C 10 pF
ICC
Power Supply Current
Active Mode, 12 MHz 25 mA
Idle Mode, 12 MHz 6.5 mA
Power-down Mode(2) VCC = 5.5V 50 µA
20 AT89S512487A–10/01
AT89S51
AC Characteristics Under operating conditions, load capacitance for Port 0, ALE/PROG, and PSEN = 100 pF; load capacitance for all otheroutputs = 80 pF.
External Program and Data Memory Characteristics
Symbol Parameter
12 MHz Oscillator Variable Oscillator
UnitsMin Max Min Max
1/tCLCL Oscillator Frequency 0 33 MHz
tLHLL ALE Pulse Width 127 2tCLCL-40 ns
tAVLL Address Valid to ALE Low 43 tCLCL-25 ns
tLLAX Address Hold After ALE Low 48 tCLCL-25 ns
tLLIV ALE Low to Valid Instruction In 233 4tCLCL-65 ns
tLLPL ALE Low to PSEN Low 43 tCLCL-25 ns
tPLPH PSEN Pulse Width 205 3tCLCL-45 ns
tPLIV PSEN Low to Valid Instruction In 145 3tCLCL-60 ns
tPXIX Input Instruction Hold After PSEN 0 0 ns
tPXIZ Input Instruction Float After PSEN 59 tCLCL-25 ns
tPXAV PSEN to Address Valid 75 tCLCL-8 ns
tAVIV Address to Valid Instruction In 312 5tCLCL-80 ns
tPLAZ PSEN Low to Address Float 10 10 ns
tRLRH RD Pulse Width 400 6tCLCL-100 ns
tWLWH WR Pulse Width 400 6tCLCL-100 ns
tRLDV RD Low to Valid Data In 252 5tCLCL-90 ns
tRHDX Data Hold After RD 0 0 ns
tRHDZ Data Float After RD 97 2tCLCL-28 ns
tLLDV ALE Low to Valid Data In 517 8tCLCL-150 ns
tAVDV Address to Valid Data In 585 9tCLCL-165 ns
tLLWL ALE Low to RD or WR Low 200 300 3tCLCL-50 3tCLCL+50 ns
tAVWL Address to RD or WR Low 203 4tCLCL-75 ns
tQVWX Data Valid to WR Transition 23 tCLCL-30 ns
tQVWH Data Valid to WR High 433 7tCLCL-130 ns
tWHQX Data Hold After WR 33 tCLCL-25 ns
tRLAZ RD Low to Address Float 0 0 ns
tWHLH RD or WR High to ALE High 43 123 tCLCL-25 tCLCL+25 ns
212487A–10/01
External Program Memory Read Cycle
External Data Memory Read Cycle
tLHLL
tLLIV
tPLIV
tLLAXtPXIZ
tPLPH
tPLAZtPXAV
tAVLL tLLPL
tAVIV
tPXIX
ALE
PSEN
PORT 0
PORT 2 A8 - A15
A0 - A7 A0 - A7
A8 - A15
INSTR IN
tLHLL
tLLDV
tLLWL
tLLAX
tWHLH
tAVLL
tRLRH
tAVDV
tAVWL
tRLAZ tRHDX
tRLDV tRHDZ
A0 - A7 FROM RI OR DPL
ALE
PSEN
RD
PORT 0
PORT 2 P2.0 - P2.7 OR A8 - A15 FROM DPH
A0 - A7 FROM PCL
A8 - A15 FROM PCH
DATA IN INSTR IN
22 AT89S512487A–10/01
AT89S51
External Data Memory Write Cycle
External Clock Drive Waveforms
tLHLL
tLLWL
tLLAX
tWHLH
tAVLL
tWLWH
tAVWL
tQVWXtQVWH
tWHQX
A0 - A7 FROM RI OR DPL
ALE
PSEN
WR
PORT 0
PORT 2 P2.0 - P2.7 OR A8 - A15 FROM DPH
A0 - A7 FROM PCL
A8 - A15 FROM PCH
DATA OUT INSTR IN
tCHCX
tCHCX
tCLCX
tCLCL
tCHCLtCLCHV - 0.5VCC
0.45V0.2 V - 0.1VCC
0.7 VCC
External Clock DriveSymbol Parameter Min Max Units
1/tCLCL Oscillator Frequency 0 33 MHz
tCLCL Clock Period 30 ns
tCHCX High Time 12 ns
tCLCX Low Time 12 ns
tCLCH Rise Time 5 ns
tCHCL Fall Time 5 ns
232487A–10/01
Shift Register Mode Timing Waveforms
AC Testing Input/Output Waveforms(1)
Note: 1. AC Inputs during testing are driven at VCC - 0.5V for a logic 1 and 0.45V for a logic 0. Timing measurements are made at VIHmin. for a logic 1 and VIL max. for a logic 0.
Float Waveforms(1)
Note: 1. For timing purposes, a port pin is no longer floating when a 100 mV change from load voltage occurs. A port pin begins tofloat when a 100 mV change from the loaded VOH/VOL level occurs.
Serial Port Timing: Shift Register Mode Test ConditionsThe values in this table are valid for VCC = 4.0V to 5.5V and Load Capacitance = 80 pF.
Symbol Parameter
12 MHz Osc Variable Oscillator
UnitsMin Max Min Max
tXLXL Serial Port Clock Cycle Time 1.0 12tCLCL µs
tQVXH Output Data Setup to Clock Rising Edge 700 10tCLCL-133 ns
tXHQX Output Data Hold After Clock Rising Edge 50 2tCLCL-80 ns
tXHDX Input Data Hold After Clock Rising Edge 0 0 ns
tXHDV Clock Rising Edge to Input Data Valid 700 10tCLCL-133 ns
MCS-51® is the registered trademark of Intel Corporation. Terms and product names in this document may betrademarks of others.
2487A–10/01/xM
L293, L293DQUADRUPLE HALF-H DRIVERS
SLRS008B – SEPTEMBER 1986 – REVISED JUNE 2002
1POST OFFICE BOX 655303 • DALLAS, TEXAS 75265
Featuring Unitrode L293 and L293DProducts Now From Texas Instruments
Wide Supply-Voltage Range: 4.5 V to 36 V
Separate Input-Logic Supply
Internal ESD Protection
Thermal Shutdown
High-Noise-Immunity Inputs
Functional Replacements for SGS L293 andSGS L293D
Output Current 1 A Per Channel(600 mA for L293D)
Peak Output Current 2 A Per Channel(1.2 A for L293D)
Output Clamp Diodes for InductiveTransient Suppression (L293D)
description
The L293 and L293D are quadruple high-currenthalf-H drivers. The L293 is designed to providebidirectional drive currents of up to 1 A at voltagesfrom 4.5 V to 36 V. The L293D is designed toprovide bidirectional drive currents of up to600-mA at voltages from 4.5 V to 36 V. Bothdevices are designed to drive inductive loads suchas relays, solenoids, dc and bipolar steppingmotors, as well as other high-current/high-voltageloads in positive-supply applications.
All inputs are TTL compatible. Each output is a complete totem-pole drive circuit, with a Darlington transistorsink and a pseudo-Darlington source. Drivers are enabled in pairs, with drivers 1 and 2 enabled by 1,2EN anddrivers 3 and 4 enabled by 3,4EN. When an enable input is high, the associated drivers are enabled and theiroutputs are active and in phase with their inputs. When the enable input is low, those drivers are disabled andtheir outputs are off and in the high-impedance state. With the proper data inputs, each pair of drivers formsa full-H (or bridge) reversible drive suitable for solenoid or motor applications.
On the L293, external high-speed output clamp diodes should be used for inductive transient suppression.
A VCC1 terminal, separate from VCC2, is provided for the logic inputs to minimize device power dissipation.
The L293and L293D are characterized for operation from 0°C to 70°C.
Copyright 2002, Texas Instruments IncorporatedPRODUCTION DATA information is current as of publication date.Products conform to specifications per the terms of Texas Instrumentsstandard warranty. Production processing does not necessarily includetesting of all parameters.
Please be aware that an important notice concerning availability, standard warranty, and use in critical applications ofTexas Instruments semiconductor products and disclaimers thereto appears at the end of this data sheet.
HEAT SINK ANDGROUND
HEAT SINK ANDGROUND
1
2
3
4
5
6
7
8
16
15
14
13
12
11
10
9
1,2EN1A1Y
2Y2A
VCC2
VCC14A4Y
3Y3A3,4EN
N, NE PACKAGE(TOP VIEW)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
28
27
26
25
24
23
22
21
20
19
18
17
16
15
1,2EN1A1YNCNCNC
NCNC2Y2A
VCC2
VCC14A4YNCNCNC
NCNC3Y3A3,4EN
DWP PACKAGE(TOP VIEW)
HEAT SINK ANDGROUND
HEAT SINK ANDGROUND
L293, L293DQUADRUPLE HALF-H DRIVERS
SLRS008B – SEPTEMBER 1986 – REVISED JUNE 2002
2 POST OFFICE BOX 655303 • DALLAS, TEXAS 75265
block diagram
10
3
4
5
6
7
8 9
10
11
12
13
14
15
161
210
1
10
2
4
3
M
M
M
10
10
10
VC
VCC1
NOTE: Output diodes are internal in L293D.
TEXAS INSTRUMENTSAVAILABLE OPTIONS
PACKAGE
TAPLASTIC
DIP(NE)
0°C to 70°CL293NEL293DNE
AVAILABLE OPTIONS
PACKAGED DEVICES
TASMALL
OUTLINE(DWP)
PLASTICDIP(N)
0°C to 70°CL293DWPL293DDWP
L293NL293DN
The DWP package is available taped and reeled. Addthe suffix TR to device type (e.g., L293DWPTR).
L293, L293DQUADRUPLE HALF-H DRIVERS
SLRS008B – SEPTEMBER 1986 – REVISED JUNE 2002
3POST OFFICE BOX 655303 • DALLAS, TEXAS 75265
FUNCTION TABLE(each driver)
INPUTS† OUTPUTA EN Y
H H H
L H L
X L Z
H = high level, L = low level, X = irrelevant,Z = high impedance (off)† In the thermal shutdown mode, the output is
in the high-impedance state, regardless ofthe input levels.
logic diagram
ÁÁÁÁÁÁÁÁÁÁ
ÁÁÁÁÁÁ
ÁÁÁÁ
2
1
7
10
9
15
3
6
11
14
1A
1,2EN
2A
3A
3,4EN
4A
1Y
2Y
3Y
4Y
schematics of inputs and outputs (L293)
Input
VCC2
Output
GND
TYPICAL OF ALL OUTPUTSEQUIVALENT OF EACH INPUT
VCC1
CurrentSource
GND
L293, L293DQUADRUPLE HALF-H DRIVERS
SLRS008B – SEPTEMBER 1986 – REVISED JUNE 2002
4 POST OFFICE BOX 655303 • DALLAS, TEXAS 75265
schematics of inputs and outputs (L293D)
Input
VCC2
Output
GND
TYPICAL OF ALL OUTPUTSEQUIVALENT OF EACH INPUT
VCC1
CurrentSource
GND
absolute maximum ratings over operating free-air temperature range (unless otherwise noted)†
† Stresses beyond those listed under “absolute maximum ratings” may cause permanent damage to the device. These are stress ratings only, andfunctional operation of the device at these or any other conditions beyond those indicated under “recommended operating conditions” is notimplied. Exposure to absolute-maximum-rated conditions for extended periods may affect device reliability.
NOTES: 1. All voltage values are with respect to the network ground terminal.2. For operation above 25°C free-air temperature, derate linearly at the rate of 16.6 mW/°C.3. For operation above 25°C case temperature, derate linearly at the rate of 71.4 mW/°C. Due to variations in individual device electrical
characteristics and thermal resistance, the built-in thermal overload protection may be activated at power levels slightly above orbelow the rated dissipation.
L293, L293DQUADRUPLE HALF-H DRIVERS
SLRS008B – SEPTEMBER 1986 – REVISED JUNE 2002
5POST OFFICE BOX 655303 • DALLAS, TEXAS 75265
recommended operating conditions
MIN MAX UNIT
Supply voltageVCC1 4.5 7
VSupply voltageVCC2 VCC1 36
V
VIH High level input voltageVCC1 ≤ 7 V 2.3 VCC1 V
VIH High-level input voltageVCC1 ≥ 7 V 2.3 7 V
VIL Low-level output voltage –0.3† 1.5 V
TA Operating free-air temperature 0 70 °C† The algebraic convention, in which the least positive (most negative) designated minimum, is used in this data sheet for logic voltage levels.
electrical characteristics, VCC1 = 5 V, VCC2 = 24 V, TA = 25°CPARAMETER TEST CONDITIONS MIN TYP MAX UNIT
tPLH Propagation delay time, low-to-high-level output from A input 750 ns
tPHL Propagation delay time, high-to-low-level output from A inputCL = 30 pF See Figure 1
200 ns
tTLH Transition time, low-to-high-level outputCL = 30 pF, See Figure 1
100 ns
tTHL Transition time, high-to-low-level output 350 ns
L293, L293DQUADRUPLE HALF-H DRIVERS
SLRS008B – SEPTEMBER 1986 – REVISED JUNE 2002
6 POST OFFICE BOX 655303 • DALLAS, TEXAS 75265
PARAMETER MEASUREMENT INFORMATION
Output
CL = 30 pF(see Note A)
VCC1
Input
3 V
TEST CIRCUIT
tf tr3 V
0
tPHL
VOH
tTHL tTLH
VOLTAGE WAVEFORMS
tPLH
Output
Input
VOL
tw
NOTES: A. CL includes probe and jig capacitance.B. The pulse generator has the following characteristics: tr ≤ 10 ns, tf ≤ 10 ns, tw = 10 µs, PRR = 5 kHz, ZO = 50 Ω.
PulseGenerator
(see Note B)
5 V 24 V
VCC2
A
EN
Y90% 90%
50%
10%
50%
10%
90% 90%
50%
10%
50%
10%
Figure 1. Test Circuit and Voltage Waveforms
L293, L293DQUADRUPLE HALF-H DRIVERS
SLRS008B – SEPTEMBER 1986 – REVISED JUNE 2002
7POST OFFICE BOX 655303 • DALLAS, TEXAS 75265
APPLICATION INFORMATION
24 V5 V
10 kΩ
VCC1VCC2
Control A
Control B
4, 5, 12, 13
GND
ThermalShutdown
Motor
16 3
3
6
11
14
4Y
3Y
2Y
1Y
1,2EN
1A
2A
3,4EN
3A
4A
15
10
9
7
2
1
Figure 2. Two-Phase Motor Driver (L293)
L293, L293DQUADRUPLE HALF-H DRIVERS
SLRS008B – SEPTEMBER 1986 – REVISED JUNE 2002
8 POST OFFICE BOX 655303 • DALLAS, TEXAS 75265
APPLICATION INFORMATION
24 V5 V
10 kΩ
VCC1 VCC2
16 3
1,2EN1
1A2
2A
7
3,4EN
9
3A10
4A15
Control A
Control B
4, 5, 12, 13
GND
ThermalShutdown
Motor
1Y
3
2Y
6
3Y
11
4Y
14
Figure 3. Two-Phase Motor Driver (L293D)
L293, L293DQUADRUPLE HALF-H DRIVERS
SLRS008B – SEPTEMBER 1986 – REVISED JUNE 2002
9POST OFFICE BOX 655303 • DALLAS, TEXAS 75265
APPLICATION INFORMATION
EN 3A M1 4A M2
H H Fast motor stop H Run
H L Run L Fast motor stop
L XFree-running motorstop
XFree-running motorstop
L = low, H = high, X = don’t care
EN 1A 2A FUNCTION
H L H Turn right
H H L Turn left
H L L Fast motor stop
H H H Fast motor stop
L X X Fast motor stop
L = low, H = high, X = don’t care
VCC2 SES5001
1/2 L293
4, 5, 12, 13
10
SES5001
VCC1
EN
1511 14
16
9
M2
M1
3A 4A
8
Figure 4. DC Motor Controls(connections to ground and to
supply voltage)
GND
2 × SES5001
1/2 L293
4, 5, 12, 13
367
8
1
216
VCC2
2 × SES5001
2A 1A
VCC1
EN
M
Figure 5. Bidirectional DC Motor Control
GND
L293, L293DQUADRUPLE HALF-H DRIVERS
SLRS008B – SEPTEMBER 1986 – REVISED JUNE 2002
10 POST OFFICE BOX 655303 • DALLAS, TEXAS 75265
APPLICATION INFORMATION
3
4
5
6
7
8
1
2
9
10
11
12
13
14
15
16
+
+
+
+
D7
D8 D4
D3
L2 IL2
C1
D5 D1
D6 D2
VCC1L293
IL1/IL2 = 300 mA
0.22 µF
VCC2 L1 IL1
D1–D8 = SES5001
Figure 6. Bipolar Stepping-Motor Control
mounting instructions
The Rthj-amp of the L293 can be reduced by soldering the GND pins to a suitable copper area of the printedcircuit board or to an external heatsink.
Figure 9 shows the maximum package power PTOT and the θJA as a function of the side of two equal squarecopper areas having a thickness of 35 µm (see Figure 7). In addition, an external heat sink can be used (seeFigure 8).
During soldering, the pin temperature must not exceed 260°C, and the soldering time must not be longer than12 seconds.
The external heatsink or printed circuit copper area must be connected to electrical ground.
L293, L293DQUADRUPLE HALF-H DRIVERS
SLRS008B – SEPTEMBER 1986 – REVISED JUNE 2002
11POST OFFICE BOX 655303 • DALLAS, TEXAS 75265
APPLICATION INFORMATION
Copper Area 35-µm Thickness
Printed Circuit Board
Figure 7. Example of Printed Circuit Board Copper Area (used as heat sink)
Texas Instruments Incorporated and its subsidiaries (TI) reserve the right to make corrections, modifications,enhancements, improvements, and other changes to its products and services at any time and to discontinueany product or service without notice. Customers should obtain the latest relevant information before placingorders and should verify that such information is current and complete. All products are sold subject to TI’s termsand conditions of sale supplied at the time of order acknowledgment.
TI warrants performance of its hardware products to the specifications applicable at the time of sale inaccordance with TI’s standard warranty. Testing and other quality control techniques are used to the extent TIdeems necessary to support this warranty. Except where mandated by government requirements, testing of allparameters of each product is not necessarily performed.
TI assumes no liability for applications assistance or customer product design. Customers are responsible fortheir products and applications using TI components. To minimize the risks associated with customer productsand applications, customers should provide adequate design and operating safeguards.
TI does not warrant or represent that any license, either express or implied, is granted under any TI patent right,copyright, mask work right, or other TI intellectual property right relating to any combination, machine, or processin which TI products or services are used. Information published by TI regarding third–party products or servicesdoes not constitute a license from TI to use such products or services or a warranty or endorsement thereof.Use of such information may require a license from a third party under the patents or other intellectual propertyof the third party, or a license from TI under the patents or other intellectual property of TI.
Reproduction of information in TI data books or data sheets is permissible only if reproduction is withoutalteration and is accompanied by all associated warranties, conditions, limitations, and notices. Reproductionof this information with alteration is an unfair and deceptive business practice. TI is not responsible or liable forsuch altered documentation.
Resale of TI products or services with statements different from or beyond the parameters stated by TI for thatproduct or service voids all express and any implied warranties for the associated TI product or service andis an unfair and deceptive business practice. TI is not responsible or liable for any such statements.
Symbol Parameter Value UnitsVCEO Collector-Emitter Voltage 30 VVCBO Collector-Base Voltage 40 VVEBO Emitter-Base Voltage 10 VIC Collector Current - Continuous 1 APD Total Power Dissipation TA = 25°C 625 mWTJ, TSTG Operating and Storage Junction Temperature Range -55 ~ +150 °C
Symbol Parameter Test Condition Min. Typ. Max. UnitsVCEO Collector-Emitter Breakdown Voltage IC = 2mA, IB = 0 30 VVCBO Collector-Base Breakdown Voltage IC = 100µA, IE = 0 40 VVEBO Emitter-Base Breakdown Voltage IE = 10µA, IC = 0 10 VICBO Collector Cutoff Current VCB = 30V, IE = 0 100 nAhFE DC Current Gain IC = 20mA, VCE = 2V 30,00
0VCE(sat) Collector-Emitter Saturation Voltage IC = 100mA, IB = 0.1mA 1 VVBE(on) Base-Emitter On Voltage IC = 10mA, VCE = 5V 1.4 VfT Current Gain Bandwidth Product (2) IC = 10mA, VCE = 5V, f = 100MHz 200 MHZ
Symbol Parameter Max. UnitsRθJA Thermal Resistance, Junction to Ambient 200 °C/WRθJC Thermal Resistance, Junction to Case 83.3 °C/W
BC516
PNP Darlington Transistor• This device is designed for applications reguiring extremely high
current gain at currents to 1mA.• Sourced from process 61.
The following are registered and unregistered trademarks Fairchild Semiconductor owns or is authorized to use and is notintended to be an exhaustive list of all such trademarks.
DISCLAIMERFAIRCHILD SEMICONDUCTOR RESERVES THE RIGHT TO MAKE CHANGES WITHOUT FURTHER NOTICE TO ANYPRODUCTS HEREIN TO IMPROVE RELIABILITY, FUNCTION OR DESIGN. FAIRCHILD DOES NOT ASSUME ANYLIABILITY ARISING OUT OF THE APPLICATION OR USE OF ANY PRODUCT OR CIRCUIT DESCRIBED HEREIN;NEITHER DOES IT CONVEY ANY LICENSE UNDER ITS PATENT RIGHTS, NOR THE RIGHTS OF OTHERS.
LIFE SUPPORT POLICY
FAIRCHILD’S PRODUCTS ARE NOT AUTHORIZED FOR USE AS CRITICAL COMPONENTS IN LIFE SUPPORTDEVICES OR SYSTEMS WITHOUT THE EXPRESS WRITTEN APPROVAL OF FAIRCHILD SEMICONDUCTORCORPORATION.As used herein:1. Life support devices or systems are devices or systemswhich, (a) are intended for surgical implant into the body,or (b) support or sustain life, or (c) whose failure to performwhen properly used in accordance with instructions for useprovided in the labeling, can be reasonably expected toresult in significant injury to the user.
2. A critical component is any component of a life supportdevice or system whose failure to perform can bereasonably expected to cause the failure of the life supportdevice or system, or to affect its safety or effectiveness.
PRODUCT STATUS DEFINITIONS
Definition of Terms
Datasheet Identification Product Status Definition
Advance Information Formative or In Design
This datasheet contains the design specifications forproduct development. Specifications may change inany manner without notice.
Preliminary First Production This datasheet contains preliminary data, andsupplementary data will be published at a later date.Fairchild Semiconductor reserves the right to makechanges at any time without notice in order to improvedesign.
No Identification Needed Full Production This datasheet contains final specifications. FairchildSemiconductor reserves the right to make changes atany time without notice in order to improve design.
Obsolete Not In Production This datasheet contains specifications on a productthat has been discontinued by Fairchild semiconductor.The datasheet is printed for reference information only.
ACEx™ActiveArray™Bottomless™CoolFET™CROSSVOLT™DOME™EcoSPARK™E2CMOS™EnSigna™Across the board. Around the world.™The Power Franchise™Programmable Active Droop™
YELLOW MAN5350/5360 RED MAN5750/5760GREEN MAN5450/5460 HER MAN5950/5960
APPLICATIONS
For industrial and consumer applications such as:
• Digital readout displays• Instrument panels• Point of sale equipment• Digital clocks• TV and radios
MODEL NUMBERS
Part Number Color DescriptionPin Out Specification
(See Page 5)
MAN5350MAN5360
YellowYellow
Common AnodeCommon Cathode
AB
MAN5450MAN5460
GreenGreen
Common AnodeCommon Cathode
AB
MAN5750MAN5760
RedRed
Common AnodeCommon Cathode
AB
MAN5950MAN5960
HERHER
Common AnodeCommon Cathode
AB
A
FB
G
ED
C
DP
0.512 (13mm)
Date Code
PartIdentification
NOTE: Dimensions in inches (mm) Tolerances ±0.010" unless otherwise specified
PartNo. XYY Z
Pin #1
Light Intensity Category
0.291(7.4mm)0.049
(1.25mm)
10°
0.049(1.25mm)
0.482(12.25mm)
0.252(6.4mm)
0.100(2.54mm)
0.012(0.3mm)
0.600(15.24mm)
0.020(0.5mm)
0.276(7.0mm)
0.417(10.6mm)
±0.006
±0.012
±0.002
±0.006
±0.012
0.689(17.5mm)
+0.012-0.004
±0.004
DESCRIPTION
This display series is a family of large digits 0.510 inches in height. All models have right hand decimal points and are availble in common anode or common cathode configurations. All units are constructed with untinted segments on grey face to enhance ON/OFF contrast. Stan-dard units are available in red, orange-red, green and yellow.
FEATURES
• Large, easy to read, digits• Common anode or common cathode models• Fast switching — excellent for multiplexing• Low power consumption• Bold solid segments that are highly legible• Solid state reliability — long operation life• Rugged plastic construction• Directly compatible with integrated circuits• High brightness with high contrast• Categorized for Luminous Intensity
(See Note 5)• Wide angle viewing...150°• Low forward voltage• Untinted segments on grey face
YELLOW MAN5350/5360 RED MAN5750/5760GREEN MAN5450/5460 HER MAN5950/5960
Notes:
1. The digit average Luminous Intensity is obtained by summing the Luminous Intensity of each segment and dividing by the total number of segments. Intensity will not vary more than ±33.3% between all segments within a digit.
2. The relative Luminous Intensity in this curve is normalized to the brightness at 25°C to indicate the relative efficiency over the operating temperature range.
3. Leads of the device immersed to 1/16 inch from the body. Maximum device surface temperature is 140°C.4. For flux removal, Freon TF, Freon TE, Isoproponal or water may be used to up their boiling points.5. All displays are categorized for Luminous Intensity. The intensity category is marked on each part as a suffix letter to the part
number.
ABSOLUTE MAXIMUM RATINGS
RatingMAN5350MAN5360
MAN5450MAN5460
MAN5750MAN5760
MAN5950MAN5960
Power dissipation at 25°C ambient 600 mW 570 mW 480 mW 600 mW
YELLOW MAN5350/5360 RED MAN5750/5760GREEN MAN5450/5460 HER MAN5950/5960
TYPICAL CHARACTERISTIC CURVES — MAN5950/MAN5960
5060708090
100
40302010
0
1.0
2.0
3.0
4.0
2
1.5
1
00 5 10 15 20 25 30 4
DC Forward Current – IF (mA)
Fig. 4A. Relative Luminous Intensity vs. Forward Current
Forward Voltage – VF (Volts)
Fig. 4B. Forward Current vs. Forward Voltage
Duty Cycle – %IF Per Seg 10 mA Average
Fig. 4E. Relative Luminous Intensity vs. Duty Cycle
Rel
ativ
e Lu
min
ous
Inte
nsity
(IF)
- m
A
Rel
ativ
e In
tens
ity
8 1.20 1.6 2.0 2.4 2.8 3.2 3.6 4.0
10 20 40 DC
100110120130140150160170
60708090
50
Ambient Temperature – °C
Fig. 3C. Relative Luminous Intensity vs. Temperature(See Note 2)
Rel
ativ
e In
tens
ity –
%
-50 -25 0 25 50 70
1000
20
200
1008050
500800
10
Duty Cycle – %
Fig. 4D. Maximum Peak Current vs. Duty Cycle
Pea
k I F
– m
A
1 3 5 10 20 50 100
FREQUENCY = 200pps
NORMALIZED at IF = 10 mA
LIFE SUPPORT POLICY
FAIRCHILD’S PRODUCTS ARE NOT AUTHORIZED FOR USE AS CRITICAL COMPONENTS IN LIFE SUPPORT DEVICES OR SYSTEMS WITHOUT THE EXPRESS WRITTEN APPROVAL OF THE PRESIDENT OF FAIRCHILD SEMICONDUCTOR CORPORATION. As used herein:
1. Life support devices or systems are devices or systemswhich, (a) are intended for surgical implant into the body, or(b) support or sustain life, and (c) whose failure to performwhen properly used in accordance with instructions for useprovided in the labeling, can be reasonably expected toresult in a significant injury of the user.
2. A critical component in any component of a life supportdevice or system whose failure to perform can bereasonably expected to cause the failure of the life supportdevice or system, or to affect its safety or effectiveness.
DISCLAIMER
FAIRCHILD SEMICONDUCTOR RESERVES THE RIGHT TO MAKE CHANGES WITHOUT FURTHER NOTICE TO ANY PRODUCTS HEREIN TO IMPROVE RELIABILITY, FUNCTION OR DESIGN. FAIRCHILD DOES NOT ASSUME ANY LIABILITY ARISING OUT OF THE APPLICATION OR USE OF ANY PRODUCT OR CIRCUIT DESCRIBED HEREIN; NEITHER DOES IT CONVEY ANY LICENSE UNDER ITS PATENT RIGHTS, NOR THE RIGHTS OF OTHERS.