PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer...

223
i PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC TUGAS AKHIR Diajukan untuk memenuhi salah satu syarat memperoleh gelar Sarjana Teknik pada Program Studi Teknik Elektro Fakultas Sains dan Teknologi Universitas Sanata Dharma Disusun oleh : TOMY KUSWARDHANI NIM : 045114061 PROGRAM STUDI TEKNIK ELEKTRO FAKULTAS SAINS DAN TEKNOLOGI UNIVERSITAS SANATA DHARMA YOGYAKARTA 2009

Transcript of PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer...

Page 1: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

i

PENAMPIL BIAYA LISTRIK BERBASIS VISUAL

BASIC

TUGAS AKHIR

Diajukan untuk memenuhi salah satu syarat memperoleh gelar

Sarjana Teknik pada Program Studi Teknik Elektro

Fakultas Sains dan Teknologi Universitas Sanata Dharma

Disusun oleh :

TOMY KUSWARDHANI

NIM : 045114061

PROGRAM STUDI TEKNIK ELEKTRO

FAKULTAS SAINS DAN TEKNOLOGI

UNIVERSITAS SANATA DHARMA

YOGYAKARTA

2009

Page 2: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

ii

ELECTRICITY COST VIEWER VISUAL BASICBASED

FINAL PROJECT

Presented as one of the requirement to obtain

Sarjana Teknik Degree in Electrical Engineering

Science and Technology Faculty Sanata Dharma University

By :

TOMY KUSWARDHANI

Student Number : 045114061

ELECTRICAL ENGINEERING STUDY PROGRAM

SCIENCE AND TECHNOLOGY FACULTY

SANATA DHARMA UNIVERSITY

YOGYAKARTA

2009

Page 3: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will
Page 4: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will
Page 5: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will
Page 6: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

vi

HALAMAN PERSEMBAHAN DAN MOTTO HIDUP

KARYA INI KUPERSEMBAHKAN KEPADA

ALLAH SWT

AYAH DAN IBUKU

SAUDARA-SAUDARIKU

SEMUA PIHAK YANG TELAH MEMBANTU TERCIPTANYA KARYA INI

MOTTO :

Dan persembahkanlah yang terindah bagi sahabatmu.

Jika dia harus tahu musim surutmu, biarlah dia mengenal pula

musim pasangmu.

Gerangan apa sahabat itu hingga kau senantiasa mencarinya,

untuk sekadar bersama dalam membunuh waktu?

Carilah ia untuk bersama menghidupkan sang waktu!

Karena dialah yang bisa mengisi kekuranganmu, bukan mengisi

kekosonganmu.

Dan dalam manisnya persahabatan, biarkanlah ada tawa ria

berbagi kebahagiaan.

Karena dalam titik-titik kecil embun pagi, hati manusia menemukan

fajar jati dan gairah segar kehidupan.

(Sang Nabi, Khalil Gibran)

Page 7: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

vii

INTISARI

Meteran listrik atau KWH Meter sangat umum dijumpai pada setiap rumahpelanggan listrik. Fungsi dari alat ini adalah menghitung seberapa besar pemakaianenergi listrik suatu bangunan kantor, rumah, maupun pabrik. Nilai pemakaian energilistrik yang dihitung dalam satuan KWH (Kilo Watt Hour) setiap bulannya akandikalikan dengan harga satuan Tarif Dasar Listrik (TDL) dan ditambahkan dengan nilaiabonemen serta pajak sebesar 8 persen akan menghasilkan tagihan yang kita terima setiapbulannya. Menyadari akan sulitnya melakukan perhitungan – perhitungan tagihan listrik,maka dengan alat ini memberikan kemudahan untuk melakukan kalkulasi pembayaranlistrik. Alat ini memberikan nilai setiap putaran piringan KWH Meter, sehingga denganmudah kita dapat mengetahui seberapa besar biaya pemakaian listrik kita setiap saat kitaingin melihatnya.

Proses pembacaan putaran KWH Meter dimulai dari pembacaan putaran piringanKWh Meter oleh sensor optokopler. Jumlah pulsa yang dibaca sensor akan disimpan olehmikrokontroler setiap harinya. Untuk melihat besarnya pemakaian listrik, makamikrokontroler harus dihubungkan dengan PC, pada PC, menggunakan software VisualBasic untuk melakukan kalkulasi perhitungan tagihan. Perhitungan tagihan listrik yangdilakukan dapat disesuaikan dengan golongan pemakainya, sehingga alat ini dapatdigunakan untuk semua golongan pemakai.

Dalam implementasi tugas akhir ini, mikrokontroler sudah dapat menyimpan danmengirimkan data dengan baik. Data yang dikirimkan oleh mikrokontroler telah dapatditampilkan dengan baik pada PC menggunakan kabel serial. Untuk program VisualBasic dapat melakukan kalkulasi perhitungan dengan baik, dengan dilakukannyaperbandingan kalkulasi manual.

Kata Kunci : KWH Meter ,KWH Meter Berbasis Visual Basic , mikrokontroler Atmega16

Page 8: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

viii

ABSTRACT

KWH meter we can see it generally today in every house. Main function of thisgage is to calculate how much electricity being used at office building, household andfactory. The calculation value of electricity being used monthly in 1 unit of KWH (KiloWatt Hour) will be multiply with TDL price and added with subscription cost and 8percen, so the result is customer invoice. Using this device to calculate troublesomeelecticity calculation, It will make easier to know the monthly of our electricity invoice.This device will give a marks on every cycle of KWH gage, this marks will makes usknow how much electricities being used if we want to see it.

The reading process of KWH gage cycle start from KWH gage cycle reading byoptocoupler sensor. Number of pulse reading by the sensor will be saved dailly bymicrocontroller. Microcontroller needs to be fused to the pc regarding to know how muchelectricities being used using visual basic software to calculate the invoice. Theelectricity calculation can be adjust to the group of customers, in order to be able usedfor any group of customers.

At facts on this final assigment, the microcontroller had already run well onsending the data and saving it. The sending data which is sent by microcontroller able tobe view on PC using serial cable. As the accuracy of calculation, manual calculation isstill needed for comparison.

Keyword : KWH meter ,KWH meter Visual Basic Based , microcontroller Atmega 16

Page 9: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will
Page 10: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

x

KATA PENGANTAR

Puji syukur kepada Tuhan atas segala karunia-Nya sehingga penulis dapat

menyelesaikan penulisan karya tugas akhir ini. Tugas akhir berjudul : “Penampil

Pemakaian Biaya Listrik Berbasis Visual Basic”.

Tugas akhir ini ditulis untuk memenuhi salah satu syarat dalam memperoleh

gelar sarjana teknik pada program studi Teknik Elektro Universitas Sanata Dharma.

Penulisan skripsi ini didasarkan pada hasil-hasil yang penulis peroleh pada saat

perancangan alat, pembuatan alat, sampai pada hasil pengujian pengujian alat.

Penulis ingin mengucapkan terima kasih kepada beberapa pihak yang telah

memberikan banyak bimbingan, bantuan, dan arahan sehingga laporan ini dapat

diselesaikan, diantaranya :

1. Allah SWT, pelindung dan penuntun hidupku

2. Ibu Wiwien Widyastuti, S.T., M.T. selaku dosen pembimbing skripsi yang telah

memberikan masukan, arahan, serta bimbingan selama pengerjaan rugas akhir ini.

3. Bapak Ir. Tjendro selaku dosen Jurusan Teknik Elektro yang telah membantu

dalam memberikan arahan serta masukan dalam pengerjaan proyek ini dan telah

memberikan bimbingan sehingga penulis dapat menyelesaikan proyek ini dengan

baik.

4. Bapak Martanto, S.T., M.T. selaku dosen Jurusan Teknik Elektro yang telah

membantu dalam memberikan arahan serta masukan dalam pengerjaan proyek ini

dan telah memberikan bimbingan sehingga penulis dapat menyelesaikan proyek

ini dengan baik.

5. Bapak dan Ibu dosen Jurusan Teknik Elektro yang telah mendidik dan

mengajarkan banyak hal yang berguna untuk masa depan penulis.

6. Seluruh staf sekretariat yang telah membantu penulis dalam mengurus semua

masalah administrasi selama perkuliahan di Universitas Sanata Dharma ini.

7. Para laboran prodi TE Universitas Sanata Dharma

Page 11: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will
Page 12: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

xii

DAFTAR ISI

Halaman Judul (Indonesia)………………………………………….………..………. i

Halaman Judul (Inggris)………………………………………………………………. ii

Lembar Pengesahan oleh Pembimbing………………………………..……..………... iii

Lembar Pengesahan oleh Penguji……………………………….………..…………… iv

Lembar Pernyataan Keaslian Karya……………………………………..……………. v

Halaman Persembahan dan Motto Hidup..…………………………………………….. vi

Intisari………………………………..…………………………………….…………... vii

Abstract………………………………………………………….………..…………… viii

Lembar Pernyataan Persetujuan Publikasi Karya Ilmiah …………………..…………. viii

Kata Pengantar…………………….……………………………………..……………. x

Daftar Isi……………………………….....………………………..………………….. xii

Daftar Gambar……………………………………………………..………………….. xv

Daftar Tabel………………………………………………………..………………….. xvii

Bab I Pendahuluan ……………………………………………...…………… 1

1.1. Judul ………………………………………………...…….……… 1

1.2. Latar Belakang Masalah….………………………….…………… 1

1.3. Tujuan dan Manfaat………………………………...…………….. 2

1.4. Batasan Masalah …….…………………….……..………………. 2

1.5. Metodologi Penelitian.………………………….…….………….. 3

Bab II Dasar Teori…………………………………..………………..……..… 5

2.1. KWH Meter………………………………………………….……. 5

2.1.1. Fungsi dan Prinsip Kerja KWH Meter…………..………… 5

2.2. Perhitungan Biaya Pemakaian Listrik..…………………..………. 7

2.3. Sensor Optokopler……….…………………………….…...…….. 10

2.4. Inverter Schmitt Trigger 74LS14……………………………...….. 12

2.5.Mikrokontroler Atmega 16……………………………………..…. 13

2.5.1. Susunan Kaki Standart Mikrokontroler AVR Atmega 16…. 14

2.5.2. Konsep I/O pada Mikrokontroler AVR Atmega 16…...…… 16

Page 13: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

xiii

2.5.3. Konsep Komunikasi Serial…………………………...…….. 17

2.6. RTC (Real Time Clock)………………………………………...… 18

2.7. LCD (Liquid Crystal Display)………………………………..…... 19

2.7.1. Register……………………………………………………... 20

2.7.2. BF (Busy Flag)………………………………………...…… 21

2.7.3. AC (Address Counter)……………………………………… 21

2.7.4. DDRAM (Display Data RAM)…………………………….. 21

2.7.5. CGROM (Character Generator ROM)…………………...… 21

2.7.6. CGRAM (Character Generator RAM)………………...…… 22

2.7.7. Deskripsi LCD…………………………………………..…. 22

2.7.8. Pin LCD……………………………………………….…… 23

2.8. Komunikasi Serial………………………………………….…….. 23

2.9. Port Serial………………………………………………………… 25

2.10. RS232…………………………………………………………… 26

2.11. Pemrograman Visual Basic……………………………………… 28

2.11.1. Tampilan Awal Pada Visual Basic………………………... 28

2.11.2. Toolbar……………………………………………………. 29

2.11.3. Form Window…………………………………………….. 29

2.11.4. Toolbox…………………………………………………… 30

2.11.5. Project Explorer…………………………………………… 30

2.11.6. Properties Window……………………………………...… 31

2.11.7. Form Layout Windows……………………………..…….. 32

2.11.8. Code Window……………………………………...……… 32

2.11.9. Komunikasi Serial Pada Visual Basic……………..……… 33

Bab III Perancangan Alat……………………………………………..………. 35

3.1. Blok Diagram Rangkaian………………………………...………. 35

3.2. Realisasi Rangkaian………………………………………………. 35

3.3. Rangkaian Sensor…………………………………………………. 36

3.4. Rangkaian Schmitt Trigger………………………………..……… 38

3.5. Rangkain Mikrokontroler AVR Seri Atmega 16…………..…….. 39

Page 14: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

xiv

3.6. Rangkaian RS232 ke Komputer…………………………….……. 45

3.7. Pemrograman Visual Basic………………………………...…….. 48

Bab IV Hasil dan Pembahasan……………. ………………...……...…..…….. 34

4.1. Pengamatan Pada Rangkaian Sensor…………………………….. 56

4.2. Pengamatan Pada Tampilan LCD………………………………… 57

4.3. Pengamatan Pada Visual Basic…………………………………… 58

4.4. Analisa……………………………………………………………. 60

Bab V Kesimpulan dan Saran…………………………………….…………... 72

5.1. Kesimpulan ……………………………………...……………….. 72

5.2. Saran ……………………………………………………………… 72

Daftar Pustaka ………………………………………………….…………………..… 73

Lampiran ……………………………………………………….…………………..…. 74

Page 15: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

xv

DAFTAR GAMBAR

Gambar 2.1. Medan Magnet Pada KWH Meter……………………………………. 5

Gambar 2.2. Model Fisik KWH Meter……………………………………………… 6

Gambar 2.3. Skema Hubungan Kumparan pada KWH Meter…………………….. 7

Gambar 2.4. Sensor Optokopler…………………………………………………….. 11

Gambar 2.5. Diagram Blok IC 74LS14……………………………………………... 12

Gambar 2.6. Mikrokontroler Atmega 16………………………………………...…. 15

Gambar 2.7. Arsitektur Unit Pemrosesan AVR…………………………...……….. 16

Gambar 2.8. Konfigurasi Pin RTC DS1307…………………………….………….. 19

Gambar 2.9. Pengaksesan RTC Serial………………………………………………. 19

Gambar 2.10. Dimensi Layar LCD…………………………………………………. 20

Gambar 2.11. Blok Diagram USART………………………………………………. 24

Gambar 2.12. Sebuah Frame Pada Komunikasi Serial…………………………….. 25

Gambar 2.13. Konfigurasi Port Serial DB9………………………………………… 25

Gambar 2.14. Pengiriman huruf ‘A’ pada level tegangan RS 232 dalam format

ASCII tanpa bit paritas………………...………………………... 27

Gambar 2.15 Visual Basic IDE (Integrated Development Environment)………… 28

Gambar 2.16. Toolbar Standart Visual Basic………………………………………. 29

Gambar 2.17. Jendela Form…………………………………………………………. 29

Gambar 2.18. Toolbox control…………………………………………………..….. 30

Gambar 2.19. Windows Project Explorer…………………………………………… 31

Gambar 2.20. Window Properties…………………………………………………… 31

Gambar 2.21. Form Layout…………………………………………………………. 32

Gambar 2.22. Code Window………………………………………………………… 33

Gambar 3.1. Blok Diagram Rangkaian……………………………………………… 35

Gambar 3.2. Perancangan Posisi Sensor Pada Piringan KWH Meter……………… 36

Gambar 3.3. Perancangan Rangkaian Sensor Optokopler…………………………. 37

Page 16: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

xvi

Gambar 3.4. Sinyal Masukan IC 74LS14…………………………………………… 39

Gambar 3.5. Sinyal Keluaran IC 74LS14…………………………………………… 39

Gambar 3.6. Perancangan Rangkaian Mikrokontroler Atmega 16………………… 40

Gambar 3.7. Diagram Alir Pemrograman Mikrokontroler Atmega 16…………….. 44

Gambar 3.8. Tampilan Program Pemakaian Biaya Listrik…………………………. 48

Gambar 3.9. Diagram Alir Utama Program Visual Basic………………………….. 49

Gambar 3.10. Diagram Alir Perhitungan Biaya Listrik Pergolongan……………… 50

Gambar 3.11. Diagram Alir Perhitungan Biaya Listrik Golongan Sosial………….. 51

Gambar 3.12. Diagram Alir Perhitungan Biaya Listrik Golongan Rumah Tangga.. 53

Gambar 3.13. Diagram Alir Perhitungan Biaya Listrik Golongan Bisnis…………. 54

Gambar 3.14. Diagram Alir Perhitungan Biaya Listrik Golongan Industri……….. 54

Gambar 3.15. Diagram Alir Perhitungan Biaya Listrik Golongan Pemerintah……. 55

Gambar 4.1. Tampilan LCD………………………………………………………….. 57

Gambar 4.2. Tampilan Program Visual Basic……………………………………….. 58

Gambar 4.3. Penyimpanan data selama 2 bulan……………………………………… 59

Gambar 4.4. Pergeseran data pada bulan selanjutnya………………………………... 60

Gambar 4.5. Tampilan program Visual Basic bulan pertama……………………….. 64

Gambar 4.5. Tampilan program Visual Basic bulan kedua………………………….. 66

Page 17: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

xvii

DAFTAR TABEL

Tabel 2.1. Perhitungan Insentif dan Disinsentif…………………………………… 8

Tabel 2.2. Penggolongan Daya Listrik dan tarif Listrik……………………………. 8

Tabel 2.3. Tarif Dasar Listrik……………………………………………………….. 9

Tabel 2.4. Tabel Kebenaran IC 74LS14…………………………………………….. 13

Tabel 2.5. Konfigurasi Pin LCD……………………………………………………… 23

Tabel 4.1. Hasil Pengamatan Pada Rangkaian Sensor……………………………… 56

Tabel 4.2. Hasil Percobaan Pertama…………………………………………………. 61

Tabel 4.3. Data hasil perhitungan secara manual dan program pada golongan

Sosial…………………………………………………………………….. 67

Tabel 4.4. Data hasil perhitungan secara manual dan program pada golongan

Rumah Tangga………………………………………………………….. 67

Tabel 4.5. Data hasil perhitungan secara manual dan program pada golongan

Bisnis…………………………………………………………………….. 67

Tabel 4.6. Data hasil perhitungan secara manual dan program pada golongan

Industri………………………………………………………………….. 67

Tabel 4.7. Data hasil perhitungan secara manual dan program pada golongan

Pemerintah……………………………………………………………… 67

Tabel 4.8. Pengamatan Hasil Simulasi Golongan Sosial…………………………… 74

Tabel 4.9. Pengamatan Hasil Simulasi Golongan Rumah Tangga………………… 74

Tabel 4.10. Pengamatan Hasil Simulasi Golongan Bisnis…………………………… 74

Tabel 4.11. Pengamatan Hasil Simulasi Golongan Industri…………………………. 74

Tabel 4.12. Pengamatan Hasil Simulasi Golongan Pemerintah…………………….. 74

Page 18: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

1

BAB IPENDAHULUAN

1.1. Judul

Penampil Biaya Listrik Berbasis Visual Basic

1.2. Latar Belakang Masalah

Satuan yang digunakan untuk mengukur energi listrik adalah kilowatthour

(KWH). Untuk menghitung energi yang digunakan dalam kilowatthour, maka di kalikan

daya dengan kilowatt (KW) dengan waktu dalam jam (hour). Kilowatthour digunakan

untuk mengukur jumlah pemakaian energi listrik yang kemudian digunakan untuk

menentukan harga listrik.

KWH meter digunakan untuk menghitung pemakaian energi listrik. Dengan

perkembangan, maka KWH meter berkembang menjadi suatu alat ukur otomatis yang

bisa mengirimkan hasil pengukurannya kepada perusahaan listrik yang bersangkutan.

Perkembangan KWH meter ini didukung karena adanya perkembangan pada dunia

teknologi informasi khususnya internet, sehingga sekarang ini pengiriman data dapat

dengan mudah terlaksana dan proses pengirimannya pun cepat.

Perusahaan penyedia tenaga listrik di Indonesia masih belum bisa menyediakan

meteran otomatis sehingga meteran listrik konvensional masih dipakai di rumah – rumah

pelanggan listrik. Masalah yang sering terjadi ialah masalah kekeliruan pencatatan karena

letak KWH meter yang sulit dilihat oleh mata sehingga tagihan menjadi tidak akurat.

Oleh karena itu pada kesempatan penyusunan Tugas Akhir ini penulis mencoba

memodifikasi KWH meter konvensional agar pelanggan lebih mudah untuk mengetahui

besar pemakaian energi listrik.

Page 19: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

2

Dalam tugas akhir ini KWH meter konvensional tersebut akan disempurnakan

dengan adanya suatu sistem perhitungan tagihan sehingga para pelanggan listrik maupun

penyewa kamar kos dapat dengan mudah mengetahui besar tagihan listrik mereka dalam

nilai rupiah.

1.3. Tujuan dan Manfaat

Tujuan pembuatan alat penghitung meteran listrik digital ini adalah untuk

membuat sebuah alat untuk menghitung nilai rupiah dari pemakaian listrik sehingga para

pelanggan dapat dengan mudah mengetahui besar biaya penggunaan listrik mereka.

Alat ini sangat bermanfaat untuk pelanggan listrik dengan adanya nilai

pemakaian listrik dalam rupiah, maka pelanggan dapat melakukan penghematan listrik

sendiri, sehingga pemakaian listrik konsumen dapat terkontrol.

1.4. Batasan Masalah

Untuk memperjelas pembahasan dalam perancangan, maka akan diberikan

pembatasan masalah sebagai berikut :

a. KWH meter yang digunakan adalah KWH meter jenis analog.

b. Pada bagian sensor, digunakan sensor optokopler.

c. Menggunakan IC 74LS14 sebagai schmitt trigger

d. Untuk perhitungan jumlah putaran piringan KWH meter, digunakan

mikrokontroler Atmega16.

e. Jenis komunikasi yang digunakan antara PC dengan mikrokontroler adalah

komunikasi serial RS232.

Page 20: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

3

f. RTC (Real Time Clock) yang digunakan adalah DS1307, yang sesuai dengan

komunikasi serial I2C mikrokontroler Atmega16.

g. Biaya pemakaian listrik ditampilkan berbasis Visual Basic

h. Pada perhitungan tarif, perhitungan yang dilakukan hanya yang berdasarkan pada

pemakaian KWHnya.

i. Perhitungan tarif listrik akan dihitung setiap akhir bulan.

1.5. Metodologi Penelitian

Dalam Penyelesaian penelitian digunakan metode sebagai berikut :

1. Studi Pustaka meliputi :

a) Perumusan ide pokok.

b) Mencari dan mempelajari topik tentang KWH meter.

c) Mencari data-data dari internet dan dari berbagai jenis buku yang dapat

dijadikan sebagai referensi penelitian.

2. Perancangan Perangkat Keras meliputi :

a) Merancang dan mewujudkan rangkaian optokopler dan schmitt trigger.

b) Memprogram Mikrokontroler .

c) Merancang dan memprogram pengolahan pulsa sensor dengan

mikrokontroler.

d) Merancang dan memprogram komunikasi serial I2C antara mikrokontroler

dengan RTC (Real Time Clock).

e) Merancang sistem komunikasi serial antara mikrokontroler dangan PC.

3. Perancangan Perangkat Lunak meliputi :

a) Merancang tampilan program.

Page 21: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

4

b) Menentukan data yang dibutuhkan program dari mikrokontroler.

c) Merancang diagram alir pengolah data.

4. Implementasi meliputi :

a) Pemrograman pengolahan data dan penampil data.

5. Pengujian dan Pengetesan alat meliputi :

a) Menguji sistem secara keseluruhan untuk dianalisa kekurangannya.

b) Mengumpulkan data-data untuk mengetahui keadaan sistem secara

keseluruhan.

c) Melakukan perbandingan hasil keluaran program pada PC dengan KWH

meter analog.

d) Melakukan perbandingan hasil perhitungan program pada PC dengan

perhitungan secara manual.

Page 22: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

5

BAB IIDASAR TEORI

2.1. KWH Meter

2.1.1. Fungsi dan Prinsip Kerja KWH Meter

KWH Meter adalah alat penghitung pemakaian energi listrik. Alat ini bekerja

menggunakan metode induksi medan magnet, di mana medan magnet tersebut

menggerakkan piringan yang terbuat dari alumunium. Pada piringan alumunium itu

terdapat as yang akan menggerakan pencacah digital sebagai tampilan jumlah KWH

nya[1].

KWH meter memiliki 3 kumparan yaitu 1 kumparan tegangan dengan koil yang

diameternya tipis dan 2 kumparan arus dengan koil yang diameternya tebal. Pada KWH

meter juga terdapat magnet permanen yang tugasnya menetralkan piringan alumunium

dari induksi medan magnet[1].

Gambar 2.1.Medan Magnet Pada KWH meter

Page 23: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

6

Pada Gambar 2.1 adalah cara medan magnet memutarkan piringan alumunium.

Arus listrik yang melalui kumparan arus mengalir sesuai dengan perubahan arus terhadap

waktu. Hal ini menimbulkan adanya medan di permukaan kawat tembaga pada koil

kumparan arus. Kumparan tegangan membantu mengarahkan medan magnet agar

menerpa permukaan alumunium sehingga terjadi suatu gesekan antara piringan

alumunium dengan medan magnet disekelilingnya. Dengan demikian maka piringan

tersebut mulai berputar dan kecepatan putarnya dipengaruhi oleh besar kecilnya arus

listrik yang melalui kumparan arus[1].

Gambar 2.2.Model Fisik KWH Meter

Pada Gambar 2.2. merupakan model fisik KWH meter di mana ada empat buah

terminal yang terdiri dari dua buah terminal masukan dari jala – jala listrik PLN dan dua

terminal lainnya merupakan terminal keluaran yang akan menyuplai tenaga listrik ke

rumah. Dua terminal masukan dihubungkan ke kumparan tegangan secara paralel dan

antara terminal masukan dan keluaran dihubungkan ke kumparan arus. Untuk lebih

jelasnya dapat dilihat pada Gambar 2.3[1].

Page 24: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

7

Gambar 2.3.Skema Hubungan Kumparan Pada KWH meter

2.2 Perhitungan Biaya Pemakaian Listrik

Jika membeli sebuah KWH meter maka akan tercantum banyaknya putaran

untuk menghasilkan satu KWH dalam setiap jamnya. Contohnya jika 150 putaran per

KWH maka harus ada 150 putaran untuk dikatakan sebesar satu KWH. Jumlah KWH itu

secara kumulatif dihitung dan pada akhir bulan dicatat oleh petugas besarnya pemakaian

lalu dikalikan dengan Tarif Dasar Listrik (TDL) ditambah dengan biaya abonemen dan

pajak menghasilkan jumlah tagihan yang harus dibayarkan setiap bulannya[2].

Untuk melakukan penghematan energi listrik, maka pemerintah memberikan

kebijakan suatu tarif progresif. Kebijakan tarif progresif bertujuan agar pelanggan

menekan pemakaian listrik hingga sebatas kebutuhan wajar aktivitas sehari-hari. Untuk

itu, pelanggan dengan pemakaian KWH <80% rata-rata nasional akan mendapat insentif.

Sebaliknya pelanggan dengan KWH >80% rata-rata nasional akan dikenakan disinsentif.

Pelanggan yang terkena kebijakan ini adalah Pelanggan Rumah Tangga (R1, R2, R3),

Pelanggan Bisnis skala kecil (B1), Bisnis skala menengah (B2), dan Pelanggan

Pemerintah (P1, P2, P3). Pada tabel 2.1[2].

Page 25: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

8

Tabel 2.1. Perhitungan Insentif dan Disinsentif

Tabel 2.2. Penggolongan Daya Listrik dan Tarif listrik

Page 26: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

9

Biaya beban dan biaya per blok pemakaian dapat dilihat pada Tabel Tarif Dasar

Listrik (TDL) berikut. Sejak tahun 2004 s.d sekarang harga TDL belum berubah. PPJ n%

(nilai n tergantung Perda setempat)[3].

Tabel 2.3 Tarif Dasar Listrik

Page 27: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

10

2.3. Sensor Optokopler

Sensor Optokopler seperti yang terlihat pada Gambar 2.4 merupakan sensor yang

dapat mendeteksi perubahan cahaya infra merah. Sensor ini banyak dipakai untuk

mendeteksi jarak ataupun pergerakan suatu benda dengan cara memberikan kisi – kisi

Page 28: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

11

ataupun baling – baling sehingga akan terdapat celah dan penghalang. Dengan menerima

sinar infra merah yang putus – putus akan menimbulkan pulsa – pulsa listrik. Pulsa –

pulsa itu kemudian diolah dan nantinya dapat memberikan keluaran seperti yang kita

inginkan[4].

Gambar 2.4 Sensor Optokopler

Bagian dari sensor optokopler ini adalah sebuah led merah biasa atau led infra

merah sebagai pengirim dan sebuah fototransistor sebagai penerima. Jumlah celah yang

akan dideteksi oleh sensor optokopler tergantung dari banyaknya celah pada piringan

KWH meter. Berikut ini adalah cara mencari total putaran pada piringan KWH meter,

dimana jumlah celah pada piringan KWH meter sangat berpengaruh pada perhitungan.

Dengan perhitungan jumlah pulsa sebagai berikut :

Jika : n = jumlah pulsa yang dihasilkan.

p = total putaran piringan KWH meter

l = Jumlah lubang pada piringan KWH meter = 2

maka didapatkan rumus sebagai beikut :

(2-1)

Page 29: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

12

Cara Kerja dari rangkaian sensor adalah sebagai berikut :

a) Saat piringan aluminium berputar maka lubang –lubang pada piringan

aluminium ikut berputar.

b) Lubang lubang tersebut dideteksi oleh sensor optokopler dimana keluarannya

berupa pulsa – pulsa listrik.

c) Pada saat sensor optokoupler bertemu lubang pada piringan aluminium maka

sinar infra merah atau sinar LED akan tembus sehingga sensor optokopler

mengalirkan arus listrik, sedangkan apabila tertutup maka sensor optokopler

akan berhenti mengalirkan arus listrik.

2.4. Inverter Schmitt Triggers 74LS14

Inverter schmitt trigger adalah rangkaian yang digunakan untuk membersihkan

desah, atau membersihkan isyarat yang lambat naik atau turun menjadi pulsa digital yang

cepat naik dan cepat turun[5].

Salah satu IC schmitt trigger yang banyak dijumpai di pasar adalah 74LS14. IC

74LS14 merupakan inverter schmitt trigger yang memiliki 6 buah pin masukan dan 6

buah pin keluaran. Diagram Blok IC 74LS14 ditujukan pada gambar 2.5[5].

Gambar 2.5 Diagram blok IC 74LS14

Page 30: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

13

Sedangkan tabel kebenaran inverter schmitt trigger adalah sebagai berikut :

Tabel 2.4 Tabel kebenaran IC 74LS14

INPUT OUTPUT

0 1

1 0

Keterangan : 0 = logika rendah

1 = logika tinggi

2.5. Mikrokontroler AVR ATmega 16

Mikrokontroler AVR (Alfa and Vegard’s Risc processor) standart memiliki

arsitektur 8 bit, dimana semua instruksi dikemas dalam kode 16 bit, dan sebagian besar

intruksi dieksekusi dalam 1 (satu) siklus clock. AVR berteknologi RISC ( Reduced

Instruction Set Computing), sedangkan MCS51 berteknologi CISC (Complex Instruction

Set Computing)[6].

Di dalam mikrokontroler ATmega16 sudah terdiri dari :

1. Saluran I/O ada 32 buah, yaitu Port A, Port B, Port C, dan Port D.

2. ADC (Analog to Digital Converter) 10 bit, sebanyak 8 channel.

3. Tiga buah Timer/Counter dengan kemampuan pembandingan.

4. CPU yang terdiri dari 32 buah register.

5. 131 instruksi andal yang umumnya hanya membutuhkan 1 siklus clock.

6. Watchdog Timer dengan osilator internal.

7. Dua buah timer/counter 8 bit.

8. Satu buah timer/counter 16 bit.

Page 31: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

14

9. Tegangan operasi 2.7 V-5.5V pada ATmega16.

10. Internal SRAM sebesar 1KB.

11. Memory Flash sebesar 16 KB dengan kemampuan Read While Write.

12. Unit interupsi internal dan eksternal.

13. Port antarmuka SPI.

14. EEPROM sebesar 512 byte yang dapat diprogram saat operasi.

15. Antarmuka komparator analog.

16. 4 channel PWM.

17. 32x8 general purpose register.

18. Hampir mencapai 16 MIPS pada Kristal 16 MHz.

19. Port USART programmable untuk komunikasi serial.

2.5.1. Susunan Kaki Standart Mikrokontroler AVR ATmega16

Pada Gambar 2.6 dibawah ini merupakan susunan kaki standart ATmega16[6].

Berikut ini adalah penjelasan umum susunan kaki ATmega16.

a) VCC merupakan pin masukan positif catu daya.

b) GND sebagai pin Ground.

c) Port A (PA0….PA7) merupakan pin I/O dua arah dan dapat diprogram sebagai

pin masukan ADC.

d) Port B (PB0….PB7) merupakan pin I/O dua arah dan pin fungsi khusus, yaitu

Timer/Counter, komparator analog, dan SPI.

e) Port C(PC0….PC7) merupakan pin I/O dua arah dan pin fungsi khusus, yaitu

TWI, komparator analog, dan timer Osilator.

Page 32: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

15

f) Port D(PD0….PD7) merupakan pin I/O dua arah dan pin fungsi khusus, yaitu

komparator analog, interupsi eksternal, dan komunikasi serial.

g) Reset merupakan pin yang digunakan untuk mereset mikrokontroler.

h) XTAL 1 dan XTAL 2 sebagai masukan clock eksternal. Suatu mikrokontroler

membutuhkan sumber detak (clock) agar dapat mengeksekusi instruksi yang ada

di memori. Semakin tinggi tinggi kristalnya, maka semakin cepat mikrokontroler

tersebut.

i) AVCC sebagai pin masukan tegangan untuk ADC.

j) AREF sebagai pin masukan tegangan referensi.

Gambar 2.6. Mikrokontroler Atmega16

2.5.2. Konsep I/O pada Mikrokontroler AVR ATmega16

Pada Gambar 2.6, terdapat empat buah port, yaitu PA,PB,PC, dan PD. Yang

semuanya dapat diprogram sebagai input ataupun output. Jika dilihat lebih detail lagi

pada bagian pemrosesan mikrokontroler ini, terdapat unit CPU utama untuk memastikan

Page 33: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

16

eksekusi program. CPU juga dapat mengakses memori, melakukan kalkulasi,

pengontrolan, dan penangan instruksi dengan menggunakan arsitektur Harvard (bus

untuk memori dan program data terpisah), sehingga dihasilkan performa yang tinggi[6].

Hal ini dikarenakan instruksi pada memori program dieksekusi dengan single

level pipelining, dengan demikian, pada saat sebuah instruksi dieksekusi, instruksi

berikutnya dapat diakses dari memori program. Konsep ini memungkinkan instruksi-

instruksi dieksekusi pada setiap siklus clock[6].

