DETEKSI KEPADATAN ARUS KENDARAAN PADA SISTEM PRIORITAS LAMPU LALU LINTAS TUGAS AKHIR
Diajukan untuk memenuhi salah satu syarat Memperoleh gelar Sarjana Teknik Program Studi Teknik Elektro
Disusun oleh: DAVID KURNIAWAN NIM : 005114016
PROGRAM STUDI TEKNIK ELEKTRO JURUSAN TEKNIK ELEKTRO FAKULTAS TEKNIK UNIVERSITAS SANATA DHARMA YOGYAKARTA 2007
i
TRAFFIC DENSITY DETECTING OF TRAFFIC LIGHT PRIORITY SYSTEM FINAL PROJECT Presented as Partial Fulfillment of the Requirements To Obtain the Sarjana Teknik Degree In Electrical Engineering
By : DAVID KURNIAWAN Student ID Number : 005114016
ELECTRICAL ENGINEERING STUDY PROGRAM ELECTRICAL ENGINEERING DEPARTMENT ENGINEERING FACULTY SANATA DHARMA UNIVERSITY YOGYAKARTA 2007
ii
iii
iv
Pernyataan Keaslian Karya Saya menyatakan dengan sesungguhnya bahwa tugas akhir yang saya tulis ini tidak memuat karya atau bagian karya orang lain, kecuali yang telah disebutkan dalam kutipan dan daftar pustaka, sebagaimana layaknya karya ilmiah.
Yogyakarta, Januari 2007 Penulis
David Kurniawan
v
Katakanlah pada dirimu apa yang akan kamu raih….. Lakukan apa yang harus kamu lakukan…. Dan percayalah pada dirimu sendiri karena sebenarnya di dalam dirimu tersimpan kekuatan yang mungkin dirimu sendiri tidak mengetahuinya……
Karya ini kupersembahkan untuk:
ALLAH SWT. dan Rosul-Nya (Atas rahmat dan hidayah-Nya)
Kedua orang tuaku tercinta, Bapak Pardiyono & Ibu Sutinah yang selalu memberikan doa, dukungan, dan motivasi…….. Yang selalu membimbingku dengan penuh cinta kasih…. Kakakku dan Adikku serta orang-orang yang dekat di hatiku sebagai tanda cinta dan baktiku…….
vi
KATA PENGANTAR
Puji dan syukur penulis panjatkan ke hadirat Tuhan Yang Maha Esa, oleh karena kasih dan penyertaan-Nya sehingga penulis dapat meyelesaikan Tugas Akhir yang berjudul “Deteksi Kepadatan Arus Kendaraan Pada Sistem Prioritas Lampu Lalu Lintas”. Tugas Akhir ini disusun sebagai salah satu syarat untuk memperoleh gelar Sarjana pada jurusan Teknik Elektro, Fakultas Teknik Universitas Sanatha Dharma Yogyakarta. Tersusunya tugas akhir ini tidak terlepas dari bantuan dan dukungan dari berbagai pihak. Pada kesempatan ini tidak lupa penulis mengucapkan terima kasih yang dalam kepada : 1. Bapak Ir. Iswanjono, M.T., selaku Dosen Pembimbing yang telah banyak memberikan bimbingan dan pengarahan hingga tugas akhir ini dapat tersusun. 2. Semua dosen jurusan teknik elektro, terima kasih atas bimbingan dan kerjasamanya selama ini. 3. Bapak dan Ibuku atas doa, dukungan dan cinta yang besar yang telah diberikan dengan segenap kasih sayang. 4. Kakakku Lina Budiarti atas yang selalu memberikan dukungan moril dan materiil serta semangatnya. 5. Saudara-saudaraku yang selalu mendukungku, Yuli, Mba’ Maya, dan semuanya. Terima kasih. 6. Teman-teman
seperjuangan:
Joko,
Bowo,
Danang,
terima
kasih
atas
kerjasamanya. 7. Teman-teman TE 2000 : Irwan, , Aas, Wisnu, Koko, Sigit, Agung, Harry, Wahyu, Marchel, dan semua saja yang tidak bisa disebutkan satu persatu. 8. Teman-temanku : Samsul, Yoyok, Wiratno, Angga “Bebek”, Santo, Roni, kalian adalah sahabat-sahabat terbaikku. 9. Dewi, Dissa, Mitha, Chandra, terima kasih atas pertemanannya selama ini. Semoga kita tetap berteman. 10. Semua orang yang pernah membantuku disaat aku butuh bantuan, terima kasih atas bantuannya.
vii
Semoga Tuhan membalas segala kebaikan yang telah diberikan kepada penulis. Penulis sungguh sangat menyadari bahwa masih banyak kekurangan dalam pembuatan dan penyusunan Tugas Akhir ini, maka dari itu segala saran dan kritik yang bersifat membangun sangat diharapkan penulis.
Yogyakarta, Januari 2007
Penulis
viii
DETEKSI KEPADATAN ARUS KENDARAAN PADA SISTEM PRIORITAS LAMPU LALU LINTAS Oleh : Nama : DAVID KURNIAWAN NIM : 005114016
INTISARI Kepadatan arus kendaraan pada suatu persimpangan saat lampu lalu lintas menyala merah sering menyebabkan terjadinya kemacetan. Untuk mengurangi kemacetan tersebut diperlukan suatu alat yang dapat mendeteksi terjadinya kepadatan arus kendaraan. Apabila sensor mendeteksi terjadinya kemacetan maka sistem akan memberikan tambahan waktu nyala lampu hijau lebih lama dari waktu normalnya (saat tidak terjadi kemacetan). Pendeteksi kepadatan arus kendaraan terdiri dari sensor (infra merah sebagai pemancar dan foto transistor sebagai penerima), schmit trigger sebagai pemantap tegangan, dan multiplexer (MUX) sebagai pemilih sensor mana yang akan dibaca oleh pengendali utama yaitu mikrokontroler dan sebagai keluarannya adalah seperangkat lampu lalu lintas. Hasil akhir yang diperoleh pada perancangan alat ini adalah suatu sistem yang memberikan masukan bagi mikrokontroler untuk memberi tambahan waktu nyala lampu hijau pada salah satu arah atau jalur di suatu persimpangan berdasarkan tingkat kepadatan yang terdeteksi oleh sensor.
ix
TRAFFIC DENSITY DETECTING OF TRAFFIC LIGHT PRIORITY SYSTEM By : Name : David Kurniawan Student ID Number : 005114016
ABSTRACT The traffic density on a crossroad when the traffic light is red often causes jam. To decrease those jams, it is necessary to have a kind of equipment which can detect the crowd. If the sensor detects any jam then the system will give more time for the green light to have longer turn than if there is no jam (normal traffic) The detector of this equipment consists of the censor (infra red as the transmitter and photo-transistor as the receiver, schmit trigger as the stabilizer of the voltage and multiplexer(MUX) to choose which sensor that are going to be read by the main controller that is the microcontroller and the output is the traffic light. The last result would be a kind of system which gives input for microcontroller to give more time for the green light to light longer on one direction or way on an intersection based on the crowded level that detected by the censor.
x
DAFTAR ISI
HALAMAN JUDUL ........................................................................................ ..
i
HALAMAN PERSETUJUAN PEMBIMBING ............................................. ..
iii
HALAMAN PENGESAHAN...............................................................................
iv
HALAMAN PERNYATAAN KEASLIAN KARYA ..................................... ..
v
HALAMAN PERSEMBAHAN.............................................................................. vi KATA PENGANTAR....................................................................................... ..
vii
INTISARI ................ ......................................................................................... ..
ix
ABSTRAC..............................................................................................................
x
DAFTAR ISI............ ......................................................................................... ..
xi
DAFTAR TABEL.................................................................................................. xiii DAFTAR GAMBAR.............................................................................................
xiv
DAFTAR LAMPIRAN..........................................................................................
xv
BAB
BAB
I
PENDAHULUAN ........................................................................ ..
1
1.1 Judul......................................................................................... ..
1
1.2 Latar Belakang ......................................................................... ..
1
1.3 Perumusan Masalah ................................................................. ..
1
1.4 Batasan Masalah ...................................................................... ..
2
1.5 Tujuan Penelitian ..................................................................... ..
2
1.6 Manfaat Penelitian ................................................................... ..
3
1.7 Sistematika Penulisan .............................................................. ..
3
II DASAR TEORI............................................................................ ..
5
2.1 LED (Light Emitting Diode) .................................................... ..
5
xi
BAB
BAB
BAB
2.2 IRED (Infra Red Emitting Diode)............................................ ..
7
2.3 Fototransistor................................................................................
7
2.4 Schmitt Trigger (Pemicu Schmitt)................................................
10
2.5 Multiplexer....................................................................................
10
2.6 Rangkaian penyangga...................................................................
11
2.7 Relay…………………………………………………………….
12
2.8 Penggerak Relay...........................................................................
13
2.9 Penampil Lampu Lalu Lintas.......................................................
14
III PERANCANGAN ........................................................................ ..
16
3.1 Rangkaian Sensor..................................................................... ..
17
3.2 Rangkaian Schmitt Trigger ...................................................... ..
18
3.3 Multiplexer……………………………………………………...
19
3.4 Rangkaian Penyangga…………………………………………..
21
3.5 Rangkaian Penggerak Relay…………………………………….
21
3.6 Rangkaian Relay dan Penampil Lampu Lalu Lintas……………
23
IV PEMBAHASAN ........................................................................... ..
24
4.1 Pengukuran Keluaran Sensor................................................... ..
24
4.2 Pengukuran Keluaran Inverter................................................. ..
25
4.3 Pengukuran Keluaran MUX .................................................... ..
26
4.4 Tingkat Kepadatan………………………………………………
28
V KESIMPULAN DAN PENUTUP ............................................... ..
30
5.1 Kesimpulan ............................................................................. ..
30
5.2 Saran …….............................................................................. ..
30
DAFTAR PUSTAKA …….............................................................................. ..
31
LAMPIRAN
xii
DAFTAR TABEL
Tabel 2.1
Tabel Fungsi Pemicu Schmitt ..................................................... ....
10
Tabel 3.1
Tabel Fungsi MUX 4 ke 1 .......................................................... ....
20
Tabel 4.1
Tegangan Keluaran Sensor ......................................................... ....
25
Tabel 4.2
Tegangan Keluaran Inverter ....................................................... ....
26
Tabel 4.3
Tegangan Keluaran MUX........................................................... …
26
Tabel 4.4
Tingkat Kepadatan…………………………………………………
28
xiii
DAFTAR GAMBAR
Gambar 2.1
Diagram Blok Sistem........................................................................
5
Gambar 2.2
Simbol LED ......................................................................................
6
Gambar 2.3
Rangkaian Dasar LED ......................................................................
6
Gambar 2.4
Simbol Fototransistor........................................................................
8
Gambar 2.5
Rangkaian Fototransistor ..................................................................
9
Gambar 2.6
Simbol Pemicu Schmitt..................................................................... 10
Gambar 2.7
MUX 4 ke 1 ...................................................................................... 11
Gambar 2.8
Buffer Open Collector....................................................................... 11
Gambar 2.9
Relay ................................................................................................. 12
Gambar 2.10 Transistor Sebagai Penguat Arus ...................................................... 13 Gambar 2.11 Diagram Lampu Lalu-lintas 4 Persimpangan ................................... 14 Gambar 3.1
Letak Sensor Pada Lampu Lalu-lintas .............................................. 16
Gambar 3.2
Rangkaian Pemancar......................................................................... 17
Gambar 3.3
Rangkaian Penerima ......................................................................... 18
Gambar 3.4
IC DM74LS14 .................................................................................. 19
Gambar 3.5
Gelombang Masukan dan Keluaran Schmitt Trigger........................ 19
Gambar 3.6
Dua MUX 4 ke 1............................................................................... 20
Gambar 3.7
Rangkaian Penyangga....................................................................... 21
Gambar 3.8
Rangkaian Penggerak Relay ............................................................. 22
Gambar 3.9
Rangkaian Relay dan Penampil Lalu-lintas...................................... 23
xiv
DAFTAR LAMPIRAN
Gambar Rangkaian........................................................................................
L1
Data Sheet QED121/122/123 Plastic Infrared Light Emitting Diode ..........
L2
Data Sheet QSD122/123/124 Plastic Silicon Infrared Phototransistor .......
L3
Data Sheet DM74LS14.................................................................................
L4
Data Sheet DM74LS153...............................................................................
L5
DC Characteristics AT89S52.........................................................................
L6
xv
1
BAB I
PENDAHULUAN
1.1
JUDUL PENELITIAN Deteksi kepadatan arus kendaraan pada sistem prioritas lampu lalu-lintas.
1.2
LATAR BELAKANG Saat ini sistem pengaturan lampu lalu-lintas di Indonesia kebanyakan masih
menggunakan sistem time driven atau pengaturan lampu lalu-lintas berdasarkan waktu yang dikendalikan oleh timer. Siklus nyala lampu sudah diatur terlebih dahulu tanpa melihat kepadatan arus kendaraan pada waktu itu. Dengan demikian siklus mati hidupnya lampu lalu-lintas pada suatu persimpangan saat jam sembilan pagi dapat saja berbeda dengan saat jam sembilan malam. Oleh sebab itu sering terjadi kemacetan khususnya pada saat jam-jam sibuk. Berdasarkan permasalahan tersebut maka akan dibuat suatu alat yang dapat memberikan prioritas pada suatu kondisi, yaitu jika salah satu arah di suatu persimpangan terdapat antrian kendaraan yang panjang maka pada arah tersebut lampu hijau menyala lebih lama dari waktu standarnya.
1.3
PERUMUSAN MASALAH Pada penelitian akan dibuat suatu alat yang dapat mengatur lamanya waktu
nyala lampu lalu-lintas untuk mengatasi kemacetan atau antrian kendaraan pada suatu persimpangan. Untuk kondisi kemacetan atau antrian panjang, beberapa sensor dipasang pada jarak tertentu dari lampu pengatur lalu-lintas. Apabila panjang antrian
2 kendaraan mencapai panjang yang telah ditentukan, maka sensor akan memberi masukan kepada sistem untuk mengatur lampu lalu-lintas agar memberi waktu nyala lampu hijau yang lebih lama dari pada sisi atau arah yang lain. Setelah panjang antrian kurang dari jarak yang ditentukan maka lampu lalu-lintas akan kembali bekerja normal. Sensor bekerja pada kondisi lampu lalu-lintas menyala merah. Masalah yang mungkin timbul adalah apabila ada sesuatu yang menghalangi dan membuat sensor terus bekerja, misal mobil mogok.
1.4
BATASAN MASALAH Permasalahan yang akan diangkat hanya dibatasi pada beberapa permasalahan
sebagai berikut: a. Sebagai pendeteksi kendaraan digunakan sensor infra merah. b. Sensor bekerja pada saat lampu menyala merah. c. Sensor dipasang setiap arah jalur untuk setiap lampu lalu-lintas. d. Untuk jalur yang berlawanan arah dipisahkan oleh pembatas. e. Jalur tidak ada kendaraan mogok yang mengenai sensor. f. Penelitian ini hanya merancang dan menganalisis perangkat kerasnya saja, mikrokontroler hanya sebagai pendukung dan tidak dibahas pada penelitian ini.
1.5
TUJUAN PENELITIAN Tujuan yang ingin dicapai adalah : a. Membuat miniatur (prototipe) sistem prioritas lampu lalu lintas untuk mendeteksi panjang antrian kendaraan.
3 b. Merancang suatu rangkaian elektronika yang dapat mendeteksi panjang antrian kendaraan.
1.6
MANFAAT PENELITIAN Manfaat yang bisa didapat adalah: a. Memprioritaskan salah satu jalur pada suatu persimpangan bila terjadi antrian panjang kendaraan. b. Mengurangi kemacetan
atau
kepadatan kendaraan pada suatu
persimpangan. c. Memberi kemudahan dan kenyamanan bagi pengguna jalan.
1.7
SISTEMATIKA PENULISAN a. Bab I. Pendahuluan Pendahuluan berisi: latar belakang, rumusn masalah, batasan masalah, tujuanpenelitian, manfaat penelitian, dan sistematika penulisan b. Bab II. Dasar Teori Dasar teori berisi teori-teori yang mendukung tenteng penelitian yang dilakukan. c. Bab III. Perancangan Pada bab ini berisi tentang perencangan perengkat-perangkat pendukung sistem yang akan dibuat pada penelitian ini. d. Bab IV. Hasil dan Pembahasan Bab ini berisi hasil dan pembahasan cara perencangan yang dibuat, yaitu mulai dari perancangan sampai hasil akhir pembuatan alat.
4 e. Bab V. Kesimpulan dan Saran Berisi Kesimpulan dan saran mengenai sistem dan hasil pengujian sistem secara keseluruhan. f. Bab VI. Daftar Pustaka Daftar pustaka memuat sumber-sumber informasi yang digunakan dalam penelitian.
5
BAB II
DASAR TEORI
Sistem prioritas lampu pengatur lampu lalu lintas untuk antrian kendaraan pada suatu lampu lalu-lintas terdiri dari rangkaian sensor ( infra merah sebagai pemancar dan foto transistor sebagai penerima ), rangkaian pengkondisi sinyal (schmitt trigger), dan MUX. Sedangkan untuk tampilan keluaran sistem akan digunakan perangkat lampu lalu lintas (penyangga, penggerak relay, relay, lampu). Pada penelitian ini akan dibuat suatu sistem seperti terlihat pada gambar 2.1 berikut ini :
Traffic 1 4 Sensor
4 Pengkondisi Sinyal
MUX 4-1
Traffic 2 4 Sensor
4 Pengkondisi Sinyal
MUX 4-1
Traffic 3 4 Sensor
4 Pengkondisi Sinyal
MUX 4-1
Traffic 4 4 Sensor
4 Pengkondisi Sinyal
MUX 4-1
M I K R O K O N T R O L E R
Penyangga
Penggerak Relay
Relay
Lampu Lalu-lintas
Selektor
Gambar 2.1. Blok diagram sistem
2.1
LED ( Light Emitting Diode ) LED adalah dioda penghasil cahaya dimana energi yang dikeluarkannya
berupa energi pancaran cahaya. Dioda biasa dibuat dari bahan silikon, yaitu bahan buram yang menghalangi pengeluaran cahaya, sedangkan LED terbuat dari bahan
6 dengan unsur gallium, arsen dan fosfat yang dapat menghasilkan atau memancarkan cahaya merah, hijau, kuning dan jingga. LED juga dapat memancarkan cahaya yang tak tampak oleh mata yaitu infra merah. Simbol LED dapat dilihat pada gambar 2.2.
Gambar 2.2. Simbol Light Emitting Diode ( LED )
Rangkaian dasar dari LED dapat terlihat seperti pada gambar 2.3 berikut ini: VCC
RD
ID
VD
LED
Gambar 2.3. Rangkaian dasar LED
Berdasarkan gambar rangkaian dasar LED di atas, maka besarnya nilai Rd dapat dicari dengan persamaan berikut:
Vcc − VD = I D − Rd
RD =
VCC − V LED ................................................... ( 2.1 ) I LED F
7 Dengan : RD = Resistor yang dibutuhkan.
VCC = Tegangan masukaan V F = Tegangan I F = Arus
2.2
IRED ( Infra Red Emitting Diode ) Infra Red Emitting Diode (IRED) adalah salah satu jenis LED. IRED
mempunyai karakteristik yang sama dengan LED, hanya saja cahaya yang dipancarkan berbeda. LED memancarkan cahaya tampak, sedangkan IRED sesuai dengan namanya memancarkan infra merah yang tak tampak oleh mata manusia.IRED
digunakan dalam aplikasi komunikasi serat optik, alignment
(penjajaran), scanning system, dan juga digunakan pada piranti penyimpan data seperti CD dan DVD. Simbol dan rangakaian IRED sama dengan LED, sehingga persamaan (2.1) berlaku juga untuk IRED.
2.3
Fototransistor Fototransistor adalah piranti peka cahaya atau sering disebut sebagai
transduser fotoelektrik, yaitu piranti elektronis yang memiliki perubahan karakteristik listrik bila dikenai cahaya tampak maupun tak tampak. Fototransistor terbentuk oleh transistor, sehingga memiliki sifat yang mirip dengan Bipolar Junction Transistor (BJT), hanya saja secara fisik sangat berbeda satu sama lain. Fototransistor didesain dengan penutup transparan yang berfungsi untuk meneruskan atau menerima cahaya, sedangkan BJT didesain dengan penutup yang tidak transparan supaya cahaya tidak
8 tembus sehingga tidak mempengaruhi kerja BJT. Kemasan fototransistor dapat dijumpai sebagai piranti dua terminal tanpa koneksi basis dan piranti 3 terminal dengan koneksi basis. Simbol fototransistor dua terminal tanpa koneksi basis dapat dilihat pada gambar 2.4.
Gambar 2.4. Skematik fototransistor
Pada fototransistor, arus basis dipengaruhi oleh cahaya infra merah yang mengenai permukaan dari fototransistor, sehingga ketika cahaya infra merah mengenai permukaan fototransistor akan timbul arus basis ( IB ). Keadaan tersebut akan menyebabkan resistansi emitter-collector akan menjadi kecil sekali mendekati nol, sehingga arus akan mengalir ke kaki collector ( IC ). Hal ini menyebabkan tegangan pada kaki collector mendekati 0V. Keadaan tersebut menyatakan keadaan transistor dalam keadaan on. Sebaliknya apabila tidak ada cahaya infra merah atau dapat dikatakan dalam keadaan gelap, maka tidak ada IB. Ketika tidak ada arus IB, maka resistansi emitter-collector menjadi besar dan tidak ada arus collector ( IC ), sehingga tegangan di kaki collector terhadap ground ( Vc ) sama dengan Vcc, sehingga transistor dalam keadaan off . Rangkaian fototransistor dapat dilihat pada gambar 2.5.
9
Gambar 2. 5. Rangkaian fototransistor
Pada fototransistor berlaku persamaan saat saturasi :
Vo ≅ 0 Volt
………..……………...…………….…( 2.2)
Vo = Vcc
………………...…………..……..….( 2.3 )
Sedangkan saat cut off :
Untuk mencari nilai Rc pada gambar di atas digunakan persamaan :
VCC − VCE = RC I C RC =
VCC − VCE IC
Dengan : Rc = Resistor yang dibutuhkan Vcc = Tegangan masukan
VCE = Tegangan Collector Emitter Ic = Arus Collector
.............................................( 2.4 )
10
2.4.
Schmitt Trigger ( Pemicu Schmitt ) Pemicu Schmitt merupakan suatu contoh kategori rangkaian yang dikenal
sebagai pembanding tegangan. Pembanding sangat berguna dalam pembentuk pulsa dan sebagai suatu piranti pengkondisi sinyal. Pemicu Schmitt menghasilkan suatu keluaran segi empat dengan pinggiran naik dan turun yang tajam. Waktu bangkit yang cepat ini sangat dibutuhkan, karena rangkaian-rangkaian dimaksudkan untuk bekerja dengan tegangan masukan dua keadaan. Simbol dari pemicu schmitt seperti terlihat pada gambar 2.6.
Gambar 2.6. Simbol pemicu schmitt Tabel 2.1. Fungsi pemicu schmitt Input (A)
Output (Y)
L
H
H
L
Y=Ā Prinsip kerja pemicu schmitt sama seperti gerbang not, yaitu jika masukan logika rendah maka keluarannya logika tinggi, begitu juga sebaliknya.
2.5
Multiplexer (MUX) Multiplexer adalah suatu rangkaian yang mampu memilih sebuah masukan
dari beberapa masukan dan menjadikannya sebuah keluaran. Biasanya ada 2 n masukan dan n selektor dimana kombinasi selektor akan menentukan masukan yang
11 akan dipilih. Multiplexer yang digunakan pada penelitian ini adalah MUX 4 ke 1 yaitu
multiplexer 4 masukan dengan sebuah keluaran. Gambar 2.7 adalah rangkaian dasar MUX 4 ke 1.
Gambar 2.7. MUX 4 ke 1
2.6
Rangkaian penyangga (Buffer) Penyangga merupakan rangkaian tambahan (optional) yang fungsinya
menjaga agar rangkaian masukannya tidak terbebani berlebih (overload). Dengan kata lain, rangkaian pada keluaran tidak menyerap arus dari rangkaian masukannya, tetapi langsung dari power supply. Rangkaian penyangga mempunyai impedansi masukan yang besar (arus masukan kecil) dan impedansi keluaran kecil (arus keluaran besar ), dan tegangannya tidak berubah. VCC
R pull-up
Masukan
Keluaran
Gambar 2.8. Buffer open collector
12 Penyangga (Buffer) yang digunakan dalam penelitian ini pada pemakaiannya diperlukan sebuah resistor pull-up pada keluarannya (keluaran merupakan kaki kolektor dari transistor) seperti pada gambar 2.8. Besarnya nilai resistor pull-up dapat dicari dengan persamaan : R Pull−up ≥
Vcc I OL max
……………………………...…….(2.5)
Dengan : Vcc = Tegangan masukan
I OL max = Arus maksimum yang diserap
2.7
Relay Relay adalah merupakan suatu saklar mekanis yang dikendalikan secara
elektronis yaitu menggunakan arus dan tegangan dari luar. Relay terdiri atas kumparan kawat penghantar yang digulung pada former teras magnet, apabila kumparan diberi arus maka medan magnet yang dihasilkan kumparan akan menarik pengungkit yang berfungsi sebagai penutup atau pembuka kontak. Gambar relay dapat dilihat pada gambar 2.9 berikut ini :
COM
5
NC
4
NO
3 1 2
Gambar 2.9. Relay
Pada relay terdapat 2 jenis keadaan normal sebelum terpengaruh kontrol dari luar, yaitu normally open (NO) yaitu keadaan dimana kontaktor terbuka dan normally
close (NC) yaitu keadaan dimana kontaktor tertutup.
13
2.8
Penggerak relay ( driver ) Untuk menyalakan beban yang memerlukan arus besar (seperti relay, LED)
diperlukan suatu rangkaian penggerak beban. Driver memiliki karakteristik penguat arus yaitu memoerkuat arus masukan untuk dapat menggerakkan beban pada keluaran.Untuk penggerak yang sederhana, biasanya hanya berupa rangkaian transistor common emitter (lihat gambar 2.10). VCC
RL
Ic Rb
Vin
hfe Ib
VBE
Ie
Gambar 2.10. Tansistor sebagai penguat arus
Beban yang akan dikontrol (RL) ditempatkan pada kaki kolektor. Arus masukan (Ib) dapat dihitung dengan rumus sebagai berikut : Ib =
Vin − VBE …………………………………....(2.6) Rb
Ic = Ib x hfe …………………….………….…….(2.7)
VBE adalah tegangan antara basis dan kolektor dimana untuk transistor silicon
berharga 0,7 V. Ic(max) adalah arus maksimum yang dapat melewati kolektor saat transistor ON, sedangkan hfe adalah konstanta penguatan arusnya. Arus penggerak beban harus lebih kecil dari Ic(max).
14
2.9
Penampil lampu lalu-lintas Rangkaian keluaran dari sistem ini adalah lampu pengatur lalu lintas (traffic
light). Lampu lalu lintas keluaran untuk simpang empat membutuhkan 12 lampu pijar ( 4 merah, 4 kuning, 4 hijau ). Secara umum lampu lalu lintas telah diatur penyalaannya sehingga tiap lampu menyala secara berturutan, sehingga didapat diagram pewaktuan untuk menyalakan lampu lalu lintas. Pada saat menyala normal semua lampu dapat difungsikan, seperti gambar 2.11 berikut adalah diagram waktu penyalaan lampu lalu-lintas dengan 4 persimpangan.
tunda waktu
Gambar 2.11. Diagram waktu penyalaan lampu lalu-lintas dengan 4 persimpangan Keterangan : H adalah untuk lampu hijau K adalah untuk lampu kuning M adalah untuk lampu merah t adalah waktu nyala lampu
15 Pada diagram waktu tersebut diatas dapat dilihat bahwa pada saat lampu menyala normal terdapat tunda waktu (semua ruas menyala merah) pada saat sebelum perubahan dari merah ke hijau, jadi pada waktu tersebut semua lampu yang menyala di semua ruas adalah merah. Hal ini dengan maksud sebagai faktor keamanan saja pada saat suatu ruas akan menyala hijau, semua ruas benar-benar telah menyala merah.
16
BAB III
PERANCANGAN PERANGKAT KERAS
Pada penelitian ini akan dibuat miniatur pendeteksi kepadatan arus kendaraan pada sistem prioritas lampu lalu-lintas. Untuk setiap lampu lalu-lintas terpasang 4 buah rangkaian sensor yang terpasang seperti pada gambar 3.1.
Gambar 3.1. Jarak sensor dari lampu lalu-lintas
Kepadatan arus kendaraan pada perancangan ini terbagu dalam 4 kondisi yaitu kepadatan tingkat pertama, yaitu jika kepadatan kendaraan sampai pada sensor pertama (S1). Kepadatan tingkat kedua yaitu jika kepadatan kendaraan sampai pada sensor kedua (S1 dan S2 mendeteksi adanya kendaraan). Kepadatan tingkat ketiga yaitu jika kepadatan kendaraan sampai pada sensor ketiga (S1, S2, dan S3 mendeteksi adanya kendaraan).Kepadatan tingkat keempat terjadi jika semua sensor S1, S2, S3, dan S4 mendeteksi adanya kendaraan (kepadatan kendaraan sampai pada sensor keempat. Untuk setiap tingkat kepadatan akan diberi tambahan waktu nyala lampu hijau yang berbeda-beda.
17
3.1
Rangkaian sensor Rangkaian sensor terdiri dari bagian pemancar ( led infra merah ) dan bagian
penerima ( foto transistor ). Bagian pemancar bertugas memancarkan cahaya infra merah dan bagian penerima berfungsi menangkap cahaya infra merah yang dipancarkan. Bagian pemancar menggunakan LED QED 112. Tegangan Vd merupakan tegangan dioda yang besarnya 1,7 Volt berdasarkan data sheet. Nilai resistor yang digunakan dipilih berdasarkan pada arus yang melewati LED karena kuat arus juga mempengaruhi intensitas cahaya yang dipancarkan oleh LED. Rangkaian pemancar terlihat seperti gambar 3.2. Vcc
R Id LED Vd
Gambar 3.2. Rangkaian pemancar
Besar arus minimal agar LED QED 122 dapat memancarkan cahaya infra merah adalah 20 mA. Nilai resistor maksimal yang dapat dipasang adalah:
5 − 1,7 =165Ω 20mA
Nilai R yang dipasang pada sensor sebesar 150Ω sehingga arus yang melewati led sebesar 22 mA. Besar arus tersebut cukup untuk dapat dipantulkan oleh suatu benda.
18 Penerima menggunakan sebuah foto transistor untuk mendeteksi cahaya infra merah yang dipantulkan oleh penghalang. Foto transistor yang digunakan adalah foto transistor QSD 122. Foto transisitor ini digunakan karena dirancang untuk mendeteksi cahaya infra merah saja sehingga cahaya lain tidak akan mempengaruhi pendeteksian sinyal. Besar arus maksimal yang dapat melalui foto transistor dalam keadaan ‘on’ sebesar 6mA. Karena itu nilai resistor tidak boleh kecil dari : 5 − 0,4V = 766Ω 6mA
Nilai R yang dipasang sebesar 1 KΩ sehingga arus yang melewati foto transistor adalah sebesar 4,6 mA. Rangkaian penerima foto transisitor tampak pada gambar 3.3
Gambar 3.3. Rangkaian Penerima
3.2
Rangkaian Schmitt Trigger ( Pemicu Schmitt ) Untuk gelombang yang berupa sinus menunjukan waktu naik turun sangat
lamban. Bentuk gelombang yang berupa ini dapat mengakibatkan operasi yang tak dapat diandalkan. Oleh karena itu ditambahkan rangkaian inverter pemicu schmitt untuk yang dapat membuat gelombang kotak dari sinyal input. Pemicu schmitt yang digunakan pada perancangan ini yaitu IC DM74LS14 seperti terlihat pada gambar 3.4
19
Gambar 3.4. IC DM74LS14
Ambang alih tegangan pemicu schmitt dibedakan berdasarkan tegangan arah positif (V+). Profil tegangan untuk IC7414 ini memperlihatkan ambang alih 1,7 Volt untuk tegangan input arah positif (V+), 0.9 Volt untuk tegangan input arah negatif. Bentuk gelombang masukan dan keluaran dari pemicu schmitt terlihat seperti pada gambar 3.5.
Gambar 3.5. Bentuk gelombang masukan dan keluaran Schmit Trigger
3.3
Multiplexer Multiplexer adalah suatu rangkaian yang mampu memilih sebuah masukan
dari beberapa masukan dan menjadikannya sebuah keluaran. MUX yang digunakan adalah IC 74LS153 dimana di dalamnya terdapat 2 buah MUX 4 ke 1. Masing-masing
20 rangkaian terdiri dari empat masukan serta sebuah keluaran bersama komplemennya seperti gambar 3.6.
Gambar 3.6. Dua MUX 4 ke 1
Selector berfungsi mengatur masukan mana yang akan dilewatkan. Misalkan masukan kedua selector A dan B adalah aktif rendah (logika 0), maka masukan yang dilewatkan adalah Co. Tabel fungsi dari MUX 4 ke 1 terlihat pada tabel 3.1.
Tabel 3.1 tabel fungsi
Dari tabel 3.1 jelaslah bahwa keluaran Y mengikuti masukan yang sesuai (C0, C1, C2, atau C3) berdasarkan masukan selector (A B).
21
3.4
Perancangan rangkaian penyangga (buffer) Fungsi dari rangkaian ini adalah untuk mengisolasi rangkaian penggerak relay
agar tidak menarik arus terlalu besar dari rangkaian mikrokontroler. Rangkaian penyangga yang digunakan sudah terintegrasi di dalam IC SN74LS07 seperti pada gambar 3.7 yang merupakan buffer open collector, yang dalam pengoperasiannya membutuhkan resistor pull-up. Dari data sheet SN74LS07, arus maksimum yang diserap (I OL max
), yaitu pada saat masukannya berlogika 0 ( keluarannya juga 0 )
adalah 40 mA. Maka besarnya R Pull −up sebagai resistor pembatas arus kolektor harus melebihi harga yang didapat dari perhitungan berikut ini : R Pull −up ≥
5V 40mA
R Pull −up ≥ 125 Ω VCC 5 V
dari uC
1a
vcc
1y
6a
2a
6y
2y
5a
3a
5y
3y
4a
gnd
4y ke penggerak relay
Gambar 3.7. Rangkaian penyangga (buffer) SN74LS07
3.5
Rangkaian penggerak relay Penggerak relay menggunakan rangkaian transistor penguat arus yang
terintegrasi dalam IC ULN2803A. IC tersebut memiliki 8 pasang transistor Darlington
22 yang masing-masing telah dilengkapi ‘clamp diode’ untuk beban induktif. Rangkaian penggerak relay ULN2803 terlihat pada gambar 3.8.
COM
VCC 5 V
ke relay
Rpull-up OUTPUT
INPUT
2,7 k
dari buffer
7,2 k
3k
Gambar 3.8. Rangkaian penggerak relay ULN2803
Relay yang dipakai dalam perancangan ini adalah relay 12 V SPDT (Single Pole Double Throw ) yang memiliki hambatan dalam 364 Ω. Dari data sheet Vce (sat) = 0.9 V ( untuk hfe (Ic/Ii) = 100mA/250μA = 400) dengan pendekatan arus relay. Maka besarnya arus untuk mengaktifkan relay (Ic) adalah: Ic=
Vrelay − VCE Rrelay
=
12V − 0,9V = 30,4945mA 364Ω
Dengan demikian arus masukan minimum (Ii min) yang diperlukan adalah : Ii min =
I C 30,4945mA = = 76,2362 μA hfe 400
Agar dapat menggerakkan relay, resistor pull-up yang dipasang pada masukannya (keluaran dari buffer ) perlu diperhatikan agar tidak melebihi harga maksimum yang didapat dari perhitungan berikut ini : Ii min ≤
V BB RGab
( RGab = hambatan total pada basis)
23
76,2362 μA ≤
R pull −up
5V + 2,7 KΩ + 7,2 KΩ + 3KΩ
65,586 KΩ ≥ R pull −up + 2,7 KΩ+ 7,2 K Ω+ 3 KΩ
R pull −up ≤ 52,686 KΩ
Maka syarat untuk resistor pull-up adalah 125Ω ≤ Rpull-up ≤ 52,686 kΩ. Pada perancangan ini dipakai R pull-up sebesar 10 KΩ.
3.6 Rangkaian relay dan penampil lampu lalu lintas (LL) Penampil yang digunakan adalah lampu pijar 2,5 watt 220 volt. Maka untuk sebuah persimpangan 4 arah akan dibutuhkan 12 lampu yaitu 4 lampu warna merah, kuning, hijau. Dari masing-masing lampu tersebut dihubungkan dengan relay yang terhubung dengan pin COM dan OUTPUT untuk pensaklarannya. Pin COM disini berfungsi sebagai sumber tegangan tetap 12 volt. Perancangan ini menggunakan relay SPDT 12 volt yang mampu dilewati arus hingga 3 ampere. Gambar 3.9 adalah gambar rangkaian relay dan penampil lalu-lintas.
2,5 W / 220 Vac 1 2
12 V
5
220 Vac
3 4 Dari ULN2803A
1 2 RELAY SPDT
gambar 3.9. Rangkaian relay dan penampil lalu-lintas
24
BAB IV ANALISA DATA DAN PEMBAHASAN
Bab ini akan menjelaskan proses pendeteksian kendaraan pada suatu lampu lalu-lintas saat terjadi kepadatan arus kendaraan. Pada satu jalur lampu lalu-lintas terpasang empat sensor infra merah sebagai pemancar dan empat fototransistor sebagai penerima. Keluaran dari sensor menjadi masukan bagi inverter sebagai pengkondisi sinyal dan keluaran dari inverter terhubung ke masukan MUX yang akan menyeleksi masukan dari sensor mana yang akan dilewatkan. Saat cahaya infra merah mengenai fototransistor berarti tidak ada kendaraan yang terdeteksi oleh sensor dan dianggap logika ‘0’. Saat cahaya infra merah tidak mengenai fototransistor artinya ada kendaraan yang terdeteksi oleh sensor dan dianggap logika ‘1’. Keluaran sensor terhubung ke dua buah inverter yang terpasang serial agar saat sensor logika ‘0’ keluaran dari inverter juga logika ‘0’, dan saat sensor logika ‘1’ keluaran inverter juga logika ‘1’. Kemudian keluaran dari inverter diseleksi oleh MUX berdasarkan selektor yang diberikan. Saat selektor ‘00’ berarti keluaran sensor pertama yang dilewatkan, saat ‘01’ berarti keluaran sensor kedua yang dilewatkan, saat ‘10’ keluaran sensor ketiga yang dilewatkan, dan saat ‘11’ keluaran sensor keempat yang dilewatkan. Keluaran MUX menjadi informasi atau masukan bagi mikrokontroler untuk memberikan tambahan waktu nyala lampu hijau.
4.1
Pengukuran keluaran sensor Pada perancangan, sensor dipasang pada suatu perempatan dimana tiap-tiap
jalur terpasang empat sensor S1, S2, S3, dan S4. Sensor-sensor ini bertujuan untuk
25 menunjukkan tingkat kepadatan arus kendaraan pada suatu jalur lampu lalu-lintas. Berdasarkan data sheet, tegangan keluaran fototransistor saat mendeteksi sebesar 5 V. Pada pengukuran didapatkan tegangan rata-rata keluaran dari fototansistor saat mendeteksi dan saat tidak mendeteksi adanya kendaraan yang menutupi sensor seperti pada tabel 4.1. Tabel 4.1. Tegangan keluaran sensor Sensor
Tegangan (V) Saat tidak mendeteksi
Saat mendeteksi
S1
0,55
3,90
S2
0,57
3,91
S3
0,57
3,89
S4
0,56
3,90
Dari tabel terlihat bahwa tegangan keluaran saat mendeteksi terjadi perbedaan antara hasil pengukuran dengan data sheet. Hal ini dipengaruhi oleh tahanan yang ada pada perancangan. Tegangan keluaran dari sensor ini kemudian akan menjadi masukan bagi inverter sebagai pengkondisi sinyal . Inverter akan membaca tegangan keluaran dari sensor sebagai logika ‘0’ jika tegangan keluarannya maksimal 1 V, dan sebagai logika ‘1’ jika tegangan keluaran sensor minimal 1,4 V.
4.2
Pengukuran keluaran inverter Keluaran dari sensor dihubungkan dengan dua inverter yang terpasang serial
agar logika keluaran dari inverter sama dengan logika keluaran sensor. Jika masukan inverter pertama logika ‘1’ maka keluarannya adalah logika ‘0’. Logika ‘0’ ini akan menjadi masukan bagi inverter kedua sehingga keluarannya menjadi logika ‘1’.
26 Berdasarkan pengukuran didapat nilai rata-rata keluaran dari inverter seperti pada tabel 4.2. Tabel 4.2. Tegangan keluaran inverter Inverter
Tegangan keluaran (V) Saat tidak mendeteksi
Saat mendeteksi
S1
0,30
3,86
S2
0,29
3,85
S3
0,32
3,89
S3
0,30
3,87
Keluaran dari inverter dianggap sebagai logika ‘0’ jika tegangan keluarannya maksimal 0,5 V dan sebagai logika ‘1’ jika tegangan keluarannya minimal 2,7 V (data sheet). Dari tabel terlihat bahwa tegangan keluaran dari inverter saat tidak mendeteksi dan saat mendeteksi sudah dapat dibaca sebagai logika ‘0’ dan logika ‘1’ karena telah memenuhi syarat yang diinginkan. Keluaran dari inverter ini kemudian akan menjadi masukan bagi MUX yang kemudian akan diseleksi masukan dari sensor mana yang akan dilewatkan oleh MUX.
4.3
Pengukuran keluaran MUX MUX berfungsi menyeleksi keluaran sensor mana yang akan dilewatkan.
Keluaran yang dilewatkan dipilih berdasarkan selektor yang diberikan. Pada perancangan menggunakan empat MUX. MUX akan membaca masukannya sebagai logika ‘0’ jika tegangan masukan maksimal 0,8 V dan sebagai logika ‘1’ jika tegangan masukan minimal 2 V (data sheet). Keluaran dari inverter sudah memenuhi syarat tersebut sehingga sudah dapat dibaca oleh MUX sebagai logika ‘0’ dan logika
27 ‘1’. Berdasarkan pengukuran didapatkan hasil rata-rata keluaran MUX seperti pada tabel 4.3. Tabel 4.3. Tegangan keluaran MUX Selektor
00
01
10
11
Data masukan (keluaran inverter) (V)
Keluaran
S1
S2
S3
S4
(V)
0,30
X
X
X
0,20
3,86
X
X
X
3,58
X
0,29
X
X
0,20
X
3,85
X
X
3,58
X
X
0,32
X
0,21
X
X
3,89
X
3,59
X
X
X
0,30
0,19
X
X
X
3,87
3,57
Dari data tersebut maka sesuai dengan tebel fungsi dari multiplexer (MUX) bahwa saat selektor ‘00’ maka data yang dilewatkan adalah data dari sensor pertama (S1). Saat selektor ‘01’ data yang dilewatkan adalah data dari sensor kedua (S2), saat selektor ‘10’ maka data yang dilewatkan adalah data dari sensor ketiga (S3). Sedangkan saat selektornya adalah ‘11’ maka data yang dilewatkan adalah data dari sensor keempat (S4). Keluaran MUX dianggap logika ‘0’ jika tegangan keluarannya maksimal 0,5 V dan logika ‘1’ jika tegangan keluarannya minimal 2,7 V (data sheet). Data yang telah dilewatkan oleh MUX sesuai dengan selektor yang diberikan kemudian akan menjadi masukan bagi mikrokontroler untuk memberikan tambahan waktu nyala lampu hijau saat terjadi kepadatan arus kendaraan. Mikrokontroler akan membaca tegangan keluaran dari inverter sebagai logika ‘0’ jika tegangan
28 keluarannya maksimal 0,2Vcc − 0,1 V, dan sebagai logika ‘1’ jika tegangan keluaran inverter minimal 0,2Vcc + 0,9 V.
4.4
Tingkat Kepadatan Yang dimaksud dengan tingkat kepadatan adalah seberapa jauh atau sampai
sensor mana kepadatan arus kendaraan terdeteksi. Tingkat kepadatan arus kendaraan pada sistem ini ditentukan berdasarkan konfigurasi seperti yang terlihat pada tabel 4.4 sebagai berikut. Tabel 4.4. Tingkat kepadatan arus kendaraan S1
S2
S3
S4
Keterangan
X
X
X
X
Tidak terjadi kepadatan(normal)
V
X
X
X
Kepadatan tingkat 1
V
X
X
V
Kepadatan tingkat 1
V
X
V
X
Kepadatan tingkat 1
V
X
V
V
Kepadatan tingkat 1
V
V
X
X
Kepadatan tingkat 2
V
V
X
V
Kepadatan tingkat 2
V
V
V
X
Kepadatan tingkat 3
V
V
V
V
Kepadatan tingkat 4
Keterangan: X = Sensor tidak mendeteksi V = Sensor mendeteksi
29 Berdasarkan tabel 4.4 terlihat bahwa ada empat tingkat kepadatan arus kendaraan yang diinginkan pada sistem ini. Namun ada tingkat kepadatan dengan konfigurasi lebih dari satu, hal ini terlihat pada tingkat kepadatan 1 dan 2. Dikatakan terjadi kepadatan tingkat 1 jika kepadatan arus kendaraan sampai pada sensor S1 (S1 mendeteksi; S2, S3, S4 tidak mendeteksi). Namun ada 3 kondisi lain yang juga dikatakan sebagai kepadatan tingkat 1, sebagai contoh saat S1 dan S3 mendeteksi, S2 dan S4 tidak mendeteksi. Hal ini dikarenakan S3 mendeteksi adanya sesuatu yang menghalangi sensor walaupun sebenarnya kepadatan hanya sampai sensor S1. Begitu juga dengan 2 kondisi yang lain. Kepadatan tingkat 2 terjadi jika arus kendaraan mengenai sensor S1 dan S2. Kepadatan tingkat 3 terjadi jika sensor S1, S2, S3 mendeteksi adanya kendaraan dan sensor S4 tidak mendeteksi. Kepadatan tingkat 4 jika semua sensor S1, S2, S3, dan S4 mendeteksi adanya kendaraan.
30
BAB V KESIMPULAN DAN SARAN
5.1
Kesimpulan Kesimpulan secara umum mengenai pendeteksian kepadatan arus kendaraan
pada sistem prioritas lampu lalu-lintas adalah: 1.
Saat sensor tidak mendeteksi adanya kendaraan, masih terdapat tegangan keluaran pada tiap-tiap blok.
2.
Terjadi penurunan tegangan keluaran di tiap blok dari sensor sampai ke MUX selama proses pendeteksian.
3.
Untuk mengetahui tingkat kepadatan arus kendaraan maka data akan dibaca berdasarkan dengan sampai sensor mana terdeteksi adanya kendaraan.
4.
Mikrokontroler akan memberikan tambahan waktu nyala lampu hijau berdasarkan tingkat kepadatan yang terjadi.
5.2
Saran Pada perancangan pendeteksi kepadatan arus kendaraan masih banyak
kekurangan, karena itu penulis menyarankan: 1. Sensor yang digunakan pada tugas akhir ini dapat menggunakan sensor-sensor yang lain selain infra merah. 2. Ada baiknya jika ditambah dengan suatu piranti penunjuk lamanya waktu nyala lampu lalu-lintas ketika mendeteksi adanya kepadatan arus kendaraan.
31
Daftar pustaka
Morris Mano, M., 1979, Digital Logic and Computer Design, Prentice Hall International Inc., New Jersey
Malvino, A.P., Leach, D.P., 1992, Prinsip-prinsip dan Penerapan Digital, Erlangga, Jakarta, Indonesia
Fairchild Semiconductor, 2001, QED121/122/123 Plastic Infrared Light Emitting Diode, Fairchild Semiconductor Corporation
Fairchild
Semiconductor,
2001,
QSD122/123/124
Plastic
Silicon
Infrared
Phototransistor, Fairchild Semiconductor Corporation
Fairchild Semiconductor, 2000, DM74LS14 Hex Inverter with Schmitt Trigger Inputs, Fairchild Semiconductor Corporation . National Semiconductor, 1995, 54LS153/DM54LS153/DM74LS153 Dual 4-Line to 1Line Data Selectors/Multiplexers , National Semiconductor Corporation
LAMPIRAN
3 QSD 122
Q4
QED 122
3 QSD 122 1
QED 122
3 QSD 122
D4
S1 S2 S3 S4
RANGKAIAN SENSOR
1K Ohm
Vout Vout Vout Vout
S1 S2 S3 S4
150 Ohm
3 QSD 122
Q4
1
D4 QED 122
Q3
3 QSD 122
D3 QED 122
3 QSD 122
Q2
S1 S2 S3 S4
1K Ohm
150 Ohm
1
D2 QED 122
QED 122
Q1
3 QSD 122
D1
Vout Vout Vout Vout
+5V
150 Ohm
1
Q4
Vout Vout Vout Vout
Q3
1K Ohm
150 Ohm
3 QSD 122
D4 QED 122
3 QSD 122
Q3
D3
1
1K Ohm
150 Ohm
1
D3 QED 122
3 QSD 122
Q2
Q2
150 Ohm
1
1K Ohm
150 Ohm
1
D2 QED 122
3 QSD 122
Q1
150 Ohm
SENSOR JALUR 4 1K Ohm
150 Ohm
1
QED 122
D1
+5V
1K Ohm
150 Ohm
D2
1K Ohm
S1 S2 S3 S4
1
1K Ohm
Q1
1
QED 122
1
D1
1K Ohm
150 Ohm
QED 122
Q4
Vout Vout Vout Vout
SENSOR JALUR 3
1K Ohm
150 Ohm
QED 122
D4
+5V
1
1K Ohm
150 Ohm
Q3
QED 122
1
1
D3
3 QSD 122
Q2
QED 122
3 QSD 122
D2
1K Ohm
150 Ohm
3 QSD 122
150 Ohm
Q1
QED 122
1K Ohm
3 QSD 122
1K Ohm
150 Ohm D1
SENSOR JALUR 2
3 QSD 122
1K Ohm
+5V
1
SENSOR JALUR 1
JALUR 2
5V
DM74LS14
S1 jalur 2
7 6 5 4 3 2 1
S1 jalur 1
14 13 12 11 10 9 8
JALUR 1
DM74LS14
1 2 3 4 5 6 7 8
1G B 1C3 1C2 1C1 1C0 1Y GND
VCC 2G A 2C3 2C2 2C1 2C0 2Y
16 15 14 13 12 11 10 9
S2 jalur 2
S3 jalur 2
DM74LS14
Loika 0
DM74LS14 Selektor A
1 2 3 4 5 6 7
8 9 10 11 12 13 14
DM74LS153 S4 jalur 2
Selektor B
S1 jalur 4
Out jalur 1
14 13 12 11 10 9 8
S1 jalur 3
7 6 5 4 3 2 1
S4 jalur 1
DM74LS14
DM74LS14 Out jalur 2
1 2 3 4 5 6 7 8
S3 jalur 3
14 13 12 11 10 9 8
S2 jalur 3
1G B 1C3 1C2 1C1 1C0 1Y GND
VCC 2G A 2C3 2C2 2C1 2C0 2Y
16 15 14 13 12 11 10 9
S2 jalur 4
DM74LS14
S3 jalur 4 DM74LS14
8 9 10 11 12 13 14
1 2 3 4 5 6 7
DM74LS153 S4 jalur 4 S4 jalur 3
JALUR 3
Out jalur 3 Out jalur 4
7 6 5 4 3 2 1
1 2 3 4 5 6 7
8 9 10 11 12 13 14
MUX 2
JALUR 4
RANGKAIAN INVERTER DAN MUX
KE MIKROKONTROLER
S3 jalur 1
14 13 12 11 10 9 8
S2 jalur1
7 6 5 4 3 2 1
1 2 3 4 5 6 7
8 9 10 11 12 13 14
MUX 1
RANGKAIAN BUFFER DAN DRIVER
2 1
5
RELAY SPDT
3
4
LAMPU H0
2 1
5
RELAY SPDT
3
4
LAMPU K0
2 1
5
RELAY SPDT
3
2 1
4
LAMPU M0
5
H3
3
4
4 3
M0
K0
H0
5
M1
LAMPU M1
1 2
RELAY SPDT
RELAY SPDT
LAMPU H3 2 1
5
K3
3
4
4 3
5
K1
LAMPU K1
1 2
RELAY SPDT
RELAY SPDT
LAMPU K3 2 1
5
M3
3
4
4 3
5
H1
RELAY SPDT
M2
RELAY SPDT 2 1 4 3 5
3 5
4
RELAY SPDT
LAMPU M3
K2
2 1
H2
RELAY SPDT 2 1 4 3 5
RELAY SPDT
1 2
COM
220 V LAMPU H2
LAMPU K2
LAMPU M2
RANGKAIAN LAMPU LALU-LINTAS
LAMPU H1
QED121/122/123 PLASTIC INFRARED LIGHT EMITTING DIODE PACKAGE DIMENSIONS 0.195 (4.95)
FEATURES • D= 880 nm REFERENCE SURFACE
• Chip material = AlGaAs
0.305 (7.75)
• Package type: T-1 3/4 (5mm lens diameter) • Matched Photosensor: QSD122/123/124 • Narrow Emission Angle, 18°
0.040 (1.02) NOM
• High Output Power
0.800 (20.3) MIN
• Package material and color: Clear, peach tinted, plastic 0.050 (1.25)
CATHODE 0.100 (2.54) NOM
1. Derate power dissipation linearly 2.67 mW/°C above 25°C. 2. RMA flux is recommended. 3. Methanol or isopropyl alcohols are recommended as cleaning agents. 4. Soldering iron 1/16” (1.6mm) minimum from housing.
0.240 (6.10) 0.215 (5.45)
NOTES:
0.020 (0.51) SQ. (2X)
SCHEMATIC
ANODE
1. Dimensions for all drawings are in inches (mm). 2. Tolerance of ± .010 (.25) on all non-nominal dimensions unless otherwise specified.
ABSOLUTE MAXIMUM RATINGS
CATHODE
(TA = 25°C unless otherwise specified)
Parameter
Symbol
Rating
Unit
Operating Temperature
TOPR
-40 to +100
°C
Storage Temperature
TSTG
-40 to +100
°C
(Iron)(2,3,4)
Soldering Temperature
TSOL-I
240 for 5 sec
°C
Soldering Temperature (Flow)(2,3)
TSOL-F
260 for 10 sec
°C
Continuous Forward Current
IF
100
mA
Reverse Voltage
VR
5
V
PD
200
mW
Power
Dissipation(1)
ELECTRICAL / OPTICAL CHARACTERISTICS PARAMETER
(TA =25°C)
TEST CONDITIONS
SYMBOL
MIN
TYP
Peak Emission Wavelength
IF = 20 mA
Emission Angle
IF = 100 mA
Forward Voltage Reverse Current
DPE
—
880
—
nm
0
—
±9
—
Deg.
IF = 100 mA, tp = 20 ms
VF
—
—
1.7
V
VR = 5 V
IR
—
—
10
µA
Radiant Intensity QED121
IF = 100 mA, tp = 20 ms
IE
16
—
40
mW/sr
Radiant Intensity QED122
IF = 100 mA, tp = 20 ms
IE
32
—
100
mW/sr
Radiant Intensity QED123
IF = 100 mA, tp = 20 ms
IE
50
—
—
mW/sr
tr
—
800
—
ns
tf
—
800
—
ns
Rise Time Fall Time
IF = 100 mA
2001 Fairchild Semiconductor Corporation DS300336 4/19/01
1 OF 3
MAX
UNITS
www.fairchildsemi.com
QED121/122/123 PLASTIC INFRARED LIGHT EMITTING DIODE TYPICAL PERFORMANCE CURVES
NORMALIZED COLLECTOR CURRENT
NORMALIZED RADIANT INTENSITY
10 Normalized to: IF= 100 mA, TA = 25˚C Pulse Width = 100 µs 1
0.1
0.01
0.001 1
10
100
1 Normalized to: Pulse Width = 100 µs Duty Cycle = 0.1% VCC = 5 V RL = 100 1 TA = 25˚C
IF = 100 mA
0.8
0.6 IF = 20 mA
0.4
0.2
0
1000
0
1
IF - INPUT CURRENT (mA)
2
3
4
5
6
LENS TIP SEPERATION (INCHES)
Fig. 1 Normalized Radiant Intensity vs. Input Current
Fig. 2 Coupling Characteristics of QED12X and QSD12X
NORMALIZED RADIANT INTENSITY
1.0
VF - FORWARD VOLTAGE (V)
2.5 IF = 100 mA
IF = 50 mA 2
1.5
1
IF = 10 mA
0.5
IF = 20 mA
Pulse Width = 100 µs Duty Cycle = 0.1%
0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1
0 -40
-30
-20
-10
0
10
20
30
40
50
60
70
80
775
90 100
800
825
850
TA - TEMPERATURE (˚C)
875
900
925
950
D (nm)
Fig. 3 Forward Voltage vs. Temperature
Fig. 4 Normalized Radiant Intensity vs. Wavelength
Fig. 5 Radiation Pattern 20
10
0˚
-10
-20
30
-30
40
-40
50
-50
60
-60
70
-70
80
-80
90
-90 100
www.fairchildsemi.com
80
60
40
20
0
2 OF 3
20
40
60
80
100
4/19/01
DS300336
QED121/122/123 PLASTIC INFRARED LIGHT EMITTING DIODE DISCLAIMER FAIRCHILD SEMICONDUCTOR RESERVES THE 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. 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 systems which, (a) are intended for surgical implant into the body,or (b) support or sustain life, and (c) whose failure to perform when properly used in accordance with instructions for use provided in labeling, can be reasonably expected to result in a significant injury of the user.
DS300336
4/19/01
2. A critical component in any component of a life support device or system whose failure to perform can be reasonably expected to cause the failure of the life support device or system, or to affect its safety or effectiveness.
3 OF 3
www.fairchildsemi.com
This datasheet has been download from: www.datasheetcatalog.com Datasheets for electronics components.
Revised March 2000
DM74LS14 Hex Inverter with Schmitt Trigger Inputs General Description This device contains six independent gates each of which performs the logic INVERT function. Each input has hysteresis which increases the noise immunity and transforms a slowly changing input signal to a fast changing, jitter free output.
Ordering Code: Order Number
Package Number
Package Description
DM74LS14M
M14A
14-Lead Small Outline Integrated Circuit (SOIC), JEDEC MS-120, 0.150 Narrow
DM74LS14SJ
M14D
14-Lead Small Outline Package (SOP), EIAJ TYPE II, 5.3mm Wide
DM74LS14N
N14A
14-Lead Plastic Dual-In-Line Package (PDIP), JEDEC MS-001, 0.300 Wide
Devices also available in Tape and Reel. Specify by appending the suffix letter “X” to the ordering code.
Connection Diagram
Function Table Y=A Input
Output
A
Y
L
H
H
L
H = HIGH Logic Level L = LOW Logic Level
© 2000 Fairchild Semiconductor Corporation
DS006353
www.fairchildsemi.com
DM74LS14 Hex Inverter with Schmitt Trigger Inputs
August 1986
DM74LS14
Absolute Maximum Ratings(Note 1) Supply Voltage
Note 1: The “Absolute Maximum Ratings” are those values beyond which the safety of the device cannot be guaranteed. The device should not be operated at these limits. The parametric values defined in the Electrical Characteristics tables are not guaranteed at the absolute maximum ratings. The “Recommended Operating Conditions” table will define the conditions for actual device operation.
7V
Input Voltage
7V 0°C to +70°C
Operating Free Air Temperature Range
−65°C to +150°C
Storage Temperature Range
Recommended Operating Conditions Min
Nom
Max
VCC
Symbol Supply Voltage
Parameter
4.75
5
5.25
Units V
VT+
Positive-Going Input Threshold Voltage (Note 2)
1.4
1.6
1.9
V
VT−
Negative-Going Input Threshold Voltage (Note 2)
0.5
0.8
1
V
HYS
Input Hysteresis (Note 2)
0.4
0.8
IOH
HIGH Level Output Current
−0.4
mA
IOL
LOW Level Output Current
8
mA
TA
Free Air Operating Temperature
70
°C
V
0
Note 2: VCC = 5V.
Electrical Characteristics over recommended operating free air temperature range (unless otherwise noted) Symbol
Parameter
Conditions
VI
Input Clamp Voltage
VCC = Min, II = −18 mA
VOH
HIGH Level
VCC = Min, IOH = Max
Output Voltage
VIL = Max
VOL
IT+
LOW Level
VCC = Min, IOL = Max
Output Voltage
VIH = Min
Input Current at
Min
Typ (Note 3)
2.7
Max
Units
−1.5
V
3.4
V
0.35
0.5
VCC = Min, IOL = 4 mA
0.25
0.4
VCC = 5V, VI = VT+
−0.14
mA
VCC = 5V, VI = VT−
−0.18
mA
V
Positive-Going Threshold IT−
Input Current at Negative-Going Threshold
II
Input Current @ Max Input Voltage
VCC = Max, VI = 7V
0.1
IIH
HIGH Level Input Current
VCC = Max, VI = 2.7V
20
µA
IIL
LOW Level Input Current
VCC = Max, VI = 0.4V
−0.4
mA
IOS
Short Circuit Output Current
VCC = Max (Note 4)
−100
mA
ICCH
Supply Current with Outputs HIGH
VCC = Max
8.6
16
mA
ICCL
Supply Current with Outputs LOW
VCC = Max
12
21
mA
−20
mA
Note 3: All typicals are at VCC = 5V, TA = 25°C. Note 4: Not more than one output should be shorted at a time, and the duration should not exceed one second.
Switching Characteristics at VCC = 5V and TA = 25°C RL = 2 kΩ Symbol
tPLH
CL = 15 pF
Parameter
Propagation Delay Time LOW-to-HIGH Level Output
tPHL
Propagation Delay Time HIGH-to-LOW Level Output
www.fairchildsemi.com
2
CL = 50 pF
Units
Min
Max
Min
Max
5
22
8
25
ns
5
22
10
33
ns
DM74LS14
Physical Dimensions inches (millimeters) unless otherwise noted
14-Lead Small Outline Integrated Circuit (SOIC), JEDEC MS-120, 0.150 Narrow Package Number M14A
3
www.fairchildsemi.com
DM74LS14
Physical Dimensions inches (millimeters) unless otherwise noted (Continued)
14-Lead Small Outline Package (SOP), EIAJ TYPE II, 5.3mm Wide Package Number M14D
www.fairchildsemi.com
4
DM74LS14 Hex Inverter with Schmitt Trigger Inputs
Physical Dimensions inches (millimeters) unless otherwise noted (Continued)
14-Lead Plastic Dual-In-Line Package (PDIP), JEDEC MS-001, 0.300 Wide Package Number N14A
Fairchild does not assume any responsibility for use of any circuitry described, no circuit patent licenses are implied and Fairchild reserves the right at any time without notice to change said circuitry and specifications. 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: 2. A critical component in any component of a life support device or system whose failure to perform can be reasonably expected to cause the failure of the life support device or system, or to affect its safety or effectiveness.
1. Life support devices or systems are devices or systems which, (a) are intended for surgical implant into the body, or (b) support or sustain life, and (c) whose failure to perform when properly used in accordance with instructions for use provided in the labeling, can be reasonably expected to result in a significant injury to the user.
www.fairchildsemi.com
5
www.fairchildsemi.com
54LS153/DM54LS153/DM74LS153 Dual 4-Line to 1-Line Data Selectors/Multiplexers Y
General Description Each of these data selectors/multiplexers contains inverters and drivers to supply fully complementary, on-chip, binary decoding data selection to the AND-OR-invert gates. Separate strobe inputs are provided for each of the two four-line sections.
Y
Y
Y
Features Y
Y
Y
Permits multiplexing from N lines to 1 line Performs at parallel-to-serial conversion
Strobe (enable) line provided for cascading (N lines to n lines) High fan-out, low impedance, totem pole outputs Typical average propagation delay times Ð From data 14 ns Ð From strobe 19 ns Ð From select 22 ns Typical power dissipation 31 mW Alternate Military/Aerospace device (54LS153) is available. Contact a National Semiconductor Sales Office/ Distributor for specifications.
Connection Diagram Dual-In-Line Package
Order Number 54LS153DMQB, 54LS153FMQB, 54LS153LMQB, DM54LS153J, DM54LS153W, DM74LS153M or DM74LS153N See NS Package Number E20A, J16A, M16A, N16E or W16A
TL/F/6393 – 1
Logic Diagram
Function Table Select Inputs
Data Inputs
Strobe
Output
B
A
C0
C1
C2
C3
G
Y
X L L L L H H H H
X L L H H L L H H
X L H X X X X X X
X X X L H X X X X
X X X X X L H X X
X X X X X X X L H
H L L L L L L L L
L L H L H L H L H
Select inputs A and B are common to both sections. H e High Level, L e Low Level, X e Don’t Care
TL/F/6393 – 2
C1995 National Semiconductor Corporation
TL/F/6393
RRD-B30M105/Printed in U. S. A.
54LS153/DM54LS153/DM74LS153 Dual 4-Line to 1-Line Data Selectors/Multiplexers
June 1989
Absolute Maximum Ratings
(Note) Note: The ‘‘Absolute Maximum Ratings’’ are those values beyond which the safety of the device cannot be guaranteed. The device should not be operated at these limits. The parametric values defined in the ‘‘Electrical Characteristics’’ table are not guaranteed at the absolute maximum ratings. The ‘‘Recommended Operating Conditions’’ table will define the conditions for actual device operation.
If Military/Aerospace specified devices are required, please contact the National Semiconductor Sales Office/Distributors for availability and specifications. Supply Voltage 7V Input Voltage 7V Operating Free Air Temperature Range b 55§ C to a 125§ C DM54LS and 54LS DM74LS 0§ C to a 70§ C Storage Temperature Range
b 65§ C to a 150§ C
Recommended Operating Conditions Symbol
DM54LS153
Parameter
VCC
Supply Voltage
VIH
High Level Input Voltage
VIL
Low Level Input Voltage
IOH
High Level Output Current
IOL
Low Level Output Current
TA
Free Air Operating Temperature
Electrical Characteristics Symbol
DM74LS153
Units
Min
Nom
Max
Min
Nom
Max
4.5
5
5.5
4.75
5
5.25
2
2
V
0.7
0.8
V
b 0.4
b 0.4
mA
8
mA
70
§C
4 b 55
125
0
over recommended operating free air temperature range (unless otherwise noted)
Parameter
Conditions
Min
Typ (Note 1)
Max
Units
b 1.5
V
VI
Input Clamp Voltage
VCC e Min, II e b18 mA
VOH
High Level Output Voltage
VCC e Min, IOH e Max VIL e Max, VIH e Min
Low Level Output Voltage
VCC e Min, IOL e Max VIL e Max, VIH e Min
DM54
0.25
0.4
DM74
0.35
0.5
IOL e 4 mA, VCC e Min
DM74
0.25
0.4
VOL
V
DM54
2.5
3.4
DM74
2.7
3.4
V
V
II
Input Current @ Max Input Voltage
VCC e Max, VI e 7V
IIH
High Level Input Current
VCC e Max, VI e 2.7V
20
mA
IIL
Low Level Input Current
VCC e Max, VI e 0.4V
b 0.36
mA
IOS
Short Circuit Output Current
VCC e Max (Note 2)
mA
Supply Current
VCC e Max (Note 3)
ICC
0.1
DM54
b 20
b 100
DM74
b 20
b 100
Note 1: All typicals are at VCC e 5V, TA e 25§ C. Note 2: Not more than one output should be shorted at a time, and the duration should not exceed one second. Note 3: ICC is measured with all outputs open and all other inputs grounded.
2
6.2
10
mA
mA
Switching Characteristics
at VCC e 5V and TA e 25§ C (See Section 1 for Test Waveforms and Output Load) RL e 2 kX From (Input)
Symbol
Parameter
CL e 15 pF
to (Output)
Min
Max
CL e 50 pF Min
Units
Max
tPLH
Propagation Delay Time Low to High Level Output
Data to Y
15
20
ns
tPHL
Propagation Delay Time High to Low Level Output
Data to Y
26
35
ns
tPLH
Propagation Delay Time Low to High Level Output
Select to Y
29
35
ns
tPHL
Propagation Delay Time High to Low Level Output
Select to Y
38
45
ns
tPLH
Propagation Delay Time Low to High Level Output
Strobe to Y
24
30
ns
tPHL
Propagation Delay Time High to Low Level Output
Strobe to Y
32
40
ns
3
Physical Dimensions inches (millimeters)
Ceramic Leadless Chip Carrier Package (E) Order Number 54LS153LMQB NS Package Number E20A
16-Lead Ceramic Dual-In-Line Package (J) Order Number 54LS153DMQB or DM54LS153J NS Package Number J16A
4
Physical Dimensions inches (millimeters) (Continued)
16-Lead Small Outline Molded Package (M) Order Number DM74LS153M NS Package Number M16A
16-Lead Molded Dual-In-Line Package (N) Order Number DM74LS153N NS Package Number N16E
5
54LS153/DM54LS153/DM74LS153 Dual 4-Line to 1-Line Data Selectors/Multiplexers
Physical Dimensions inches (millimeters) (Continued)
16-Lead Ceramic Flat Package (W) Order Number 54LS153FMQB or DM54LS153W NS Package Number W16A
LIFE SUPPORT POLICY NATIONAL’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 NATIONAL SEMICONDUCTOR CORPORATION. As used herein: 1. Life support devices or systems are devices or systems which, (a) are intended for surgical implant into the body, or (b) support or sustain life, and whose failure to perform, when properly used in accordance with instructions for use provided in the labeling, can be reasonably expected to result in a significant injury to the user. National Semiconductor Corporation 1111 West Bardin Road Arlington, TX 76017 Tel: 1(800) 272-9959 Fax: 1(800) 737-7018
2. A critical component is any component of a life support device or system whose failure to perform can be reasonably expected to cause the failure of the life support device or system, or to affect its safety or effectiveness.
National Semiconductor Europe Fax: (a49) 0-180-530 85 86 Email: cnjwge @ tevm2.nsc.com Deutsch Tel: (a49) 0-180-530 85 85 English Tel: (a49) 0-180-532 78 32 Fran3ais Tel: (a49) 0-180-532 93 58 Italiano Tel: (a49) 0-180-534 16 80
National Semiconductor Hong Kong Ltd. 13th Floor, Straight Block, Ocean Centre, 5 Canton Rd. Tsimshatsui, Kowloon Hong Kong Tel: (852) 2737-1600 Fax: (852) 2736-9960
National Semiconductor Japan Ltd. Tel: 81-043-299-2309 Fax: 81-043-299-2408
National does not assume any responsibility for use of any circuitry described, no circuit patent licenses are implied and National reserves the right at any time without notice to change said circuitry and specifications.
This datasheet has been downloaded from: www.DatasheetCatalog.com Datasheets for electronic components.
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)
Description The AT89S51 is a low-power, high-performance CMOS 8-bit microcontroller with 4K bytes of in-system programmable Flash memory. The device is manufactured using Atmel’s high-density nonvolatile memory technology and is compatible with the industry-standard 80C51 instruction set and pinout. The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional nonvolatile memory programmer. By combining a versatile 8-bit CPU with in-system programmable Flash on a monolithic chip, the Atmel AT89S51 is a powerful microcontroller which provides a highly-flexible and cost-effective solution to many embedded control applications.
8-bit Microcontroller with 4K Bytes In-System Programmable Flash AT89S51
The AT89S51 provides the following standard features: 4K bytes of Flash, 128 bytes of RAM, 32 I/O lines, Watchdog timer, two data pointers, two 16-bit timer/counters, a fivevector two-level interrupt architecture, a full duplex serial port, on-chip oscillator, and clock circuitry. In addition, the AT89S51 is designed with static logic for operation down 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, and interrupt system to continue functioning. The Power-down mode saves the RAM contents but freezes the oscillator, disabling all other chip functions until the next external interrupt or hardware reset.
Rev. 2487A–10/01
1
Pin Configurations PLCC VCC P0.0 (AD0) P0.1 (AD1) P0.2 (AD2) P0.3 (AD3) P0.4 (AD4) P0.5 (AD5) P0.6 (AD6) P0.7 (AD7) EA/VPP ALE/PROG PSEN P2.7 (A15) P2.6 (A14) P2.5 (A13) P2.4 (A12) P2.3 (A11) P2.2 (A10) P2.1 (A9) P2.0 (A8)
(MOSI) P1.5 (MISO) P1.6 (SCK) P1.7 RST (RXD) P3.0 NC (TXD) P3.1 (INT0) P3.2 (INT1) P3.3 (T0) P3.4 (T1) P3.5
6 5 4 3 2 1 44 43 42 41 40
40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21
7 8 9 10 11 12 13 14 15 16 17
39 38 37 36 35 34 33 32 31 30 29
18 19 20 21 22 23 24 25 26 27 28
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
P0.4 (AD4) P0.5 (AD5) P0.6 (AD6) P0.7 (AD7) EA/VPP NC ALE/PROG PSEN P2.7 (A15) P2.6 (A14) P2.5 (A13)
(WR) P3.6 (RD) P3.7 XTAL2 XTAL1 GND NC (A8) P2.0 (A9) P2.1 (A10) P2.2 (A11) P2.3 (A12) P2.4
P1.0 P1.1 P1.2 P1.3 P1.4 (MOSI) P1.5 (MISO) P1.6 (SCK) P1.7 RST (RXD) P3.0 (TXD) P3.1 (INT0) P3.2 (INT1) P3.3 (T0) P3.4 (T1) P3.5 (WR) P3.6 (RD) P3.7 XTAL2 XTAL1 GND
P1.4 P1.3 P1.2 P1.1 P1.0 NC VCC P0.0 (AD0) P0.1 (AD1) P0.2 (AD2) P0.3 (AD3)
PDIP
44 43 42 41 40 39 38 37 36 35 34
P1.4 P1.3 P1.2 P1.1 P1.0 NC VCC P0.0 (AD0) P0.1 (AD1) P0.2 (AD2) P0.3 (AD3)
TQFP
33 32 31 30 29 28 27 26 25 24 23
1 2 3 4 5 6 7 8 9 10 11
P0.4 (AD4) P0.5 (AD5) P0.6 (AD6) P0.7 (AD7) EA/VPP NC ALE/PROG PSEN P2.7 (A15) P2.6 (A14) P2.5 (A13)
(WR) P3.6 (RD) P3.7 XTAL2 XTAL1 GND GND (A8) P2.0 (A9) P2.1 (A10) P2.2 (A11) P2.3 (A12) P2.4
12 13 14 15 16 17 18 19 20 21 22
(MOSI) P1.5 (MISO) P1.6 (SCK) P1.7 RST (RXD) P3.0 NC (TXD) P3.1 (INT0) P3.2 (INT1) P3.3 (T0) P3.4 (T1) P3.5
2
AT89S51 2487A–10/01
AT89S51 Block Diagram P0.0 - P0.7
P2.0 - P2.7
PORT 0 DRIVERS
PORT 2 DRIVERS
VCC
GND
RAM ADDR. REGISTER
B REGISTER
PORT 0 LATCH
RAM
PORT 2 LATCH
FLASH
PROGRAM ADDRESS REGISTER
STACK POINTER
ACC
BUFFER TMP2
TMP1
PC INCREMENTER
ALU INTERRUPT, SERIAL PORT, AND TIMER BLOCKS
PROGRAM COUNTER
PSW
PSEN ALE/PROG EA / VPP
TIMING AND CONTROL
INSTRUCTION REGISTER
DUAL DPTR
RST WATCH DOG
PORT 3 LATCH
PORT 1 LATCH
ISP PORT
PROGRAM LOGIC
OSC PORT 3 DRIVERS
P3.0 - P3.7
PORT 1 DRIVERS
P1.0 - P1.7
3 2487A–10/01
Pin Description VCC
Supply voltage.
GND
Ground.
Port 0
Port 0 is an 8-bit open drain bidirectional I/O port. As an output port, each pin can sink eight TTL inputs. When 1s are written to port 0 pins, the pins can be used as high-impedance inputs. Port 0 can also be configured to be the multiplexed low-order address/data bus during accesses 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 bytes during 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 can sink/source four TTL inputs. When 1s are written to Port 1 pins, they are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 1 pins that are externally being pulled 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 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)
Port 2 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 2 output buffers can sink/source four TTL inputs. When 1s are written to Port 2 pins, they are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 2 pins that are externally being pulled 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 and during accesses to external data memory that use 16-bit addresses (MOVX @ DPTR). In this application, Port 2 uses strong internal pull-ups when emitting 1s. During accesses to external data memory that use 8-bit addresses (MOVX @ RI), Port 2 emits the contents of the P2 Special Function Register. Port 2 also receives the high-order address bits and some control signals during Flash programming and verification.
Port 3
Port 3 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 3 output buffers can sink/source four TTL inputs. When 1s are written to Port 3 pins, they are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 3 pins that are externally being pulled 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 the following table.
4
AT89S51 2487A–10/01
AT89S51 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)
RST
Reset input. A high on this pin for two machine cycles while the oscillator is running resets the device. This pin drives High for 98 oscillator periods after the Watchdog times out. The DISRTO bit in SFR AUXR (address 8EH) can be used to disable this feature. In the default state of 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 during accesses to external memory. This pin is also the program pulse input (PROG) during Flash programming. In normal operation, ALE is emitted at a constant rate of 1/6 the oscillator frequency and may be used for external timing or clocking purposes. Note, however, that one ALE pulse is skipped 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 pulled high. Setting the ALE-disable bit has no effect if the microcontroller is in external execution mode.
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 activated twice each machine cycle, except that two PSEN activations are skipped during each access to external data memory.
EA/VPP
External Access Enable. EA must be strapped to GND in order to enable the device to fetch code 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 (V PP ) during Flash programming.
XTAL1
Input to the inverting oscillator amplifier and input to the internal clock operating circuit.
XTAL2
Output from the inverting oscillator amplifier
5 2487A–10/01
Special Function Registers
A map of the on-chip memory area called the Special Function Register (SFR) space is shown in Table 1. Note that not all of the addresses are occupied, and unoccupied addresses may not be implemented 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 0F0H
0FFH B 00000000
0F7H
0E8H 0E0H
0EFH ACC 00000000
0E7H
0D8H 0D0H
6
0DFH PSW 00000000
0D7H
0C8H
0CFH
0C0H
0C7H
0B8H
IP XX000000
0BFH
0B0H
P3 11111111
0B7H
0A8H
IE 0X000000
0AFH
0A0H
P2 11111111
98H
SCON 00000000
90H
P1 11111111
88H
TCON 00000000
TMOD 00000000
TL0 00000000
TL1 00000000
TH0 00000000
TH1 00000000
80H
P0 11111111
SP 00000111
DP0L 00000000
DP0H 00000000
DP1L 00000000
DP1H 00000000
AUXR1 XXXXXXX0
WDTRST XXXXXXXX
0A7H
SBUF XXXXXXXX
9FH 97H AUXR XXX00XX0
8FH PCON 0XXX0000
87H
AT89S51 2487A–10/01
AT89S51 User software should not write 1s to these unlisted locations, since they may be used in future products to invoke new features. In that case, the reset or inactive values of the new bits will always be 0. Interrupt Registers: The individual interrupt enable bits are in the IE register. Two priorities can be set for each of the five interrupt sources in the IP register. Table 2. AUXR: Auxiliary Register AUXR
Address = 8EH
Reset Value = XXX00XX0B
Not Bit Addressable
Bit
–
–
–
WDIDLE
DISRTO
–
–
DISALE
7
6
5
4
3
2
1
0
–
Reserved for future expansion
DISALE
Disable/Enable ALE DISALE Operating Mode
DISRTO
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
Disable/Enable Reset out DISRTO
WDIDLE
0
Reset pin is driven High after WDT times out
1
Reset pin is input only
Disable/Enable WDT in IDLE mode
WDIDLE 0
WDT continues to count in IDLE mode
1
WDT halts counting in IDLE mode
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 82H83H 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 the respective Data Pointer Register.
7 2487A–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 not affected by reset. Table 3. AUXR1: Auxiliary Register 1 AUXR1 Address = A2H Reset Value = XXXXXXX0B Not Bit Addressable
Bit
–
–
–
–
–
–
–
DPS
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
Memory Organization
MCS-51 devices have a separate address space for Program and Data Memory. Up to 64K bytes 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 through FFFH are directed to internal memory and fetches to addresses 1000H through FFFFH are directed to external memory.
Data Memory
The AT89S51 implements 128 bytes of on-chip RAM. The 128 bytes are accessible via direct and indirect addressing modes. Stack operations are examples of indirect addressing, so the 128 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 to software 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, a user 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 disable the WDT except through reset (either hardware reset or WDT overflow reset). When WDT 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 01EH and 0E1H to WDTRST to avoid a WDT overflow. The 14-bit counter overflows when it reaches 16383 (3FFFH), and this will reset the device. When the WDT is enabled, it will increment every machine cycle while the oscillator is running. This means the user must reset the WDT at least every 16383 machine cycles. To reset the WDT the user must write 01EH and 0E1H to 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 RESET pulse duration is 98xTOSC, where TOSC=1/FOSC. To make the best use of the WDT, it
8
AT89S51
2487A–10/01
AT89S51 should be serviced in those sections of code that will periodically be executed within the time required 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 Powerdown mode, the user does not need to service the WDT. There are two methods of exiting Power-down mode: by a hardware reset or via a level-activated external interrupt, which is enabled 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. Exiting Power-down with an interrupt is significantly different. The interrupt is held low long enough for the oscillator to stabilize. When the interrupt is brought high, the interrupt is serviced. To prevent the WDT from resetting the device while the interrupt pin is held low, the WDT is not started until the interrupt is pulled high. It is suggested that the WDT be reset during the interrupt 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 best to 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 whether the 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, and reenter IDLE mode. With WDIDLE bit enabled, the WDT will stop to count in IDLE mode and resumes the count upon exit from IDLE.
UART
The UART in the AT89S51 operates the same way as the UART in the AT89C51. For further information 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 the AT89C51. 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 Flash Microcontroller’, then ‘Product Overview’.
Interrupts
The AT89S51 has a total of five interrupt vectors: two external interrupts (INT0 and INT1), two timer interrupts (Timers 0 and 1), and the serial port interrupt. These interrupts are all shown in Figure 1. Each of these interrupt sources can be individually enabled or disabled by setting or clearing a bit in Special Function Register IE. IE also contains a global disable bit, EA, which disables all interrupts at once. Note that Table 4 shows that bit position IE.6 is unimplemented. In the AT89S51, bit position IE.5 is also unimplemented. User software should not write 1s to these bit positions, since they may 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 timers overflow. The values are then polled by the circuitry in the next cycle
9 2487A–10/01
.
Table 4. Interrupt Enable (IE) Register (MSB) EA
(LSB) –
–
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.
Figure 1. Interrupt Sources
0 INT0
IE0 1
TF0
0 INT1
IE1 1
TF1 TI RI
10
AT89S51 2487A–10/01
AT89S51 Oscillator Characteristics
XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier that can be configured for use as an on-chip oscillator, as shown in Figure 2. Either a quartz crystal or ceramic resonator may be used. To drive the device from an external clock source, XTAL2 should be left unconnected while XTAL1 is driven, as shown in Figure 3. There are no requirements on the duty cycle of the external clock signal, since the input to the internal clocking circuitry is through a divide-by-two flip-flop, but minimum and maximum voltage high and low time specifications must be observed. Figure 2. Oscillator Connections C2 XTAL2
C1 XTAL1
GND
Note:
C1, C2 = 30 pF ± 10 pF for Crystals = 40 pF ± 10 pF for Ceramic Resonators
Figure 3. External Clock Drive Configuration NC
XTAL2
EXTERNAL OSCILLATOR SIGNAL
XTAL1
GND
Idle Mode
In idle mode, the CPU puts itself to sleep while all the on-chip peripherals remain active. The mode is invoked by software. The content of the on-chip RAM and all the special function registers remain unchanged during this mode. The idle mode can be terminated by any enabled interrupt or by a hardware reset. Note that when idle mode is terminated by a hardware reset, the device normally resumes program execution from where it left off, up to two machine cycles before the internal reset algorithm takes control. On-chip hardware inhibits access to internal RAM in this event, but access to the port pins is not inhibited. To eliminate the possibility of an unexpected write to a port pin when idle mode is terminated by a reset, the instruction following the one that invokes idle 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 Powerdown is the last instruction executed. The on-chip RAM and Special Function Registers retain their values until the Power-down mode is terminated. Exit from Power-down mode can be initiated either by a hardware reset or by activation of an enabled external interrupt into INT0 or INT1. Reset redefines the SFRs but does not change the on-chip RAM. The reset should not be activated before VCC is restored to its normal operating level and must be held active long enough to allow the oscillator to restart and stabilize.
11 2487A–10/01
Table 5. Status of External Pins During Idle and Power-down Modes
Program Memory Lock Bits
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
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. 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
When lock bit 1 is programmed, the logic level at the EA pin is sampled and latched during reset. If the device is powered up without a reset, the latch initializes to a random value and holds that value until reset is activated. The latched value of EA must agree with the current logic 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. The programming interface needs a high-voltage (12-volt) program enable signal and is compatible 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 control signals should be set up according to the Flash programming mode table and Figures 13 and 14. 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 bytewrite 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 of the written data on P0.7. Once the write cycle has been completed, true data is valid on all outputs, and the next cycle may begin. Data Polling may begin any time after a write cycle has been initiated.
12
AT89S51 2487A–10/01
AT89S51 Ready/Busy: The progress of byte programming can also be monitored by the RDY/BSY output signal. P3.0 is pulled low after ALE goes high during programming to indicate BUSY. P3.0 is pulled high again when programming is done to indicate READY. Program Verify: If lock bits LB1 and LB2 have not been programmed, the programmed code data can be read back via the address and data lines for verification. The status of the individual 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 normal verification of locations 000H, 100H, and 200H, except that P3.6 and P3.7 must be pulled to a logic low. The values returned are as follows. (000H) = 1EH indicates manufactured by Atmel (100H) = 51H indicates 89S51 (200H) = 06H Chip Erase: In the parallel programming mode, a chip erase operation is initiated by using the proper 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 Erase instruction. 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 is pulled to VCC. The serial interface consists of pins SCK, MOSI (input) and MISO (output). After RST is set high, the Programming Enable instruction needs to be executed first before other operations can be executed. Before a reprogramming sequence can occur, a Chip Erase operation is required. The Chip Erase operation turns the content of every memory location in the Code array into FFH. Either an external system clock can be supplied at pin XTAL1 or a crystal needs to be connected across pins XTAL1 and XTAL2. The maximum serial clock (SCK) frequency should be less than 1/16 of the crystal frequency. With a 33 MHz oscillator clock, the maximum SCK frequency is 2 MHz.
Serial Programming Algorithm
To program and verify the AT89S51 in the serial programming mode, the following sequence is 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 MHz clock 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 content 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. 13
2487A–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, during a write cycle an attempted read of the last byte written will result in the complement of the MSB 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 8 on page 18.
Programming Interface – Parallel Mode
Every code byte in the Flash array can be programmed by using the appropriate combination of control signals. The write operation cycle is self-timed and once initiated, will automatically time 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.
Table 7. Flash Programming Modes
Mode
VCC
RST
PSEN
Write Code Data
5V
H
L
Read Code Data
5V
H
L
P2.3-0
P1.7-0
ALE/
EA/
PROG
VPP
P2.6
P2.7
P3.3
P3.6
P3.7
Data
12V
L
H
H
H
H
DIN
A11-8
A7-0
H
L
L
L
H
H
DOUT
A11-8
A7-0
12V
H
H
H
H
H
X
X
X
12V
H
H
H
L
L
X
X
X
12V
H
L
H
H
L
X
X
X
H
H
H
L
H
L
X
X
12V
H
L
H
L
L
X
X
X
P0.7-0
Address
(2)
H (3)
Write Lock Bit 1
5V
H
L
Write Lock Bit 2
5V
H
L
Write Lock Bit 3
5V
H
L
5V
H
L
Chip Erase
5V
H
L
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
(3)
(3)
Read Lock Bits 1, 2, 3
H
P0.2, P0.3, P0.4
(1)
Notes:
14
1. 2. 3. 4. 5.
Each PROG pulse is 200 ns - 500 ns for Chip Erase. Each PROG pulse is 200 ns - 500 ns for Write Code Data. Each PROG pulse is 200 ns - 500 ns for Write Lock Bits. RDY/BSY signal is output on P3.0 during programming. X = don’t care.
AT89S51 2487A–10/01
AT89S51 Figure 4. Programming the Flash Memory (Parallel Mode) VCC
AT89S51 A0 - A7
ADDR. 0000H/FFFH
A8 - A11
VCC
P1.0-P1.7 P2.0 - P2.3 P2.6 P2.7 P3.3 P3.6
SEE FLASH PROGRAMMING MODES TABLE
PGM DATA
P0
ALE
PROG
EA
VIH/VPP
P3.7 XTAL2
3-33 MHz P3.0
RDY/ BSY
RST
VIH
XTAL1 GND
PSEN
Figure 5. Verifying the Flash Memory (Parallel Mode) VCC
AT89S51 A0 - A7
ADDR. 0000H/FFFH
A8 - A11
SEE FLASH PROGRAMMING MODES TABLE
P1.0-P1.7
VCC
P2.0 - P2.3
P0
P2.6 P2.7 P3.3 P3.6 P3.7
PGM DATA (USE 10K PULLUPS)
ALE VIH
XTAL 2
EA
XTAL1
RST
3-33 MHz
GND
VIH
PSEN
15 2487A–10/01
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
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
tAVQV
Address to Data Valid
48tCLCL
tELQV
ENABLE Low to Data Valid
48tCLCL
tEHQZ
Data Float After ENABLE
tGHBL
PROG High to BUSY Low
1.0
µs
tWC
Byte Write Cycle Time
50
µs
3
1
0
µs
48tCLCL
Figure 6. Flash Programming and Verification Waveforms – Parallel Mode PROGRAMMING ADDRESS
P1.0 - P1.7 P2.0 - P2.3
VERIFICATION ADDRESS
tAVQV PORT 0
DATA IN
tAVGL
tDVGL
tGHDX
DATA OUT
tGHAX
ALE/PROG
tSHGL
tGLGH VPP
tGHSL LOGIC 1 LOGIC 0
EA/VPP
tEHSH
tEHQZ
tELQV
P2.7 (ENABLE)
tGHBL P3.0 (RDY/BSY)
BUSY
READY
tWC
16
AT89S51 2487A–10/01
AT89S51 Figure 7. Flash Memory Serial Downloading VCC
AT89S51 VCC
INSTRUCTION INPUT
P1.5/MOSI
DATA OUTPUT
P1.6/MISO P1.7/SCK
CLOCK IN
XTAL2
3-33 MHz
XTAL1
VIH
RST
GND
Flash Programming and Verification Waveforms – Serial Mode Figure 8. Serial Programming Waveforms
7
6
5
4
3
2
1
0
17 2487A–10/01
Table 8. Serial Programming Instruction Set Instruction Format Byte 4
Operation
Programming Enable
1010 1100
0101 0011
xxxx xxxx
xxxx xxxx 0110 1001 (Output)
Enable Serial Programming while RST is high
Chip Erase
1010 1100
100x xxxx
xxxx xxxx
xxxx xxxx
Chip Erase Flash memory array
Read Program Memory (Byte Mode)
0010 0000
xxxx
Write Program Memory (Byte Mode)
0100 0000
xxxx
Write Lock Bits(2)
1010 1100
1110 00
Read Lock Bits
0010 0100
xxxx xxxx
Read Signature Bytes(1)
0010 1000
xxx
Read Program Memory (Page Mode)
0011 0000
xxxx
Write Program Memory (Page Mode)
0101 0000
xxxx
Notes:
A7 A6 A5 A4 A3 A2 A1 A0
A11 A10 A9 A8
Read data from Program memory in the byte mode Write data to Program memory in the byte mode
xxxx xxxx
Write Lock bits. See Note (2).
xxxx xxxx
xx
Read back current status of the lock bits (a programmed lock bit reads back as a “1”)
LB2 LB1
xx
Byte 0
Byte 1... Byte 255
Read data from Program memory in the Page Mode (256 bytes)
Byte 0
Byte 1... Byte 255
Write data to Program memory in the Page Mode (256 bytes)
A0
Read Signature Byte
A5 A4 A3 A2 A1
Signature Byte
A11 A10 A9 A8
xxx xxxx
LB3
xxxx xxxx
A11 A10 A9 A8
B1 B2
D7 D6 D5 D4 D3 D2 D1 D0
Byte 3
D7 D6 D5 D4 D3 D2 D1 D0
Byte 2
A7 A6 A5 A4 A3 A2 A1 A0
Byte 1
A11 A10 A9 A8
Instruction
1. The signature bytes are not readable in Lock Bit Modes 3 and 4. 2. B1 = 0, B2 = 0 →Mode 1, no lock protection Each of the lock bits needs to be activated sequentially before B1 = 0, B2 = 1 →Mode 2, lock bit 1 activated Mode 4 can be executed. B1 = 1, B2 = 0 →Mode 3, lock bit 2 activated B1 = 1, B1 = 1 →Mode 4, lock bit 3 activated
}
After Reset signal is high, SCK should be low for at least 64 system clocks before it goes high to clock in the enable data bytes. 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 are latched, each byte thereafter is treated as data until all 256 bytes are shifted in/out. Then the next instruction will be ready to be decoded.
18
AT89S51 2487A–10/01
AT89S51 Serial Programming Characteristics Figure 9. Serial Programming Timing
MOSI tOVSH SCK
tSHOX
tSLSH
tSHSL
MISO tSLIV
Table 9. Serial Programming Characteristics, TA = -40° C to 85° C, VCC = 4.0 - 5.5V (Unless Otherwise Noted) Symbol
Parameter
Min
1/tCLCL
Oscillator Frequency
0
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
tERASE
Chip Erase Instruction Cycle Time
tSWC
Serial Byte Write Cycle Time
10
Typ
16
Max
Units
33
MHz
32
ns
500
ms
64 tCLCL + 400
µs
19 2487A–10/01
Absolute Maximum Ratings* Operating Temperature.................................. -55°C to +125°C
*NOTICE:
Storage Temperature ..................................... -65°C to +150°C Voltage on Any Pin with Respect to Ground .....................................-1.0V to +7.0V Maximum Operating Voltage ............................................ 6.6V
Stresses beyond those listed under “Absolute Maximum Ratings” may cause permanent damage 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.
DC Output Current...................................................... 15.0 mA
DC Characteristics The 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
VIL
Input Low Voltage
(Except EA)
VIL1
Input Low Voltage (EA)
VIH
Input High Voltage
(Except XTAL1, RST)
VIH1
Input High Voltage
(XTAL1, RST)
VOL
Output Low Voltage(1) (Ports 1,2,3)
Min
Output Low Voltage (Port 0, ALE, PSEN)
-0.5
0.2 VCC-0.1
V
0.2 VCC-0.3
V
0.2 VCC+0.9
VCC+0.5
V
0.7 VCC
VCC+0.5
V
0.45
V
0.45
V
IOL = 1.6 mA IOL = 3.2 mA IOH = -60 µA, VCC = 5V ± 10%
VOH
Output High Voltage (Ports 1,2,3, ALE, PSEN)
2.4
V
IOH = -25 µA
0.75 VCC
V
IOH = -10 µA
0.9 VCC
V
2.4
V
IOH = -300 µA
0.75 VCC
V
IOH = -80 µA
0.9 VCC
V
IOH = -800 µA, VCC = 5V ± 10% VOH1
Output High Voltage (Port 0 in External Bus Mode)
IIL
Logical 0 Input Current (Ports 1,2,3)
VIN = 0.45V
ITL
Logical 1 to 0 Transition Current (Ports 1,2,3)
VIN = 2V, VCC = 5V ± 10%
ILI
Input Leakage Current (Port 0, EA)
0.45 < VIN < VCC
RRST
Reset Pulldown Resistor
CIO
Pin Capacitance
Power Supply Current ICC Notes:
20
Power-down Mode
(2)
Units
-0.5
(1)
VOL1
Max
-50
µA
-650
µA
±10
µA
300
KΩ
Test Freq. = 1 MHz, TA = 25°C
10
pF
Active Mode, 12 MHz
25
mA
Idle Mode, 12 MHz
6.5
mA
VCC = 5.5V
50
µA
50
1. Under steady state (non-transient) conditions, IOL must be externally limited as follows: Maximum IOL per port pin: 10 mA Maximum IOL per 8-bit port: Port 0: 26 mA Ports 1, 2, 3: 15 mA Maximum total IOL for all output pins: 71 mA If IOL exceeds the test condition, VOL may exceed the related specification. Pins are not guaranteed to sink current greater than the listed test conditions. 2. Minimum VCC for Power-down is 2V.
AT89S51 2487A–10/01
AT89S51 AC Characteristics Under operating conditions, load capacitance for Port 0, ALE/PROG, and PSEN = 100 pF; load capacitance for all other outputs = 80 pF.
External Program and Data Memory Characteristics 12 MHz Oscillator
Variable Oscillator
Min
Min
Max
Units
0
33
MHz
Symbol
Parameter
Max
1/tCLCL
Oscillator Frequency
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
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
tPXIX
Input Instruction Hold After PSEN
tPXIZ
Input Instruction Float After PSEN
tPXAV
PSEN to Address Valid
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
tRHDX
Data Hold After RD
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
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
tWHLH
RD or WR High to ALE High
233
4tCLCL-65
145 0
3tCLCL-60 0
59 75
tCLCL-8
0
5tCLCL-90
3tCLCL-50
0 43
123
tCLCL-25
ns ns
0
300
ns ns
tCLCL-25
252
ns
ns ns
0
ns
tCLCL+25
ns
21 2487A–10/01
External Program Memory Read Cycle tLHLL ALE tAVLL
tLLIV
tLLPL
tPLIV
PSEN
tPXAV
tPLAZ
tPXIZ
tLLAX
tPXIX
A0 - A7
PORT 0
tPLPH
INSTR IN
A0 - A7
tAVIV A8 - A15
PORT 2
A8 - A15
External Data Memory Read Cycle tLHLL ALE tWHLH PSEN
tLLDV
tRLRH
tLLWL RD
tLLAX tAVLL
PORT 0
tRLDV
tRLAZ
A0 - A7 FROM RI OR DPL
tRHDZ tRHDX
DATA IN
A0 - A7 FROM PCL
INSTR IN
tAVWL tAVDV PORT 2
22
P2.0 - P2.7 OR A8 - A15 FROM DPH
A8 - A15 FROM PCH
AT89S51 2487A–10/01
AT89S51 External Data Memory Write Cycle tLHLL ALE tWHLH PSEN tLLWL WR tAVLL
tLLAX tQVWX
A0 - A7 FROM RI OR DPL
PORT 0
tWLWH
tQVWH DATA OUT
tWHQX A0 - A7 FROM PCL
INSTR IN
tAVWL PORT 2
P2.0 - P2.7 OR A8 - A15 FROM DPH
A8 - A15 FROM PCH
External Clock Drive Waveforms tCHCX VCC - 0.5V
tCHCX tCLCH
tCHCL
0.7 VCC 0.2 VCC - 0.1V 0.45V
tCLCX tCLCL
External Clock Drive Symbol
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
23 2487A–10/01
Serial Port Timing: Shift Register Mode Test Conditions The values in this table are valid for VCC = 4.0V to 5.5V and Load Capacitance = 80 pF. 12 MHz Osc
Variable Oscillator
Symbol
Parameter
Min
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
Units
ns
Shift Register Mode Timing Waveforms INSTRUCTION ALE
0
1
2
3
4
5
6
7
8
tXLXL CLOCK
tQVXH
tXHQX
WRITE TO SBUF
0
1
2
tXHDV
OUTPUT DATA CLEAR RI
3
4
5
6
tXHDX
VALID
VALID
VALID
7 SET TI
VALID
VALID
VALID
VALID
VALID
SET RI
INPUT DATA
AC Testing Input/Output Waveforms(1) VCC - 0.5V
0.2 VCC + 0.9V TEST POINTS 0.2 VCC - 0.1V
0.45V
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 VIH min. for a logic 1 and VIL max. for a logic 0.
Float Waveforms(1) V LOAD+
0.1V
V LOAD -
24
0.1V
V OL +
0.1V
Timing Reference Points
V LOAD
Note:
V OL -
0.1V
1. For timing purposes, a port pin is no longer floating when a 100 mV change from load voltage occurs. A port pin begins to float when a 100 mV change from the loaded VOH/VOL level occurs.
AT89S51 2487A–10/01
AT89S51 Ordering Information Speed (MHz)
Power Supply
24
4.0V to 5.5V
33
4.5V to 5.5V
Ordering Code
Package
Operation Range
AT89S51-24AC AT89S51-24JC AT89S51-24PC
44A 44J 40P6
Commercial (0° C to 70° C)
AT89S51-24AI AT89S51-24JI AT89S51-24PI
44A 44J 40P6
Industrial (-40° C to 85° C)
AT89S51-33AC AT89S51-33JC AT89S51-33PC
44A 44J 40P6
Commercial (0° C to 70° C)
= Preliminary Availability
Package Type 44A
44-lead, Thin Plastic Gull Wing Quad Flatpack (TQFP)
44J
44-lead, Plastic J-leaded Chip Carrier (PLCC)
40P6
40-pin, 0.600" Wide, Plastic Dual Inline Package (PDIP)
25 2487A–10/01
Packaging Information 44A, 44-lead, Thin (1.0 mm) Plastic Gull Wing Quad Flat Package (TQFP) Dimensions in Millimeters and (Inches)*
44J, 44-lead, Plastic J-leaded Chip Carrier (PLCC) Dimensions in Inches and (Millimeters)
.045(1.14) X 45° 12.21(0.478) SQ 11.75(0.458)
PIN 1 ID
0.45(0.018) 0.30(0.012)
0.80(0.031) BSC
PIN NO. 1 IDENTIFY
.045(1.14) X 30° - 45°
.032(.813) .026(.660)
.695(17.7) SQ .685(17.4)
.500(12.7) REF SQ
.021(.533) .013(.330)
.043(1.09) .020(.508) .120(3.05) .090(2.29) .180(4.57) .165(4.19)
1.20(0.047) MAX
0 7
0.20(.008) 0.09(.003)
.630(16.0) .590(15.0)
.656(16.7) SQ .650(16.5)
.050(1.27) TYP
10.10(0.394) SQ 9.90(0.386)
.012(.305) .008(.203)
.022(.559) X 45° MAX (3X)
0.75(0.030) 0.45(0.018)
0.15(0.006) 0.05(0.002)
*Controlling dimension: millimeters 40P6, 40-pin, 0.600" Wide, Plastic Dual Inline Package (PDIP) Dimensions in Inches and (Millimeters) JEDEC STANDARD MS-011 AC
2.07(52.6) 2.04(51.8)
PIN 1
.566(14.4) .530(13.5)
.090(2.29) MAX
1.900(48.26) REF .220(5.59) MAX
.005(.127) MIN
SEATING PLANE
.065(1.65) .015(.381) .022(.559) .014(.356)
.161(4.09) .125(3.18) .110(2.79) .090(2.29)
.012(.305) .008(.203)
26
.065(1.65) .041(1.04) .630(16.0) .590(15.0) 0 REF 15 .690(17.5) .610(15.5)
AT89S51 2487A–10/01
Atmel Headquarters
Atmel Product Operations
Corporate Headquarters
Atmel Colorado Springs
2325 Orchard Parkway San Jose, CA 95131 TEL (408) 441-0311 FAX (408) 487-2600
Europe Atmel SarL Route des Arsenaux 41 Casa Postale 80 CH-1705 Fribourg Switzerland TEL (41) 26-426-5555 FAX (41) 26-426-5500
Asia Atmel Asia, Ltd. Room 1219 Chinachem Golden Plaza 77 Mody Road Tsimhatsui East Kowloon Hong Kong TEL (852) 2721-9778 FAX (852) 2722-1369
Japan Atmel Japan K.K. 9F, Tonetsu Shinkawa Bldg. 1-24-8 Shinkawa Chuo-ku, Tokyo 104-0033 Japan TEL (81) 3-3523-3551 FAX (81) 3-3523-7581
1150 E. Cheyenne Mtn. Blvd. Colorado Springs, CO 80906 TEL (719) 576-3300 FAX (719) 540-1759
Atmel Grenoble Avenue de Rochepleine BP 123 38521 Saint-Egreve Cedex, France TEL (33) 4-7658-3000 FAX (33) 4-7658-3480
Atmel Heilbronn Theresienstrasse 2 POB 3535 D-74025 Heilbronn, Germany TEL (49) 71 31 67 25 94 FAX (49) 71 31 67 24 23
Atmel Nantes La Chantrerie BP 70602 44306 Nantes Cedex 3, France TEL (33) 0 2 40 18 18 18 FAX (33) 0 2 40 18 19 60
Atmel Rousset Zone Industrielle 13106 Rousset Cedex, France TEL (33) 4-4253-6000 FAX (33) 4-4253-6001
Atmel Smart Card ICs Scottish Enterprise Technology Park East Kilbride, Scotland G75 0QR TEL (44) 1355-357-000 FAX (44) 1355-242-743
e-mail
[email protected]
Web Site http://www.atmel.com
© Atmel Corporation 2001. Atmel Corporation makes no warranty for the use of its products, other than those expressly contained in the Company’s standard warranty which is detailed in Atmel’s Terms and Conditions located on the Company’s web site. The Company assumes no responsibility for any errors which may appear in this document, reserves the right to change devices or specifications detailed herein at any time without notice, and does not make any commitment to update the information contained herein. No licenses to patents or other intellectual property of Atmel are granted by the Company in connection with the sale of Atmel products, expressly or by implication. Atmel’s products are not authorized for use as critical components in life support devices or systems. ATMEL ® is the registered trademark of Atmel. MCS-51 ® is the registered trademark of Intel Corporation. Terms and product names in this document may be trademarks of others. Printed on recycled paper. 2487A–10/01/xM