Gambar 2.7. Arsitektur Unit Pemrosesan AVR

Pin I/O pada mikrokontroler AVR dapat dikonfigurasikan sebagai input atau

output, dengan cara mengubah isi I/O register Data Direction Register. Misalnya jika

ingin port B dikonfigurasikan sebagai output, maka Data Direction Register port B

Page 34: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

17

(DDRB) harus diset sebagai 0xFFH (sama dengan 255). Jika sebagai input, maka diset

0x00H (sama dengan 0)[6].

Contoh :

a) DDRB = 255 // Port B dikonfigurasikan sebagai output, yaitu PB0-PB7

b) DDRD = 0x00// Port D dikonfigurasikan sebagai input.

VOH (Output High Voltage) ialah tegangan pada pin I/O mikrokontroler ketika ia

mengeluarkan logika “1” dengan besar sekitar 4,2 V dan arus sebesar 20 mA (IOH). Setiap

pin I/O mikrokontroler AVR memiliki internal pull-up. Misalnya Port B dikonfigurasikan

sebagai input dan internal Pull-upnya diaktifkan, maka DDRB=00H dan Port B =00H.[6]

Contoh :

a) Port B = PIN C // Semua data di Port C dikirim ke Port B.

b) Port B.0 = PIN C.0 // Data di Port C.0 dikirim ke Port B.0

Keluaran dari suatu port mikrokontroler hanya dapat mengendalikan perangkat

dengan arus yang kecil, oleh karena jika dipergunakan untuk pengendalian dengan arus

yang kuat maka perlu penguat lagi berupa transistor atau IC penguat agar port tersebut tak

terbebani[6].

2.5.3. Konsep Komunikasi Serial

Komunikasi serial merupakan fitur yang penting dalam suatu sistem embedded,

karena dengan komunikasi serial kita dapat dengan mudah menghubungkan

mikrokontroler dengan peranngkat lainnya. Port serial pada mikrokontroler terdiri atas

dua pin yaitu TxD dan RxD. RxD berfungsi untuk menerima data dari komputer atau

peralatan lainnya sedangkan TxD berfungsi untuk mengirim data ke komputer/peralatan

Page 35: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

18

lainnya. Pengiriman data serial dikirim satu per satu, beserta format data serial yang

umum.[6]

Standar komunikasi serial untuk komputer ialah RS-232. RS-232 mempunyai

standar tegangan yang berbeda dengan serial port mikrokontroler, sehingga agar sesuai

dengan RS-232, maka dibutuhkan suatu rangkaian level converter. IC yang digunakan

bermacam-macam, tetapi yang paling mudah dan sering digunakan ialah IC

MAX232/HIN232. Menggunakan transistor dan diode juga bisa.[6]

Pada mikrokontroler ATmega16, pin PD0 dan PD1 digunakan untuk

komunikasi serial USART (Universal Synchronous and Ansynchronous Serial Receiver

and Transmitter) yang mendukung komunikasi full duplex (komunikasi dua arah).

Gambar 2.9.menampilkan model hubungan antara mikrokontroler dengan PC melalui

format serial[6].

Pada gambar di atas terdapat 3 buah register, yaitu UCSRA, UCSRB dan

ACSRC. Clock generation logic membangkitkan clock untuk pengirim dan penerima.

USART ini mendukung empat mode operasi clock, yaitu Normal Asynchronous, Double

Speed Asynchronous, Master Synchronous, dan Slave synchronous. Bit UMSEL pada

USART Control And Status Register C (UCSRC) memilik operasi sinkron atau asinkron

tersebut.[6]

2.6. RTC ( Real Time Clock )

Merupakan chip yang didesain khusus sebagai pembangkit waktu. Chip ini

digunakan pada rangkaian – rangkaian yang membutuhkan data berupa waktu yang real

time, seperti jam dan mainboard komputer. Untuk mendukung kehandalan data waktu

Page 36: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

19

yang real time, RTC dilengkapi dengan input tegangan cadangan yang berasal dari

baterai[7].

Gambar 2.8. Konfigurasi Pin RTC DS1307

Data waktu yang dihasilkan RTC meliputi : detik, menit, jam, hari, tanggal,

bulan, dan tahun. Masing-masing data memiliki alamat yang dapat diakses oleh

mikroprosesor ataupun mikrokontroler secara serial maupun parallel sesuai spesifikasi

RTC. Dalam hal ini RTC yang digunakan adalah yang bertipe DS 1307 dimana

pengaksesan datanya dilakukan secara serial melalui port I2C pada mikrokontroler

ATmega 16 seperti pada gambar 2.9[7].

Gambar 2.9. Pengaksesan RTC serial

2.7. LCD (Liquid Crystal Display)

LCD merupakan suatu tampilan (display) yang terdiri dari bahan cairan Kristal

yang dioperasikan dengan menggunakan sistem dot matrik[8].

Page 37: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

20

LCD HD44780U dapat menampilkan angka-angka, huruf jepang, abjad, dan juga

simbol – simbol lainnya. Interface LCD HD44780U dengan mikrokontroler ATmega 16

dapat dilakukan dengan sistem 4 bit maupun 8 bit[8].

Dimensi LCD HD4470U yang digunakan memiliki ukuran 2 x 16. Hal ini berarti

LCD tersebut memiliki layar tampilan yang terdiri atas 2 baris dan 16 kolom seperti pada

gambar 2.10 dibawah ini[8].

Dengan demikian total jumlah karakter yang ditampilkan sekaligus dalam satu

layar adalah sebanyak 32 karakter. Dimana setiap karakter terbentuk dari susunan titik –

titik (dot) yang memiliki ukuran 8 x 5[8].

Gambar 2.10. Dimensi Layar LCD

LCD HD44780U memiliki beberapa bagian sebagai berikut :

2.7.1. Register

HD44780U memiliki dua buah register 8 bit, yaitu IR (Instruction Register) dan

DR (Data Register). IR merupakan register yang hanya dapat ditulis dan berguna untuk

menyimpan kode-kode instruksi seperti Display Clear, Cursor Shift, dan juga untuk

alamat dari DDRAM (Display Data RAM) ataupun CGRAM (Character Generator

RAM). Sedangkan DR merupakan register yang bias ditulis maupun dibaca dan juga

Page 38: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

21

berguna sebagai tempat penyimpanan sementara data yang akan ditulis atau dibaca dari

atau kedalam DDRAM ataupun CGRAM[8].

2.7.2. BF (Busy Flag)

Sewaktu BF bernilai “1” maka driver HD44780U akan menjalankan operasi

internal sehingga instruksi selanjutnya tidak dapat dijalankan. Maka untuk menjalankan

instruksi selanjutnya perlu diperiksa apakah busy flag tersebut bernilai “0” atau dapat

dilakukan dengan memberikan waktu lebih lama dari waktu yang dibutuhkan oleh

eksekusi instruksi itu sendiri diantara instruksi pertama dengan instruksi selanjutnya[8].

2.7.3. AC (Address Counter)

Fungsi dari AC adalah untuk mengamati DDRAM dan juga CGRAM[8].

2.7.4. DDRAM (Display Data RAM)

DDRAM digunakan untuk menyimpan tampilan data yang direpreresentasikan

dalam bentuk 8 bit kode karakter. DDRAM memiliki kapasitas 80 x 8 bit atau 80

karakter[8].

2.7.5. CGROM ( Character Generator ROM )

CGROM merupakan ROM (Random Only Memory) berukuran 80 x 8 bit yang

mampu membangkitkan bentuk dot matriks berukuran 5 x 8 maupun 5 x 10 dari 8 bit

kode karakter[8].

Page 39: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

22

2.7.6. CGRAM ( Character Generator RAM )

CGRAM merupakan RAM (Random Access Memory) berukuran 64 x 8 bit yang

memungkinkan untuk memprogram karakter yang diinginkan[8].

2.7.7. Deskripsi LCD

DB0 sampai dengan DB7 merupakan jalur data yang dipakai untuk menyalurkan

kode ASCII maupun perintah pengatur kerja LCD tersebut[8].

RS merupakan Register Select yang dipakai untuk membedakan jenis data yang

dikirim ke LCD. Jika RS=0, maka data yang dikirim adalah perintah untuk mengatur

kerja LCD tersebut. Sebaliknya jika RS=1, maka data yang dikirim adalah kode ASCII

yang ingin ditampilkan[8].

R/W merupakan Read/Write. Jika R/W = 0, menandakan akan diadakan

pengiriman data ke LCD. Dan jika R/W = 1, menandakan akan diadakan pengambilan

data dari LCD[8].

E (Enable) merupakan sinyal sinkronisasi. Saat E berubah dari “1” menjadi “0”,

maka data di DB0 hingga DB7 akan diterima atau diambil dari atau oleh LCD[8].

Untuk menyalakan backlight pada layar LCD maka Anoda dan Katoda akan

dihubungkan pada +5V dan ground. Letak Anoda dan Katoda terpisah dari pin, namun

kadang pada LCD lain sudah ada yang termasuk pada pin[8].

Page 40: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

23

2.7.8. Pin LCD

LCD memiliki 14 kaki pin dengan konfigurasi pin seperti tabel 2.7 berikut ini[8].

Tabel 2.5 Konfigurasi PIN LCD

Nomor Pin Simbol1 Vcc (+5V)2 Vee (0V)3 GND (0V)4 RS5 R/W6 E7 DB08 DB19 DB210 DB311 DB412 DB513 DB614 DB7

2.8. Komunikasi Serial

Komunikasi serial ialah komunikasi pengiriman data yang dilakukan per bit

secara serial, sehingga akan lebih lambat dibandingkan komunikasi paralel. Dikenal dua

cara komunikasi data secara serial, yaitu komunikasi data serial sinkron dan komunikasi

data serial asinkron. Pada komunikasi data serial sinkron, clock dikirimkan bersama-sama

dengan data serial, sedangkan komunikasi data serial asinkron, clock tidak dikirimkan

bersama data serial, tetapi dibangkitkan secara sendiri-sendiri baik pada sisi pengirim

(transmitter) maupun pada sisi penerima (receiver)[6].

Page 41: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

24

Gambar 2.11. Blok diagram USART

Pada komunikasi asinkron setiap karakter yang dikirim akan disinkronkan

dengan menyisipkan bit-bit framing (pembingkaian) pada permulaan karakter yaitu 14 bit

start dan akhir karakter yaitu bit stop. Bit start selalu berlogika rendah (0) berfungsi

untuk mengidentifikasikan permulaan karakter. Setelah bit data terakhir (MSB), 1 bit

paritas disisipkan , yang berfungsi untuk mengecek keabsahan dari data yang dikirim.

Logika 1 untuk paritas genap dan logika 0 untuk paritas ganjil. Bit stop selalu berlogika

tinggi (1) dan berfungsi mengidentifikasikan akhir dari karakter[6].

Biasanya komunikasi serial digunakan untuk mengirimkan data antara dua

tempat yang berjauhan sehingga data dapat dikirimkan melaui satu jalur transmisi[6].

Page 42: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

25

Gambar 2.12 Sebuah Frame pada Komunikasi Serial

2.9. Port Serial

Dalam penyampaian data secara serial pada PC dibutuhkan port sebagai saluran

data. Port yang biasanya digunakan adalah DB9. Standar RS232 menyangkut komunikasi

data antar komputer (Data Terminal Equipment/DTE) dengan peralatan pada komputer

(Data Circuit-Terminating Equipment/DCE). Berikut konfigurasi port serial DB9

ditunjukkan pada gambar 2.13[7].

Gambar 2.13. Konfigurasi Port Serial DB9

Keterangan mengenai fungsi saluran RS232 pada konektor DB-9 adalah sebagai

berikut:

1. Received Line Signal Detect, dengan saluran ini DCE memberitahukan ke DTE

bahwa pada terminal masukan ada data masuk.

2. Receive Data, digunakan DTE menerima data dari DCE.

Page 43: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

26

3. Transmit Data, digunakan DTE mengirimkan data dari DCE.

4. Data Terminal Ready, pada saluran ini DTE memberitahukan kesiapan

terminalnya.

5. Signal Ground, saluran ground.

6. Ring Indicator, pada saluran ini DCE memberitahu ke DTE bahwa sebuah stasiun

menghendaki hubungan dengannya.

7. Clear To Send, dengan saluran ini DCE memberitahukan bahwa DTE boleh

mengirimkan data.

8. Request To Send, dengan saluran ini DCE diminta mengirim data oleh DTE.

9. DCE Ready, sinyal aktif pada saluran ini menunjukkan bahwa DCE sudah siap.

2.10. RS232

Terdapat beberapa macam cara untuk menerapkan interface data biner pada

komunikasi secara serial, salah satunya adalah RS-232 yang merupakan salah satu dari

standar yang dipilih dan sekarang telah dipakai secara luas dan dalam komunikasi data

umumnya digunakan untuk menghubungkan DTE (Data Terminal Equipment) ke DCE

(Data Communication Equipment) yang berupa peralatan sistem komunikasi analog[9].

RS232 merupakan singkatan dari Recommended Standard number 232. Standar

ini dibuat oleh Electronic Industry Association (EIA), untuk interface antara peralatan

terminal data dan komunikasi data, dengan menggunakan data biner sebagai data yang

ditransmisi. RS232 adalah suatu data Serial Data Interface Standard yang dikeluarkan

oleh EIA. Standarisasi meliputi konektor, fungsi dan level tegangan atau arus. Standar ini

juga berisikan karakteristik sinyal listrik, karakteristik mekanik dan cara operasional

Page 44: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

27

rangkaian fungsional. Beberapa karakteristik rangkaian fungsionalnya adalah sebagai

berikut[9] :

1. Logika ‘1’ disebut ‘mark’ terletak antara -3V hingga -25V.

2. Logika ‘0’ disebut ‘space’ terletak antara +3V hingga +25V.

3. Daerah tegangan antara -3V hingga +3V, ≤ -25V dan ≥ +25V adalah invalid

level, yaitu daerah tegangan yang tidak memiliki logika pasti dan harus

dihindari.

Rangkaian pengubah level tegangan TTL menjadi level tegangan RS232

menggunakan rangkaian voltage doubler atau rangkaian pengganda tegangan dan

rangkaian voltage inverter atau rangkaian pembalik tegangan. Voltage doubler digunakan

untuk menggandakan tegangan TTL. Logika “1” pada tegangan TTL adalah saat memiliki

tegangan +5V dan logika “0” adalah saat memiliki tegangan 0V. Untuk dapat diterima di

PC keadaan logika “1” harus terletak antara -3V hingga -25V dan logika “0” terletak

antara +3V hingga +25V maka dibutuhkan voltage doubler dan voltage inverter

sekaligus[9].

Gambar 2.14. adalah contoh pengiriman huruf ‘A’ pada level tegangan RS232

dalam format ASCII tanpa bit paritas[9].

Gambar 2.14. Pengiriman huruf ‘A’ pada level tegangan RS232

dalam format ASCII tanpa bit paritas

Page 45: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

28

2.11. Pemrograman Visual Basic

Visual Basic merupakan salah satu bahasa pemrograman yang berorientasi pada

obyek (Object Oriented Programming). Salah satu kehandalan Visual Basic adalah

pembuatan aplikasi Graphical User Interface (GUI). Dalam pembuatan tampilan user

interfacenya relatif mudah dilakukan karena hanya perlu diletakkan obyek-obyek grafis

ke lembar (form) yang telah disediakan, setelah itu hanya perlu pengaturan properti dan

obyek-obyek tersebut menurut kreatifitas pemrogram[10].

2.11.1. Tampilan Awal Pada Visual Basic

Pada tahap awal penggunaan Visual Basic, akan menampilkan tampilan

ToolBox, ToolBar, Properties dan Form Layout[10].

Gambar 2.15 Visual Basic IDE (Integrated Development Environment)

IDE merupakan bidang kerja tempat progammer membuat aplikasi. Di dalam

IDE antara lain terdapat Programming Tools, Toolbox Controls, Form Windows,

Properties Windows, Project Windows, Code Windows, Immediate Windows, Form

Layout Windows dan Online Help Systems[10].

Page 46: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

29

2.11.2. Toolbar

ToolBar adalah tombol-tombol yang mewakili suatu perintah tertentu dari Visual

Basic. Setiap tombol tersebut dapat langsung diklik untuk melakukan perintah tertentu.

Tombol-tombol dan perintah-perintah yang sering digunakan dalam Visual Basic:[10]

Gambar 2.16. Toolbar Standar Visual Basic

2.11.3. Form Window

Form Window atau jendela form adalah daerah kerja utama dimana akan dibuat

aplikasi-aplikasi Visual Basic. Pada form ini akan diletakkan berbagai macam objek

alternatif seperti misalnya teks, gambar, tombol-tombol perintah, scrollbar, dan

sebagainya. Jendela form pada gambar 2.17. ini pada awalnya terlihat kecil tetapi

ukurannya dapat diubah-ubah[10].

Gambar 2.17. Jendela Form

Page 47: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

30

2.11.4. Toolbox

ToolBox adalah sebuah kotak piranti yang mengandung semua kotak atau kontrol

yang dibutuhkan untuk membentuk suatu program aplikasi. Kontrol adalah suatu objek

yang akan menjadi interface penghubung antara program aplikasi dan penggunanya, dan

kesemuanya harus diletakkan dalam jendela form. Apabila pertama kali menjalankan

Visual Basic, maka ToolBox akan ditampilkan di sebelah kiri layer dan berisi objek-objek

standar yang akan muncul setiap Visual Basic dijalankan. Objek kontrol ini terdapat pada

semua versi dari Visual Basic 6.0[10].

Gambar 2.18. Toolbox Control

2.11.5. Project Explorer

Jendela Project Explorer adalah jendela yang mengandung semua file di dalam

apikasi Visual Basic disebut dengan istilah project (proyek), dan setiap proyek bisa

mengandung lebih dari satu file. Pada Project Explorer ditampilkan semua file yang

terdapat pada aplikasi (proyek), misalnya form, modul, class, dan sebagainya[10].

Page 48: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

31

Gambar 2.19. Windows Project Explorer

2.11.6. Properties Window

Jendela Properties adalah jendela yang mengandung semua informasi mengenai

obyek, seperti nama, warna, ukuran, posisi, dan sebagainya. Setiap objek sebagian besar

memiki properties yang sama, tetapi ada pula yang berbeda-beda. Melalui jendela

properties ini dapat diatur bentuk dan karakteristik dari setiap obyek. Bagian paling atas

dari jendela properties ini terdapat kotak yang dapat menunjukkan nama obyek yang

sedang aktif, sedangkan propertinya ditampilkan dibagian bawah dari jendela properties

tersebut[10].

Gambar 2.20. Windows Properties

Page 49: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

32

2.11.7. Form Layout Windows

Form Layout Windows adalah jendela yang menggambarkan posisi dari setiap

form yang ditampilkan pada layar monitor. Posisi form pada Form Layout Windows inilah

yang merupakan petunjuk dimana aplikasi yang dibuat akan ditampilkan pada layar

monitor akan dijalankan. Pengaturan letak aplikasi tersebut dapat diatur pada properties

form maupun code window[10].

Gambar 2.21. Form Layout

2.11.8. Code Window

Code window merupakan tempat untuk menuliskan kode atau program. Ada dua

combo box di bagian atas dari code windows, box yang kiri menunjukkan obyek yang

kodenya ditulis dan box yang kanan menunjukkan prosedur atau event dari kontrol yang

sedang didefinisi kelakuannya[10].

Page 50: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

33

Gambar 2.22. Code Window

2.11.9. Komunikasi Serial Pada Visual Basic

Pada komunikasi serial pada Visual Basic digunakan custom control yaitu

communication control. Sintaks yang digunakan pada Visual Basic antara lain yaitu:

1) [Variabel] = Comm1.Input: Membaca karakter-karakter dari buffer penerima dan

dimasukkan variabel.

2) Comm1.Output = [Variabel]: Mengirimkan karakter-karakter yang terdapat pada

variabel melalui port Comm1.

Pada prosedur penerimaan data secara serial digunakan kode program sebagai

berikut:

1) Comm1.CommPort = 1, perintah ini digunakan untuk menginisialisasi penggunaan

port com1 dengan nama “Comm1”

Page 51: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

34

2) Comm1.Settings = ‘9600,N,8,1”, perintah ini digunakan untuk mengeset port com1

dengan parameter sebagai berikut:

a. Angka pertama menunjukkan kecepatan transmisi data 9600 baud.

b. N (none) menunjukkan tidak ada paritas yang digunakan.

c. Angka ketiga menunjukkan jumlah bit yang dikirim dalam 1 karakter yaitu 8 bit.

d. Angka terakhir menunjukkan bit akhir (stop bit) dalam satu karakter.

3) Comm1. InputLen = 0, perintah ini digunakan untuk menyatakan banyaknya karakter

yang akan dibaca jika input digunakan.

4) Comm1.PortOpen = True, perintah ini digunakan untuk membuka (true) atau

menutup (false) port Comm1.

Sedangkan pada prosedur pengiriman data digunakan kode program sebagai

berikut:

1. Comm1.CommPort = 1

2. Comm1.Settings = ‘9600,N,8,1”

3. Comm1.InputLen = 0

4. Comm1.PortOpen = True

5. Comm1.OutputLen = “Data yang akan dikirim”

6. Comm1.PortOpen = False

Page 52: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

35

BAB IIIPERANCANGAN ALAT

3.1. Blok Diagram Rangkaian

Untuk merealisasikan alat penghitung pemakaian listrik digital ini, maka langkah

yang pertama kali dilakukan adalah dengan membuat blok diagram alat seperti pada

gambar 3.1.

Gambar 3.1. Blok Diagram Rangkaian

3.2. Realisasi Rangkaian

Langkah berikutnya adalah merealisasikan rangkaian setiap blok. Rangkaian yang

akan dibuat yaitu :

a. Rangkain sensor

b. Rangkaian schmitt trigger

c. Rangkaian Mikrokontroler

d. Rangkaian RS232 ke Komputer

e. Pemrograman Visual Basic.

Page 53: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

36

3.3. Rangkaian Sensor

Rangkaian sensor berfungsi sebagai masukan bagi sistem mikrokontroler.

Rangkaian sensor ini akan mendeteksi putaran piringan aluminium pada KWH Meter.

Pada piringan aluminium diberi lubang agar sensor optokopler dapat mendeteksi putaran

piringan aluminium tersebut.

Jumlah lubang akan mempengaruhi rumus perhitungan yang nantinya akan di

masukan ke mikrokontroler. Spesifikasi yang akan digunakan adalah sebagai beikut :

a. Piringan KWH meter memiliki 2 lubang pada pinggirannya.

b. KWH meter yang memiliki spesifikasi 150 putaran per KWH.

Gambar 3.2 Perancangan Posisi Sensor Pada Piringan KWH Meter

Pada Gambar 3.2 menunjukkan posisi sensor pada piringan KWH meter, serta

jumlah titik akan dibuat sebanyak 2 titik, serta jarak antara titik satu dengan yang lainnya

diperoleh dari 3600 : 2 = 1800.

Page 54: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

37

Gambar 3.3. Perancangan Rangkaian Sensor Optokopler

Pada rangkaian optokopler diatas, nilai R1 dan R2 didapatkan dengan

mengetahui bahwa fototransistor pada keadaan rendah (ON) atau arus I2 minimal 0,3 mA

dan arus I2 maksimal 0,5 mA, maka nilai R2 dapat ditentukan sebagai berikut :

Nilai R2 itu adalah nilai batas maksimum. Jika misalnya nilai tersebut diperkecil

menjadi 10000Ω, maka akan menaikkan arus I2 menjadi :

Sedangkan nilai R1 dapat dicari dengan mengetahui bahwa LED dapat dialiri

arus I1 minimal 20 mA, dari nilai arus maksimal tersebut nilai R1 dapat diketahui dengan

cara :

Nilai R1=250Ω, adalah nilai maksimum, jika menggunakan nilai R1 sebesar

220Ω, maka arus yang akan mengallir ke LED adalah :

Page 55: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

38

Sehingga dengan menggunakan nilai R1 sebesar 220Ω, LED masih dapat bekerja

dengan baik, serta cahaya yang dihasilkan dapat dibaca oleh fototransistor.

Cara Kerja dari rangkaian sensor adalah sebagai berikut :

a) Saat piringan aluminium berputar maka lubang –lubang pada piringan

aluminium ikut berputar.

b) Lubang lubang tersebut dideteksi oleh sensor optokopler dimana keluarannya

berupa pulsa – pulsa listrik.

c) Pada saat sensor optokoupler bertemu lubang pada piringan aluminium maka

sinar infra merah atau sinar LED akan tembus sehingga sensor optokopler

mengalirkan arus listrik, sedangkan apabila tertutup maka sensor optokopler

akan berhenti mengalirkan arus listrik.

d) Besarnya tegangan yang dihasilkan saat optokopler terhalang adalah 4V –

4,8V, dan saat tidak terhalang 0,2V – 0,7V.

3.4. Rangkaian Schmitt Trigger

Penggunaan inverter schmitt trigger pada rangkaian digunakan untuk

membersihkan desah, atau membersihkan isyarat yang lambat naik atau turun menjadi

pulsa digital yang cepat naik dan cepat turun. Salah satu IC schmitt trigger yang banyak

dijumpai di pasar adalah 74LS14. IC 74LS14 merupakan inverter schmitt trigger yang

memiliki 6 buah pin masukan dan 6 buah pin keluaran. Diagram Blok IC 74LS14

ditujukan pada gambar 2.5.

Page 56: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

39

IC 74LS14 digunakan sebagai pembentuk gelombang kotak dengan keluaran 0V

dan 5V. Seperti pada gambar 3.5.

Gambar 3.4. Sinyal Masukan IC 74LS14

Gambar 3.5. Sinyal Keluaran IC 74LS14

3.5. Rangkaian Mikrokontroler AVR Seri Atmega 16

Pada rangkaian mikrokontroler seperti pada gambar 3.6, port yang akan

digunakan adalah port A, port B, port C dan port D. Port A yang merupakan pin I/O dua

arah pada mikrokontroler akan digunakan sebagai input masukan pulsa dari optokopler

atau sebagai input dari sensor optokopler.

Port B digunakan sebagai input dari saklar, yang berfungsi untuk pengesetan

jam. Port B yang digunakan sebanyak 3 pin, yaitu pin PB1 sebagai tombol pemilihan

menu pada hitungan jam, pin PB2 sebagai tombol down, serta PB3 sebagai tombol up.

Port C digunakan untuk pengiriman data ke LCD, karena pengiriman data

dilakukan secara 4 bit, maka hanya digunakan 4 pin yaitu pin PC4, PC5, PC6, dan PC7.

Page 57: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

40

Sedangkan pin PC0 dan PC1 digunakan sebagai komunikasi serial I2C antara

mikrokontroler dengan RTC DS1307.

Port D akan digunakan sebagai komunikasi serial pada mikrokontroler. Untuk

melakukan pengiriman data digunakan pin ke-15, yaitu pin PD1 sedangkan untuk

melakukan penerimaan data digunakan pin ke-14, yaitu pin PD0. Pada pin PD7

digunakan untuk sinyal sinkronisasi LCD, sedangkan pin PD5 berfungsi sebagai

pengiriman dan pembacaan data LCD.

Untuk penggunaan besarnya nilai kristal yang digunakan berdasarkan pada data

sheet, dimana penggunaan kristal sebesar 11,0592 Mhz pada baud rate 9600 bps error

yang terjadi adalah 0 %. Penggunaan kapasitor pada pin VCC dan AVCC adalah untuk

meredam noise yang berasal dari CPU.

SW

61

2

U9A

74LS14

12

C25

1uF

R32k7

SW

71

2

C180,1u

U2

DS1307

4

7

5

12

63

8

GND

SQW/OUT

SDA

X1X2

SCLKVBAT

VCCR4 2k7

C170,1u

VCC

U4

MAX232

13

8

11

10

1

3

4

5

2

6

12

9

14

7

16

15

R1IN

R2IN

T1IN

T2IN

C+

C1-

C2+

C2-

V+

V-

R1OUT

R2OUT

T1OUT

T2OUT

VCC

GND

R9

10K

R71M

J4

power

12

SW1

RE

SE

T1

2

J2

LM7805

1 2 3

Y 232,768KhzVCC

R8

10K

C12

30pF

VCC

C247u

C20

1uF

C8

1uF

VCC

C13

30pF

VCC

Y1

11.059MHZ

R10

10K

C19

1uF

BT1CR2303

12

U1

ATMEGA 16

9

21

1030

1213

1415

1617181920

4039383736353433

2223242526272829

12345

678

32

3111

RESET

PD7

VCCAVCC

XTAL2XTAL1

PD0PD1

PD2PD3PD4PD5PD6

PA0PA1PA2PA3PA4PA5PA6PA7

PC0PC1PC2PC3PC4PC5PC6PC7

PB0PB1PB2PB3PB4

PB5PB6PB7

AREF

GNDGND2

VCC

VCC

J3

CON16

12345678910111213141516

C21

1uF

VCC

J1

Sensor

123

C347u

C14

1uF

D8 1n4001

VCC

J9

Serial Port

123

R6

330

C1 0,1uF

VCC

SW

51

2

J7

Programing

13579

246810

VCC

R2

POT1 3

2

R5100K

Gambar 3.6. Perancangan Rangkaian Mikrokontroler Atmega 16.

Page 58: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

41

Pada mikrokontroler juga dilengkapi dengan tombol reset yang digunakan untuk

mereset program mikrokontroler. Reset dilakukan secara otomatis pada saat power

diaktifkan. Berdasar data sheet, reset terjadi saat adanya logika 1 selama 2 siklus mesin

pada pin 9 (RST). Dalam perancangan ini karena menggunakan osilator kristal 12 MHz

dan 1 siklus mesin dikerjakan dalam 12 periode osilator, maka 1 siklus mesin dikerjakan

selama :

Sehingga pada 1 siklusnya adalah :

Dengan demikian untuk keperluan reset dibutuhkan logika 1 pada pin RST

selama 2 x 1 µd = 2 µd. Pada perancangan ini, digunakan nilai kapasitor sebesar C =1 µF

dan nilai resistor sebesar R = 100 KΩ. Pada saat sumber daya diaktifkan, karena muatan

kapasitor masih kosong (VC=0),, maka pin RST akan terhubung langsung dengan Vcc.

Sejalan dengan pertambahan waktu, kapasitor akan diisi muatannya yang

mengakibatkan VC bertambah besar dan VR akan mengecil. Perlu diperhatikan disini

untuk power-on reset adalah nilai R dan C, agar VR selama minimal 2 ud masih dianggap

berlogika 1. Berdasarkan data sheet ATMega 16, diketahui tegangan masukan logika 1

pin RST memiliki batas bawah sebesar 0,7Vcc. Dengan memasukan rumus VR, maka

didapatkan perhitungan :

Page 59: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

42

Dengan demikian konstanta waktu RC haruslah lebih besar dari 5,602 µd. Jika

toleransi komponen R dan C diperhitungkan, maka pada perancangan digunakan waktu

reset (konstanta waktu RC) yang jauh lebih besar dari syarat, yaitu 100 ms dengan

menggunakan kapasitor C = 1 µF dan resistor R = 100 KΩ. Setelah power-on, kapasitor

akan terus terisi, hingga tegangan Vc sama dengan Vcc (dibutuhkan waktu 100 ms), yang

berarti pin RST akan berlogika 0 dan selesailah proses reset.

Pada diagram Alir pemrograman mikrokontroler seperti yang ditujukan pada

gambar 3.7, hal pertama kali adalah memulai program kemudian inisialisasi port, dimana

hal ini sangat penting sebagai patokan port mana saja yang akan digunakan sebagai I/O

pada mikrokontroler.

Berikut ini adalah adalah contoh program inisialisasi port :

Config Porta = InputConfig Portb = InputConfig Portd = Output

Config Lcdpin = Pin , Db4 = Portc.4 , Db5 = Portc.5 , Db6 = Portc.6 , Db7 = Portc.7 , E =Portd.7 , Rs = Portd.5Config Scl = Portc.0Config Sda = Portc.1Config Lcd = 16 * 2

Const Ds1307w = &HD0Const Ds1307r = &HD1

Page 60: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

43

Pada port C0 dan C1 digunakan untuk komunikasi serial I2C RTC DS1307,

sehingga diperlukan inisialisasi port pada awal program. Sedangkan Const DS1307w dan

Const Ds1307r digunakan untuk variabel yang nilainya tetap.

Pada program, mikrokontroler hanya melakukan penyimpanan pulsa KWH per

hari, sehingga untuk perhitungan biaya akan dilakukan pada program Visual Basic.

Berikut ini adalah program pada sub-routine Baca_sensor:

Baca_sensor:If Pina.0 = 1 Then

Waitms 40If Pina.0 = 1 Then

If Sudah = 0 ThenSudah = 1Kwh = Kwh + 1Gosub Tulis_eprom

End IfEnd If

ElseSudah = 0

End IfReturn

Pada program sub-routine Baca_sensor terdapat waktu tunda sekitar 40 ms.

Waktu tunda ini dimaksudkan untuk menghindari terjadinya bouncing pada pembacaan

sensor, sehingga data yang diterima atau dibaca oleh mikrokontroler menjadi lebih akurat.

Page 61: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

44

START

1. Inisialisasi Alamat Data2. Inisialisai Alamat LCD3. Inisialisasi Alamat RTC3. Inisialisasi Komunikasi Serial

Read_ds1307

Clock_init

Konvert

Cetak_ds1307

Baca_rs232

Baca_Sensor

Baca_eeprom

Cek_masukkan

Tulis_kwh

Check_setting

A

A

Jika setting=0

Cursor BlinkCursor On

Y

N

Cursor NoblinkCursor Off

Tulis_kwh

Gosub_masukkan1

Tunggu 100ms

B

B

C

C

Gambar 3.7. Diagram Alir Pemrograman Mikrokontroler Atmega 16

Page 62: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

45

3.6. Rangkaian RS232 ke Komputer

Komunikasi serial pada mikrokontroler ATMega16 dilakukan melalui port D dan

port A yang merupakan pin I/O dua arah pada mikrokontroler. Untuk melakukan

pengiriman data digunakan pin ke-15, yaitu pin PD1 sedangkan untuk melakukan

penerimaan data digunakan pin ke-14, yaitu pin PD0.

Untuk membangun hubungan komunikasi data serial memerlukan suatu

kecepatan data ( data transfer rate ) yang sesuai, baik di sisi komputer maupun di sisi

mikrokontroler. Oleh karena itu, diperlukan proses inisialisasi di sisi mikrokontroler.

Masukan TTL pada MAX232 ada dua, yaitu T1IN dan T2IN. Pada perancangan

dipilih T1IN sebagai masukan tegangan TTL dari mikrokontroler, yaitu data yang akan

dikirim. Sedangkan keluaran TTL pada MAX232 juga ada dua saluran, yaitu R1OUT dan

R2OUT. Pada perancangan dipilih R1OUT sebagai jalur data yang diterima oleh

mikrokontroler. Sedangkan masukan dan keluaran yang terhubung dengan port serial

dihubungkan dengan pin T1OUT dan R1IN. Ground pada rangkaian dengan ground pada

komputer dihubungkan, agar referensi tegangan antar kedua perangkat sama sehingga

data dapat diterima dan dikirim dengan acuan yang sama.

Fungsi kapasitor pada rangkaian pengubah level tegangan TTL ke level tegangan

RS232, yaitu sebagai kapasitor ekternal untuk voltage doubler. Masing-masing kapasitor

digunakan sebagai berikut :

1. C1 + sebagai kapasitor “+” internal voltage doubler.

2. C1 – sebagai kapsitor “+” internal voltage doubler.

3. C2 + sebagai kapasitor “+” internal voltage inverter.

4. C2 – sebagai kapasitor “-“ internal voltage inverter.

Page 63: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

46

Nilai – nilai kapasitor yang digunakan sesuai dengan nilai-nilai yang tertera pada

datasheet MAX232. Bila nilai C1 dan C2 dinaikan, maka akan mengurangi nilai

impedansi masukan rangkaian voltage doubler dan inverter. Bila nilai C3 dan C4

dinaikkan, maka akan mengurangi riak catu daya.

Pengaturan nilai baud rate pada mikrokontoler dilakukan dengan cara

menentukan nilai Register USART baud rate (UBRR) menggunakan rumus :

Nilai UBRR = (Frekuensi_kristal / (16 * baud_rate)) –1…………………..(3-2)

Sehingga jika ingin digunakan baud rate sebesar 9600 maka nilai UBBR dapat

dihitung :

Nilai UBRR = (11.052 MHz / (16*9600)) – 1

Nilai UBRR = 27…………………………………………………………..(3-3)

Untuk dapat terjadi komunikasi antara port serial DB9 dengan komputer terlebih

dahulu dilakukan pengubahan level tegangan dari level tegangan TTL yang hanya

mempunyai kondisi tegangan positif hingga nol ke level tegangan RS232 yang mampu

menghasilkan tegangan keluaran positif, negatif, dan nol. Level tegangan RS232 ini

diperlukan karena komputer tidak dapat membaca data yang dikirimkan jika hanya

mempunyai tegangan positif dan nol. Pengubahan level tegangan ini dapat dilakukan

dengan menambahkan IC MAX232 antara port serial DB9 dan serial port pada komputer.

Awal dari algoritma penyusunan perangkat lunak sebagai komunikasi terhadap

perangkat keras adalah inisislisasi port serial, yang bertujuan supaya data input tersebut

dapat dibaca atau diterima oleh PC dengan menggunakan peragkat lunak visual basic.

Penggalan program untuk inisialisasi port serial pada visual basic :

MSComm1.CommPort = 1

MSComm1.Settings = "9600,N,8,1"

Page 64: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

47

Program pada baris pertama menujukan pemilihan COM yang digunakan dalam

hal ini adalah COM1. Selanjutnya pada baris kedua yaitu setting MSComm, nilai 9600

menujukan baud rate yang digunakan, N menujukan bahwa setting port serial tanpa

paritas, 8 menunjukan jumlah data 8 bit, dan 1 menujukan jumlah bit stop adalah 1 bit.

Untuk dapat menggirimkan data atau menerima data maka dibutuhkan program

sebagai berikut :

MSComm1.PortOpen = True

Apabila sudah selesai mengirimkan atau menerima data maka dapat diganti nilai

true dengan false.

MSComm1.PortOpen = False

Dengan demikian tidak akan terjadi komunikasi antara software dengan

hardware.

3.7. Pemrograman Visual Basic

Visual basic di sini, berfungsi untuk menghitung jumlah biaya yang harus

dikeluarkan berdasarkan golongan listrik. Tampilan awal program ditujukan seperti pada

gambar 3.8.

Pada tampilan program tersebut, pertama kali adalah menekan “BUKA COM”

untuk mengecek, apakah com 1 tersedia atau tidak. Jika com 1 tidak tersedia maka blok

yang ditujukan nomer 2 akan berstatus “8005”, apabila com 1 digunakan untuk aplikasi

lain, maka akan berstatus "Port sedang dipakai aplikasi lain, silahkan dicek" , sehingga

com 1 tidak dapat digunakan. Untuk mengetahui apakah port siap digunakan maka akan

berstatus “TERHUBUNG”.

Page 65: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

48

Gambar 3.8. Tampilan Program Pemakaian Biaya Listrik

Selanjutnya tekan “BACA KWH” yang berarti program akan terhubung dengan

mikrokontroler, dan membaca data yang terdapat dalam EEPROM. Data telah terbaca,

ditampilkan pada program. Blok yang ditujukan oleh angka 1 mengartikan tanggal dan

bulan dari jumlah putaran piringan KWH terbaru, sedangkan blok nomer 3 menunjukan

jumlah putaran piringan KWH setiap hari selama 2 bulan.

Untuk blok yang ditujukan nomer 4 menandakan jumlah putaran piringan KWH

selama 31 hari atau sebulan. Dari blok 1, 2, 3, 4, merupakan data yang didapatkan dari

hasil pembacaan EEPROM Mikrokontroler. Untuk melakukan perhitungan biaya maka

sebelumnya harus melakukan pemilihan pada “Golongan Pelanggan” dan “Daya Listrik

Yang Digunakan”. Pemilihan ini sangat pengaruh pada rincian biaya yang akan dihitung,

Page 66: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

49

karena biaya setiap golongan akan sangat berbeda, begitu juga dengan pemilihan daya

listriknya juga berpengaruh terhadap perhitungan harganya.

Pada pemilihan golongan pelanggan listrik yang dipakai, disini disediakan 5

golongan yaitu golongan sosial, rumah tangga, bisnis, industri dan pemerintah.

Penggolongan ini didasarkan pada perbedaan tarif perKWH berdasarkan pada tabel 2.3.

Gambar 3.9 menunjukan diagram alir utama pada program pemakaian biaya

listrik. Pada blok perhitungan biaya, terdapat beberapa sub yang didalamnya terkandung 5

golongan pelanggan listrik.

Gambar 3.9. Diagram Alir Utama Program Visual Basic

Page 67: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

50

Untuk mendapatkan total putaran pada piringan KWH meter digunakan

persamaan (2-1). Perhitungan tersebut menghasilkan jumlah nilai p sebagai total putaran

yang dihasilkan, selanjutnya nilai p tersebut akan dibagi dengan 150, nilai 150

berdasarkan spesifikasi KWH meter. Hasil pembagian tersebut adalah pemakaian daya

listrik yang terpakai.

Gambar 3.10. Diagram Alir Perhitungan Biaya Listrik Pergolongan

Page 68: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

51

Pada diagram alir tersebut, perhitungan biaya yang akan dilakukan sesuai dengan

pilihan pengguna saat pertama kali program dijalankan. Jika nilai G=S, maka perhitungan

yang dilakukan masuk pada perhitungan golongan sosial, dan seterusnya.

Setelah perhitungan biaya pemakain listrik didasarkan pada golongan, maka jika

ada golongan yang memiliki tarif insentif dan disinsentif akan dilakukan perhitungan

kembali, sebelum ditampilkan pada program.

Gambar 3.11. Diagram Alir Perhitungan Biaya Listrik Golongan Sosial

Page 69: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

52

Perhitungan diagram alir jika masuk pada golongan rumah tangga, maka

dibedakan menjadi dua. Jika daya yang digunakan antara < 450 VA – 2200 VA pemakain

dayanya akan dihitung berdasarkan perblok. Sedangkan selain itu pemakaian dayanya

akan dihitung perKWH.

Untuk melakukan penghematan energi listrik, maka pemerintah memberikan

kebijakan suatu tarif progresif. Kebijakan tarif progresif bertujuan agar pelanggan

menekan pemakaian listrik hingga sebatas kebutuhan wajar aktivitas sehari-hari. Untuk

itu, pelanggan rumah tangga dengan pemakaian KWH <80% rata-rata nasional akan

mendapat insentif. Sebaliknya pelanggan dengan pemakaian KWH >80% rata-rata

nasional akan dikenakan disinsentif. Nilai insentif dan disinsentif yang dilakukan pada

perhitungan berdasarkan pada tabel 2.1 dan tabel 2.2. Pada penentuan apakah KWH

melebihi atau kurang dari 80% KWHRN, dilakukan pada data KWH.

Gambar 3.13 adalah diagram alir pada golongan bisnis, dimana pada golongan ini,

juga diterapkan penghematan listrik dengan adanya program insentif dan disinsentif. Pada

golongan bisnis hanya terdapat satu pilihan perhitungan yaitu pemakaian daya listrik akan

di hitung perblok.

Pada diagram alir golongan industri tidak dikenakan tarif insentif dan disinsentif.

Pada gambar 3.14 menerangkan diagram alir pada golongan pemerintah yang hanya akan

menghitung pemakaian daya listrik berdasarkan per KWH. Pada golongan ini juga ada

pemberian intensif dan intensif yang bertujuan agar pemerintah juga melakukan

penghematan listrik. Besarnya nilai insentif dan disinsentif juga berbeda pada setiap daya

yang dipakai sesuai pada tabel 2.1.

Pada golongan rumah tangga ARN diartikan sebagai KWH pemakaian rata-rata

nasional, sedangkan RN diartikan sebagai KWH pemakaian pelanggan.

Page 70: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

53

Gambar 3.12. Diagram Alir Perhitungan Biaya Listrik Golongan Rumah Tangga

Page 71: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

54

Gambar 3.13. Diagram Alir Perhitungan Biaya Listrik Golongan Bisnis

Gambar 3.14. Diagram Alir Perhitungan Biaya Listrik Golongan Industri

Page 72: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

55

Gambar 3.15. Diagram Alir Perhitungan Biaya Listrik Golongan Pemerintah

Page 73: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

56

BAB IVHASIL PENGAMATAN DAN PEMBAHASAN

Pada Bab ini akan dibuktikan hasil perancangan dengan menampilkan beberapa

hasil percobaan beserta analisanya.

4.1 Pengamatan Pada Rangkaian Sensor

Rangkaian sensor terdiri atas optokopler dan IC 74LS14. Saat optokopler aktif

karena terkena cahaya dari diode, maka IC 74LS14 akan mendapat masukan logika ‘0’

sehingga keluaran berupa logika ‘1’, dan sebaliknya, jika optokopler tidak aktif, maka IC

74LS14 akan mendapat input logika ‘1’ sehingga keluaran berupa logika ‘0’.

Berikut ini adalah table hasil pengukuran dan pengamatan pada rangkaian

sensor, di mana Vin pada IC 74LS14 sama dengan Vout pada rangkaian optokopler dan

Vout dari IC 74LS14 adalah masukan bagi mikrokontroler ATmega 16. Pengukuran

menggunakan alat ukur berupa multimeter digital.

Berdasarkan tabel 4.1, optokopler akan aktif (ON) jika tidak terkena cahaya.

Tabel 4.1 Hasil Pengamatan Pada Rangkaian Sensor

Tegangan Pada

IC74LS14

Kondisi Pada Optokopler

Kena Cahaya Tidak Kena Cahaya

Vin 0,5 V 4,7 V

Vout 4,6 V 0,8 V

Page 74: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

57

Berdasarkan tabel 4.1 dapat diketahui bahwa sensor optokopler akan aktif jika

terkena cahaya. Hal ini menunjukkan bahwa komponen pada sensor yaitu LED sebagai

pengirim cahaya serta fototransistor sebagai penerima cahaya bekerja dengan semestinya

sesuai dengan dasar teorinya. Pada nilai tegangan juga sudah sesuai dengan perancangan,

saat terhalang yaitu 4V – 4,8V, dan saat tidak terhalang 0,2V – 0,7V.

4.2 Pengamatan Pada Tampilan LCD

Pada pembuatan alat ini, tampilan LCD berguna untuk mengamati hari, tanggal,

jam, serta jumlah pulsa KWH Meter. Pada hasil percobaan LCD dapat menampilkan data

dengan baik dan sesuai yang diinginkan, seperti yang di tujukan pada gambar 4.1

Gambar 4.1. Tampilan LCD

Pada gambar 4.1 dapat diketahui bahwa alat dapat bekerja dengan baik, hal ini

dapat diketahui dengan berjalannya jam digital, serta jumlah pulsa KWH Meter.

Page 75: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

58

4.3 Pengamatan Pada Visual Basic

Pengamatan pada Visual Basic, program dapat berjalan dengan baik, dimana

program Visual Basic dapat membaca data yang tersimpan pada mikrokontroler. Seperti

pada gambar 4.2 :

Gambar 4.2 Tampilan Program Visual Basic

Berdasarkan pada gambar 4.2 dapat diketahui juga proses kalkulasi yang juga

bekerja baik dengan perhitungan sampai dengan total tagihan, serta komunikasi serial

antara mikrokontroler dengan Visual Basic, hal ini dapat diketahui pada kolom status

yang bertuliskan “Terhubung”.

Page 76: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

59

Berdasarkan pada gambar 4.3 dan 4.4 dapat terlihat pergeseran Jumlah Pulsa

KWH meter perhari, dimana pulsa per hari yang terdapat pada kolom 2 berpindah

kekolom 1 sedangkan kolom ke 2 terisi oleh jumlah pulsa per hari yang baru. Hal ini

mendakan bahwa mikrokontroler dapat menyimpan pemakaian listrik selama 2 bulan, dan

data tersebut tidak akan hilang walau terjadi pemadaman listrik. Data yang tersimpan

pada mikrokontroler tidak akan penuh, karena data akan selalu berubah dan bergeser ke

kolom 1.

Gambar 4.3 Penyimpana data selama 2 bulan

1

2

Page 77: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

60

Gambar 4.4. Pergeseran data pada bulan selanjutnya

4.4 Analisa

Untuk membuktikan apakah alat yang dibikin dapat bekerja dengan baik, maka

pengambilan data dilakukan dengan cara yang berbeda seperti berikut:

1. Pengambilan data yang dilakukan dalam waktu 4 jam dengan menggunakan beban

2 buah pemanas air dengan pemakain daya 120 Watt. Pengambilan data ini

dimaksudkan untuk mengetahui apakah mikrokontroler dapat bekerja dengan baik,

serta sebagai kalibrasi alat dengan KWH Meter analog.

2. Pengambilan data yang dilakukan selama 11 hari dengan beban pompa air.

Pengambilan data ini dimaksudkan untuk mengetahui apakah mikrokontroler dapat

menyimpan jumlah pulsa KWH Meter setiap hari, serta perhitungan pada bulan

berikutnya.

1

2

Page 78: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

61

Pada tabel 4.2 menunjukan percobaan yang dilakukan dengan cara pertama

Tabel 4.2. Hasil percobaan Pertama

JamTampilan pada KWH

Meter Analog

Tampilan jumlah Pulsa KWH

Meter Pada LCD

01.30 00001,7 0000000

02.30 00001,84 0000419

03.30 00001,93 0000690

04.30 00002,08 0001138

05.30 00002,19 0001466

Berdasarkan daya yang didapatkan pada tabel 4.5, maka dapat dicari berapa persen

kesalahan pada rangkain alat yang dibuat. Perhitungan Jumlah pulsa menggunakan

persaman (2-1) dan disesuaikan dengan spesifikasi KWH yaitu 150 putaran per KWH

sebagai berikut :

a. Pada 1 jam pertama (01.30-02.30) didapatkan pemakaian daya listrik sebesar :

- KWH Analog :

(1,84 – 1,7) = 0,14 menjadi 1,4 KWH

- LCD:

((419:2):150) = 1,39667 KWH

- Persen galat :

b. Pada 1 jam kedua (02.30-03.30) didapatkan pemakaian daya listrik sebesar :

Page 79: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

62

- KWH Analog :

(1,93 – 1,84) = 0,09 menjadi 0,9 KWH

- LCD:

((690-419):2):150 = 0,9 KWH

- Persen galat :

c. Pada 1 jam ketiga (03.30-04.30) didapatkan pemakaian daya listrik sebesar :

- KWH Analog :

(2,08 – 1,93) = 0,15 menjadi 1,5 KWH

- LCD:

((1138-690):2):150 = 1,4933 KWH

- Persen galat :

d. Pada 1 jam keempat (04.30-05.30) didapatkan pemakaian daya listrik sebesar :

- KWH Analog :

(2,17 – 2,08) = 0,11 menjadi 1,1 KWH

- LCD:

((1466-1138):2):150 = 1.0933 KWH

- Persen galat :

Berdasarkan perhitungan, dan dilakukan perbandingan antara KWH analog

dengan jumlah pulsa pada LCD didapatkan hasil dengan galat kurang dari 1%, hal ini

Page 80: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

63

membuktikan bahwa alat dapat bekerja dengan sangat baik, dengan tingkat kesalahan

yang cukup rendah.

Sedangkan pada percobaan kedua, pengambilan data dilakukan selama sebelas

hari, 10 hari pada bulan sebelumnya dan 1 hari pada bulan berikutnya.hal ini

dimaksudkan untuk mengetahui apakah mikrokontroler dapat melakukan penyimpanan

data perhari dan perbulan.

Program Visual Basic, pada bulan pertama didapatkan total putaran KWH Meter

sejumlah 1795, seperti yang ditujukan pada gambar 4.6. Perhitungan selanjutnya adalah

menghitung besarnya biaya yang harus dibayarkan pada bulan pertama, dengan daya yang

digunakan sebesar 1300 VA dengan golongan rumah tangga.

Dengan adanya kebijakan tarif progresif maka pelanggan dengan pemakaian

KWH <80% rata-rata nasional akan mendapat insentif. Pada golongan rumah tangga

dengan pemakaian daya sebesar 1300 VA, KWH pemakain rata-rata nasionalnya sebesar

60 KWH berdasarkan pada tabel 2.1 dan 2.2. Karena daya yg digunakan tidak melebihi

dari 60 KWH, maka mendapatkan insentif.

Berdasarkan perhitungan secara manual sebagai berikut ini :

Diketahui :

- Total putaran = 1795 : 2 = 897.5 putaran

- Daya listrik yang digunakan = 897.5 : 150 = 5,983 KWH

- Biaya Beban = (1300 : 1000) x Rp 30.100,- = Rp 39.130,00

- Biaya Pemakaian :

Blok I = 5,983 kWh x Rp 385,- = Rp 2.303,00 (+)

= Rp 41.433,00

Page 81: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

64

- Insentif = 20% x (197 – 6) x Rp. 495 = Rp 18.909,00 (-)

- Total = Rp 22.524,00

- Pajak = 8 % x Rp 22.524 = Rp 1.801,92 (+)

- Total Tagihan = Rp 24.325,92

Gambar 4.5 Tampilan Program Visual Basic Bulan Pertama

Pada program Visual Basic total tagihan yang dihasilkan sebesar Rp 24.324,84

sedangkan perhitungan manual sebesar Rp 24.325,92. Berdasarkan perhitungan manual

dan program Visual Basic didapatkan hasil yang hampir sama, perbedaan yang terjadi

pada perhitungan manual dikarenakan pembulatan yang dilakukan yaitu pembulatan

menjadi 2 angka dibelakang koma. Maka hal ini membuktikan program Visual Basic

bekerja sesuai dengan keinginan.

Page 82: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

65

Sedangkan program Visual Basic, pada bulan kedua didapatkan total putaran

KWH Meter sejumlah 141, seperti yang ditujukan pada gambar 4.7. Perhitungan

selanjutnya adalah menghitung besarnya biaya yang harus dibayarkan pada bulan kedua,

dengan daya yang digunakan sebesar 1300 VA dengan golongan rumah tangga.

Berdasarkan perhitungan secara manual sebagai berikut ini :

Diketahui :

- Total putaran = 141 : 2 = 70.5 putaran

- Daya listrik yang digunakan = 70.5 : 150 = 0,47 KWH

- Biaya Beban = (1300 : 1000) x Rp 30.100,- = Rp 39.130,00

- Biaya Pemakaian :

Blok I = 0,47 kWh x Rp 385,- = Rp 180,95,00 (+)

= Rp 39.310,95

- Insentif = 20% x (197 – 0,47) x Rp. 495 = Rp 19.456,47 (-)

- Total = Rp 19.854,48

- Pajak = 8 % x Rp 19.854,48 = Rp 1.588,4 (+)

- Total Tagihan = Rp 21.442,88

Page 83: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

66

Gambar 4.6 Tampilan Program Visual Basic Bulan Kedua

Pada program Visual Basic total tagihan yang dihasilkan sebesar Rp 21.443,4

sedangkan perhitungan manual sebesar Rp 21.442,88. Berdasarkan perhitungan manual

dan program Visual Basic didapatkan hasil yang hampir sama, perbedaan yang terjadi

pada perhitungan manual dikarenakan pembulatan yang dilakukan yaitu pembulatan

menjadi 2 angka dibelakang koma. Maka hal ini membuktikan program Visual Basic

bekerja sesuai dengan keinginan.

Berikut ini adalah simulasi yang dilakukan pada program dengan memasukan

sejumlah angka pada kolom jumlah pulsa KWH meter di program. Hal ini dimaksudkan

untuk perbandingan antara perhitungan manual dan program pada setiap golongan dan

daya yang digunakan.

Page 84: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

67

4.4.1 Golongan Sosial

Pada tabel 4.8. adalah simulasi yang dilakukan untuk golongan sosial. Simulasi

akan dibandingkan dengan perhitungan secara manual. Berikut ini adalah contoh

perhitungan manual pada golongan sosial :

- Pelanggan Tarif S2 Daya 900 VA, pemakaian energi 80 kWh.

- Perhitungan tagihan rekening listriknya sebagai berikut:

- Biaya Beban = (900 : 1000) x Rp 15.000 = Rp 13.500,00

- Biaya Pemakaian =

- Blok I = 20 kWh x Rp 200 = Rp 4.000,00

- Blok II = 60 kWh x Rp 295 = Rp 17.700,00

- Blok III = 0 kWh x Rp 360 = Rp 0 (+)

Total1 = Rp 35.200,00

- Pajak = 8% x Rp 35.200 = Rp 2.816,00 (+)

Total Tagihan = Rp 38.016,00

Berikut ini adalah hasil perbandingan dengan program Visual Basic.

Tabel 4.3. Data hasil perhitungan secara manual dan program pada golongan Sosial.

DayaPerhitungan

Daya yangdigunakan

(KWH)

Blok 1Rp

Blok2Rp

Blok3Rp

BebanRp

InsentifRp

DisinsentifRp

PajakRp

TotalRp

900VA

Manual

80

4000 17700 0 13500 0 0 2816 38016

program 4000 17700 0 13500 0 0 2816 38016

Pada tabel 4.3. didapatkan data hasil perhitungan secara manual dan program.

Berdasarkan data tersebut dapat diketahui bahwa perhitungan tidak mengalami perbedaan

atau sama persis. Hal ini menandakan bahwa program dapat melakukan perhitungan

dengan baik karena data yang dihasilkan sama persis dengan perhitungan manual. Karena

pada golongan sosial tidak dikenakan tarif progresif, maka pada golongan ini kolom

insentif dan disinsentif bernilai nol.

4.4.2 Golongan Rumah Tangga

Pada tabel 4.9. adalah simulasi yang dilakukan untuk golongan rumah tangga.

Simulasi dilakukan dengan memasukan sejumlah nilai pada kolom Jumlah Pulsa “KWH

Page 85: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

68

Meter” dan hasil perhitungan program akan dibandingkan dengan perhitungan secara

manual. Berikut ini adalah contoh perhitungan manual pada golongan rumah tangga :

- Pelanggan Tarif R1 Daya 900 VA, pemakaian energi 36 kWh.

- Perhitungan tagihan rekening listriknya sebagai berikut:

- Biaya Beban = (900 : 1000) x Rp 20.000 = Rp 18.000,00

- Biaya Pemakaian =

- Blok I = 20 kWh x Rp 275 = Rp 5.500,00

- Blok II = 16 kWh x Rp 445 = Rp 7.120,00

- Blok III = 0 kWh x Rp 495 = Rp 0 (+)

Total1 = Rp 30.620,00

- Insentif = 20% x (115 – 36) x Rp. 495 = Rp 7.821,00 (-)

Total2 = Rp 22.799,00

- Pajak = 8% x Rp 22.799 = Rp 1.823,92 (+)

Total Tagihan = Rp 24.622,92

Tabel 4.4. Data hasil perhitungan secara manual dan program pada golongan Rumah Tangga.

DayaPerhitungan

Daya yangdigunakan

(KWH)

Blok 1Rp

Blok2Rp

Blok3Rp

BebanRp

InsentifRp

DisinsentifRp

PajakRp

TotalRp

900VA

Manual

36

5500 7120 0 18000 7821 0 1823,92 24622,92

program 5500 7120 0 18000 7821 0 1823,92 24622,92

Pada tabel 4.4. didapatkan data hasil perhitungan secara manual dan program.

Berdasarkan data tersebut dapat diketahui bahwa perhitungan tidak mengalami perbedaan

atau sama persis. Hal ini menandakan bahwa program dapat melakukan perhitungan

dengan baik karena data yang dihasilkan sama persis dengan perhitungan manual. Pada

golongan Rumah Tangga dikenakan tarif progresif, jika pemakaian daya kurang dari 80%

rata-rata pemakaian daya nasional, maka akan dikenakan tarif insentif atau pengurangan

total tagihan listrik. Pada tabel 4.4 program dapat memilih pemakaian daya sebesar 36

KWH mendapatkan tarif insentif, hal ini menandakan bahwa program dapat bekerja

dengan baik.

Page 86: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

69

4.4.3 Golongan Bisnis

Pada tabel 4.10. adalah simulasi yang dilakukan untuk golongan rumah tangga.

Simulasi akan dibandingkan dengan perhitungan secara manual. Berikut ini adalah contoh

perhitungan manual pada golongan bisnis :

- Pelanggan Tarif B1 Daya 1300 VA, pemakaian energi 632 kWh.

- Perhitungan tagihan rekening listriknya sebagai berikut:

- Biaya Beban = (1300 : 1000) x Rp 28.200 = Rp 36.660,00

- Biaya Pemakaian =

- Blok I = 146 kWh x Rp 470 = Rp68.620,00

- Blok II = 486 kWh x Rp 473 = Rp 229.878,00 (+)

Total1 = Rp 335.158,00

- Dis-insentif = 0,35 x (632 – 150) x Rp. 473 = Rp 79.795,00 (+)

Total2 = Rp 414.953,00

- Pajak = 8% x Rp 414.953 = Rp 33.196,24 (+)

Total Tagihan = Rp 448.149,24

Tabel 4.5. Data hasil perhitungan secara manual dan program pada golongan Bisnis.

DayaPerhitungan

Daya yangdigunakan

(KWH)

Blok 1Rp

Blok2Rp

Blok3Rp

BebanRp

InsentifRp

DisinsentifRp

PajakRp

TotalRp

900VA

Manual

632

68620 229878 0 36660 0 79795 33196,24 448149,24

program 68620 229878 0 36660 0 79795 33196,24 448149,24

Pada tabel 4.5. didapatkan data hasil perhitungan secara manual dan program.

Berdasarkan data tersebut dapat diketahui bahwa perhitungan tidak mengalami perbedaan

atau sama persis. Hal ini menandakan bahwa program dapat melakukan perhitungan

dengan baik karena data yang dihasilkan sama persis dengan perhitungan manual. Pada

golongan Rumah Tangga dikenakan tarif progresif, jika pemakaian daya kurang dari 80%

rata-rata pemakaian daya nasional, maka akan dikenakan tarif insentif atau pengurangan

total tagihan listrik. Pada tabel 4.5. program dapat memilih pemakaian daya sebesar 632

KWH mendapatkan tarif disinsentif, hal ini menandakan bahwa program dapat bekerja

dengan baik.

Page 87: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

70

4.4.4 Golongan Industri

Pada tabel 4.11. adalah simulasi yang dilakukan untuk golongan industri.

Simulasi akan dibandingkan dengan perhitungan secara manual. Berikut ini adalah contoh

perhitungan manual pada golongan industri :

- Pelanggan Tarif I1 Daya 2200 VA, pemakaian energi 492 kWh.

- Perhitungan tagihan rekening listriknya sebagai berikut:

- Biaya Beban = (2200 : 1000) x Rp 32.000 = Rp 70.400,00

- Biaya Pemakaian =

- Blok I = 196 kWh x Rp 455 = Rp 89.180,00

- Blok II = 296 kWh x Rp 460 = Rp136.160,00 (+)

Total1 = Rp 295.740,00

- Pajak = 8% x Rp 295.740 = Rp 23.659,2 (+)

Total Tagihan = Rp 319.399,2

Tabel 4.6. Data hasil perhitungan secara manual dan program pada golongan Industri.

DayaPerhitungan

Daya yangdigunakan

(KWH)

Blok 1Rp

Blok2Rp

Blok3Rp

BebanRp

InsentifRp

DisinsentifRp

PajakRp

TotalRp

900VA

Manual

492

89180 136160 0 70400 0 0 23659,2 319399,2

program 89180 136160 0 70400 0 0 23659,2 319399,2

Pada tabel 4.6. didapatkan data hasil perhitungan secara manual dan program.

Berdasarkan data tersebut dapat diketahui bahwa perhitungan tidak mengalami perbedaan

atau sama persis. Hal ini menandakan bahwa program dapat melakukan perhitungan

dengan baik karena data yang dihasilkan sama persis dengan perhitungan manual. Karena

pada golongan sosial tidak dikenakan tarif progresif, maka pada golongan ini kolom

insentif dan disinsentif bernilai nol.

4.4.5 Golongan Pemerintah

Pada tabel 4.12. adalah simulasi yang dilakukan untuk golongan pemerintah.

Simulasi akan dibandingkan dengan perhitungan secara manual. Berikut ini adalah contoh

perhitungan manual pada golongan pemerintah :

Page 88: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

71

- Pelanggan Tarif P1 Daya 450 VA, pemakaian energi 123 kWh.

- Perhitungan tagihan rekening listriknya sebagai berikut:

- Biaya Beban = (450 : 1000) x Rp 20.000 = Rp 9.000,00

- Biaya Pemakaian =

- Blok I = 123 kWh x Rp 575 = Rp70.725,00 (+)

Total1 = Rp 79.725,00

- Dis-insentif = 0,3 x (123 – 71) x Rp. 575 = Rp 8.970,00 (+)

Total2 = Rp 88.695,00

- Pajak = 8% x Rp 88.695 = Rp 7.095,6 (+)

Total Tagihan = Rp 95.790,6

Tabel 4.7. Data hasil perhitungan secara manual dan program pada golongan Sosial.

DayaPerhitungan

Daya yangdigunakan

(KWH)

Blok 1Rp

Blok2Rp

Blok3Rp

BebanRp

InsentifRp

DisinsentifRp

PajakRp

TotalRp

900VA

Manual

123

70725 0 0 9000 0 8970 7095,6 95790,6

program 70725 0 0 9000 0 8970 7095,6 95790,6

Pada tabel 4.7. didapatkan data hasil perhitungan secara manual dan program.

Berdasarkan data tersebut dapat diketahui bahwa perhitungan tidak mengalami perbedaan

atau sama persis. Hal ini menandakan bahwa program dapat melakukan perhitungan

dengan baik karena data yang dihasilkan sama persis dengan perhitungan manual. Pada

golongan Rumah Tangga dikenakan tarif progresif, jika pemakaian daya kurang dari 80%

rata-rata pemakaian daya nasional, maka akan dikenakan tarif insentif atau pengurangan

total tagihan listrik. Pada tabel 4.7. program dapat memilih pemakaian daya sebesar 632

KWH mendapatkan tarif disinsentif, hal ini menandakan bahwa program dapat bekerja

dengan baik.

Page 89: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

72

BAB V

KESIMPULAN DAN SARAN

5.1 Kesimpulan

Dari hasil pengamatan dan pembahasan pada bagian sebelumnya dapat diambil

beberapa kesimpulan, antara lain :

1. Alat penampil biaya listrik berbasis Visual Basic yang telah dirancang dan

diimplementasikan terbukti telah mampu menghitung jumlah dan biaya

pemakaian energi listrik berdasarkan jumlah putaran piringan pada KWH

Meter mekanik dan menampilkan jumlah putaran pada LCD dan perhitungan

biaya pada Visual Basic.

2. Proses komunikasi antara PC dan mikro yang merupakan komunikasi serial

dapat bekerja dengan baik. Hal ini dapat terlihat pada pembacaan data mikro

yang dilakukan program Visual Basic.

3. Alat ini mampu menyimpan data pemakaian listrik selama 2 bulan.

5.2 Saran

Alat penampil biaya listrik Berbasis Visual Basic yang telah dibuat masih jauh

dari sempurna, karena itu penulis mencoba untuk memberikan saran-saran bagi

pengembangan lebih lanjut agar dapat menjadi lebih baik, yaitu :

1. Dibutuhkan perangkat penyimpanan yang lebih besar agar dapat menyimpan

pemakaian listrik perjam.

Page 90: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

73

DAFTAR PUSTAKA

[1] Dahl, David, Dave’s Watthour Meter Webpage, USA: www.watthourmeters.com,

2002.

[2] Perhitungan Intensif dan Disintensif tarif listrik : www.langitbiru.co.id, 2008.

[3] Website PT PLN Indonesia : www.pln.co.id, 2008.

[4] Optocoupler Data Sheet

[5] www.delta-electronic.com, diakses pada tanggal 1 Agustus 2008

[6] Budiharto, Widodo. 2008. Panduan Praktikum Mikrokontroler AVR Atnega16.

Jakarta : Elex Media Komputindo.

[7] www.wahyusp.wordpress.com/2008/08/12/real_time_clock_ds12c887/, diakses

tanggal 25 februari 2009

[8] HD44780U (Dot Matrix Liquid Crystal Display Controler/Driver), HITACHI,

Data Sheet

[9] Prasetia Retna, Edi Wibowo C., 2004, Interfacing Port Paralel dan Port Serial

komputer dengan Visual basic 6.0, Andi, Yogyakarta

[10] Komputer, Wahana. 2004. Tutorial Membuat Program Dengan Visual Basic.

Jakarta : Salemba Infotek.

Page 91: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

74

LAMPIRAN

Page 92: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

Tabel 4.8. Pengamatan Hasil Simulasi Golongan Sosial

DayaListrik.

PerhitunganDaya yangdigunakan

(KWH)

Blok 1Rp

Blok2Rp

Blok3Rp

BebanRp

InsentifRp

DisinsentifRp

PajakRp

TotalRp

200VA

Manual

10

14800 0 0 0 0 0 1184 15984

program 14800 0 0 0 0 0 1184 15984

450VA

Manual

40

3690 2650 0 4500 0 0 867,2 11707,2

program 3690 2650 0 4500 0 0 867,2 11707,2

900VA

Manual

80

4000 17700 0 13500 0 0 2816 38016

program 4000 17700 0 13500 0 0 2816 38016

1300VA

Manual

173

5000 20100 37665 32500 0 0 7621,2 102886,2

program 5000 20100 37665 32500 0 0 7621,2 102886,2

2200VA

Manual

300

5000 22200 92400 59400 0 0 14320 193320

program 5000 22200 92400 59400 0 0 14320 193320

Page 93: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

Tabel 4.9. Pengamatan Hasil Simulasi Golongan Rumah Tangga

DayaListrik.

PerhitunganDaya yangdigunakan

(KWH)

Blok 1Rp

Blok2Rp

Blok3Rp

BebanRp

InsentifRp

DisinsentifRp

PajakRp

TotalRp

450VA

Manual

10

1690 0 0 4950 6435 0 16,4 221,4

program 1690 0 0 4950 6435 0 16,4 221,4

900VA

Manual

36

5500 7120 0 18000 7821 0 1823,92 24622,92

program 5500 7120 0 18000 7821 0 1823,92 24622,92

1300VA

Manual

175

7700 26700 47025 39130 0 2945 9880 133380

program 7700 26700 47025 39130 0 2945 9880 133380

2200VA

Manual

250

7700 26700 84150 66440 10296 0 13983,52 188777,52

program 7700 26700 84150 66440 10296 0 13983,52 188777,52

>6000VA

Manual

374

11200 33600 164640 133760 0 0 27456 370656

program 11200 33600 164640 133760 0 0 27456 370656

<6000VA

Manual

482

18630 37260 243432 200640 0 0 39996,96 539958,96

program 18630 37260 243432 200640 0 0 39996,96 539958,96

Page 94: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

Tabel 4.10. Pengamatan Hasil Simulasi Golongan Bisnis

DayaListrik.

PerhitunganDaya yangdigunakan

(KWH)

Blok 1Rp

Blok2Rp

Blok3Rp

BebanRp

InsentifRp

DisinsentifRp

PajakRp

TotalRp

450VA

Manual

42

7620 5040 0 10575 2352 0 1670,64 22553,64

program 7620 5040 0 10575 2352 0 1670,64 22553,64

900VA

Manual

543

45360 202275 0 23850 0 61101 26606,88 359192,88

program 45360 202275 0 23850 0 61101 26606,88 359192,88

1300VA

Manual

632

68620 229878 0 36660 0 79795 33196,24 448149,24

program 68620 229878 0 36660 0 79795 33196,24 448149,24

2200VA

Manual

824

121920 295260 0 64240 0 245324 58139,6 784884,6

program 121920 295260 0 64240 0 245324 58139,6 784884,6

Page 95: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

Tabel 4.11. Pengamatan Hasil Simulasi Golongan Industri

DayaListrik.

PerhitunganDaya yangdigunakan

(KWH)

Blok 1Rp

Blok2Rp

Blok3Rp

BebanRp

InsentifRp

DisinsentifRp

PajakRp

TotalRp

450VA

Manual

90

4800 23700 0 11700 0 0 3216 43416

program 4800 23700 0 11700 0 0 3216 43416

900VA

Manual

276

22680 82620 0 28350 0 0 10692 144342

program 22680 82620 0 28350 0 0 10692 144342

1300VA

Manual

385

46800 129260 0 41340 0 0 17392 234792

program 46800 129260 0 41340 0 0 17392 234792

2200VA

Manual

492

89180 136160 0 70400 0 0 23659,2 319399,2

program 89180 136160 0 70400 0 0 23659,2 319399,2

Page 96: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

Tabel 4.12. Pengamatan Hasil Simulasi Golongan Pemerintah

DayaListrik.

PerhitunganDaya yangdigunakan

(KWH)

Blok 1Rp

Blok2Rp

Blok3Rp

BebanRp

InsentifRp

DisinsentifRp

PajakRp

TotalRp

450VA

Manual

123

70725 0 0 9000 0 8970 7095,6 95790,6

program 70725 0 0 9000 0 8970 7095,6 95790,6

900VA

Manual

234

140400 0 0 22140 0 24660 14976 202176

program 140400 0 0 22140 0 24660 14976 202176

1300VA

Manual

295

177000 0 0 31980 0 28560 19003,2 256543,2

program 177000 0 0 31980 0 28560 19003,2 256543,2

2200VA

Manual

375

225000 0 0 54120 0 57120 26899,2 363139,2

program 225000 0 0 54120 0 57120 26899,2 363139,2

>22000VA

Manual

463

277800 0 0 108240 0 0 30883,2 416923,2

program 277800 0 0 108240 0 0 30883,2 416923,2

Page 97: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

Rangkaian Penampil Biaya Listrik Berbasis Visual Basic

VCC

U1

ATMEGA 16

9

21

1030

1213

1415

1617181920

4039383736353433

2223242526272829

12345

678

32

3111

RESET

PD7

VCCAVCC

XTAL2XTAL1

PD0PD1

PD2PD3PD4PD5PD6

PA0PA1PA2PA3PA4PA5PA6PA7

PC0PC1PC2PC3PC4PC5PC6PC7

PB0PB1PB2PB3PB4

PB5PB6PB7

AREF

GNDGND2

J3

CON16

12345678910111213141516

C1 0,1uF

VCC

D8 1n4001

J1

Sensor

123

C347u

R5100K

SW

5

12

J9

Serial Port

123

R6

330

R32k7

SW

6

12

J7

Programing

13579

246810

R2

POT1 3

2

VCC

R4 2k7

VCC

SW

7

12

U9A

74LS14

12

C25

1uF

R9

10K

J4

power

12

C170,1u

C180,1u

U2

DS1307

4

7

5

12

63

8

GND

SQW/OUT

SDA

X1X2

SCLKVBAT

VCC

Y232,768Khz

VCC

U4

MAX232

13

8

11

10

1

3

4

5

2

6

12

9

14

7

16

15

R1IN

R2IN

T1IN

T2IN

C+

C1-

C2+

C2-

V+

V-

R1OUT

R2OUT

T1OUT

T2OUT

VCC

GND

VCC

R71M

C20

1uF

VCC

VCC

SW1

RE

SET

12

J2

LM7805

1 2 3

R8

10K

R10

10K

VCC

VCC

C12

30pF

C247u

C8

1uF

C21

1uF

BT1CR2303

12

C13

30pF

Y1

11.059MHZ

VCC

C19

1uF

C14

1uF

Page 98: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

Listing Program BASCOM untuk Rangkaian Penampil Biaya Listrik

Berbasis Visual Basic

'-----------------------------------------------------------------------------------------'name : KWH Meter.bas'micro : Mega16'-----------------------------------------------------------------------------------------$regfile = "m16def.dat"$crystal = 11059200$baud = 9600

Config Porta = InputConfig Portb = InputConfig Portd = Output

Config Lcdpin = Pin , Db4 = Portc.4 , Db5 = Portc.5 , Db6 = Portc.6 , Db7 = Portc.7 , E =Portd.7 , Rs = Portd.5Config Scl = Portc.0Config Sda = Portc.1Config Lcd = 16 * 2

Const Ds1307w = &HD0Const Ds1307r = &HD1

Dim Reg_sec As Byte , Reg_hour As Byte , Reg_min As Byte , Tempa As Byte , TempbAs ByteDim Reg_day As Byte , Reg_date As Byte , Reg_month As Byte , Reg_year As ByteDim Hari_ke As Byte , Hari As String * 4 , Tanggal As Byte , Bulan As Byte , Tahun AsByteDim Jam As Byte , Menit As Byte , Detik As Byte

Dim Setting As Byte , Maks As Byte , Sudah As Bit , Kwh As Integer , Kwh_str AsString * 7Dim Update As Bit , Tempc As String * 7Dim I As Byte , Posisi As Integer , J As Byte , Tempd As ByteDim Tambah As Byte , Baca As Bit , Data_rs232 As Byte , Tgl As Byte , Bln As Byte

Wait 1ClsPortd.4 = 0Setting = 0Sudah = 0Kwh = 0Update = 0Baca = 0Lcd "Tomy"

Page 99: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

Gosub Read_ds1307Gosub Clock_initGosub Baca_epromGosub Tulis_kwhDo

Gosub Check_masukkanIf Setting = 0 Then

Gosub Read_ds1307Gosub KonvertGosub Cetak_ds1307Cursor NoblinkCursor OffGosub Baca_rs232Gosub Baca_sensorGosub Baca_epromGosub Tulis_kwh

ElseCursor BlinkCursor OnGosub Check_setting

End IfGosub Masukkan1Waitms 100

Loop

End

Baca_rs232:Data_rs232 = Inkey()If Data_rs232 = 65 Then

Print " "Print TanggalPrint BulanTgl = TanggalBln = BulanFor Bulan = 0 To 1

For Tanggal = 1 To 31Gosub Baca_epromPrint Kwh

Next TanggalNext BulanBulan = BlnTanggal = TglGosub Baca_eprom

End IfReturn

Check_setting:Select Case Setting

Page 100: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

Case 1:Locate 1 , 1

Case 2:Locate 1 , 7

Case 3:Locate 1 , 10

Case 4:Locate 1 , 13

Case 5:Locate 2 , 1

Case 6:Locate 2 , 4

Case 7:Locate 2 , 7

End SelectReturn

Cetak_ds1307:Locate 1 , 1Lcd HariLocate 1 , 7If Tanggal < 10 Then Lcd "0"Lcd TanggalLcd "-"If Bulan < 10 Then Lcd "0"Lcd BulanLcd "-20"If Tahun < 10 Then Lcd "0"Lcd TahunLocate 2 , 1If Jam < 10 Then Lcd "0"Lcd JamLcd ":"If Menit < 10 Then Lcd "0"Lcd MenitLcd ":"If Detik < 10 Then Lcd "0"Lcd Detik

Return

Tulis_kwh:Kwh_str = Str(kwh)Locate 2 , 10Tempa = Len(kwh_str)Tempc = ""If Tempa < 7 Then

Tempb = 7 - TempaFor Tempa = 1 To Tempb

Tempc = Tempc + "0"

Page 101: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

NextEnd IfTempc = Tempc + Kwh_strLcd Tempc

Return

Baca_eprom:Tempa = Bulan Mod 2If Tempa = 0 Then Tambah = 31 Else Tambah = 0Posisi = Tanggal - 1Posisi = Posisi * 7Posisi = Posisi + TambahReadeeprom Kwh , PosisiIf Kwh = &HFFFF Then Kwh = 0Return

Tulis_eprom:Tempa = Bulan Mod 2If Tempa = 0 Then Tambah = 31 Else Tambah = 0Posisi = Tanggal - 1Posisi = Posisi * 7Posisi = Posisi + TambahWriteeeprom Kwh , PosisiWaitms 40Return

Baca_sensor:If Pina.0 = 1 Then

Waitms 40If Pina.0 = 1 Then

If Sudah = 0 ThenSudah = 1Kwh = Kwh + 1Gosub Tulis_eprom

End IfEnd If

ElseSudah = 0

End IfReturn

Return

Check_masukkan:If Pinb.1 = 0 Then

Waitms 20If Pinb.1 = 0 Then

Incr SettingIf Setting > 7 Then Setting = 0

Page 102: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

Tunggu:If Pinb.1 = 0 Then Goto Tunggu

End IfGosub Tulis_epromEnd If

Return

Masukkan1:If Pinb.3 = 0 Then

Waitms 40If Pinb.3 = 0 Then

Select Case SettingCase 1:

If Hari_ke < 7 Then Incr Hari_keCase 2:

If Bulan = 2 ThenMaks = Tahun Mod 4If Maks = 0 Then Maks = 29 Else Maks = 28

ElseSelect Case Bulan

Case 1:Maks = 31

Case 2:Maks = 30

Case 3:Maks = 31

Case 4:Maks = 30

Case 5:Maks = 31

Case 6:Maks = 30

Case 7:Maks = 31

Case 8:Maks = 31

Case 9:Maks = 30

Case 10:Maks = 31

Case 11:Maks = 30

Case 12:Maks = 31

End SelectEnd IfIf Tanggal < Maks Then Incr Tanggal

Case 3:If Bulan < 12 Then Incr Bulan

Page 103: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

Case 4:If Tahun < 99 Then Incr Tahun

Case 5:Incr JamIf Jam = 24 Then Jam = 0

Case 6:If Menit < 59 Then Incr Menit

Case 7:If Detik < 59 Then Incr Detik

End SelectEnd IfGosub Write_ds1307

ElseIf Pinb.2 = 0 Then

Waitms 40If Pinb.2 = 0 Then

Select Case SettingCase 1:

If Hari_ke > 0 Then Decr Hari_keCase 2:

Decr TanggalIf Tanggal = 0 Then Tanggal = 31

Case 3:If Bulan > 1 Then Decr Bulan

Case 4:If Tahun > 0 Then Decr Tahun

Case 5:If Jam > 0 Then Decr Jam Else Jam = 23

Case 6:If Menit > 0 Then Decr Menit

Case 7:If Menit > 0 Then Decr Detik

End SelectEnd IfGosub Write_ds1307

End IfEnd If

Return

Return

Konvert:Select Case Hari_ke

Case 1:Hari = "MING"

Case 2:Hari = "SEN "

Case 3:Hari = "SEL "

Page 104: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

Case 4:Hari = "RAB "

Case 5:Hari = "KAM "

Case 6:Hari = "JUM "

Case 7:Hari = "SAB "

End SelectReturn

Read_ds1307:I2cstartI2cwbyte Ds1307wI2cwbyte &H00I2cstop

'I2cstartI2cwbyte Ds1307rI2crbyte Reg_sec , AckI2crbyte Reg_min , AckI2crbyte Reg_hour , AckI2crbyte Reg_day , AckI2crbyte Reg_date , AckI2crbyte Reg_month , AckI2crbyte Reg_year , Nack

I2cstopJam = Makedec(reg_hour)Menit = Makedec(reg_min)Detik = Makedec(reg_sec)Hari_ke = Makedec(reg_day)Tanggal = Makedec(reg_date)Bulan = Makedec(reg_month)Tahun = Makedec(reg_year)

Return

'---------------------------------------------------------------------------Clock_init:'

Tempb = Reg_sec And &B01111111I2cstartI2cwbyte Ds1307wI2cwbyte &H00I2cwbyte TempbI2cstopWaitms 40

'Tempb = Reg_hour And &B10111111

Page 105: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

I2cstartI2cwbyte Ds1307wI2cwbyte &H02I2cwbyte TempbI2cstopWaitms 40

'Tempb = &B10010000I2cstartI2cwbyte Ds1307wI2cwbyte &H07I2cwbyte TempbI2cstopWaitms 40

Return'---------------------------------------------------------------------------

Write_ds1307:Reg_hour = Makebcd(jam)Reg_min = Makebcd(menit)Reg_sec = Makebcd(detik)Reg_day = Makebcd(hari_ke)Reg_date = Makebcd(tanggal)Reg_month = Makebcd(bulan)Reg_year = Makebcd(tahun)I2cstartI2cwbyte Ds1307wI2cwbyte &H00I2cwbyte Reg_secI2cwbyte Reg_minI2cwbyte Reg_hourI2cwbyte Reg_dayI2cwbyte Reg_dateI2cwbyte Reg_monthI2cwbyte Reg_yearI2cstopWaitms 20Gosub Read_ds1307Gosub KonvertGosub Cetak_ds1307

Return

Page 106: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

Listing Program Visual Basic untuk Rangkaian Penampil Biaya Listrik

Berbasis Visual Basic

Dim Message_buffer As StringDim tempa As StringDim Total1 As IntegerDim Total2 As IntegerDim Kirim As ByteDim kali As IntegerDim Perintah As StringDim teks(24) As StringDim i As IntegerDim j As IntegerDim teks1(24) As StringDim hex As StringDim dum1 As StringDim dec As ByteDim hex_dec As BytePrivate Sub Command1_Click()On Error GoTo X1x2:MSComm1.CommPort = 1MSComm1.Settings = "9600,n,8,1"MSComm1.Handshaking = comNonePerintah = ""If MSComm1.PortOpen = False Then

MSComm1.PortOpen = TrueMSComm1.DTREnable = TrueMSComm1.RTSEnable = TrueMSComm1.RThreshold = 1MSComm1.InputLen = 1Text1.Text = "TERHUBUNG"Command1.Enabled = FalseCommand2.Enabled = TrueCommand4.Enabled = TrueKirim = 0

ElseText1.Text = "Port sudah dibuka"

End IfExit SubX1:

Text1.Text = Text1.Text + Str(Err.Number)If Err.Number = 8005 Then

Text1.Text = "Port sedang dipakai aplikasi lain, silahkan dicheck"End If

End Sub

Page 107: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

Private Sub Command2_Click()If MSComm1.PortOpen = True Then

MSComm1.PortOpen = FalseCommand1.Enabled = TrueCommand2.Enabled = FalseCommand4.Enabled = FalseText1.Text = "TERPUTUS"

End IfEnd Sub

Private Sub Command3_Click()EndEnd Sub

Private Sub Command4_Click()Text4.Text = ""Text5.Text = ""For i = 0 To 61

Text6(i).BackColor = &H80000005Text6(i) = ""

Next iMessage_buffer = ""Perintah = "A"MSComm1.Output = "A" + Chr(13)

End Sub

Private Sub Command5_Click()Dim blok1 As LongDim blok2 As LongDim blok3 As LongDim insentif As LongDim disinsentif As LongDim hrg1 As LongDim hrg2 As LongDim hrg3 As LongDim beban As LongDim total As LongDim n1 As IntegerDim n2 As IntegerDim n As Singleblok1 = 0blok2 = 0blok3 = 0beban = 0insentif = 0disinsentif = 0n1 = 30n2 = 60

Page 108: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

'----------------------------------GOLONGAN SOSIAL------------------------------------------'

If Option1.Value = True Thenhrg1 = 0hrg2 = 0hrg3 = 0If Combo2.ListIndex = 0 Then

hrg1 = 14800hrg2 = 0hrg3 = 0n1 = 1

ElseIf Combo2.ListIndex = 1 Then

hrg1 = 123hrg2 = 265hrg3 = 360beban = 4500n1 = 30n2 = 60

ElseIf Combo2.ListIndex = 2 Then

hrg1 = 200hrg2 = 295hrg3 = 360beban = 13500n1 = 20n2 = 60

ElseIf Combo2.ListIndex = 3 Then

hrg1 = 250hrg2 = 335hrg3 = 405beban = 32500n1 = 20n2 = 60

ElseIf Combo2.ListIndex = 4 Then

hrg1 = 250hrg2 = 370hrg3 = 420beban = 59400n1 = 20n2 = 60

End IfEnd If

End IfEnd If

End If

Page 109: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

n = Text69.Textp = (n / 2)kwh = p / 150Text10.Text = kwhIf kwh <= n1 Thenblok1 = kwh * hrg1

ElseIf kwh < n2 Then

blok1 = n1 * hrg1blok2 = (kwh - n1) * hrg2

Elseblok1 = n1 * hrg1blok2 = n2 * hrg2blok3 = (kwh - n1 - n2) * hrg3

End IfEnd If

End If

'------------------------GOLONGAN RUMAH TANGGA--------------------------------------'

If Option2.Value = True Thenhrg1 = 0hrg2 = 0hrg3 = 0If Combo2.ListIndex = 0 Then

hrg1 = 169hrg2 = 360hrg3 = 495beban = 4950n1 = 30n2 = 60RN = 75ARN = 60He = 495F = 0.3

ElseIf Combo2.ListIndex = 1 Then

hrg1 = 275hrg2 = 445hrg3 = 495beban = 18000n1 = 20n2 = 60RN = 115ARN = 92He = 495F = 0.3

ElseIf Combo2.ListIndex = 2 Then

Page 110: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

hrg1 = 385hrg2 = 445hrg3 = 495beban = 39130n1 = 20n2 = 60RN = 197ARN = 158He = 495F = 0.35

ElseIf Combo2.ListIndex = 3 Then

hrg1 = 390hrg2 = 445hrg3 = 495beban = 66440n1 = 20n2 = 60RN = 354ARN = 283He = 495F = 0.8

ElseIf Combo2.ListIndex = 4 Then

hrg1 = 560hrg2 = 560hrg3 = 560beban = 133760n1 = 20n2 = 60

ElseIf Combo2.ListIndex = 5 Then

hrg1 = 621hrg2 = 621hrg3 = 621beban = 200640n1 = 30n2 = 60

End IfEnd If

End IfEnd If

End IfEnd Ifn = Text69.Textp = (n / 2)kwh = p / 150Text10.Text = kwh

Page 111: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

If kwh <= n1 Thenblok1 = kwh * hrg1

ElseIf kwh < n2 Then

blok1 = n1 * hrg1blok2 = (kwh - n1) * hrg2

Elseblok1 = n1 * hrg1blok2 = n2 * hrg2blok3 = (kwh - n1 - n2) * hrg3

End IfEnd If

End If

'----------------------------------GOLONGAN BISNIS-------------------------------------------'

If Option3.Value = True Thenhrg1 = 0hrg2 = 0hrg3 = 0If Combo2.ListIndex = 0 Then

hrg1 = 254hrg2 = 420beban = 10575n1 = 30RN = 70ARN = 56He = 420F = 0.3

ElseIf Combo2.ListIndex = 1 Then

hrg1 = 420hrg2 = 465beban = 23850n1 = 108RN = 131ARN = 105He = 465F = 0.3

ElseIf Combo2.ListIndex = 2 Then

hrg1 = 470hrg2 = 473beban = 36660n1 = 146RN = 187ARN = 150He = 473F = 0.35

Page 112: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

ElseIf Combo2.ListIndex = 3 Then

hrg1 = 480hrg2 = 518beban = 64240n1 = 254RN = 290ARN = 232He = 518F = 0.8

End IfEnd If

End IfEnd Ifn = Text69.Textp = (n / 2)kwh = p / 150Text10.Text = kwhIf kwh <= n1 Then

blok1 = n1 * hrg1Else

If kwh > n1 Thenblok1 = n1 * hrg1blok2 = (kwh - n1) * hrg2

End IfEnd If

End If

'------------------------------GOLONGAN INDUSTRI-------------------------------------------'

If Option4.Value = True Thenhrg1 = 0hrg2 = 0hrg3 = 0If Combo2.ListIndex = 0 Then

hrg1 = 160hrg2 = 395beban = 11700n1 = 30

ElseIf Combo2.ListIndex = 1 Then

hrg1 = 315hrg2 = 405beban = 28350n1 = 72

ElseIf Combo2.ListIndex = 2 Then

hrg1 = 450hrg2 = 460

Page 113: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

beban = 41340n1 = 104

ElseIf Combo2.ListIndex = 3 Then

hrg1 = 455hrg2 = 460beban = 70400n1 = 196

End IfEnd If

End IfEnd Ifn = Text69.Textp = (n / 2)kwh = p / 150Text10.Text = kwhIf kwh <= n1 Then

blok1 = n1 * hrg1Else

If kwh > n1 Thenblok1 = n1 * hrg1blok2 = (kwh - n1) * hrg2

End IfEnd If

End If

'-----------------------------GOLONGAN PEMERINTAH--------------------------------------'

If Option5.Value = True Thenhrg1 = 0hrg2 = 0hrg3 = 0If Combo2.ListIndex = 0 Then

hrg1 = 575beban = 9000RN = 89ARN = 71He = 575F = 0.3

ElseIf Combo2.ListIndex = 1 Then

hrg1 = 600beban = 22140RN = 121ARN = 97He = 600F = 0.3

ElseIf Combo2.ListIndex = 2 Then

Page 114: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

hrg1 = 600beban = 31980RN = 199ARN = 159He = 600F = 0.35

ElseIf Combo2.ListIndex = 3 Then

hrg1 = 600beban = 54120RN = 320ARN = 256He = 600F = 0.8

ElseIf Combo2.ListIndex = 4 Then

hrg1 = 600beban = 108240

End IfEnd If

End IfEnd If

End Ifn = Text69.Textp = (n / 2)kwh = p / 150Text10.Text = kwhblok1 = kwh * hrg1

End If

If kwh <= ARN Theninsentif = (0.2) * (RN - kwh) * (He) '----------insentif-------------'Text12.Text = insentifText13.Text = ""

Elsedisinsentif = (F) * (kwh - ARN) * (He) '-----------disinsentif---------------'Text12.Text = ""Text13.Text = disinsentif

End If

Text7.Text = Str(blok1)Text8.Text = Str(blok2)Text9.Text = Str(blok3)Text11.Text = bebantotal = blok1 + blok2 + blok3 + beban - insentif + disinsentifpajak = 0.08 * Str(total)Text14.Text = pajakTP = pajak + Str(total)Text15.Text = TP

Page 115: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

End SubPrivate Sub Command6_Click()

Dim blok1 As LongDim blok2 As LongDim blok3 As LongDim insentif As LongDim disinsentif As LongDim hrg1 As LongDim hrg2 As LongDim hrg3 As LongDim beban As LongDim total As LongDim n1 As IntegerDim n2 As IntegerDim n As Singleblok1 = 0blok2 = 0blok3 = 0beban = 0insentif = 0disinsentif = 0n1 = 30n2 = 60

'---------------------------GOLONGAN SOSIAL-----------------------------------------------'

If Option1.Value = True Thenhrg1 = 0hrg2 = 0hrg3 = 0If Combo2.ListIndex = 0 Then

hrg1 = 14800hrg2 = 0hrg3 = 0n1 = 1

ElseIf Combo2.ListIndex = 1 Then

hrg1 = 123hrg2 = 265hrg3 = 360beban = 4500n1 = 30n2 = 60

ElseIf Combo2.ListIndex = 2 Then

hrg1 = 200hrg2 = 295hrg3 = 360beban = 13500

Page 116: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

n1 = 20n2 = 60

ElseIf Combo2.ListIndex = 3 Then

hrg1 = 250hrg2 = 335hrg3 = 405beban = 32500n1 = 20n2 = 60

ElseIf Combo2.ListIndex = 4 Then

hrg1 = 250hrg2 = 370hrg3 = 420beban = 59400n1 = 20n2 = 60

End IfEnd If

End IfEnd If

End Ifn = Text71.Textp = (n / 2)kwh = p / 150Text10.Text = kwhIf kwh <= n1 Thenblok1 = kwh * hrg1

ElseIf kwh < n2 Then

blok1 = n1 * hrg1blok2 = (kwh - n1) * hrg2

Elseblok1 = n1 * hrg1blok2 = n2 * hrg2blok3 = (kwh - n1 - n2) * hrg3

End IfEnd If

End If

'-----------------------------GOLONGAN RUMAH TANGGA---------------------------------'

If Option2.Value = True Thenhrg1 = 0hrg2 = 0hrg3 = 0If Combo2.ListIndex = 0 Then

hrg1 = 169

Page 117: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

hrg2 = 360hrg3 = 495beban = 4950n1 = 30n2 = 60RN = 75ARN = 60He = 495F = 0.3

ElseIf Combo2.ListIndex = 1 Then

hrg1 = 275hrg2 = 445hrg3 = 495beban = 18000n1 = 20n2 = 60RN = 115ARN = 92He = 495F = 0.3

ElseIf Combo2.ListIndex = 2 Then

hrg1 = 385hrg2 = 445hrg3 = 495beban = 39130n1 = 20n2 = 60RN = 197ARN = 158He = 495F = 0.35

ElseIf Combo2.ListIndex = 3 Then

hrg1 = 390hrg2 = 445hrg3 = 495beban = 66440n1 = 20n2 = 60RN = 354ARN = 283He = 495F = 0.8

ElseIf Combo2.ListIndex = 4 Then

hrg1 = 560

Page 118: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

hrg2 = 560hrg3 = 560beban = 133760n1 = 20n2 = 60

ElseIf Combo2.ListIndex = 5 Then

hrg1 = 621hrg2 = 621hrg3 = 621beban = 200640n1 = 30n2 = 60

End IfEnd If

End IfEnd If

End IfEnd Ifn = Text71.Textp = (n / 2)kwh = p / 150Text10.Text = kwhIf kwh <= n1 Then

blok1 = kwh * hrg1Else

If kwh < n2 Thenblok1 = n1 * hrg1blok2 = (kwh - n1) * hrg2

Elseblok1 = n1 * hrg1blok2 = n2 * hrg2blok3 = (kwh - n1 - n2) * hrg3

End IfEnd If

End If

'----------------------------------GOLONGAN BISNIS----------------------------------------'

If Option3.Value = True Thenhrg1 = 0hrg2 = 0hrg3 = 0If Combo2.ListIndex = 0 Then

hrg1 = 254hrg2 = 420beban = 10575n1 = 30RN = 70

Page 119: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

ARN = 56He = 420F = 0.3

ElseIf Combo2.ListIndex = 1 Then

hrg1 = 420hrg2 = 465beban = 23850n1 = 108RN = 131ARN = 105He = 465F = 0.3

ElseIf Combo2.ListIndex = 2 Then

hrg1 = 470hrg2 = 473beban = 36660n1 = 146RN = 187ARN = 150He = 473F = 0.35

ElseIf Combo2.ListIndex = 3 Then

hrg1 = 480hrg2 = 518beban = 64240n1 = 254RN = 290ARN = 232He = 518F = 0.8

End IfEnd If

End IfEnd Ifn = Text71.Textp = (n / 2)kwh = p / 150Text10.Text = kwhIf kwh <= n1 Then

blok1 = n1 * hrg1Else

If kwh > n1 Thenblok1 = n1 * hrg1blok2 = (kwh - n1) * hrg2

End IfEnd If

Page 120: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

End If

'----------------------------GOLONGAN INDUSTRI--------------------------------------------'

If Option4.Value = True Thenhrg1 = 0hrg2 = 0hrg3 = 0If Combo2.ListIndex = 0 Then

hrg1 = 160hrg2 = 395beban = 11700n1 = 30

ElseIf Combo2.ListIndex = 1 Then

hrg1 = 315hrg2 = 405beban = 28350n1 = 72

ElseIf Combo2.ListIndex = 2 Then

hrg1 = 450hrg2 = 460beban = 41340n1 = 104

ElseIf Combo2.ListIndex = 3 Then

hrg1 = 455hrg2 = 460beban = 70400n1 = 196

End IfEnd If

End IfEnd Ifn = Text71.Textp = (n / 2)kwh = p / 150Text10.Text = kwhIf kwh <= n1 Then

blok1 = n1 * hrg1Else

If kwh > n1 Thenblok1 = n1 * hrg1blok2 = (kwh - n1) * hrg2

End IfEnd If

End If

Page 121: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

'----------------------------------GOLONGAN PEMERINTAH----------------------------------'

If Option5.Value = True Thenhrg1 = 0hrg2 = 0hrg3 = 0If Combo2.ListIndex = 0 Then

hrg1 = 575beban = 9000RN = 89ARN = 71He = 575F = 0.3

ElseIf Combo2.ListIndex = 1 Then

hrg1 = 600beban = 22140RN = 121ARN = 97He = 600F = 0.3

ElseIf Combo2.ListIndex = 2 Then

hrg1 = 600beban = 31980RN = 199ARN = 159He = 600F = 0.35

ElseIf Combo2.ListIndex = 3 Then

hrg1 = 600beban = 54120RN = 320ARN = 256He = 600F = 0.8

ElseIf Combo2.ListIndex = 4 Then

hrg1 = 600beban = 108240

End IfEnd If

End IfEnd If

End Ifn = Text71.Textp = (n / 2)kwh = p / 150

Page 122: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

Text10.Text = kwhblok1 = kwh * hrg1

End If

If kwh <= ARN Theninsentif = (0.2) * (RN - kwh) * (He) '----------insentif-------------'Text12.Text = insentifText13.Text = ""

Elsedisinsentif = (F) * (kwh - ARN) * (He) '-----------disinsentif---------------'Text12.Text = ""Text13.Text = disinsentif

End If

Text7.Text = Str(blok1)Text8.Text = Str(blok2)Text9.Text = Str(blok3)Text11.Text = bebantotal = blok1 + blok2 + blok3 + beban - insentif + disinsentifpajak = 0.08 * Str(total)Text14.Text = pajakTP = pajak + Str(total)Text15.Text = TPEnd Sub

Private Sub Command7_Click()Text7.Text = "0"Text8.Text = "0"Text9.Text = "0"Text10.Text = "0"Text11.Text = "0"Text12.Text = "0"Text13.Text = "0"Text14.Text = "0"Text15.Text = "0"End SubPrivate Sub Form_Load()

Combo2.ClearCombo2.Enabled = False

End Sub

Private Sub MSComm1_OnComm()

Dim tempb As StringDim tempc As StringStatic CEvent As StringDim CChar As String * 1Dim CountA As IntegerDim Tgl As IntegerDim total As Integer

Page 123: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

Select Case MSComm1.CommEventCase comEvReceive

Message_Store = TrueDo

CChar = MSComm1.InputSelect Case CChar

Case ">"Greater_Sign = True

Case vbLf

Case vbCrMessage_buffer = Message_buffer & CChar

Case ElseMessage_buffer = Message_buffer & CCharCEvent = CEvent + CChar

End SelectLoop While MSComm1.InBufferCount

End Select

tempa = Message_bufferj = 0Total1 = 0Total2 = 0

For i = 1 To Len(tempa)tempb = Mid(tempa, i, 1)If tempb <> Chr(13) Then

tempc = tempc + tempb

ElseIf tempc <> " " Thenj = j + 1If j = 1 Then Text4.Text = tempcIf j = 2 Then Text5.Text = tempcTgl = Val(Text4.Text)CountA = Val(Text5.Text)If CountA Mod 2 = 0 ThenIf Val(Text5.Text) - 1 = 0 Then

Label3.Caption = "BULAN 12"Else

Label3.Caption = "BULAN " + Str(Val(Text5.Text) - 1)End IfLabel4.Caption = "BULAN " + Text5.TextIf j > 2 ThenIf j > 33 Then

If tempc > 0 Then Text6(j - 34).Text = tempcEnd IfIf (j < 34) And ((j - 3) < Tgl) Then

Page 124: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

If tempc > 0 Then Text6(j + 28) = tempcEnd IfEnd IfElseIf Val(Text5.Text) - 1 = 0 Then

Label3.Caption = "BULAN 12"Else

Label3.Caption = "BULAN " + Str(Val(Text5.Text) - 1)End IfLabel4.Caption = "BULAN " + Text5.TextCountA = j - 34If j > 2 ThenIf j < 34 Then

If tempc > 0 Then Text6(j - 3).Text = tempcEnd IfIf j = 34 Then

If tempc > 0 Then Text6(31).Text = tempcEnd IfIf (j > 34) And ((j - 34) < Tgl) Then

If tempc > 0 Then Text6(j - 3) = tempcEnd IfEnd IfEnd IfEnd Iftempc = ""

End IfNext iTotal1 = 0Total2 = 0Tgl = Val(Text4.Text)CountA = Val(Text5.Text)For i = 0 To 30

If Text6(i).Text <> "" ThenTotal1 = Total1 + Str(Text6(i).Text)

End IfNext iTgl = Val(Text4.Text)CountA = Val(Text5.Text)For i = 31 To 61

If ((i - 30) = Tgl) ThenText6(i).BackColor = &H80000003

ElseText6(i).BackColor = &H80000005

End IfIf Text6(i).Text <> "" Then

Total2 = Total2 + Str(Text6(i).Text)End If

Next iText69.Text = Str(Total1)

Page 125: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

Text71.Text = Str(Total2)

End SubPrivate Sub Option1_Click()

If Option1.Value = True ThenCombo2.ClearCombo2.AddItem ("200VA")Combo2.AddItem ("450VA")Combo2.AddItem ("900VA")Combo2.AddItem ("1300VA")Combo2.AddItem ("2200VA")Combo2.Enabled = True

End IfEnd Sub

Private Sub Option2_Click()If Option2.Value = True Then

Combo2.ClearCombo2.AddItem ("450VA")Combo2.AddItem ("900VA")Combo2.AddItem ("1300VA")Combo2.AddItem ("2200VA")Combo2.AddItem ("s/d 6600VA")Combo2.AddItem (">6600VA")Combo2.Enabled = True

End IfEnd Sub

Private Sub Option3_Click()If Option3.Value = True Then

Combo2.ClearCombo2.AddItem ("450VA")Combo2.AddItem ("900VA")Combo2.AddItem ("1300VA")Combo2.AddItem ("2200VA")Combo2.Enabled = True

End IfEnd Sub

Private Sub Option4_Click()If Option4.Value = True Then

Combo2.ClearCombo2.AddItem ("450VA")Combo2.AddItem ("900VA")Combo2.AddItem ("1300VA")Combo2.AddItem ("2200VA")Combo2.Enabled = True

End IfEnd Sub

Page 126: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

Private Sub Option5_Click()If Option5.Value = True Then

Combo2.ClearCombo2.AddItem ("450VA")Combo2.AddItem ("900VA")Combo2.AddItem ("1300VA")Combo2.AddItem ("2200VA")Combo2.AddItem (">2200VA s/d 200KVA")Combo2.Enabled = True

End IfEnd Sub

Page 127: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

Application Note AN-3001

Optocoupler Input Drive Circuits

www.fairchildsemi.com

REV. 4.00 4/30/02

An optocoupler is a combination of a light source and a photosensitive detector. In the optocoupler, or photon coupled pair, the coupling is achieved by light being generated on one side of a transparent insulating gap and being detected on the other side of the gap without an electrical connection between the two sides (except for a minor amount of coupling capacitance). In the Fairchild Semiconductor optocouplers, the light is generated by an infrared light emitting diode, and the photo-detector is a silicon diode which drives an amplifier, e.g., transistor. The sensitivity of the silicon material peaks at the wavelength emitted by the LED, giving maximum signal coupling.

Where the input to the optocoupler is a LED, the input characteristics will be the same, independent of the type of detector employed. The LED diode characteristics are shown in Figure 1. The forward bias current threshold is shown at approximately 1 volt, and the current increases exponen-tially, the useful range of I

F

between 1 mA and 100 mA being delivered at a V

F

between 1.2 and 1.3 volts. The dynamic values of the forward bias impedance are current dependent and are shown on the insert graph for R

DF

and

R as defined in the figure. Reverse leakage is in the nano-ampere range before avalanche breakdown.

The LED equivalent circuit is represented in Figure 2, along with typical values of the components. The diode equations are provided if needed for computer modeling and the con-stants of the equations are given for the IR LED’s. Note that the junction capacitance is large and increases with applied forward voltage. An actual plot of this capacitance variation with applied voltage is shown on the graph of Figure 3. It is this large capacitance controlled by the driver impedance which influences the pulse response of the LED. The capaci-tance must be charged before there is junction current to create light emission. This effect causes an inherent delay of 10-20 nanoseconds or more between applied current and light emission in fast pulse conditions.

The LED is used in the forward biased mode. Since the current increases very rapidly above threshold, the device should always be driven in a current mode, not voltage driven. The simplest method of achieving the current drive is to provide a series current-limiting resistor, as shown in Figure 4, such that the difference between V

APP

and V

F

is

dropped across the resistor at the desired I

F

, determined from other criteria. A silicon diode is shown installed inversely parallel to the LED. This diode is used to protect the reverse breakdown of the LED and is the simplest method of achiev-ing this protection. The LED must be protected from exces-sive power dissipation in the reverse avalanche region. A small amount of reverse current will not harm the LED, but it must be guarded against unexpected current surges.

The forward voltage of the LED has a negative temperature coefficient of 1.05 mV/°C and the variation is shown in Figure 5.

The brightness of the IR LED slowly decreases in an expo-nential fashion as a function of forward current (I

F

) and time. The amount of light degradation is graphed in Figure 6 which is based on experimental data out to 20,000 hours. A 50% degradation is considered to be the failure point. This degradation must be considered in the initial design of optoisolator circuits to allow for the decrease and still remain within design specifications on the current-transfer-ratio (CTR) over the design lifetime of the equipment. Also, a limitation on I

F

drive is shown to extend useful lifetime of the device.

In some circumstances it is desirable to have a definite threshold for the LED above the normal 1.1 volts of the diode V

F

. This threshold adjustment can be obtained by shunting the LED by a resistor, the value of which is determined by a ratio between the applied voltage, the series resistor, and the desired threshold. The circuit of Figure 7 shows the relationship between these values. The calculations will determine the resistor values required for a given I

FT

and V

A

. It is also quite proper to connect several LED’s in series to share the same I

F

. The V

F

of the series is the sum of the individual V

F

’s. Zener diodes may also be used in series.

Where the input applied voltage is reversible or alternating and it is desired to detect the phase or polarity of the input, the bipolar input circuit of Figure 8 can be employed. The individual optocouplers could control different functions or be paralleled to become polarity independent. Note that in this connection, the LED’s protect each other in reverse bias.

Page 128: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

AN-3001 APPLICATION NOTE

2

REV. 4.00 4/30/02

R = VAPP - VF

IF

VFVAPP

RIF

LED

1.5

0.1 1.0 10 100

1.4

VF -

FO

RW

AR

D V

OLT

AG

E (

VO

LTS

)

AVALANCHE

NOTE CHANGE OF SCALES

REVERSE BIASTHRESHOLD

FORWARD BIAS

SLOPE

SLOPE

VF VOLTSRANGE OF

BVR

VR

20 18 16 14 12 10 8 6 4 2 0 0.5

0.01

0.1

1.0

10

80

60

40

20

100

100

mA

IR

mA

IF

1.0 1.5

1.3

1.2

1.1

1.0

RDF=13Ω

120Ω

1KΩ

10KΩ

0.9

0.8

∆R = 300Ω

= ∆R = ∆V

30Ω 3Ω 0.3Ω

TA = 25˚C

IF - FORWARD CURRENT (mA) ∆I

= RDF = VI

APPLIED VOLTAGE

NOTE SCALE CHANGE

JUN

CT

ION

CA

PAC

ITA

NC

E (

Cj)

- pF

1.5 1.0 0.5 0

VF VR

21 43 65 87

150

100

50

300

250

200

350

VF -5 0 - - - V

I

For IRLED (940nm)

F = IFT exp VF - VFT

k

RS = 0.03V

I (A)F

VF =

VFTH = 0.98V

IFTH = 0.10mA

K = 0.360

VFT + k log IFIFT

CjRP

RSIF

VFVj

D

D - IDEAL DIODE

LEDEQUIVALENT

CIRCUIT

IF - - 1 10 100 mA

Cj 55 100 300 500 - pF

Vj 1.0 1.1 1.2 1.3 V

IR <10 0 - - - nA

R Ω

Ω

S 30∞ 3 0.3

RP >109 - - - -

Figure 1. Characteristics of IR LED

Figure 2. Equivalent Circuit Equations

Figure 3. Voltage Dependence of Junction Capacitance

Figure 4. Typical LED Drive Circuit

Page 129: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

APPLICATION NOTE AN-3001

REV. 4.00 4/30/02

3

1.1

1.0

0.9

0.8

1.4

1.3

1.2

0.1 0.2 0.5 1 2 5 10 20 50 100

FORWARD CURRENT - IF (mA)

FO

RW

AR

D V

OLT

AG

E -

VF (

VO

LTS

)

T = +100°C

T = +25°C

T = -55°C

IFVF

1

2

468

2

1

50

20

30

40

10

10 100 1000 10,000 100,000

TIME - HOURS

NO

RM

ALI

ZE

D C

TR

DE

GR

AD

ATIO

N -

%

IF = 10 mA

IF = 30 mA

IF = 60 mA

IF = 75 mAI F

= 100 mA

TA = 25°C

IFT = VF FR2

R1 = VA

- VIFT

VA VF R2

R2 PROVIDES A THRESHOLDR1

IFT

VA VFR2

R1

VA VFR2

R1

VR2

IF

R2

R1

+ -

C1 R3

+

-EXTERNALSWITCHDEVICE

120VRMS60 Hz

Figure 5. IR Forward Voltage vs. ForwardCurrent and Temperature

Figure 6. Brightness Degredation vs.Forward Current and Time

Figure 7. LED Threshold Adjustment

Figure 8. Bipolar Input Selects LED

Figure 9. High Threshold Bipolar Input

Figure 10. AC Input to LED Drive Circuit

Another method of obtaining a high threshold for high level noise immunity is shown in Figure 9, where the LED’s are in inverse series with inverse parallel diodes to conduct the opposite polarity currents. In this circuit, the V

F

is the total

forward drop of the LED and silicon diode in series. The resistors serve their normal threshold and current limiting functions. The silicon diodes could be replaced by LED’s from other optocouplers or visible signal indicators.

Page 130: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

AN-3001 APPLICATION NOTE

4

REV. 4.00 4/30/02

AC Mains Monitoring

In some situations it may be necessary to drive the LED from a 120 VRMS, 60 Hz or 400 Hz source. Since the LED responds in nanoseconds, it will follow the AC excursions faithfully, turning on and off at each zero-crossing of the input. If a constant output is desired from the optocoupler detector as in AC to logic coupling, it is necessary to rectify and filter the input to the LED. The circuit of Figure 10 illustrates a simple filtering scheme to deliver a DC current to the LED. In some cases the filter could be designed into the detector side of the optocoupler, allowing the LED to pulse at line frequency. In the circuit of Figure 10, the value of C

1

is selected to reduce the variations in the I

F

between half cycles below the current that is detectable by the detec-tor portion. This condition usually means that the detector is functioning in saturation, so that minor variations of I

F

will not be sensed. The values of R

1

, R

2

and R

3

are adjusted to optimize the filtering function, R

3

C

1

time constant, etc. Speed of turn-off may be a determining factor. More compli-cated transistor filtering may be required, such as that shown in Figure 11, where a definite time delay, rise time and fall time can be designed in. In this circuit, C

1

and R

3

serve the same basic function as in Figure 10. The transistor provides a high impedance load to the R

4

C

2

filter network, which once reaching the V

F

value, suddenly turns on the LED and pulls the transistor quickly into saturation. The turn-off transient consists of the discharge of C

1

, through R

3

and the LED.

Logic to Logic Interface

In logic-to logic coupling using the optocoupler, a simple transistor drive circuit can be used as shown in Figure 12. In the normally-off situation, the LED is energized only when the transistor is in saturation. The design equations are given for calculating the value of the series current limiting resistor. With the transistor off, only minor collector leakage current will flow through the LED. If this small leakage is detectable in the optocoupler detector, the leakage can be bypassed around the LED by the addition of another resistor in parallel with the LED shown as R

1

. The value of R1 can be large, calculated so that the leakage current develops less than threshold V

F

(~0.8 volt) from Figure 5. The drive transistor can be the normal output current sink of a TTL or DTL integrated circuit, which will sink 16 mA at 0.2 volt nominal and up to 50 mA in saturation.

If the logic is not capable of sinking the necessary I

F

, an aux-iliary drive transistor can be employed to boost current capa-bility. The circuit of Figure 13 shows how a PNP transistor is connected as an emitter follower, or common collector, to obtain current gain. When the output of the gate (G

1

) is low, Q

1

is turned on and current flows through the LED. The calculation of R

1

must now include the base-emitter forward biased voltage drop, V

BE

, as shown in the figure.

VF

(VSAT)

IF

R1

R

VCC+

R = VCC - VF - VSAT

R = 170Ω

IF

= 5 - 1.2 - 0.4 = 3.4

VCC = 5 VIF = 20 mAVSAT = 0.4 VVF = 1.2 V

20 20

Figure 11. R-C-Transistor Filter Circuit

Figure 12. Transistor Drive, Normally Off

IF

VF

10K=R

R2=10K

R3

R4

C2

+

-

C1

1

DCINPUTFROM

BRIDGERECTIFIER

OUTPUTIFR1

VF

Q1G1

VBE

VCE(SAT)

INPUT

10K

VCCR1 = VCC - VF - VBE - VCE(SAT)GATE

VBE(Q1) = 0.6 V

VCE(SAT)(G1) = 0.4 V

IFVCC

Figure 13. Logic to LED Series Booster

Page 131: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

APPLICATION NOTE AN-3001

REV. 4.00 4/30/02

5

In the normally on situation of Figure 14, the transistor is required to shunt the I

F

around the LED, with a V

SAT

of less than threshold V

F

. Typical switching transistors have satura-tion voltages less than 0.4 volts at I

C

=20 mA or less. The value of the series resistor is determined to provide the required I

F

with the transistor off.

Again, if the logic cannot sink the I

F

, a booster transistor can be employed as shown in Figure 15. With the output of the gate low, the transistor Q

1

will be on and the sum of V

CE

(SAT) of G

1

and V

BE

of Q

1

, will be less than the threshold V

F

of the LED. With the gate high, Q

1

is not conducting and LED is on. The value of R

1

is calculated normally, but shunt current will be greater than I

F

. The normally-on or normally-off conditions are selected depend-ing on the required function of the detector portion of the optocoupler and fail-safe operation of the circuits.

In many applications it is found necessary to pulse drive the LED to values beyond the DC ratings of the device. In these

situations a “pulse” is defined as an on-off transient occur-ring and ending before thermal equilibrium is established between the LED, the lead frame, and the ambient. This equilibrium will normally occur within one millisecond. For a pulse width in the microsecond range, the I

F

can be driven above the DC ratings, if the duty cycle is low. The chart of Figure 16 shows the relationship between the amount of overdrive, duty cycle, and pulse width. The over-drive is normalized to the I

DC

value listed as maximum on the device data sheet. Average power dissipation is the limit-ing parameter at high duty cycles and short pulse widths. For longer pulse widths, the equilibrium temperature occurs at lower duty cycle values, and peak power is the limiting parameter.

For duty cycles of 1% or less the pulse becomes similar to a nonrecurrent surge allowing additional ratings such as the I

2

t used in rectifier diodes. Average current is used for lifetime calculation. The pulse response of the detector must be con-sidered in choosing drive conditions.

IF

(VSAT)

R

VCC

VF

R = VCC - VF

IF

= 3.8 = 190Ω 20

1

100

10

0.1 1.0 10 100

DUTY CYCLE - %

IPK IDC

1 µ S

5 µ S

10 µ S

PW = 30 µ sec

100 µ S

300 µ S

Figure 14. Transistor Drive, Normally On Figure 15. Logic to LED Shunt Booster

Figure 16. Maximum Peak IF Pulse Normalized to Max IDCfor Pulse Width (PW) and Duty Cycle (%)

OUTPUTIF

R1

Q1G1

VBE

VCE(SAT)

INPUT

10K

VCCR1 = VCC - VF

IF

VCC

Page 132: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

AN-3001 APPLICATION NOTE

6

REV. 4.00 4/30/02

LED Current Shunting Techniques

There are situations where it is not desirable to pass all of the input current through the LED. One method to achieve this is to provide a bypass resistor as suggested in Figure 7 for threshold adjustment. This method is satisfactory where the input current is switched on and off completely, but if the information on the current is only a small variation riding on a constant DC level, the bypass resistor also bypasses a large portion of the desired signal around the LED. Two methods can be used to retrieve the signal with little attenuation. If the signal has a rapid variation (e.g., the audio signal on a tele-phone line), the DC component can be cancelled in the detector by feedback circuits. If the variation is slow, a dynamic shunt can be used instead of the fixed resistor.

If a constant-current device or circuit is used in parallel with the LED, as shown in Figure 17, the adjusted component of the DC will flow through the dynamic impedance, and any current variations will result in a change of terminal voltage. Therefore, the total current change will flow through the paralleled LED circuit. The graph of Figure 18 shows the performance of this particular circuit adjusted to center on I

L

=120mA and a circuit node voltage of 3.4 volts. In the circuit shown, the detector portions of the CNY17-1 and CNY17-4 were employed for convenience. Note that in Figure 18 most of the current variation occurs as I

F

. The ratio between the DC resistance (R

D

) and dynamic impedance (Rd) for the shunt is 50, which represents the signal transfer gain achieved over a fixed resistor.

Figure 17. Constant-Current Shunt ImpedanceFigure 18. Shunt Impedance Performance

IF = 10 mA

HIIB2

CNY17-4

1.7V220Ω

LED

2.7K

0.5V

IL

3.4V

β>10K

30Ω

β>200

MCT2

VA

105

110

115

120

125

3.0 3.1 3.2 3.4 3.6 3.8 4.0

TERMINAL VOLTAGE - VA

I - m

A

R = 200Ω

R = 1.6K

IL2 WITH LED

IL1 SANS LED

Page 133: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

AN-3001 APPLICATION NOTE

4/30/02 0.0m 001Stock#AN300000xx

2002 Fairchild Semiconductor Corporation

DISCLAIMER

FAIRCHILD SEMICONDUCTOR RESERVES THE RIGHT TO MAKE CHANGES WITHOUT FURTHER NOTICE TO ANY PRODUCTS HEREIN TO IMPROVE RELIABILITY, FUNCTION OR DESIGN. FAIRCHILD DOES NOT ASSUME ANY LIABILITY ARISING OUT OF THE APPLICATION OR USE OF ANY PRODUCT OR CIRCUIT DESCRIBED HEREIN; NEITHER DOES IT CONVEY ANY LICENSE UNDER ITS PATENT RIGHTS, NOR THE RIGHTS OF OTHERS.

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, or (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 significant injury to the user.

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.

www.fairchildsemi.com

Page 134: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

REV. 4.00 4/30/02 1

www.fairchildsemi.com

Application Note AN-3001Optocoupler Input Drive Circuits

Anoptocoupler is a combination ofa light source andaphotosensitive detector. In the optocoupler, or photoncoupledpair, thecouplingis achieved bylight beinggenerated onone side ofa transparent insulatinggap andbeingdetected ontheother sideof the gap without anelectricalconnection between the two sides (except for aminor amountofcouplingcapacitance). In the FairchildSemiconductoroptocouplers, the light isgenerated byaninfrared light emitting diode, and the photo-detector is asilicondiodewhichdrivesanamplifier, e.g., transistor.Thesensitivityof thesiliconmaterialpeaks at thewavelengthemitted by the LED, giving maximumsignal coupling.

Where theinput totheoptocoupler is a LED, the inputcharacteristics will be the same, independent of the type ofdetector employed. The LED diode characteristics are showninFigure1.Theforwardbiascurrent thresholdisshownatapproximately 1 volt, and the current increases exponentially,the useful range of IF between 1 mA and 100 mA beingdelivered at a V Fbetween 1.2 and 1.3 volts. The dynamicvaluesof theforwardbias impedancearecurrentdependentand are shown on the insert graph for RDFand∆R asdefined in the figure. Reverse leakage is in the nano-ampererange before avalanche breakdown.

The LEDequivalentcircuit is represented inFigure 2,alongwith typical values of the components. The diode equationsareprovided ifneededforcomputermodeling andthecon-stants of the equations are given for the IR LED’s. Note thatthe junction capacitance is large and increases with appliedforward voltage. Anactualplotof this capacitancevariationwith applied voltage is shown on the graph ofFigure 3. It isthis large capacitance controlledbythe driver impedancewhich influences thepulse responseof theLED.Thecapaci-tance must be charged before there is junction current tocreate light emission. This effect causes an inherent delay of10-20 nanoseconds or more between applied current andlight emission in fast pulse conditions.The LED is used in the forward biased mode. Since thecurrent increases veryrapidlyabove threshold, thedeviceshould always be driven in a current mode, not voltagedriven. The simplest method ofachieving the current drive isto provide a series current-limiting resistor, as shown inFigure 4, such that the difference between Vis

APPand V F

dropped across the resistor at the desired IF, determined fromothercriteria. A silicondiode isshown installedinverselyparallel to the LED. This diode is used to protect the reversebreakdownofthe LEDandis thesimplestmethod ofachievingthisprotection.TheLED mustbe protected fromexcessivepower dissipation in the reverse avalanche region. A smallamount of reverse current will not harm the LED, but it mustbe guarded against unexpectedcurrent surges.

Theforwardvoltageof theLEDhasanegativetemperaturecoefficient of 1.05 mV/°C and the variation is shown inFigure 5.The brightness of the IR LEDslowlydecreases inan expo-nential fashion as a function of forward current (IF) andtime. The amount of light degradation is graphed inFigure 6 which is based on experimental data out to20,000 hours. A 50% degradation is considered to be thefailure point. This degradation must be considered in theinitial design of optoisolatorcircuits toallowfor thedecreaseandstill remainwithin design specifications on thecurrent-transfer-ratio (CTR)over thedesign lifetime of theequipment.Also, a limitation on IF drive is shown to extenduseful lifetime of the device.Insomecircumstances it isdesirable tohaveadefinitethreshold for the LED above the normal 1.1 volts of thediodeV F.This thresholdadjustmentcanbeobtainedbyshunting the LED byaresistor, the value ofwhich isdetermined bya ratio betweenthe applied voltage, theseries resistor, and the desired threshold. The circuit ofFigure 7 shows the relationship between these values.The calculations will determine the resistor valuesrequired for a given I. It is also quite proper toconnect

FTand VA

several LED’s in series to share the same Iof the

F. The V F

series is the sumof the individualVF’s. Zener diodes mayalso be used in series.

Where the input applied voltage is reversible or alternatingand it is desired to detect the phase or polarity of the input,the bipolar input circuit ofFigure 8 canbe employed. Theindividual optocouplers could control different functionsor be paralleled to become polarity independent. Note thatin this connection, the LED’s protect each other in reversebias.

Page 135: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

1.5 1.0 0.5 0 1 2 3 4 5 6 7 8

VFTH = 0.98V

IFTH= 0.10mA

K = 0.360

Figure 1. Characteristics of IR LED

350

300

250

200

150

100

VAPP

VFVOLTS

THRESHOLD

- - - V

1 1 0 1 0 0 m A

300 500 - pF

1.1 1.2 1.3 V

- - - nA

30 3 0.3 Ω

- - - Ω

IF = IFT exp VF - V

FTk

VFT + k log IF

IFT

VF =

For IRLED (940nm)

VF -5 0

IF - -

Cj 55 100

Vj 1.0

IR <10 0

RS ∞

RP >109 -

20

0.5 1.0 1.5

0.01

NOTE CHANGEOF SCALES

20 18 16 14 12 10 8 6 4 2 0

'F

mA100

80

60

40

= RDF = VI

LEDEQUIVALENT

CIRCUITIF RS

FORWARDB'AS

DVF RP CjV j

SLOPED - IDEAL DIODE

RANGEOF

BVR

REVERSEB'AS

SLOPE

= ∆R = ∆V∆I

0.1

1.0

10

100

mA

'R

VR

∆R= 300Ω 30Ω 3Ω 0.3Ω1.5

1.4

1.3

1.2

1.1

1.0

0.9

0.80.1 1.0 10 100

RD F

=13Ω

120Ω

1KΩ

10KΩ

TA = 25

˚C

'F - FORWARD CURRENT (mA)AVALANCHE

AN-3001 APPLICATION NOTE

VF VR

R'F

LED

NOTESCALECHANGE

R = VAPP - VF

'F

VF

APPLIEDVOLTAGE

Figure 3. Voltage Dependence of Junction Capacitance

2 REV. 4.00 4/30/02

Page 136: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

APPLICATION NOTE AN-3001

REV. 4.00 4/30/02 3

Figure 5. IR Forward Voltage vs. Forward Figure 8. Bipolar Input Selects LED

Current and Temperature

Figure 9. High Threshold Bipolar Input

10 100 1000 10,000

100,000

T'ME - HOURS

Figure 6. Brightness Degredation vs.Forward Current and Time

Figure 10. AC Input to

LED Drive Circuit

Another method of

obtaining a high threshold

for high level forward drop of the LED and silicon diode in series. The

noise immunity is shown inFigure 9, where the LED’sare in resistors serve their normal threshold and current limitinginverse series with inverseparallel diodes to conductthe functions. The silicon diodes could be replaced by LED’sopposite polarity currents. In this circuit, the V Fis the total from other optocouplers or visible signal indicators.

1.4

1.3

T = -55CC

1.2

1.1 T = +25CC

1.0T = +100

CC

'F

0.9

0.8

VF

0.1 0.2 0.5 1 2 5 10 20 50 100

FORWARD CURRENT - 'F (mA)

R2 PROV'DES A THRESHOLD

'FT = VF FR1 = VA - V

R2 'FT

VA VF R2

Figure 7. LED Threshold Adjustment

R1'FT

R1

VA R2 VF

50

40

30

20

10

8

6

4

2

1

TA = 25CC

R

VA R2VF

-+R2

VR

1 20VRMS60 Hz

'F

R1 +C1 R3

EXTERNALSW'TCHDEV'CE

-

Page 137: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

APPLICATION NOTE AN-3001

REV. 4.00 4/30/02 4

AC Mains MonitoringIn some situations it maybe necessary to drive the LED froma 120 VRMS, 60 Hz or 400 Hz source. Since the LEDresponds innanoseconds, itwill followtheACexcursionsfaithfully, turning on and off at each zero-crossing of theinput. If a constant output is desired from the optocouplerdetector as in AC to logic coupling, it is necessaryto rectifyand filter the input to the LED. The circuit of Figure 10illustrates a simple filtering scheme to deliver a DCcurrent to the LED. In some cases the filter could bedesigned into the detector side of the optocoupler, allowingthe LED to pulse at line frequency. In the circuit of Figure10, the valueo f C b e t w e e n

1 is selected to reduce the variations in the IF

half cycles below the current that is detectable by the detec-tor portion. This condition usuallymeans that the detector isfunctioning in saturation, so that minor variations of IF willnot be sensed. The values of Rare adjusted to

1, R2 and R3optimize the filtering function, Rtime constant, etc.3C1

Speedofturn-offmaybeadeterminingfactor.Morecompli-cated transistor filtering maybe required, such as that shownin Figure 11, where a definite time delay, rise time and falltime can be designed in. In this circuit, Cserve the

1 and R3

samebasicfunctionas inFigure10.Thetransistorprovidesahigh impedance load to the Rfilter network, which once

4C 2reaching the V Fvalue, suddenly turns on the LED and pullsthe transistor quickly into saturation. The turn-off transientconsists of the discharge of Cand the LED.

1, through R3

Logic to Logic Interface

In logic-to logic couplingusing the optocoupler, a simpletransistor drive circuit can be used as shown in Figure 12.In the normally-off situation, the LED is energized onlywhenthe transistor is insaturation.Thedesignequationsaregiven for calculating the value of the series current limitingresistor.Withthetransistoroff, onlyminorcollector leakagecurrentwill flowthrough theLED. If this small leakage isdetectable in the optocouplerdetector, the leakage can bebypassed around the LED bythe addition ofanother resistorin parallel with the LED shown as R1. The value of R1 canbe large, calculated so that the leakage current develops lessthan threshold V F(~0.8 volt) from Figure 5. The drivetransistor canbe the normaloutput current sinkofaTTLorDTLintegratedcircuit, which will sink 16mA at 0.2 voltnominal and up to 50 mA in saturation.

If the logic is not capable of sinking the necessary IF, an aux-iliary drive transistor can be employed to boost current capa-bility. The circuit of Figure 13 shows how a PNP transistor isconnected as an emitter follower, or common collector, toobtain current gain. When the output of the gate (G1) is low,Q1 is turned on and current flows through the LED. ThecalculationofR1 mustnowinclude thebase-emitter forwardbiased voltage drop, V BE,as shown in the figure.

Fig

ure

11.

R-

C-

Tra

nsi

sto

r

Filt

er

Cir

cui

t

+'FR3

DC'N PUTFROM

BR'DGERECT'F'ER

R4

C1 VF

10K=R 1 C2

R2=10K

-

R1 = VCC - VF - V

BE -V

CE(SAT)GATE'F

VB E ( Q 1 ) = 0 .6 V

VCE(SAT)(G1) = 0.4 V

VF

R1 'F 10K

OUTPUT

VC CV

C C

Page 138: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

APPLICATION NOTE AN-3001

REV. 4.00 4/30/02 5

VCC = 5 V'F = 20 mAV

S A T = 0.4 V

VF = 1.2 V

R = VCC - VF - V

SAT

'F= 5 - 1.2 - 0.4 = 3.4

20 20

R = 1 70Ω

Figure 12. Transistor Drive, Normally Off Figure 13. Logic to LED Series Booster

VC C

+

'FR

R1 VF

'NPUT

Q1G1

VB E

VCE(SAT)

(VSAT)

Page 139: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

APPL'CAT'ON NOTE AN-3001

REV. 4.00 4/30/02 6

'n the normally on situation of Figure 14, the transistor isr e q u i r e d t o s h u n t t h e ' o f l e s s Faround the LED, with a V SAT

than threshold V F.Typical switching transistorshave satura-tion voltages less than 0.4 volts at ' C=20 mA or less. Thevalue of the series resistor is determined to provide therequired 'F with the transistor off.Again, if the logic cannot sink the 'F, a booster transistorcan be employed as shown in Figure 15. With the output ofthe gate low, the transistor Q1 will be on and the sumof V , will be less than theCE (SAT) of G1 and V BE of Q1

t h r e s h o l d V i s n o t F

of the LED. With the gate high, Q1

conducting and LED is on. The value of R1 is calculatednormally, but shunt current will be greater than 'F. Thenormally-on or normally-off conditions are selected depend-ing on the required function of the detector portion of theoptocoupler and fail-safe operation of the circuits.'n manyapplications it is found necessary to pulse drive theLED to values beyond the DC ratings of the device. 'n these

situations a “pulse” is defined as an on-off transient occurringand endingbefore thermalequilibriumisestablishedbetweenthe LED, the lead frame, and theambient.This equilibriumwill normally occur within one millisecond. For a pulsewidth in the microsecond range, the 'F can be drivenabove the DC ratings, if the duty cycle is low. The chartofFigure 16shows therelationship between theamountofoverdrive,dutycycle, andpulsewidth.Theoverdrive isnormalized to the 'DCvalue listed as maximum on the devicedata sheet.Average powerdissipation is the limitingparameterathighdutycyclesandshortpulsewidths. For longerpulsewidths, theequilibrium temperature occursat lower dutycyclevalues, andpeak power is the limitingparameter.

For duty cycles of 1% or less the pulse becomes similar to anonrecurrent surge allowing additional ratings such as the ' 2tused in rectifier diodes. Average current is used for lifetimecalculation. The pulse response of the detector must be con-sidered in choosing drive conditions.

Figure 14. Transistor Drive, Normally On Figure 15. Logic to LED Shunt Booster

'PK

'DC

0.1 1.0 10 100DUTY CYCLE - %

Figure 16. Maximum Peak 'F Pulse Normalized to Max 'DC

for Pulse Width (PW) and Duty Cycle (%)

R = VCC - VF

'F

VCC

3.8=

20 'F R

VF(V

SAT)

= 190ΩR1 10K

OUTPUT'

'NPUT VB E

G Q

VCC

R1 = VCC - VF

VCC

'F

VCE(SAT)

10 µS

1 µS

5 µS

100

PW = 30 µsec10

1

300 µS

100 µS

Page 140: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

APPL'CAT'ON NOTE AN-3001

7 REV. 4.00 4/30/02

LED Current Shunting Techniques

There are situations where it is not desirable to pass all of theinput current through the LED. One method to achieve this isto provide a bypass resistor as suggested in Figure 7 forthreshold adjustment. This method is satisfactory where theinput current is switched on and off completely, but if theinformation on the current is only a small variation riding ona constant DC level, the bypass resistor also bypasses a largeportion of the desired signal around the LED. Two methodscan be used to retrieve the signal with little attenuation. If thesignal has a rapid variation (e.g., the audio signal on a tele-phone line), the DC component can be cancelled in thedetector by feedback circuits. If the variation is slow, adynamic shunt can be used instead of the fixed resistor.

If a constant-current device or circuit is used in parallel withthe LED, as shown in Figure 17, the adjusted component of

the DC will flow through the dynamic impedance, and anycurrent variations will result in a change of terminal voltage.Therefore, the total current change will flow through theparalleled LED circuit. The graph of Figure 18 shows theperformance of this particular circuit adjusted to center onIL=120mA and a circuit node voltage of 3.4 volts. In thecircuit shown, the detector portions of the CNY17-1 andCNY17-4 were employed for convenience. Note that inFigure 18 most of the current variation occurs as I F.The ratiobetween the DC resistance (RD) and dynamic impedance(Rd) for the shunt is 50, which represents the signal transfergain achieved over a fixed resistor.

Figure 17. Constant-Current Shunt Impedance 3.0 3.1 3.2 3.4 3.6 3.8 4.0

TERMINAL VOLTAGE - VA

2.7K IF = 10 mA3.4V

IL

HIIB2

220Ω1.7V

β>10K

VA

MCT2

β>2000.5V

LED

CNY17-4 30Ω

125

120

115

110

105

Page 141: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

AN-3001 APPLICATION NOTE

8 REV. 4.00 4/30/02

Figure 18. Shunt Impedance Performance

Page 142: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

APPL'CAT'ON NOTE AN-3001

4/30/02 0.0m 001

Stock#AN300000xx

DISCLAIMER

FAIRCHILD SEMICONDUCTOR RESERVES THE RIGHT TO MAKE CHANGES WITHOUT FURTHER NOTICE TO ANYPRODUCTS HEREIN TO IMPROVE RELIABILITY, FUNCTION OR DESIGN. FAIRCHILD DOES NOT ASSUME ANYLIABILITY ARISING OUT OF THE APPLICATION OR USE OF ANY PRODUCT OR CIRCUIT DESCRIBED HEREIN; NEITHERDOES 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 ORSYSTEMS WITHOUT THE EXPRESS WRITTEN APPROVAL OF THE PRESIDENT OF FAIRCHILD SEMICONDUCTORCORPORATION. As used herein:

1. Life support devices or systems are devices or systemswhich, (a) are intended for surgical implant into thebody, or (b) support or sustain life, or (c) whose failure toperform when properly used in accordance with instructionsfor use provided in the labeling, can be reasonablyexpected to result in significant injury to the user.

2. A critical component is any component of a life supportdevice or system whose failure to perform can bereasonably expected to cause the failure of the life supportdevice or system, or to affect its safety or effectiveness.

www.fairchildsemi.com

Page 143: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will
Page 144: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

Hitachi CodeJEDECEIAJWeight (reference value)

DP-14ConformsConforms0.97 g

Unit: mm

7.62

0.25

0° – 15°

19.20 20.32 Max

1

814

71.30

2.54 ± 0.25 0.48 ± 0.106.

30

7.4

0 M

ax0.

51 M

in

2.54

Min

5.06

Max

+ 0.10– 0.05

2.39 Max

Page 145: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

Hitachi CodeJEDECEIAJWeight (reference value)

FP-14DA—Conforms0.23 g

Unit: mm

*Dimension including the plating thicknessBase material dimension

*0.2

2 ±

0.05

*0.42 ± 0.08

0.70 ± 0.20

0.12

0.15

0° – 8°

M

0.10

± 0

.10

2.20

Max

5.5

10.06

1.42 Max

14 8

1 7

10.5 Max

+ 0.20– 0.307.80

1.15

1.27

0.40 ± 0.06

0.20

± 0

.04

Page 146: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

Hitachi CodeJEDECEIAJWeight (reference value)

FP-14DNConformsConforms0.13 g

Unit: mm

0° – 8°1.27

14 8

1 7

0.15

0.25 M

1.75

Max

3.95

*0.2

0 ±

0.05

8.659.05 Max

*0.40 ± 0.06

0.14

+ 0

.11

– 0.

04

0.635 Max

6.10 + 0.10– 0.30

0.60 + 0.67– 0.20

1.08

*Pd plating

Page 147: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

Cautions

1. Hitachi neither warrants nor grants licenses of any rights of Hitachi’s or any third party’s patent,copyright, trademark, or other intellectual property rights for information contained in this document.Hitachi bears no responsibility for problems that may arise with third party’s rights, includingintellectual property rights, in connection with use of the information contained in this document.

2. Products and product specifications may be subject to change without notice. Confirm that you havereceived the latest product standards or specifications before final design, purchase or use.

3. Hitachi makes every attempt to ensure that its products are of high quality and reliability. However,contact Hitachi’s sales office before using the product in an application that demands especially highquality and reliability or where its failure or malfunction may directly threaten human life or cause riskof bodily injury, such as aerospace, aeronautics, nuclear power, combustion control, transportation,traffic, safety equipment or medical equipment for life support.

4. Design your application so that the product is used within the ranges guaranteed by Hitachi particularlyfor maximum rating, operating supply voltage range, heat radiation characteristics, installationconditions and other characteristics. Hitachi bears no responsibility for failure or damage when usedbeyond the guaranteed ranges. Even within the guaranteed ranges, consider normally foreseeablefailure rates or failure modes in semiconductor devices and employ systemic measures such as fail-safes, so that the equipment incorporating Hitachi product does not cause bodily injury, fire or otherconsequential damage due to operation of the Hitachi product.

5. This product is not designed to be radiation resistant.

6. No one is permitted to reproduce or duplicate, in any form, the whole or part of this document withoutwritten approval from Hitachi.

7. Contact Hitachi’s sales office for any questions regarding this document or Hitachi semiconductorproducts.

Hitachi, Ltd.Semiconductor & Integrated Circuits.Nippon Bldg., 2-6-2, Ohte-machi, Chiyoda-ku, Tokyo 100-0004, JapanTel: Tokyo (03) 3270-2111 Fax: (03) 3270-5109

Copyright ' Hitachi, Ltd., 1999. All rights reserved. Printed in Japan.

Hitachi Asia Pte. Ltd.16 Collyer Quay #20-00Hitachi TowerSingapore 049318Tel: 535-2100Fax: 535-1533

URL NorthAmerica : http:semiconductor.hitachi.com/Europe : http://www.hitachi-eu.com/hel/ecgAsia (Singapore) : http://www.has.hitachi.com.sg/grp3/sicd/index.htmAsia (Taiwan) : http://www.hitachi.com.tw/E/Product/SICD_Frame.htmAsia (HongKong) : http://www.hitachi.com.hk/eng/bo/grp3/index.htmJapan : http://www.hitachi.co.jp/Sicd/indx.htm

Hitachi Asia Ltd.Taipei Branch Office3F, Hung Kuo Building. No.167, Tun-Hwa North Road, Taipei (105)Tel: <886> (2) 2718-3666Fax: <886> (2) 2718-8180

Hitachi Asia (Hong Kong) Ltd.Group III (Electronic Components)7/F., North Tower, World Finance Centre,Harbour City, Canton Road, Tsim Sha Tsui,Kowloon, Hong KongTel: <852> (2) 735 9218Fax: <852> (2) 730 0281 Telex: 40815 HITEC HXHitachi Europe Ltd.

Electronic Components Group.Whitebrook ParkLower Cookham RoadMaidenheadBerkshire SL6 8YA, United KingdomTel: <44> (1628) 585000Fax: <44> (1628) 778322

Hitachi Europe GmbHElectronic components GroupDornacher Stra§e 3D-85622 Feldkirchen, MunichGermanyTel: <49> (89) 9 9180-0Fax: <49> (89) 9 29 30 00

Hitachi Semiconductor (America) Inc.179 East Tasman Drive,San Jose,CA 95134 Tel: <1> (408) 433-1990Fax: <1>(408) 433-0223

For further information write to:

Page 148: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

This datasheet has been downloaded from:

www.DatasheetCatalog.com

Datasheets for electronic components.

Page 149: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

www.DataSheet1U.com© 2005 National Semiconductor Corporation DS007744 www.national.com

February 2005

LM78LXX Series3-Terminal Positive Regulators

General DescriptionThe LM78LXX series of three terminal positive regulators isavailable with several fixed output voltages making themuseful in a wide range of applications. When used as a zenerdiode/resistor combination replacement, the LM78LXX usuallyresults in an effective output impedance improvement of twoorders of magnitude, and lower quiescent current. Theseregulators can provide local on card regulation, eliminatingthe distribution problems associated with single point regu-lation. The voltages available allow the LM78LXX to be usedin logic systems, instrumentation, HiFi, and other solid stateelectronic equipment.The LM78LXX is available in the plastic TO-92 (Z) package,the plastic SO-8 (M) package and a chip sized package(8-Bump micro SMD) using National’s micro SMD packagetechnology. With adequate heat sinking the regulator candeliver 100mA output current. Current limiting is included tolimit the peak output current to a safe value. Safe areaprotection for the output transistors is provided to limit inter-

nal power dissipation. If internal power dissipation becomestoo high for the heat sinking provided, the thermal shutdowncircuit takes over preventing the IC from overheating.

Features LM78L05 in micro SMD package Output voltage tolerances of ±5% over the temperature

range Output current of 1 00mA Internal thermal overload protection Output transistor safe area protection Internal short circuit current limit Available in plastic TO-92 and plastic SO-8 low profile

packages No external components Output voltages of 5.0V, 6.2V, 8.2V, 9.0V, 12V, 15V See AN-1112 for micro SMD considerations

Connection Diagrams

SO-8 Plastic (M) (TO-92)

(Narrow Body) Plastic Package (Z)

0077440300774402

Top View

00774433

Top View

Bottom View

micro SMD Marking Orientation8-Bump micro SMD

00774424

Top View(Bump Side Down)

Page 150: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

www.national.com 2

www.DataSheet4U.com

Page 151: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

Ordering InformationPackage Order Number Output Voltage NSC Drawing Supplied As

LM78L05IBP 5V BPA08AAB Reel of 250

LM78L05IBPX 5V BPA08AAB Reel of 3000

LM78L09ITP 9V TPA08AAA Reel of 250microSMD

LM78L09ITPX 9V TPA08AAA Reel of 3000

LM78L05ACM 5V M08A Rail of 95

LM78L05ACMX 5V M08A Reel of 2500

LM78L12ACM 12V M08A Rail of 95

LM78L12ACMX 12V M08A Reel of 2500

LM78L15ACM 15V M08A Rail of 95

SOIC Narrow

LM78L15ACMX 15V M08A Reel of 2500

LM78L05ACZ 5V Z03A Box of 1800

LM78L62ACZ 6.2V Z03A Box of 1800

LM78L82ACZ 8.2V Z03A Box of 1800

LM78L09ACZ 9V Z03A Box of 1800

LM78L12ACZ 12V Z03A Box of 1800

TO-92

LM78L1 5ACZ 15V Z03A Box of 1800

Page 152: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

4www.national.com

Absolute Maximum Ratings (Note 1) Operating Junction Temperature

If Military/Aerospace specified devices are required, SO-8, TO-92 0˚C to 125

˚C

please contact the National Semiconductor Sales Office/ micro SMD —40˚C to 85

˚C

Distr ibutors for avai lab i l i t y ands p e c i f i c a t i o n s .

So lder ing Informat ion

Power Dissipation (Note 5) Internally Limited Infrared or Convection (20 sec.) 235˚C

Input Voltage 35V Wave Soldering (10 sec.) 260˚C (lead time)

Storage Temperature —65˚C to +1 50

˚C

ESD Susceptibility (Note 2) 1 kV

LM78LXX Electrical Characteristics Limits in standard typeface are for TJ = 25˚C, Bold typeface

applies over 0˚C to 125

˚C for SO-8 and TO-92 packages, and −40

˚C to 85

˚C for micro SMD package. Limits are guaran-

teed by production testing or correlation techniques using standard Statistical Quality Control (SQC) methods. Unless other-wise specified: IO = 40mA, CI = 0.33µF, CO = 0.1 µF.

LM78 L05Unless otherwise specified,

VIN = 10V

Symbol Parameter Conditions Min Typ Max Units

4.8 5 5.2

7V <V

IN <20V1 mA < IO <40mA

(Note 3)4.75 5.25

VO Output Voltage

1mA<IO<70mA

(Note 34.75 5.25

V

7V <V

IN <20V 18 75AVO Line Regulation

8V<V IN<20V 10 54

1mA < IO < 100mA 20 60AVO Load Regulation

1mA<IO<40mA 5 30

mV

IQ Quiescent Current 3 5

8V <V

IN <20V 1.0AIQ Quiescent Current Change

1mA<IO<40mA 0.1

mA

V n Output Noise Voltage f = 10 Hz to 100 kHz

(Note 4)4 µV

Ripple Rejection f = 120 Hz

8V<V IN<16V 47 62 dB

IPK Peak Output Current 140 mA

Average Output Voltage Tempco IO = 5mA—0.65 mV/

˚C

VIN (Min) Minimum Value of Input Voltage

Required to Maintain Line Regulation6.7 7 V

°JA Thermal Resistance

(8-Bump micro SMD)230.9

˚C/W

LM78 L62ACUnless otherwise specified,

VIN = 12V

Symbol Parameter Conditions Min Typ Max Units

5.95 6.2 6.45

8 .5 V < V I N

< 20 V 1 mA < IO<40mA (Note 3)

5.9 6.5

VO Output Voltage

1mA<IO<70mA

(Note 3

5 . 9

6.5

V

Page 153: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

5www.national.com

LM78LXX Electrical Characteristics Limits in standard typeface are for TJ = 25˚C, Bold typeface

applies over 0˚C to 125

˚C for SO-8 and TO-92 packages, and −40

˚C to 85

˚C for micro SMD package. Limits are

guaranteed by production testing or correlation techniques using standard Statistical Quality Control (SQC) methods. Unlessotherwise specified: IO = 40mA, CI = 0.33µF, CO = 0.1µF. (Continued)

LM78L62AC (Continued)Unless otherwise specified,

VIN = 12V

Symbol Parameter Conditions Min Typ Max Units

8.5V ~VIN ~20V 65 175AVO Line Regulation

9V~V I N~20V 55 125

1mA ~ IO ~ 100mA 13 80AVO Load Regulation

1mA~IO~40mA 6 40

mV

IQ Quiescent Current 2 5.5

8V ~VI N ~20V 1.5AIQ Quiescent Current Change

1mA~IO~40mA 0.1

mA

Vn Output Noise Voltage f = 10 Hz to 100 kHz

(Note 4)5 µV

Ripple Rejection f = 120 Hz

10V~V IN~20V 40 46 dB

IPK Peak Output Current 140 mA

Average Output Voltage Tempco IO = 5mA—0.75 mV/

˚C

VIN (Min) Minimum Value of Input Voltage

Required to Maintain Line Regulation7.9 V

LM78 L82ACUnless otherwise specified,

VIN = 14V

Symbol Parameter Conditions Min Typ Max Units

7.87 8.2 8.53

11V~V I N ~23V1mA ~ IO ~40mA(Note 3)

7.8 8.6

VO Output Voltage

1mA~IO~70mA

(Note 3

7 . 8

8.6

V

11 V ~VIN ~23V 80 175AVO Line Regulation

12V~V IN~23V 70 125

1mA ~ IO ~ 100mA 15 80AVO Load Regulation

1mA~IO~40mA 8 40

mV

IQ Quiescent Current 2 5.5

12V ~VIN ~23V 1.5AIQ Quiescent Current Change

1mA~IO~40mA 0.1

mA

V n Output Noise Voltage f = 10 Hz to 100 kHz

(Note 4)6 µV

Ripple Rejection f = 120 Hz12V ~VIN ~22V 39 45 dB

IPK Peak Output Current 140 mA

Average Output Voltage Tempco IO = 5mA—0.8 mV/

˚C

VIN (Min) Minimum Value of Input Voltage

Required to Maintain Line Regulation9.9 V

Page 154: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

www.national.com 6

LM78LXX Electrical Characteristics Limits in standard typeface are for TJ = 25˚C, Bold typeface

applies over 0˚C to 125

˚C for SO-8 and TO-92 packages, and −40

˚C to 85

˚C for micro SMD package. Limits are

guaranteed by production testing or correlation techniques using standard Statistical Quality Control (SQC) methods. Unlessotherwise specified: IO = 40mA, CI = 0.33µF, CO = 0.1µF. (Continued)

LM78 L09ACUnless otherwise specified,

VIN = 15VSymbol Parameter Conditions Min Typ Max Units

8.64 9.0 9.36

11.5V ~ V IN

~24V 1 mA ~IO~40mA (Note 3)

8.55 9.45

VO Output Voltage

1mA~IO~70mA

(Note 38.55 9.45

V

11 .5V ~VIN ~24V 100 200AVO Line Regulation

13V~V IN~24V 90 150

1mA ~ IO~ 100mA 20 90AVO Load Regulation

1mA~IO~40mA 10 45

mV

IQ Quiescent Current 2 5.5

11 .5V ~VIN ~24V 1.5AIQ Quiescent Current Change

1mA~IO~40mA 0.1

mA

V n Output Noise Voltage 70 µV

Ripple Rejection f = 120 Hz

15V~V I N~25V 38 44 dB

IPK Peak Output Current 140 mA

Average Output Voltage Tempco IO = 5mA—0.9 mV/˚C

VIN (Min) Minimum Value of Input Voltage

Required to Maintain Line Regulation10.7 V

LM78L1 2ACUnless otherwise specified,

VIN = 19V

Symbol Parameter Conditions Min Typ Max Units

11.5 12 12.5

14.5V ~VIN ~27V1mA~IO~40mA(Note 3)

11.4 12.6

VO Output Voltage

1mA~IO~70mA(Note 3

11.4 12.6

V

14.5V ~VIN ~27V 30 180AVO Line Regulation

16V~V IN~27V 20 110

1mA ~ IO ~ 100mA 30 100AVO Load Regulation

1mA~IO~40mA 10 50

mV

IQ Quiescent Current 3 5

1 6V ~VIN ~27V 1AIQ Quiescent Current Change

1mA~IO~40mA 0.1

mA

V n Output Noise Voltage 80 µV

Ripple Rejection f = 120 Hz

15V~V I N~25 40 54 dB

IPK Peak Output Current 140 mA

Average Output Voltage Tempco IO = 5mA—1.0 mV/˚C

Page 155: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

7www.national.com

LM78LXX Electrical Characteristics Limits in standard typeface are for TJ = 25˚C, Bold typeface

applies over 0˚C to 125

˚C for SO-8 and TO-92 packages, and −40

˚C to 85

˚C for micro SMD package. Limits are

guaranteed by production testing or correlation techniques using standard Statistical Quality Control (SQC) methods. Unlessotherwise specified: IO = 40mA, CI = 0.33µF, CO = 0.1µF. (Continued)

LM78L1 2AC (Continued)Unless otherwise specified, V

IN = 19V

Symbol Parameter Conditions Min Typ Max UnitsV

IN (Min) Minimum Value of Input Voltage

Required to Maintain Line Regulation13.7 14.5 V

LM78L1 5ACUnless otherwise specified, V

IN = 23V

Symbol Parameter Conditions Min Typ Max Units

14.4 15.0 15.6

17.5V <VIN <30V1mA < IO <40mA(Note 3)

14.25 15.75

VO Output Voltage

1mA < IO <70mA

(Note 314.25 15.75

V

17.5V <VIN <30V 37 250AVO Line Regulation

20V<V I N<30V 25 140

1mA < IO < 100mA 35 150AVO Load Regulation

1mA<IO<40mA 12 75

mV

IQ Quiescent Current 3 5

20V < VIN <30V 1AIQ Quiescent Current Change

1mA<IO<40mA 0.1

mA

V n Output Noise Voltage 90 µV

Ripple Rejection f = 120 Hz18.5V <VIN <28.5V 37 51 dB

IPK Peak Output Current 140 mA

Average Output Voltage Tempco IO = 5mA−1.3 mV/˚C

VIN (Min) Minimum Value of Input Voltage

Required to Maintain Line Regulation16.7 17.5 V

Note 1: Absolute Maximum Ratings indicate limits beyond which damage to the device may occur. Electrical specifications do not apply when operating the deviceoutside of its stated operating conditions.

Note 2: Human body model, 1.5 kΩ in series with 1 00pF.

Note 3: Power dissipation < 0.75W.

Note 4: Recommended minimum load capacitance of 0.01 µF to limit high frequency

noise. Note 5: Typical thermal resistance values for the packages are:

Z Package: 0JC = 60 ˚C/W, = 0JA = 230 ˚C/W

M Package:0JA = 180

˚C/W

micro SMD Package: 0JA = 230.9˚C/W

Page 156: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

8www.national.com

Typical Performance CharacteristicsMaximum Average Power Dissipation (Z Package) Peak Output Current

0 0 7 7 4 4 1 40 0 7 7 4 4 1 6

Dropout Voltage Ripple Rejection

00 77 441 7 00774418

Output Impedance Quiescent Current

0077 44 19 00774420

Page 157: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

9www.national.com

Typical Performance Characteristics (Continued)

Equivalent Circuit

Quiescent Current

LM78LXX

00774421

00774407

www.national.com 8

Page 158: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

10www.national.com

Typical Applications

Fixed Output Regulator

00774408

*Required if the regulator is located more than 3" from the power supply filter.**See (Note 4) in the electrical characteristics table.

Adjustable Output Regulator

00774409

VOUT = 5V + (5V/R1 + IQ) R2

5V/R1 > 3 IQ, load regulation (Lr) ≈ [(R1 + R2)/R1] (Lr of LM78L05)

Current Regulator

00774410

IOUT = (VOUT/R1) + IQ

>IQ = 1 .5mA over line and load changes

5V, 500mA Regulator with Short Circuit Protection

00774411

*Solid tantalum.

**Heat sink Q1.

***Optional: Improves ripple rejection and transient response.

Load Regulation: 0.6% 0 ≤ IL ≤250mA pulsed with tON = 50ms.

Page 159: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

11www.national.com

*Solid tantalum.V

OUT = VG + 5V, R1 = (−VIN

/IQ LM78L05)

VOUT = 5V (R2/R4) for (R2 + R3) = (R4 + R5)

A 0.5V output will correspond to (R2/R4) = 0.1 (R3/R4) = 0.9

Typical Applications (Continued)

*Solid tantalum.

Variable Output Regulator 0.5V-1 8V

±15V, 100mA Dual Power Supply

00774412

00774413

Page 160: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

www.national.com 12

Physical Dimensions inches (millimeters) unless otherwise noted

NOTES: UNLESS OTHERWISE SPECIFIED

1. EPOXY COATING

2. 63Sn/37Pb EUTECTIC BUMP

3. RECOMMEND NON-SOLDER MASK DEFINED LANDING PAD.

4. PIN A1 IS ESTABLISHED BY LOWER LEFT CORNER WITH RESPECT TO TEXT ORIENTATION. REMAINING PINS ARE NUMBEREDCOUNTERCLOCKWISE.

5. XXX IN DRAWING NUMBER REPRESENTS PACKAGE SIZE VARIATION WHERE X1 IS PACKAGE WIDTH, X2 IS PACKAGE LENGTH AND X3 ISPACKAGE HEIGHT.6. REFERENCE JEDEC REGISTRATION MO-211, VARIATION BC.

8-Bump micro SMD for LM78L05IBP OnlyNS Package Number BPA08AAB

X1 = 1.285mm X2 = 1.285mm X3 = 0.850mm

Page 161: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

13www.national.com

Physical Dimensions inches (millimeters) unless otherwise noted (Continued)

8-Bump micro SMD for LM78L09ITP OnlyNS Package Number TPA08AAA

X1 = 1.285mm X2 = 1.285mm X3 = 0.500mm

www.national.com 12

Page 162: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

Physical Dimensions inches (millimeters) unless otherwise noted (Continued)

S.O. Package (M)NS Package Number M08A

Page 163: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

Physical Dimensions inches (millimeters) unless otherwise noted (Continued)

Molded Offset TO-92 (Z)NS Package Number Z03A

National does not assume any responsibility for use of any circuitry described, no circuit patent licenses are implied and National reservesthe right at any time without notice to change said circuitry and specifications.

For the most current product information visit us at www.national.com.

LIFE SUPPORT POLICY

NATIONAL’S PRODUCTS ARE NOT AUTHORIZED FOR USE AS CRITICAL COMPONENTS IN LIFE SUPPORT DEVICES OR SYSTEMSWITHOUT THE EXPRESS WRITTEN APPROVAL OF THE PRESIDENT AND GENERAL COUNSEL OF NATIONAL SEMICONDUCTORCORPORATION. As used herein:

1. Life support devices or systems are devices or systems 2. A critical component is any component of a life supportwhich, (a) are intended for surgical implant into the body, or device or system whose failure to perform can be reasonably(b) support or sustain life, and whose failure to perform when expected to cause the failure of the life support device orproperly used in accordance with instructions for use system, or to affect its safety or effectiveness.provided in the labeling, can be reasonably expected to resultin a significant injury to the user.

BANNED SUBSTANCE COMPLIANCE

National Semiconductor manufactures products and uses packing materials that meet the provisions of the Customer ProductsStewardship Specification (CSP-9-1 11 C2) and the Banned Substances and Materials of Interest Specification (CSP-9-1 11S2) and containno ‘‘Banned Substances’’ as defined in CSP -9-1 11S2.

National Semiconductor National Semiconductor National Semiconductor National Semiconductor

Americas Customer Europe Customer Support Center Asia Pacific Customer Japan Customer Support Center

Support Center Fax: +49 (0) 180-530 8586 Support Center Fax: 81-3-5639-7507

Email: [email protected] Email: [email protected] Email: [email protected] Email: [email protected]: 1-800-272-9959 Deutsch Tel: +49(0)69 9508 6208 Tel: 81-3-5639-7560

English Tel: +44 (0) 8702402171

www.national.com Français Tel: +33 (0) 1 41 91 8790

Page 164: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

167

HD44780U (LCD-II)

(Dot Matrix Liquid Crystal Display Controller/Driver)

Description

The HD44780U dot-matrix liquid crystal display controller and driver LSI displays alphanumerics,Japanese kana characters, and symbols. It can be configured to drive a dot-matrix liquid crystal displayunder the control of a 4- or 8-bit microprocessor. Since all the functions such as display RAM, charactergenerator, and liquid crystal driver, required for driving a dot-matrix liquid crystal display are internallyprovided on one chip, a minimal system can be interfaced with this controller/driver.

A single HD44780U can display up to one 8-character line or two 8-character lines.

The HD44780U has pin function compatibility with the HD44780S which allows the user to easilyreplace an LCD-II with an HD44780U. The HD44780U character generator ROM is extended to generate208 5 × 8 dot character fonts and 32 5 × 10 dot character fonts for a total of 240 different character fonts.

The low power supply (2.7V to 5.5V) of the HD44780U is suitable for any portable battery-drivenproduct requiring low power dissipation.

Features

• 5 × 8 and 5 × 10 dot matrix possible

• Low power operation support:

2.7 to 5.5V

• Wide range of liquid crystal display driver power

3.0 to 11V

• Liquid crystal drive waveform

A (One line frequency AC waveform)

• Correspond to high speed MPU bus interface

2 MHz (when VCC = 5V)

• 4-bit or 8-bit MPU interface enabled

• 80 × 8-bit display RAM (80 characters max.)

• 9,920-bit character generator ROM for a total of 240 character fonts

208 character fonts (5 × 8 dot)

32 character fonts (5 × 10 dot)

Page 165: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

HD44780U

168

• 64 × 8-bit character generator RAM

8 character fonts (5 × 8 dot)

4 character fonts (5 × 10 dot)

• 16-common × 40-segment liquid crystal display driver

• Programmable duty cycles

1/8 for one line of 5 × 8 dots with cursor

1/11 for one line of 5 × 10 dots with cursor

1/16 for two lines of 5 × 8 dots with cursor

• Wide range of instruction functions:

Display clear, cursor home, display on/off, cursor on/off, display character blink, cursor shift,display shift

• Pin function compatibility with HD44780S

• Automatic reset circuit that initializes the controller/driver after power on

• Internal oscillator with external resistors

• Low power consumption

Ordering Information

Type No. Package CGROM

HD44780UA00FSHCD44780UA00HD44780UA00TF

FP-80BChipTFP-80F

Japanese standard font

HD44780UA02FSHCD44780UA02HD44780UA02TF

FP-80BChipTFP-80F

European standard font

HD44780UBxxFSHCD44780UBxxHD44780UBxxTF

FP-80BChipTFP-80F

Custom font

Note: xx: ROM code No.

Page 166: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

HD44780U

169

HD44780U Block Diagram

Displaydata RAM(DDRAM)80 × 8 bits

Charactergenerator

ROM(CGROM)9,920 bits

Charactergenerator

RAM(CGRAM)64 bytes

Instructionregister (IR)

Timinggenerator

Commonsignaldriver

16-bitshift

register

Segmentsignaldriver

40-bitlatchcircuit

40-bitshift

register

Parallel/serial converterand

attribute circuit

LCD drivevoltageselector

Addresscounter

MPUinter-face

Input/outputbuffer

Dataregister

(DR)

Cursorandblink

controller

CPG

CL1CL2

M

D

RSR/W

DB4 to DB7

E

Instructiondecoder

OSC1 OSC2

COM1 toCOM16

SEG1 toSEG40

8

8 8

7

40

55

7

8

7

8

7

VCC

GND

V1 V2 V3 V4 V5

DB0 to DB3

ResetcircuitACL

8

Busyflag

Page 167: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

HD44780U

170

LCD-II Family Comparison

Item HD44780S HD44780U

Power supply voltage 5 V ±10% 2.7 to 5.5 V

Liquid crystal drive 1/4 bias 3.0 to 11.0V 3.0 to 11.0Vvoltage VLCD 1/5 bias 4.6 to 11.0V 3.0 to 11.0V

Maximum display digitsper chip

16 digits (8 digits × 2 lines) 16 digits (8 digits × 2 lines)

Display duty cycle 1/8, 1/11, and 1/16 1/8, 1/11, and 1/16

CGROM 7,200 bits(160 character fonts for 5 ×7 dot and 32 character fontsfor 5 × 10 dot)

9,920 bits(208 character fonts for 5 ×8 dot and 32 character fontsfor 5 × 10 dot)

CGRAM 64 bytes 64 bytes

DDRAM 80 bytes 80 bytes

Segment signals 40 40

Common signals 16 16

Liquid crystal drive waveform A A

Oscillator Clock source External resistor, externalceramic filter, or externalclock

External resistor or externalclock

Rf oscillationfrequency (framefrequency)

270 kHz ±30%(59 to 110 Hz for 1/8 and1/16 duty cycles; 43 to 80Hz for 1/11 duty cycle)

270 kHz ±30%(59 to 110 Hz for 1/8and1/16 duty cycles; 43 to80 Hz for 1/11 duty cycle)

Rf resistance 91 kΩ ±2% 91 kΩ ±2% (when VCC = 5V)75 kΩ ±2% (when VCC = 3V)

Instructions Fully compatible within the HD44780S

CPU bus timing 1 MHz 1 MHz (when VCC = 3V)2 MHz (when VCC = 5V)

Package FP-80FP-80A

FP-80BTFP-80F

Page 168: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

HD44780U

171

HD44780U Pin Arrangement (FP-80B)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

80

79

78

77

76

75

74

73

72

71

70

69

68

67

66

65

64

63

62

61

60

59

58

57

56

55

54

53

52

51

50

49

48

47

46

45

44

43

42

41

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

FP-80B (Top view)

SEG39SEG40COM16 COM15COM14COM13COM12COM11COM10COM9COM8COM7COM6COM5COM4COM3COM2COM1DB7DB6DB5DB4DB3DB2

SEG22SEG21 SEG20SEG19SEG18SEG17SEG16SEG15SEG14SEG13SEG12SEG11SEG10SEG9SEG8SEG7SEG6SEG5SEG4SEG3SEG2SEG1GND

OSC1

SE

G23

SE

G24

SE

G25

SE

G26

SE

G27

SE

G28

SE

G29

SE

G30

SE

G31

SE

G32

SE

G33

SE

G34

SE

G35

SE

G36

SE

G37

OS

C2

V1

V2

V3

V4

V5

CL1

C

L2

VC

C

M

D

RS

R

/W

ED

B0

DB

1S

EG

38

Page 169: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

HD44780U

172

HD44780U Pin Arrangement (TFP-80F)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

80

79

78

77

76

75

74

73

72

71

70

69

68

67

66

65

64

63

62

61

60

59

58

57

56

55

54

53

52

51

50

49

48

47

46

45

44

43

42

41

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

TFP-80F (Top view)

COM16 COM15 COM14 COM13 COM12 COM11 COM10 COM9 COM8 COM7 COM6 COM5 COM4 COM3 COM2 COM1 DB7 DB6 DB5 DB4

SEG20 SEG19 SEG18 SEG17 SEG16 SEG15 SEG14 SEG13 SEG12 SEG11 SEG10 SEG9 SEG8 SEG7 SEG6 SEG5 SEG4 SEG3 SEG2 SEG1

SE

G21

S

EG

22

SE

G23

S

EG

24

SE

G25

S

EG

26

SE

G27

S

EG

28

SE

G29

S

EG

30

SE

G31

S

EG

32

SE

G33

S

EG

34

SE

G35

S

EG

36

SE

G37

S

EG

38

SE

G39

S

EG

40

GN

D

OS

C1

OS

C2

V1

V2

V3

V4

V5

CL1

C

L2

VC

C

M

D

RS

R

/W

E

DB

0 D

B1

DB

2 D

B3

Page 170: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

HD44780U

173

HD44780U Pad Arrangement

HD44780U

Type code

23

X

Y

42

2 1 80 63

Chip size:

Coordinate:

Origin:

Pad size:

4.90 × 4.90 mm2

Pad center (µm)

Chip center

114 × 114 µm2

Page 171: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

HD44780U

174

HCD44780U Pad Location Coordinates

Coordinate CoordinatePad No. Function X (um) Y (um) Pad No. Function X (um) Y (um)1 SEG22 –2100 2313 41 DB2 2070 –22902 SEG21 –2280 2313 42 DB3 2260 –22903 SEG20 –2313 2089 43 DB4 2290 –20994 SEG19 –2313 1833 44 DB5 2290 –18835 SEG18 –2313 1617 45 DB6 2290 –16676 SEG17 –2313 1401 46 DB7 2290 –14527 SEG16 –2313 1186 47 COM1 2313 –11868 SEG15 –2313 970 48 COM2 2313 –9709 SEG14 –2313 755 49 COM3 2313 –755

10 SEG13 –2313 539 50 COM4 2313 –53911 SEG12 –2313 323 51 COM5 2313 –32312 SEG11 –2313 108 52 COM6 2313 –10813 SEG10 –2313 –108 53 COM7 2313 10814 SEG9 –2313 –323 54 COM8 2313 32315 SEG8 –2313 –539 55 COM9 2313 53916 SEG7 –2313 –755 56 COM10 2313 75517 SEG6 –2313 –970 57 COM11 2313 97018 SEG5 –2313 –1186 58 COM12 2313 118619 SEG4 –2313 –1401 59 COM13 2313 140120 SEG3 –2313 –1617 60 COM14 2313 161721 SEG2 –2313 –1833 61 COM15 2313 183322 SEG1 –2313 –2073 62 COM16 2313 209523 GND –2280 –2290 63 SEG40 2296 231324 OSC1 –2080 –2290 64 SEG39 2100 231325 OSC2 –1749 –2290 65 SEG38 1617 231326 V1 –1550 –2290 66 SEG37 1401 231327 V2 –1268 –2290 67 SEG36 1186 231328 V3 –941 –2290 68 SEG35 970 231329 V4 –623 –2290 69 SEG34 755 231330 V5 –304 –2290 70 SEG33 539 231331 CL1 –48 –2290 71 SEG32 323 231332 CL2 142 –2290 72 SEG31 108 231333 VCC 309 –2290 73 SEG30 –108 231334 M 475 –2290 74 SEG29 –323 231335 D 665 –2290 75 SEG28 –539 231336 RS 832 –2290 76 SEG27 –755 231337 R/: 1022 –2290 77 SEG26 –970 231338 E 1204 –2290 78 SEG25 –1186 231339 DB0 1454 –2290 79 SEG24 –1401 231340 DB1 1684 –2290 80 SEG23 –1617 2313

Page 172: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

HD44780U

175

Pin Functions

SignalNo. ofLines I/O

DeviceInterfaced with Function

RS 1 I MPU Selects registers.0: Instruction register (for write) Busy flag:

address counter (for read)1: Data register (for write and read)

R/: 1 I MPU Selects read or write.0: Write1: Read

E 1 I MPU Starts data read/write.

DB4 to DB7 4 I/O MPU Four high order bidirectional tristate data buspins. Used for data transfer and receivebetween the MPU and the HD44780U. DB7 canbe used as a busy flag.

DB0 to DB3 4 I/O MPU Four low order bidirectional tristate data buspins. Used for data transfer and receivebetween the MPU and the HD44780U.These pins are not used during 4-bit operation.

CL1 1 O Extension driver Clock to latch serial data D sent to theextension driver

CL2 1 O Extension driver Clock to shift serial data D

M 1 O Extension driver Switch signal for converting the liquid crystaldrive waveform to AC

D 1 O Extension driver Character pattern data corresponding to eachsegment signal

COM1 to COM16 16 O LCD Common signals that are not used are changedto non-selection waveforms. COM9 to COM16are non-selection waveforms at 1/8 duty factorand COM12 to COM16 are non-selectionwaveforms at 1/11 duty factor.

SEG1 to SEG40 40 O LCD Segment signals

V1 to V5 5 — Power supply Power supply for LCD driveVCC –V5 = 11 V (max)

VCC, GND 2 — Power supply VCC: 2.7V to 5.5V, GND: 0V

OSC1, OSC2 2 — Oscillationresistor clock

When crystal oscillation is performed, a resistormust be connected externally. When the pininput is an external clock, it must be input toOSC1.

Page 173: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

HD44780U

176

Function Description

Registers

The HD44780U has two 8-bit registers, an instruction register (IR) and a data register (DR).

The IR stores instruction codes, such as display clear and cursor shift, and address information for displaydata RAM (DDRAM) and character generator RAM (CGRAM). The IR can only be written from theMPU.

The DR temporarily stores data to be written into DDRAM or CGRAM and temporarily stores data to beread from DDRAM or CGRAM. Data written into the DR from the MPU is automatically written intoDDRAM or CGRAM by an internal operation. The DR is also used for data storage when reading datafrom DDRAM or CGRAM. When address information is written into the IR, data is read and then storedinto the DR from DDRAM or CGRAM by an internal operation. Data transfer between the MPU is thencompleted when the MPU reads the DR. After the read, data in DDRAM or CGRAM at the next addressis sent to the DR for the next read from the MPU. By the register selector (RS) signal, these two registerscan be selected (Table 1).

Busy Flag (BF)

When the busy flag is 1, the HD44780U is in the internal operation mode, and the next instruction willnot be accepted. When RS = 0 and R/: = 1 (Table 1), the busy flag is output to DB7. The nextinstruction must be written after ensuring that the busy flag is 0.

Address Counter (AC)

The address counter (AC) assigns addresses to both DDRAM and CGRAM. When an address of aninstruction is written into the IR, the address information is sent from the IR to the AC. Selection ofeither DDRAM or CGRAM is also determined concurrently by the instruction.

After writing into (reading from) DDRAM or CGRAM, the AC is automatically incremented by 1(decremented by 1). The AC contents are then output to DB0 to DB6 when RS = 0 and R/: = 1 (Table1).

Table 1 Register Selection

RS R/:: Operation

0 0 IR write as an internal operation (display clear, etc.)

0 1 Read busy flag (DB7) and address counter (DB0 to DB6)

1 0 DR write as an internal operation (DR to DDRAM or CGRAM)

1 1 DR read as an internal operation (DDRAM or CGRAM to DR)

Page 174: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

HD44780U

177

Display Data RAM (DDRAM)

Display data RAM (DDRAM) stores display data represented in 8-bit character codes. Its extendedcapacity is 80 × 8 bits, or 80 characters. The area in display data RAM (DDRAM) that is not used fordisplay can be used as general data RAM. See Figure 1 for the relationships between DDRAM addressesand positions on the liquid crystal display.

The DDRAM address (ADD) is set in the address counter (AC) as hexadecimal.

• 1-line display (N = 0) (Figure 2)

When there are fewer than 80 display characters, the display begins at the head position. Forexample, if using only the HD44780, 8 characters are displayed. See Figure 3.

When the display shift operation is performed, the DDRAM address shifts. See Figure 3.

AC6 AC5 AC4 AC3 AC2 AC1 AC0 1 0 0 1 1 1 0AC(hexadecimal)

Example: DDRAM address 4EHigh order

bitsLow order

bits

Figure 1 DDRAM Address

00 01 02 03 04 4E 4FDDRAMaddress(hexadecimal)

Display position(digit) 1 2 3 4 5 79 80

. . . . . . . . . . . . . . . . . .

Figure 2 1-Line Display

DDRAMaddress

Displayposition 1 2 3 4 5 6 7 8

00 01 02 03 04 05 06 07

Forshift left

Forshift right 00 01 02 03 04 05 06

01 02 03 04 05 06 07 08

4F

Figure 3 1-Line by 8-Character Display Example

Page 175: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

HD44780U

178

• 2-line display (N = 1) (Figure 4)

Case 1: When the number of display characters is less than 40 × 2 lines, the two lines aredisplayed from the head. Note that the first line end address and the second line start address arenot consecutive. For example, when just the HD44780 is used, 8 characters × 2 lines are displayed.See Figure 5.

When display shift operation is performed, the DDRAM address shifts. See Figure 5.

00 01 02 03 04 26 27DDRAMaddress(hexadecimal)

Displayposition 1 2 3 4 5 39 40

. . . . . . . . . . . . . . . . . .

40 41 42 43 44 66 67. . . . . . . . . . . . . . . . . .

Figure 4 2-Line Display

DDRAMaddress

Displayposition 1 2 3 4 5 6 7 8

00 01 02 03 04 05 06 07

Forshift left

Forshift right

40 41 42 43 44 45 46 47

01 02 03 04 05 06 07 08

41 42 43 44 45 46 47 48

00 01 02 03 04 05 06

40 41 42 43 44 45 46

27

67

Figure 5 2-Line by 8-Character Display Example

Page 176: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

HD44780U

179

Case 2: For a 16-character × 2-line display, the HD44780 can be extended using one 40-outputextension driver. See Figure 6.

When display shift operation is performed, the DDRAM address shifts. See Figure 6.

DDRAMaddress

Displayposition 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

00 01 02 03 04 05 06 07 08 09 0A 0B0C0D 0E 0F

Forshift left

00 01 02 03 04 05 06 07 08 09 0A 0B0C0D 0E27

40 41 42 43 44 45 46 47 48 49 4A 4B4C4D 4E 4F

HD44780U display Extension driverdisplay

0201 03 04 05 06 07 08 09 0A 0B0C0D 0E 0F10

Forshift right

41 42 43 44 45 46 47 48 49 4A 4B4C4D 4E 4F 50

40 41 42 43 44 45 46 47 48 49 4A 4B4C4D 4E67

Figure 6 2-Line by 16-Character Display Example

Page 177: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

HD44780U

180

Character Generator ROM (CGROM)

The character generator ROM generates 5 × 8 dot or 5 × 10 dot character patterns from 8-bit charactercodes (Table 4). It can generate 208 5 × 8 dot character patterns and 32 5 × 10 dot character patterns.User-defined character patterns are also available by mask-programmed ROM.

Character Generator RAM (CGRAM)

In the character generator RAM, the user can rewrite character patterns by program. For 5 × 8 dots, eightcharacter patterns can be written, and for 5 × 10 dots, four character patterns can be written.

Write into DDRAM the character codes at the addresses shown as the left column of Table 4 to show thecharacter patterns stored in CGRAM.

See Table 5 for the relationship between CGRAM addresses and data and display patterns.

Areas that are not used for display can be used as general data RAM.

Modifying Character Patterns

• Character pattern development procedure

The following operations correspond to the numbers listed in Figure 7:

1. Determine the correspondence between character codes and character patterns.

2. Create a listing indicating the correspondence between EPROM addresses and data.

3. Program the character patterns into the EPROM.

4. Send the EPROM to Hitachi.

5. Computer processing on the EPROM is performed at Hitachi to create a character pattern listing,which is sent to the user.

6. If there are no problems within the character pattern listing, a trial LSI is created at Hitachi andsamples are sent to the user for evaluation. When it is confirmed by the user that the characterpatterns are correctly written, mass production of the LSI proceeds at Hitachi.

Page 178: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

HD44780U

181

Determinecharacter patterns

Create EPROMaddress data listing

Write EPROM

EPROM → Hitachi

Computerprocessing

Create characterpattern listing

Evaluatecharacterpatterns

OK?

Art work

Sampleevaluation

OK?

Masking

Trial

Sample

No

Yes

No

Yes

M/T

1

3

2

4

5

6

Note: For a description of the numbers used in this figure, refer to the preceding page.

UserHitachi

Massproduction

Start

Figure 7 Character Pattern Development Procedure

Page 179: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

HD44780U

182

• Programming character patterns

This section explains the correspondence between addresses and data used to program characterpatterns in EPROM. The HD44780U character generator ROM can generate 208 5 × 8 dot characterpatterns and 32 5 × 10 dot character patterns for a total of 240 different character patterns.

Character patterns

EPROM address data and character pattern data correspond with each other to form a 5 × 8 or 5 ×10 dot character pattern (Tables 2 and 3).

Table 2 Example of Correspondence between EPROM Address Data and Character Pattern(5 ×× 8 Dots)

Data

O4 O3 O2 O1 O0

0 0 0 1

0 0 1 0

0 0 1 1

0 1 0 0

0 1 1 0 0 0 1 0

EPROM Address

Character code Line position

LSB

0 1 0 1

0 1 1 0

0 1 1 1

0 0 0 0

1 0 0 1

1 0 1 0

1 0 1 1

1 1 0 0

1 1 0 1

1 1 1 0

1 1 1 1

1 0 0 0

1 1 0 0 1

1 0 0 0 1

1 0 0 0 1

1 0 0 0 0

1 0 0 0 0

1 0 1 1 0

Cursor position

1 1 1 1 0

0 0 0 0 0

0 0 0 0 0

0 0 0 0 0

0 0 0 0 0

0 0 0 0 0

0 0 0 0 0

0 0 0 0 0

0 0 0 0 0

0 0 0 0 0

A10 A9 A8 A7 A6 A5 A4 A3 A2 A1 A0A11

Notes: 1. EPROM addresses A11 to A4 correspond to a character code.2. EPROM addresses A3 to A0 specify a line position of the character pattern.3. EPROM data O4 to O0 correspond to character pattern data.4. EPROM data O5 to O7 must be specified as 0.5. A lit display position (black) corresponds to a 1.6. Line 9 and the following lines must be blanked with 0s for a 5 × 8 dot character fonts.

Page 180: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

HD44780U

183

Handling unused character patterns

1. EPROM data outside the character pattern area: Always input 0s.

2. EPROM data in CGRAM area: Always input 0s. (Input 0s to EPROM addresses 00H to FFH.)

3. EPROM data used when the user does not use any HD44780U character pattern: According tothe user application, handled in one of the two ways listed as follows.

a. When unused character patterns are not programmed: If an unused character code is writteninto DDRAM, all its dots are lit. By not programing a character pattern, all of its bits becomelit. (This is due to the EPROM being filled with 1s after it is erased.)

b. When unused character patterns are programmed as 0s: Nothing is displayed even if unusedcharacter codes are written into DDRAM. (This is equivalent to a space.)

Table 3 Example of Correspondence between EPROM Address Data and Character Pattern(5 ×× 10 Dots)

A10 A9 A8 A7 A6 A5 A4 A3 A2 A1 A0

Data

O4 O3 O2 O1 O0

0 0 0 1

0 0 1 0

0 0 1 1

0 1 0 0

0 1 0 1 0 0 1 0

EPROM Address

Character code Line position

LSB

0 1 0 1

0 1 1 0

0 1 1 1

0 0 0 0 0

0 0 0 0 0

0 1 1 0 1

1 0 0 1 1

1 0 0 0 1

1 0 0 0 1

0 0 0 0

A11

1 0 0 1

1 0 1 0

1 0 1 1

1 1 0 0

1 1 0 1

1 1 1 0

1 1 1 1

1 0 0 0

Cursor position0 0 0 0 0

0 0 0 0 0

0 0 0 0 0

0 0 0 0 0

0 0 0 0 0

0 0 0 0 0

0 0 0 0 1

0 0 0 0 1

0 0 0 0 1

0 1 1 1 1

Notes: 1. EPROM addresses A11 to A3 correspond to a character code.2. EPROM addresses A3 to A0 specify a line position of the character pattern.3. EPROM data O4 to O0 correspond to character pattern data.4. EPROM data O5 to O7 must be specified as 0.5. A lit display position (black) corresponds to a 1.6. Line 11 and the following lines must be blanked with 0s for a 5 × 10 dot character fonts.

Page 181: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

HD44780U

184

Table 4 Correspondence between Character Codes and Character Patterns (ROM Code: A00)

xxxx0000

xxxx0001

xxxx0010

xxxx0011

xxxx0100

xxxx0101

xxxx0110

xxxx0111

xxxx1000

xxxx1001

xxxx1010

xxxx1011

xxxx1100

xxxx1101

xxxx1110

xxxx1111

0000 0010 0011 0100 0101 0110 0111 1010 1011 1100 1101 1110 1111Upper 4

BitsLower 4 Bits

CG RAM (1)

(2)

(3)

(4)

(5)

(6)

(7)

(8)

(1)

(2)

(3)

(4)

(5)

(6)

(7)

(8)

0001 1000 1001

Note: The user can specify any pattern for character-generator RAM.

Page 182: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

HD44780U

185

Table 4 Correspondence between Character Codes and Character Patterns (ROM Code: A02)

xxxx0000

xxxx0001

xxxx0010

xxxx0011

xxxx0100

xxxx0101

xxxx0110

xxxx0111

xxxx1000

xxxx1001

xxxx1010

xxxx1011

xxxx1100

xxxx1101

xxxx1110

xxxx1111

0000 0010 0011 0100 0101 0110 0111 1010 1011 1100 1101 1110 1111Upper 4

BitsLower 4 Bits

CG RAM (1)

(2)

(3)

(4)

(5)

(6)

(7)

(8)

(1)

(2)

(3)

(4)

(5)

(6)

(7)

(8)

0001 1000 1001

Page 183: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

HD44780U

186

Table 5 Relationship between CGRAM Addresses, Character Codes (DDRAM) and CharacterPatterns (CGRAM Data)

Character Codes (DDRAM data) CGRAM Address

Character Patterns (CGRAM data)

7 6 5 4 3 2 1 0

0 0 0 0 * 0 0 0

0 0 0 0 * 0 0 1

0 0 0 0 * 1 1 1

5 4 3 2 1 0

0 0 0

0 0 1

1 1 1

7 6 5 4 3 2 1 0

0

0

0

0

1

1

1

1

0

0

0

0

1

1

1

1

0

0

1

1

1

1

0

0

1

1

0

0

1

1

0

0

1

1

0

0

1

1

0

0

0

0

1

1

0

1

0

1

0

1

0

1

0

1

0

1

0

1

0

1

0

1

0

1

0

1

*

*

*

*

*

*

*

*

*

*

*

*

*

*

*

*

*

*

High Low High Low High Low

Characterpattern (1)

Cursor position

1

1

1

1

1

1

1

0

1

0

1

0

1

0

0

0

0

1

1

0

0

0

1

0

1

0

1

0

1

0

0

0

1

0

0

1

0

0

0

0

0

1

1

0

1

0

0

0

1

0

0

1

1

0

0

0

0

0

1

1

1

1

1

0

1

0

0

1

0

1

0

0

0

1

1

0

1

0

0

0

Characterpattern (2)

Cursor position

For 5 × 8 dot character patterns

Notes: 1. Character code bits 0 to 2 correspond to CGRAM address bits 3 to 5 (3 bits: 8 types).2. CGRAM address bits 0 to 2 designate the character pattern line position. The 8th line is the

cursor position and its display is formed by a logical OR with the cursor.Maintain the 8th line data, corresponding to the cursor display position, at 0 as the cursordisplay.If the 8th line data is 1, 1 bits will light up the 8th line regardless of the cursor presence.

3. Character pattern row positions correspond to CGRAM data bits 0 to 4 (bit 4 being at the left).4. As shown Table 5, CGRAM character patterns are selected when character code bits 4 to 7 are

all 0. However, since character code bit 3 has no effect, the R display example above can beselected by either character code 00H or 08H.

5. 1 for CGRAM data corresponds to display selection and 0 to non-selection.* Indicates no effect.

Page 184: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

HD44780U

187

Table 5 Relationship between CGRAM Addresses, Character Codes (DDRAM) and CharacterPatterns (CGRAM Data) (cont)

Character Codes (DDRAM data) CGRAM Address

Character Patterns (CGRAM data)

7 6 5 4 3 2 1 0

0 0 0 0 * 0 0

0 0 0 0 1 1

5 4 3 2 1 0

0 0

1 1

7 6 5 4 3 2 1 0

*

*

*

*

*

*

*

*

*

*

*

*

*

*

*

*

*

*

*

*

*

*

*

*

High Low High Low High Low

Characterpattern

Cursor position

0

0

0

0

1

1

1

1

0

0

0

0

1

1

1

1

0

0

0

0

0

1

1

1

1

0

0

1

1

0

0

1

1

0

0

1

1

0

0

1

1

0

0

0

1

1

0

0

1

1

0

1

0

1

0

1

0

1

0

1

0

1

0

1

0

1

0

1

1

0

1

0

1

0

1

0

0

0

0

0

0

0

0

1

1

1

1

1

1

1

1

0

0

1

1

1

1

1

1

1

*

*

*

*

*

* *

0

0

1

1

1

1

1

1

1

1

0

0

0

0

1

0

0

1

0

0

0

0

0

0

1

0

0

0

1

0

0

0

0

0

0

1

0

0

0

1

0

0

0

0

0

0

0

1

1

1

0

0

0

0

0

*

*

*

*

*

*

*

*

*

*

*

*

*

*

*

*

For 5 × 10 dot character patterns

Notes: 1. Character code bits 1 and 2 correspond to CGRAM address bits 4 and 5 (2 bits: 4 types).2. CGRAM address bits 0 to 3 designate the character pattern line position. The 11th line is the

cursor position and its display is formed by a logical OR with the cursor.Maintain the 11th line data corresponding to the cursor display positon at 0 as the cursordisplay.If the 11th line data is “1”, “1” bits will light up the 11th line regardless of the cursor presence.Since lines 12 to 16 are not used for display, they can be used for general data RAM.

3. Character pattern row positions are the same as 5 × 8 dot character pattern positions.4. CGRAM character patterns are selected when character code bits 4 to 7 are all 0.

However, since character code bits 0 and 3 have no effect, the P display example above can beselected by character codes 00H, 01H, 08H, and 09H.

5. 1 for CGRAM data corresponds to display selection and 0 to non-selection.* Indicates no effect.

Page 185: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

HD44780U

188

Timing Generation Circuit

The timing generation circuit generates timing signals for the operation of internal circuits such asDDRAM, CGROM and CGRAM. RAM read timing for display and internal operation timing by MPUaccess are generated separately to avoid interfering with each other. Therefore, when writing data toDDRAM, for example, there will be no undesirable interferences, such as flickering, in areas other thanthe display area.

Liquid Crystal Display Driver Circuit

The liquid crystal display driver circuit consists of 16 common signal drivers and 40 segment signaldrivers. When the character font and number of lines are selected by a program, the required commonsignal drivers automatically output drive waveforms, while the other common signal drivers continue tooutput non-selection waveforms.

Sending serial data always starts at the display data character pattern corresponding to the last address ofthe display data RAM (DDRAM).

Since serial data is latched when the display data character pattern corresponding to the starting addressenters the internal shift register, the HD44780U drives from the head display.

Cursor/Blink Control Circuit

The cursor/blink control circuit generates the cursor or character blinking. The cursor or the blinking willappear with the digit located at the display data RAM (DDRAM) address set in the address counter (AC).

For example (Figure 8), when the address counter is 08H, the cursor position is displayed at DDRAMaddress 08H.

AC6

0

AC5

0

AC4

0

AC3

1

AC2

0

AC1

0

AC0

0

1

00

2

01

3

02

4

03

5

04

6

05

7

06

8

07

9

08

10

09

11

0A

1

00

40

2

01

41

3

02

42

4

03

43

5

04

44

6

05

45

7

06

46

8

07

47

9

08

48

10

09

49

11

0A

4A

AC

cursor position

cursor position

Display position

DDRAM address (hexadecimal)

Display position

DDRAM address (hexadecimal)

For a 1-line display

For a 2-line display

Note: The cursor or blinking appears when the address counter (AC) selects the character generator RAM (CGRAM). However, the cursor and blinking become meaningless. The cursor or blinking is displayed in the meaningless position when the AC is a CGRAM address.

Figure 8 Cursor/Blink Display Example

Page 186: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

HD44780U

189

Interfacing to the MPU

The HD44780U can send data in either two 4-bit operations or one 8-bit operation, thus allowinginterfacing with 4- or 8-bit MPUs.

• For 4-bit interface data, only four bus lines (DB4 to DB7) are used for transfer. Bus lines DB0 to DB3are disabled. The data transfer between the HD44780U and the MPU is completed after the 4-bit datahas been transferred twice. As for the order of data transfer, the four high order bits (for 8-bitoperation, DB4 to DB7) are transferred before the four low order bits (for 8-bit operation, DB0 toDB3).

The busy flag must be checked (one instruction) after the 4-bit data has been transferred twice. Twomore 4-bit operations then transfer the busy flag and address counter data.

• For 8-bit interface data, all eight bus lines (DB0 to DB7) are used.

RS

R/W

E

IR7

IR6

IR5

IR4

BF

AC6

AC5

AC4

DB7

DB6

DB5

DB4

Instruction register (IR) write

Busy flag (BF) and address counter (AC) read

Data register (DR) read

IR3

IR2

IR1

IR0

AC3

AC2

AC1

AC0

DR7

DR6

DR5

DR4

DR3

DR2

DR1

DR0

Figure 9 4-Bit Transfer Example

Page 187: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

HD44780U

190

Reset Function

Initializing by Internal Reset Circuit

An internal reset circuit automatically initializes the HD44780U when the power is turned on. Thefollowing instructions are executed during the initialization. The busy flag (BF) is kept in the busy stateuntil the initialization ends (BF = 1). The busy state lasts for 10 ms after VCC rises to 4.5 V.

1. Display clear

2. Function set:

DL = 1; 8-bit interface data

N = 0; 1-line display

F = 0; 5 × 8 dot character font

3. Display on/off control:

D = 0; Display off

C = 0; Cursor off

B = 0; Blinking off

4. Entry mode set:

I/D = 1; Increment by 1

S = 0; No shift

Note: If the electrical characteristics conditions listed under the table Power Supply Conditions UsingInternal Reset Circuit are not met, the internal reset circuit will not operate normally and will failto initialize the HD44780U. For such a case, initial-ization must be performed by the MPU asexplained in the section, Initializing by Instruction.

Instructions

Outline

Only the instruction register (IR) and the data register (DR) of the HD44780U can be controlled by theMPU. Before starting the internal operation of the HD44780U, control information is temporarily storedinto these registers to allow interfacing with various MPUs, which operate at different speeds, or variousperipheral control devices. The internal operation of the HD44780U is determined by signals sent fromthe MPU. These signals, which include register selection signal (RS), read/

write signal (R/:), and the data bus (DB0 to DB7), make up the HD44780U instructions (Table 6). Thereare four categories of instructions that:

• Designate HD44780U functions, such as display format, data length, etc.

• Set internal RAM addresses

• Perform data transfer with internal RAM

• Perform miscellaneous functions

Page 188: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

HD44780U

191

Normally, instructions that perform data transfer with internal RAM are used the most. However, auto-incrementation by 1 (or auto-decrementation by 1) of internal HD44780U RAM addresses after each datawrite can lighten the program load of the MPU. Since the display shift instruction (Table 11) can performconcurrently with display data write, the user can minimize system development time with maximumprogramming efficiency.

When an instruction is being executed for internal operation, no instruction other than the busyflag/address read instruction can be executed.

Because the busy flag is set to 1 while an instruction is being executed, check it to make sure it is 0before sending another instruction from the MPU.

Note: Be sure the HD44780U is not in the busy state (BF = 0) before sending an instruction from theMPU to the HD44780U. If an instruction is sent without checking the busy flag, the time betweenthe first instruction and next instruction will take much longer than the instruction time itself.Refer to Table 6 for the list of each instruc-tion execution time.

Table 6 Instructions

CodeExecution Time(max) (when f cp or

Instruction RS R/ :: DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0 Description f OSC is 270 kHz)

Cleardisplay

0 0 0 0 0 0 0 0 0 1 Clears entire display and setsDDRAM address 0 in addresscounter.

Returnhome

0 0 0 0 0 0 0 0 1 — Sets DDRAM address 0 inaddress counter. Also returnsdisplay from being shifted tooriginal position. DDRAMcontents remain unchanged.

1.52 ms

Entrymode set

0 0 0 0 0 0 0 1 I/D S Sets cursor move directionand specifies display shift.These operations areperformed during data writeand read.

37 µs

Displayon/offcontrol

0 0 0 0 0 0 1 D C B Sets entire display (D) on/off,cursor on/off (C), and blinkingof cursor position character(B).

37 µs

Cursor ordisplayshift

0 0 0 0 0 1 S/C R/L — — Moves cursor and shiftsdisplay without changingDDRAM contents.

37 µs

Functionset

0 0 0 0 1 DL N F — — Sets interface data length(DL), number of display lines(N), and character font (F).

37 µs

SetCGRAMaddress

0 0 0 1 ACG ACG ACG ACG ACG ACG Sets CGRAM address.CGRAM data is sent andreceived after this setting.

37 µs

SetDDRAMaddress

0 0 1 ADD ADD ADD ADD ADD ADD ADD Sets DDRAM address.DDRAM data is sent andreceived after this setting.

37 µs

Read busyflag &address

0 1 BF AC AC AC AC AC AC AC Reads busy flag (BF)indicating internal operation isbeing performed and readsaddress counter contents.

0 µs

Page 189: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

HD44780U

192

Table 6 Instructions (cont)

CodeExecution Time(max) (when f cp or

Instruction RS R/ :: DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0 Description f OSC is 270 kHz)

Write datato CG orDDRAM

1 0 Write data Writes data into DDRAM orCGRAM.

37 µstADD = 4 µs*

Read datafrom CG orDDRAM

1 1 Read data Reads data from DDRAM orCGRAM.

37 µstADD = 4 µs*

I/D = 1: IncrementI/D = 0: DecrementS = 1: Accompanies display shiftS/C = 1: Display shiftS/C = 0: Cursor moveR/L = 1: Shift to the rightR/L = 0: Shift to the leftDL = 1: 8 bits, DL = 0: 4 bitsN = 1: 2 lines, N = 0: 1 lineF = 1: 5 × 10 dots, F = 0: 5 × 8 dotsBF = 1: Internally operatingBF = 0: Instructions acceptable

DDRAM: Display data RAMCGRAM: Character generator

RAMACG: CGRAM addressADD: DDRAM address

(corresponds to cursoraddress)

AC: Address counter used forboth DD and CGRAMaddresses

Execution timechanges whenfrequency changesExample:When fcp or fOSC is250 kHz,37 µs × = 40 µs270

250

Note: — indicates no effect.* After execution of the CGRAM/DDRAM data write or read instruction, the RAM address counter

is incremented or decremented by 1. The RAM address counter is updated after the busy flagturns off. In Figure 10, tADD is the time elapsed after the busy flag turns off until the addresscounter is updated.

Busy stateBusy signal (DB7 pin)

Address counter (DB0 to DB6 pins)

t ADD

A A + 1

Note: t depends on the operation frequency t = 1.5/(f or f ) seconds

ADD

ADD cp OSC

Figure 10 Address Counter Update

Page 190: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

HD44780U

193

Instruction Description

Clear Display

Clear display writes space code 20H (character pattern for character code 20H must be a blank pattern)into all DDRAM addresses. It then sets DDRAM address 0 into the address counter, and returns thedisplay to its original status if it was shifted. In other words, the display disappears and the cursor orblinking goes to the left edge of the display (in the first line if 2 lines are displayed). It also sets I/D to 1(increment mode) in entry mode. S of entry mode does not change.

Return Home

Return home sets DDRAM address 0 into the address counter, and returns the display to its original statusif it was shifted. The DDRAM contents do not change.

The cursor or blinking go to the left edge of the display (in the first line if 2 lines are displayed).

Entry Mode Set

I/D: Increments (I/D = 1) or decrements (I/D = 0) the DDRAM address by 1 when a character code iswritten into or read from DDRAM.

The cursor or blinking moves to the right when incremented by 1 and to the left when decremented by 1.The same applies to writing and reading of CGRAM.

S: Shifts the entire display either to the right (I/D = 0) or to the left (I/D = 1) when S is 1. The displaydoes not shift if S is 0.

If S is 1, it will seem as if the cursor does not move but the display does. The display does not shift whenreading from DDRAM. Also, writing into or reading out from CGRAM does not shift the display.

Display On/Off Control

D: The display is on when D is 1 and off when D is 0. When off, the display data remains in DDRAM,but can be displayed instantly by setting D to 1.

C: The cursor is displayed when C is 1 and not displayed when C is 0. Even if the cursor disappears, thefunction of I/D or other specifications will not change during display data write. The cursor is displayedusing 5 dots in the 8th line for 5 × 8 dot character font selection and in the 11th line for the 5 × 10 dotcharacter font selection (Figure 13).

B: The character indicated by the cursor blinks when B is 1 (Figure 13). The blinking is displayed asswitching between all blank dots and displayed characters at a speed of 409.6-ms intervals when fcp or fOSC

is 250 kHz. The cursor and blinking can be set to display simultaneously. (The blinking frequencychanges according to fOSC or the reciprocal of fcp. For example, when fcp is 270 kHz, 409.6 × 250/270 =379.2 ms.)

Page 191: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

HD44780U

194

Cursor or Display Shift

Cursor or display shift shifts the cursor position or display to the right or left without writing or readingdisplay data (Table 7). This function is used to correct or search the display. In a 2-line display, thecursor moves to the second line when it passes the 40th digit of the first line. Note that the first andsecond line displays will shift at the same time.

When the displayed data is shifted repeatedly each line moves only horizontally. The second line displaydoes not shift into the first line position.

The address counter (AC) contents will not change if the only action performed is a display shift.

Function Set

DL: Sets the interface data length. Data is sent or received in 8-bit lengths (DB7 to DB0) when DL is 1,and in 4-bit lengths (DB7 to DB4) when DL is 0.When 4-bit length is selected, data must be sent orreceived twice.

N: Sets the number of display lines.

F: Sets the character font.

Note: Perform the function at the head of the program before executing any instructions (except for theread busy flag and address instruction). From this point, the function set instruction cannot beexecuted unless the interface data length is changed.

Set CGRAM Address

Set CGRAM address sets the CGRAM address binary AAAAAA into the address counter.

Data is then written to or read from the MPU for CGRAM.

Page 192: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

HD44780U

195

Code Note: Don’t care.*

Code

Code

Code

RS

0

R/W

0

DB7

0

DB6

0

DB5

0

DB4

0

DB3

0

DB2

0

DB1

0

DB0

1

RS

0

R/W

0

DB7

0

DB6

0

DB5

0

DB4

0

DB3

0

DB2

0

DB1

0

DB0

1

RS

0

R/W

0

DB7

0

DB6

0

DB5

0

DB4

0

DB3

0

DB2

0

DB1

0

DB0

1

RS

0

R/W

0

DB7

0

DB6

0

DB5

0

DB4

0

DB3

0

DB2

0

DB1

0

DB0

1

Return home

Clear display

Entry mode set

Display on/off control

Figure 11

RS

0

R/W

0

DB7

0

DB6

0

DB5

0

DB4

1

DB3

S/CCode

DB2

R/L

DB1 DB0

Code

Code

Higherorder bit

Lowerorder bit

*Cursor ordisplay shift

Function set

Set CGRAM address

*

RS

0

R/W

0

DB7

0

DB6

0

DB5

0

DB4

DL

DB3

N

DB2

F

DB1 DB0

* *

RS

0

R/W

0

DB7

0

DB6

0

DB5

A

DB4

A

DB3

A

DB2

A

DB1 DB0

A A

Note: Don’t care.*

Figure 12

Page 193: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

HD44780U

196

Set DDRAM Address

Set DDRAM address sets the DDRAM address binary AAAAAAA into the address counter.

Data is then written to or read from the MPU for DDRAM.

However, when N is 0 (1-line display), AAAAAAA can be 00H to 4FH. When N is 1 (2-line display),AAAAAAA can be 00H to 27H for the first line, and 40H to 67H for the second line.

Read Busy Flag and Address

Read busy flag and address reads the busy flag (BF) indicating that the system is now internally operatingon a previously received instruction. If BF is 1, the internal operation is in progress. The next instructionwill not be accepted until BF is reset to 0. Check the BF status before the next write operation. At thesame time, the value of the address counter in binary AAAAAAA is read out. This address counter isused by both CG and DDRAM addresses, and its value is determined by the previous instruction. Theaddress contents are the same as for instructions set CGRAM address and set DDRAM address.

Table 7 Shift Function

S/C R/L

0 0 Shifts the cursor position to the left. (AC is decremented by one.)

0 1 Shifts the cursor position to the right. (AC is incremented by one.)

1 0 Shifts the entire display to the left. The cursor follows the display shift.

1 1 Shifts the entire display to the right. The cursor follows the display shift.

Table 8 Function Set

N F

No. ofDisplayLines Character Font

DutyFactor Remarks

0 0 1 5 × 8 dots 1/8

0 1 1 5 × 10 dots 1/11

1 * 2 5 × 8 dots 1/16 Cannot display two lines for 5 × 10 dot character font

Note: * Indicates don’t care.

Page 194: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

HD44780U

197

Cursor

5 8 dot character font

5 10 dot character font

× × Alternating display

Blink display exampleCursor display example

Figure 13 Cursor and Blinking

RS

0

R/W

0

DB7

1

DB6

A

DB5

A

DB4

A

DB3

ACode

DB2

A

DB1

A

DB0

A

Higherorder bit

Lowerorder bit

RS

0

R/W

1

DB7

BF

DB6

A

DB5

A

DB4

A

DB3

ACode

DB2

A

DB1

A

DB0

A

Higherorder bit

Lowerorder bit

Set DDRAM address

Read busy flagand address

Figure 14

Page 195: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

HD44780U

198

Write Data to CG or DDRAM

Write data to CG or DDRAM writes 8-bit binary data DDDDDDDD to CG or DDRAM.

To write into CG or DDRAM is determined by the previous specification of the CGRAM or DDRAMaddress setting. After a write, the address is automatically incremented or decremented by 1 according tothe entry mode. The entry mode also determines the display shift.

Read Data from CG or DDRAM

Read data from CG or DDRAM reads 8-bit binary data DDDDDDDD from CG or DDRAM.

The previous designation determines whether CG or DDRAM is to be read. Before entering this readinstruction, either CGRAM or DDRAM address set instruction must be executed. If not executed, the firstread data will be invalid. When serially executing read instructions, the next address data is normallyread from the second read. The address set instructions need not be executed just before this readinstruction when shifting the cursor by the cursor shift instruction (when reading out DDRAM). Theoperation of the cursor shift instruction is the same as the set DDRAM address instruction.

After a read, the entry mode automatically increases or decreases the address by 1. However, display shiftis not executed regardless of the entry mode.

Note: The address counter (AC) is automatically incremented or decremented by 1 after the writeinstructions to CGRAM or DDRAM are executed. The RAM data selected by the AC cannot beread out at this time even if read instructions are executed. Therefore, to correctly read data,execute either the address set instruction or cursor shift instruction (only with DDRAM), then justbefore reading the desired data, execute the read instruction from the second time the readinstruction is sent.

RS

1

R/W

1

DB7

D

DB6

D

DB5

D

DB4

D

DB3

DCode

DB2

D

DB1

D

DB0

D

Higherorder bits

Lowerorder bits

RS

1

R/W

0

DB7

D

DB6

D

DB5

D

DB4

D

DB3

DCode

DB2

D

DB1

D

DB0

D

Higherorder bits

Lowerorder bits

Read data fromCG or DDRAM

Write data toCG or DDRAM

Figure 15

Page 196: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

HD44780U

199

Interfacing the HD44780U

Interface to MPUs

• Interfacing to an 8-bit MPU

See Figure 17 for an example of using a I/O port (for a single-chip microcomputer) as an interfacedevice.

In this example, P30 to P37 are connected to the data bus DB0 to DB7, and P75 to P77 are connectedto E, R/:, and RS, respectively.

RS

R/W

E

Internal operation

DB7

Functioning

Data Busy BusyNot busy Data

Instruction write

Busy flag check

Busy flag check

Busy flag check

Instruction write

Figure 16 Example of Busy Flag Check Timing Sequence

P30 to P37

P77 P76 P75

16

40

H8/325 HD44780U

8DB0 to DB7

E RS R/W

LCD

COM1 to COM16

SEG1 to SEG40

Figure 17 H8/325 Interface (Single-Chip Mode)

Page 197: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

HD44780U

200

• Interfacing to a 4-bit MPU

The HD44780U can be connected to the I/O port of a 4-bit MPU. If the I/O port has enough bits, 8-bitdata can be transferred. Otherwise, one data transfer must be made in two operations for 4-bit data. Inthis case, the timing sequence becomes somewhat complex. (See Figure 18.)

See Figure 19 for an interface example to the HMCS4019R.

Note that two cycles are needed for the busy flag check as well as for the data transfer. The 4-bitoperation is selected by the program.

RS

R/W

E

Internaloperation

DB7 IR7 IR3 Busy AC3Not

busy AC3 D7 D3

Instructionwrite

Busy flagcheck

Busy flagcheck

Instructionwrite

Note: IR7 , IR3 are the 7th and 3rd bits of the instruction.AC3 is the 3rd bit of the address counter.

Functioning

Figure 18 Example of 4-Bit Data Transfer Timing Sequence

D15

D14

D13

R10 to R13

RS

R/W

E

DB4 to DB7

COM1 to COM16

SEG1 to SEG40

4 40

16

LCD

HMCS4019R HD44780

Figure 19 Example of Interface to HMCS4019R

Page 198: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

HD44780U

201

Interface to Liquid Crystal Display

Character Font and Number of Lines: The HD44780U can perform two types of displays, 5 × 8 dotand 5 × 10 dot character fonts, each with a cursor.

Up to two lines are displayed for 5 × 8 dots and one line for 5 × 10 dots. Therefore, a total of three

types of common signals are available (Table 9).

The number of lines and font types can be selected by the program. (See Table 6, Instructions.)

Connection to HD44780 and Liquid Crystal Display: See Figure 20 for the connection examples.

Table 9 Common Signals

Number of Lines Character Font Number of Common Signals Duty Factor

1 5 × 8 dots + cursor 8 1/8

1 5 × 10 dots + cursor 11 1/11

2 5 × 8 dots + cursor 16 1/16

COM1

COM8

SEG1

SEG40

COM1

COM11

SEG1

SEG40

HD44780

Example of a 5 × 8 dot, 8-character × 1-line display (1/4 bias, 1/8 duty cycle)

Example of a 5 × 10 dot, 8-character × 1-line display (1/4 bias, 1/11 duty cycle)

HD44780

Figure 20 Liquid Crystal Display and HD44780 Connections

Page 199: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

HD44780U

202

Since five segment signal lines can display one digit, one HD44780U can display up to 8 digits for a 1-line display and 16 digits for a 2-line display.

The examples in Figure 20 have unused common signal pins, which always output non-selectionwaveforms. When the liquid crystal display panel has unused extra scanning lines, connect the extrascanning lines to these common signal pins to avoid any undesirable effects due to crosstalk during thefloating state (Figure 21).

COM1

COM8

SEG1

SEG40

HD44780

COM9

COM16

Example of a 5 × 8 dot, 8-character × 2-line display (1/5 bias, 1/16 duty cycle)

Figure 20 Liquid Crystal Display and HD44780 Connections (cont)

Cursor

5 8 dot character font

5 10 dot character font

× × Alternating display

Blink display exampleCursor display example

Figure 21 Using COM9 to Avoid Crosstalk on Unneeded Scanning Line

Page 200: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

HD44780U

203

Connection of Changed Matrix Layout: In the preceding examples, the number of lines correspond tothe scanning lines. However, the following display examples (Figure 22) are made possible by alteringthe matrix layout of the liquid crystal display panel. In either case, the only change is the layout. Thedisplay characteristics and the number of liquid crystal display characters depend on the number ofcommon signals or on duty factor. Note that the display data RAM (DDRAM) addresses for 4 characters× 2 lines and for 16 characters × 1 line are the same as in Figure 20.

Cursor

5 8 dot character font

5 10 dot character font

× × Alternating display

Blink display exampleCursor display example

Figure 22 Changed Matrix Layout Displays

Page 201: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

HD44780U

204

Power Supply for Liquid Crystal Display Drive

Various voltage levels must be applied to pins V1 to V5 of the HD44780U to obtain the liquid crystaldisplay drive waveforms. The voltages must be changed according to the duty factor (Table 10).

VLCD is the peak value for the liquid crystal display drive waveforms, and resistance dividing providesvoltages V1 to V5 (Figure 23).

Table 10 Duty Factor and Power Supply for Liquid Crystal Display Drive

Duty Factor

1/8, 1/11 1/16

Bias

Power Supply 1/4 1/5

V1 VCC–1/4 VLCD VCC–1/5 VLCD

V2 VCC–1/2 VLCD VCC–2/5 VLCD

V3 VCC–1/2 VLCD VCC–3/5 VLCD

V4 VCC–3/4 VLCD VCC–4/5 VLCD

V5 VCC–VLCD VCC–VLCD

VCC

V1

V4

V5

V2

V3

VCC

V1

V2

V3

V4

V5

R

R

R

R

VR

–5 V

VCC (+5 V)

–5 V

VCC (+5 V)

R

R

R

R

R

VR

VLCDVLCD

1/4 bias (1/8, 1/11 duty cycle)

1/5 bias (1/16, duty cycle)

Figure 23 Drive Voltage Supply Example

Page 202: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

HD44780U

205

Relationship between Oscillation Frequency and Liquid Crystal Display FrameFrequency

The liquid crystal display frame frequencies of Figure 24 apply only when the oscillation frequency is270 kHz (one clock pulse of 3.7 µs).

1 2 3 4 8 1 2

1 2 3 4 11 1 2

1 2 3 4 16 1 2

400 clocks

400 clocks

200 clocks

1 frame

1 frame

1 frame

1/8 duty cycle

1/11 duty cycle

1/16 duty cycle

VCC

V1

V2 (V3)

V4

V5

VCC

V1

V2 (V3)

V4

V5

VCC

V1

V2

V3

V4

V5

COM1

COM1

COM1

1 frame = 3.7 µs × 400 × 8 = 11850 µs = 11.9 ms

Frame frequency = = 84.3 Hz1 11.9 ms

1 frame = 3.7 µs × 400 × 11 = 16300 µs = 16.3 ms

Frame frequency = = 61.4 Hz1 16.3 ms

1 frame = 3.7 µs × 200 × 16 = 11850 µs = 11.9 ms

Frame frequency = = 84.3 Hz1 11.9 ms

Figure 24 Frame Frequency

Page 203: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

HD44780U

206

Instruction and Display Correspondence

• 8-bit operation, 8-digit × 1-line display with internal reset

Refer to Table 11 for an example of an 8-digit × 1-line display in 8-bit operation. The HD44780Ufunctions must be set by the function set instruction prior to the display. Since the display data RAMcan store data for 80 characters, as explained before, the RAM can be used for displays such as foradvertising when combined with the display shift operation.

Since the display shift operation changes only the display position with DDRAM contents unchanged,the first display data entered into DDRAM can be output when the return home operation isperformed.

• 4-bit operation, 8-digit × 1-line display with internal reset

The program must set all functions prior to the 4-bit operation (Table 12). When the power is turnedon, 8-bit operation is automatically selected and the first write is performed as an 8-bit operation.Since DB0 to DB3 are not connected, a rewrite is then required. However, since one operation iscompleted in two accesses for 4-bit operation, a rewrite is needed to set the functions (see Table 12).Thus, DB4 to DB7 of the function set instruction is written twice.

• 8-bit operation, 8-digit × 2-line display

For a 2-line display, the cursor automatically moves from the first to the second line after the 40thdigit of the first line has been written. Thus, if there are only 8 characters in the first line, theDDRAM address must be again set after the 8th character is completed. (See Table 13.) Note that thedisplay shift operation is performed for the first and second lines. In the example of Table 13, thedisplay shift is performed when the cursor is on the second line. However, if the shift operation isperformed when the cursor is on the first line, both the first and second lines move together. If theshift is repeated, the display of the second line will not move to the first line. The same display willonly shift within its own line for the number of times the shift is repeated.

Note: When using the internal reset, the electrical characteristics in the Power Supply Conditions UsingInternal Reset Circuit table must be satisfied. If not, the HD44780U must be initialized byinstructions. See the section, Initializing by Instruction.

Page 204: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

HD44780U

207

Table 11 8-Bit Operation, 8-Digit ×× 1-Line Display Example with Internal Reset

Step Instruction

No. RS R/:: DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0 Display Operation

1 Power supply on (the HD44780U is initialized by the internalreset circuit)

Initialized. No display.

2 Function set0 0 0 0 1 1 0 0 * *

Sets to 8-bit operation andselects 1-line display and 5 × 8dot character font. (Number ofdisplay lines and character fontscannot be changed after step#2.)

3 Display on/off control0 0 0 0 0 0 1 1 1 0

_ Turns on display and cursor.Entire display is in space modebecause of initialization.

4 Entry mode set0 0 0 0 0 0 0 1 1 0

_ Sets mode to increment theaddress by one and to shift thecursor to the right at the time ofwrite to the DD/CGRAM.Display is not shifted.

5 Write data to CGRAM/DDRAM1 0 0 1 0 0 1 0 0 0

H_ Writes H. DDRAM has alreadybeen selected by initializationwhen the power was turned on.The cursor is incremented byone and shifted to the right.

6 Write data to CGRAM/DDRAM1 0 0 1 0 0 1 0 0 1

HI_ Writes I.

7 ·····

·····

8 Write data to CGRAM/DDRAM1 0 0 1 0 0 1 0 0 1

HITACHI_ Writes I.

9 Entry mode set0 0 0 0 0 0 0 1 1 1

HITACHI_ Sets mode to shift display at thetime of write.

10 Write data to CGRAM/DDRAM1 0 0 0 1 0 0 0 0 0

ITACHI _ Writes a space.

Page 205: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

HD44780U

208

Table 11 8-Bit Operation, 8-Digit ×× 1-Line Display Example with Internal Reset (cont)

Step Instruction

No. RS R/:: DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0 Display Operation

11 Write data to CGRAM/DDRAM1 0 0 1 0 0 1 1 0 1

Cursor

5 8 dot character font

5 10 dot character font

× × Alternating display

Blink display exampleCursor display example

Writes M.

12 ·····

·····

13 Write data to CGRAM/DDRAM1 0 0 1 0 0 1 1 1 1

MICROKO_ Writes O.

14 Cursor or display shift0 0 0 0 0 1 0 0 * *

MICROKO _Shifts only the cursor position tothe left.

15 Cursor or display shift0 0 0 0 0 1 0 0 * *

MICROKO _Shifts only the cursor position tothe left.

16 Write data to CGRAM/DDRAM1 0 0 1 0 0 0 0 1 1

ICROCO _Writes C over K.The display moves to the left.

17 Cursor or display shift0 0 0 0 0 1 1 1 * *

MICROCO _Shifts the display and cursorposition to the right.

18 Cursor or display shift0 0 0 0 0 1 0 1 * *

MICROCO_ Shifts the display and cursorposition to the right.

19 Write data to CGRAM/DDRAM1 0 0 1 0 0 1 1 0 1

ICROCOM_ Writes M.

20 ·····

·····

21 Return home0 0 0 0 0 0 0 0 1 0

HITACHI _ Returns both display and cursorto the original position (address0).

Page 206: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

HD44780U

209

Table 12 4-Bit Operation, 8-Digit ×× 1-Line Display Example with Internal Reset

Step Instruction

No. RS R/:: DB7 DB6 DB5 DB4 Display Operation

1 Power supply on (the HD44780U is initialized by the internalreset circuit)

Initialized. No display.

2 Function set0 0 0 0 1 0

Sets to 4-bit operation.In this case, operation ishandled as 8 bits by initializa-tion, and only this instructioncompletes with one write.

3 Function set0 0 0 0 1 00 0 0 0 * *

Sets 4-bit operation and selects1-line display and 5 × 8 dotcharacter font. 4-bit operationstarts from this step andresetting is necessary. (Numberof display lines and characterfonts cannot be changed afterstep #3.)

4 Display on/off control0 0 0 0 0 00 0 1 1 1 0

_ Turns on display and cursor.Entire display is in space modebecause of initialization.

5 Entry mode set0 0 0 0 0 00 0 0 1 1 0

Sets mode to increment theaddress by one and to shift thecursor to the right at the time ofwrite to the DD/CGRAM.Display is not shifted.

6 Write data to CGRAM/DDRAM1 0 0 1 0 01 0 1 0 0 0

H_ Writes H.The cursor is incremented byone and shifts to the right.

Note: The control is the same as for 8-bit operation beyond step #6.

Page 207: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

HD44780U

210

Table 13 8-Bit Operation, 8-Digit ×× 2-Line Display Example with Internal Reset

Step Instruction

No. RS R/:: DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0 Display Operation

1 Power supply on (the HD44780U is initialized by the internalreset circuit)

Initialized. No display.

2 Function set0 0 0 0 1 1 1 0 * *

Sets to 8-bit operation andselects 2-line display and 5 × 8dot character font.

3 Display on/off control0 0 0 0 0 0 1 1 1 0

_ Turns on display and cursor. Alldisplay is in space modebecause of initialization.

4 Entry mode set0 0 0 0 0 0 0 1 1 0

_ Sets mode to increment theaddress by one and to shift thecursor to the right at the time ofwrite to the DD/CGRAM.Display is not shifted.

5 Write data to CGRAM/DDRAM1 0 0 1 0 0 1 0 0 0

H_ Writes H. DDRAM has alreadybeen selected by initializationwhen the power was turned on.The cursor is incremented byone and shifted to the right.

6 ·····

·····

7 Write data to CGRAM/DDRAM1 0 0 1 0 0 1 0 0 1

HITACHI_ Writes I.

8 Set DDRAM address0 0 1 1 0 0 0 0 0 0

HITACHI _

Sets DDRAM address so thatthe cursor is positioned at thehead of the second line.

Page 208: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

HD44780U

211

Table 13 8-Bit Operation, 8-Digit ×× 2-Line Display Example with Internal Reset (cont)

Step Instruction

No. RS R/:: DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0 Display Operation

9 Write data to CGRAM/DDRAM1 0 0 1 0 0 1 1 0 1

HITACHI M_

Writes M.

10 ·····

·····

11 Write data to CGRAM/DDRAM1 0 0 1 0 0 1 1 1 1

HITACHI MICROCO_

Writes O.

12 Entry mode set0 0 0 0 0 0 0 1 1 1

HITACHI MICROCO_

Sets mode to shift display at thetime of write.

13 Write data to CGRAM/DDRAM1 0 0 1 0 0 1 1 0 1

ITACHI ICROCOM_

Writes M. Display is shifted tothe left. The first and secondlines both shift at the same time.

14 ·····

·····

15 Return home0 0 0 0 0 0 0 0 1 0

HITACHI MICROCOM _ Returns both display and cursor

to the original position (address0).

Page 209: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

HD44780U

212

Initializing by Instruction

If the power supply conditions for correctly operating the internal reset circuit are not met, initializationby instructions becomes necessary.

Refer to Figures 25 and 26 for the procedures on 8-bit and 4-bit initializations, respectively.

Power on

Wait for more than 15 ms after VCC rises to 4.5 V

Wait for more than 4.1 ms

Wait for more than 100 µs

RS 0

R/W 0

DB7 0

DB6 0

DB5 1

DB4 1

DB3DB2 DB1 DB0 * * * *

RS 0

R/W 0

DB7 0

DB6 0

DB5 1

DB4 1

DB3DB2DB1DB0* * * *

RS 0

R/W 0

DB7 0

DB6 0

DB5 1

DB4 1

DB3DB2DB1* * *

DB0*

RS 0

R/W 0

DB7 0

DB6 0

DB5 1

DB4 1

DB3 N

DB2 F

DB1DB0* *

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

1

0

0

0

0

1

0

0

I/D

0

1

S

Initialization ends

BF cannot be checked before this instruction.

Function set (Interface is 8 bits long.)

BF cannot be checked before this instruction.

Function set (Interface is 8 bits long.)

BF cannot be checked before this instruction.

Function set (Interface is 8 bits long.)

BF can be checked after the following instructions. When BF is not checked, the waiting time between instructions is longer than the execution instuction time. (See Table 6.)

Function set (Interface is 8 bits long. Specify the number of display lines and character font.) The number of display lines and character font cannot be changed after this point.

Display off

Display clear

Entry mode set

Wait for more than 40 ms after VCC rises to 2.7 V

Figure 25 8-Bit Interface

Page 210: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

HD44780U

213

Initialization ends

Wait for more than 15 ms after VCC rises to 4.5 V

Wait for more than 40 ms after VCC rises to 2.7 V

BF cannot be checked before this instruction.

Function set (Interface is 8 bits long.)

BF cannot be checked before this instruction.

Function set (Interface is 8 bits long.)

BF cannot be checked before this instruction.

Function set (Interface is 8 bits long.)

DB7 0

DB6 0

DB5 1

DB4 1

RS 0

R/W 0

Wait for more than 4.1 ms

DB7 0

DB6 0

DB5 1

DB4 1

RS 0

R/W 0

Wait for more than 100 µs

DB7 0

DB6 0

DB5 1

DB4 1

RS 0

R/W 0

DB7 0

DB6 0

DB5 1

DB4 0

RS 0

R/W 0

0

N

0

1

0

0

0

0

0

F

0

0

0

0

0

1

1

0

0

0

0

0

I/D

0

0

0

0

1

0

S

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

* *

BF can be checked after the following instructions. When BF is not checked, the waiting time between instructions is longer than the execution instuction time. (See Table 6.)

Function set (Set interface to be 4 bits long.) Interface is 8 bits in length.

Display off

Display clear

Entry mode set

Function set (Interface is 4 bits long. Specify the number of display lines and character font.) The number of display lines and character font cannot be changed after this point.

Power on

Figure 26 4-Bit Interface

Page 211: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

HD44780U

214

Absolute Maximum Ratings*

Item Symbol Value Unit Notes

Power supply voltage (1) VCC–GND –0.3 to +7.0 V 1

Power supply voltage (2) VCC–V5 –0.3 to +13.0 V 1, 2

Input voltage Vt –0.3 to VCC +0.3 V 1

Operating temperature Topr –20 to +75 °C

Storage temperature Tstg –55 to +125 °C 4

Note: * If the LSI is used above these absolute maximum ratings, it may become permanently damaged.Using the LSI within the following electrical characteristic limits is strongly recommended for normaloperation. If these electrical characteristic conditions are also exceeded, the LSI will malfunctionand cause poor reliability.

Page 212: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

HD44780U

215

DC Characteristics (VCC = 2.7 to 4.5 V, Ta = –20 to +75°C*3)

Item Symbol Min Typ Max Unit Test Condition Notes*

Input high voltage (1)(except OSC1)

VIH1 0.7VCC — VCC V 6

Input low voltage (1)(except OSC1)

VIL1 –0.3 — 0.55 V 6

Input high voltage (2)(OSC1)

VIH2 0.7VCC — VCC V 15

Input low voltage (2)(OSC1)

VIL2 — — 0.2VCC V 15

Output high voltage (1)(DB0–DB7)

VOH1 0.75VCC — — V –IOH = 0.1 mA 7

Output low voltage (1)(DB0–DB7)

VOL1 — — 0.2VCC V IOL = 0.1 mA 7

Output high voltage (2)(except DB0–DB7)

VOH2 0.8VCC — — V –IOH = 0.04 mA 8

Output low voltage (2)(except DB0–DB7)

VOL2 — — 0.2VCC V IOL = 0.04 mA 8

Driver on resistance(COM)

RCOM — 2 20 kΩ ±Id = 0.05 mA,VLCD = 4 V

13

Driver on resistance(SEG)

RSEG — 2 30 kΩ ±Id = 0.05 mA,VLCD = 4 V

13

Input leakage current ILI –1 — 1 µA VIN = 0 to VCC 9

Pull-up MOS current(DB0–DB7, RS, R/:)

–Ip 10 50 120 µA VCC = 3 V

Power supply current ICC — 0.15 0.30 mA Rf oscillation,external clockVCC = 3 V,fOSC = 270 kHz

10, 14

LCD voltage VLCD1 3.0 — 11.0 V VCC–V5, 1/5 bias 16

VLCD2 3.0 — 11.0 V VCC–V5, 1/4 bias 16

Note: * Refer to the Electrical Characteristics Notes section following these tables.

Page 213: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

HD44780U

216

AC Characteristics (VCC = 2.7 to 4.5 V, Ta = –20 to +75°C*3)

Clock Characteristics

Item Symbol Min Typ Max Unit Test Condition Note*

External External clock frequency fcp 125 250 350 kHz 11clock External clock duty Duty 45 50 55 %operation

External clock rise time trcp — — 0.2 µs

External clock fall time tfcp — — 0.2 µs

Rf

oscillationClock oscillationfrequency

fOSC 190 270 350 kHz Rf = 75 kΩ,VCC = 3 V

12

Note: * Refer to the Electrical Characteristics Notes section following these tables.

Bus Timing Characteristics

Write Operation

Item Symbol Min Typ Max Unit Test Condition

Enable cycle time tcycE 1000 — — ns Figure 27

Enable pulse width (high level) PWEH 450 — —

Enable rise/fall time tEr, tEf — — 25

Address set-up time (RS, R/: to E) tAS 60 — —

Address hold time tAH 20 — —

Data set-up time tDSW 195 — —

Data hold time tH 10 — —

Read Operation

Item Symbol Min Typ Max Unit Test Condition

Enable cycle time tcycE 1000 — — ns Figure 28

Enable pulse width (high level) PWEH 450 — —

Enable rise/fall time tEr, tEf — — 25

Address set-up time (RS, R/: to E) tAS 60 — —

Address hold time tAH 20 — —

Data delay time tDDR — — 360

Data hold time tDHR 5 — —

Page 214: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

HD44780U

217

Interface Timing Characteristics with External Driver

Item Symbol Min Typ Max Unit Test Condition

Clock pulse width High level tCWH 800 — — ns Figure 29

Low level tCWL 800 — —

Clock set-up time tCSU 500 — —

Data set-up time tSU 300 — —

Data hold time tDH 300 — —

M delay time tDM –1000 — 1000

Clock rise/fall time tct — — 200

Power Supply Conditions Using Internal Reset Circuit

Item Symbol Min Typ Max Unit Test Condition

Power supply rise time trCC 0.1 — 10 ms Figure 30

Power supply off time tOFF 1 — —

Page 215: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

HD44780U

218

DC Characteristics (VCC = 4.5 to 5.5 V, Ta = –20 to +75°C*3)

Item Symbol Min Typ Max Unit Test Condition Notes*

Input high voltage (1)(except OSC1)

VIH1 2.2 — VCC V 6

Input low voltage (1)(except OSC1)

VIL1 –0.3 — 0.6 V 6

Input high voltage (2)(OSC1)

VIH2 VCC–1.0 — VCC V 15

Input low voltage (2)(OSC1)

VIL2 — — 1.0 V 15

Output high voltage (1)(DB0–DB7)

VOH1 2.4 — — V –IOH = 0.205 mA 7

Output low voltage (1)(DB0–DB7)

VOL1 — — 0.4 V IOL = 1.2 mA 7

Output high voltage (2)(except DB0–DB7)

VOH2 0.9 VCC — — V –IOH = 0.04 mA 8

Output low voltage (2)(except DB0–DB7)

VOL2 — — 0.1 VCC V IOL = 0.04 mA 8

Driver on resistance(COM)

RCOM — 2 20 kΩ ±Id = 0.05 mA,VLCD = 4 V

13

Driver on resistance(SEG)

RSEG — 2 30 kΩ ±Id = 0.05 mA,VLCD = 4 V

13

Input leakage current ILI –1 — 1 µA VIN = 0 to VCC 9

Pull-up MOS current(DB0–DB7, RS, R/:)

–Ip 50 125 250 µA VCC = 5 V

Power supply current ICC — 0.35 0.60 mA Rf oscillation,external clockVCC = 5 V,fOSC = 270 kHz

10, 14

LCD voltage VLCD1 3.0 — 11.0 V VCC–V5, 1/5 bias 16

VLCD2 3.0 — 11.0 V VCC–V5, 1/4 bias 16

Note: * Refer to the Electrical Characteristics Notes section following these tables.

Page 216: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

HD44780U

219

AC Characteristics (VCC = 4.5 to 5.5 V, Ta = –20 to +75°C*3)

Clock Characteristics

Item Symbol Min Typ Max Unit Test Condition Notes*

External External clock frequency fcp 125 250 350 kHz 11clock External clock duty Duty 45 50 55 % 11operation

External clock rise time trcp — — 0.2 µs 11

External clock fall time tfcp — — 0.2 µs 11

Rf

oscillationClock oscillation frequency fOSC 190 270 350 kHz Rf = 91 kΩ

VCC = 5.0 V12

Note: * Refer to the Electrical Characteristics Notes section following these tables.

Bus Timing Characteristics

Write Operation

Item Symbol Min Typ Max Unit Test Condition

Enable cycle time tcycE 500 — — ns Figure 27

Enable pulse width (high level) PWEH 230 — —

Enable rise/fall time tEr, tEf — — 20

Address set-up time (RS, R/: to E) tAS 40 — —

Address hold time tAH 10 — —

Data set-up time tDSW 80 — —

Data hold time tH 10 — —

Read Operation

Item Symbol Min Typ Max Unit Test Condition

Enable cycle time tcycE 500 — — ns Figure 28

Enable pulse width (high level) PWEH 230 — —

Enable rise/fall time tEr, tEf — — 20

Address set-up time (RS, R/: to E) tAS 40 — —

Address hold time tAH 10 — —

Data delay time tDDR — — 160

Data hold time tDHR 5 — —

Page 217: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

HD44780U

220

Interface Timing Characteristics with External Driver

Item Symbol Min Typ Max Unit Test Condition

Clock pulse width High level tCWH 800 — — ns Figure 29

Low level tCWL 800 — —

Clock set-up time tCSU 500 — —

Data set-up time tSU 300 — —

Data hold time tDH 300 — —

M delay time tDM –1000 — 1000

Clock rise/fall time tct — — 100

Power Supply Conditions Using Internal Reset Circuit

Item Symbol Min Typ Max Unit Test Condition

Power supply rise time trCC 0.1 — 10 ms Figure 30

Power supply off time tOFF 1 — —

Page 218: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

HD44780U

221

Electrical Characteristics Notes

1. All voltage values are referred to GND = 0 V.

VCC

A

B

A 1.5 V B 0.25 × A

≥ ≤

The conditions of V1 and V5 voltages are for proper operation of the LSI and not for the LCD output level. The LCD drive voltage condition for the LCD output level is specified as LCD voltage VLCD.

A = B =

VCC –V5 VCC –V1

V1

V5

2. VCC ≥ V1 ≥ V2 ≥ V3 ≥ V4≥V5 must be maintained.

3. For die products, specified up to 75°C.

4. For die products, specified by the die shipment specification.

5. The following four circuits are I/O pin configurations except for liquid crystal display output.

PMOS

NMOS

VCC VCC

PMOS

NMOS

(pull up MOS)

PMOS

VCC

PMOS

NMOS

VCC

NMOS

NMOS

VCC

PMOS

NMOS

(output circuit) (tristate)

Output enable Data

(pull-up MOS)

I/O Pin Pins: DB0 –DB7 (MOS with pull-up)

Input pin Pin: E (MOS without pull-up)

Pins: RS, R/W (MOS with pull-up)

Output pin Pins: CL1, CL2, M, D

VCC

(input circuit)

PMOSPMOS

Input enable

Page 219: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

HD44780U

222

6. Applies to input pins and I/O pins, excluding the OSC1 pin.

7. Applies to I/O pins.

8. Applies to output pins.

9. Current flowing through pull–up MOSs, excluding output drive MOSs.

10. Input/output current is excluded. When input is at an intermediate level with CMOS, the excessivecurrent flows through the input circuit to the power supply. To avoid this from happening, the inputlevel must be fixed high or low.

11. Applies only to external clock operation.

Oscillator OSC1

OSC2

0.7 VCC 0.5 VCC 0.3 VCC

Th Tl

t rcp t fcp

Duty = 100%Th Th + Tl

×

Open

12. Applies only to the internal oscillator operation using oscillation resistor Rf.

OSC1

OSC2

Rf

R : R :

f

f

75 k ± 2% (when VCC = 3 V) 91 k ± 2% (when VCC = 5 V)Ω

500

400

300

200

10050 100 150(91)

R (k )f Ω

f

(k

Hz)

OS

C

VCC = 5 V500

400

300

200

10050 100 150

R (k )f Ω

f

(k

Hz)

OS

C

VCC = 3 V

typ.

Since the oscillation frequency varies depending on the OSC1 and OSC2 pin capacitance, the wiring length to these pins should be minimized.

(270) (270)

Ω

(75)

typ.

max.

min.

max.

min.

Page 220: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

HD44780U

223

13. RCOM is the resistance between the power supply pins (VCC, V1, V4, V5) and each common signalpin (COM1 to COM16).

RSEG is the resistance between the power supply pins (VCC, V2, V3, V5) and each segment signal pin(SEG1 to SEG40).

14. The following graphs show the relationship between operation frequency and current consumption.

1.8

1.6

1.4

1.2

1.0

0.8

0.6

0.4

0.2

0.0

1.8

1.6

1.4

1.2

1.0

0.8

0.6

0.4

0.2

0.00 100 200 300 400 500

VCC = 5 V

0 100 200 300 400 500

VCC = 3 V

fOSC or fcp (kHz) fOSC or fcp (kHz)

I CC (

mA

)

I CC

(mA

)

max.

typ.max.

typ.

15. Applies to the OSC1 pin.

16. Each COM and SEG output voltage is within ±0.15 V of the LCD voltage (VCC, V1, V2, V3, V4, V5)when there is no load.

Page 221: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

HD44780U

224

Load Circuits

Data Bus DB0 to DB7

For V = 4.5 to 5.5 VCC

Testpoint

90 pF 11 kΩ

V = 5 VCC

3.9 kΩ

IS2074diodes

H

For V = 2.7 to 4.5 VCC

Testpoint

50 pF

External Driver Control Signals: CL1, CL2, D, M

Test point

30 pF

Page 222: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

HD44780U

225

Timing Characteristics

RS

R/W

E

DB0 to DB7

VIH1 VIL1

VIH1 VIL1

tAS tAH

VIL1 VIL1

tAHPWEH

tEf

VIH1 VIL1

VIH1 VIL1

tErtDSW tH

VIH1 VIL1

VIH1 VIL1

tcycE

VIL1

Valid data

Figure 27 Write Operation

RS

R/W

E

DB0 to DB7

VIH1 VIL1

VIH1 VIL1

tAS tAH

VIH1 VIH1

tAHPWEH

tEf

VIH1 VIL1

VIH1 VIL1

tDDR tDHR

tEr

VIL1

VOH1 VOL1 *

VOH1 * VOL1Valid data

tcycE

Note: * VOL1 is assumed to be 0.8 V at 2 MHz operation.

Figure 28 Read Operation

Page 223: PENAMPIL BIAYA LISTRIK BERBASIS VISUAL BASIC · 2018. 6. 29. · percen, so the result is customer invoice. Using this device to calculate troublesome electicity calculation, It will

HD44780U

226

CL1

CL2

D

M

VOH2 VOH2VOL2

tct

tCWH

tCWH

tCSU

VOH2

tCSU tCWL

tct

tDH

tSU

VOH2

tDM

VOH2 VOL2

VOL2

Figure 29 Interface Timing with External Driver

VCC

0.2 V

2.7 V/4.5 V*2

0.2 V 0.2 V

trcc tOFF*1

0.1 ms trcc 10 ms≤ ≤ tOFF 1 ms≥

Notes: 1. 2. 3.

tOFF compensates for the power oscillation period caused by momentary power supply oscillations. Specified at 4.5 V for 5-V operation, and at 2.7 V for 3-V operation. For if 4.5 V is not reached during 5-V operation, the internal reset circuit will not operate normally. In this case, the LSI must be initialized by software. (Refer to the Initializing by Instruction section.)

Figure 30 Internal Power Supply Reset