Kumpulan Cerpen Lucu Kumpulan Cerpen Lucu. Setelah bekerja seharian ada baiknya sedikit refresing, daripada terus-terusan nyepam karena pengen optimasi Astaga.com lifestyle on the net atau Peluang Usaha Ahasu Gnaulep, mending baca Cerita lucu atau Kumpulan cerpen lucu ini yuk, lumayan untuk mengurangi sakit kepala hehehe. Cerita-cerita ini saya buat beberapa bulan lalu di blog saya Ceritacinta-di.blogspot.com, tapi ga ada salahnya kalau di baca lagi. O ya, sedikit pembahasan sebelum kita masuk ke bagian ceritalucu ini. Humor atau cerita-cerita yang lucu sudah terbukti dapat membuat pembacanya awet muda dan tercegah dari penyakit kanker (apa benar?), saya juga kurang tahu hehehe. Setahu saya, humor dapat membuat suasana hati menjadi tenang, dan kita pun menjadi lebih fokus dalam pekerjaan. Kayanya dah cukup nih basa-basinya, yuk langsung sedikit dari kumpulan cerpenlucu ini.
Cerita lucu | Misteri kematian 3 hantu waria
Hari itu ada tiga sosok hantu yang sedang berkumpul, dari wajah mereka memang terlihat sangat menakutkan, tapi ketika mereka berbicara dengan anggunnya, mungkin tak ada seorang yang akan lari melihat sosok mereka karena mengerikan,,,,
Tapi lebih tepatnya lari karena geli mereka adalah waria wkekekek.
(baca selengkapnya : Cerita lucu | Misteri kematian 3 hantu waria).
Cinta di tolak dukun bertindak
Pasti pernah dengar istilah inikan?...ketika itu seorang lelaki menadatangi seorang dukun yang sangat ahli dalam hal percintaan. Ketika disana si laki-laki meminta tolong ke si dukun untuk mendapatkan seorang gadis pujaannya. "Pak dukun tolong saya untuk dapetin seorang gadis". "Wah gampang-gampang...asal...". "Oh...tenang aja pak...saya udah siapin kok...Sang dukun lalu menanyakan nama dari gadis yang disukai sang cowok, si cowok lalu memberi tahu nama gadis itu. Kemudian sang dukun melanjutkan membaca mantranya..."nah beres", kata sang dukun...tapi si cowok terliat bingung meliahat sang dukun.
Read more: http://www.anekatips.info/2010/01/kumpulan-cerpen-lucu.html#ixzz0nqFMLAZR
Kamis, 13 Mei 2010
tentang sumpah pemuda
SOEMPAH PEMOEDA
Pertama :
- KAMI POETRA DAN POETRI INDONESIA MENGAKOE BERTOEMPAH DARAH JANG SATOE, TANAH AIR INDONESIA
Kedua :
- KAMI POETRA DAN POETRI INDONESIA, MENGAKOE BERBANGSA JANG SATOE, BANGSA INDONESIA
Ketiga :
- KAMI POETRA DAN POETRI INDONESIA MENGJOENJOENG BAHASA PERSATOEAN, BAHASA INDONESIA
Djakarta, 28 Oktober 1928
Teks Soempah Pemoeda dibacakan pada waktu Kongres Pemoeda yang diadakan di
Waltervreden (sekarang Jakarta) pada tanggal 27 - 28 Oktober 1928 1928.
Panitia Kongres Pemoeda terdiri dari :
Ketua : Soegondo Djojopoespito (PPPI)
Wakil Ketua : R.M. Djoko Marsaid (Jong Java)
Sekretaris : Mohammad Jamin (Jong Sumateranen Bond)
Bendahara : Amir Sjarifuddin (Jong Bataks Bond)
Pembantu I : Djohan Mohammad Tjai (Jong Islamieten Bond)
Pembantu II : R. Katja Soengkana (Pemoeda Indonesia)
Pembantu III : Senduk (Jong Celebes)
Pembantu IV : Johanes Leimena (yong Ambon)
Pembantu V : Rochjani Soe'oed (Pemoeda Kaoem Betawi)
Peserta :
1.
Abdul Muthalib Sangadji
2.
Purnama Wulan
3.
Abdul Rachman
4.
Raden Soeharto
5.
Abu Hanifah
6.
Raden Soekamso
7.
Adnan Kapau Gani
8.
Ramelan
9.
Amir (Dienaren van Indie)
10.
Saerun (Keng Po)
11.
Anta Permana
12.
Sahardjo
13.
Anwari
14.
Sarbini
15.
Arnold Manonutu
16.
Sarmidi Mangunsarkoro
17.
Assaat
18.
Sartono
19.
Bahder Djohan
20.
S.M. Kartosoewirjo
21.
Dali
22.
Setiawan
23.
Darsa
24.
Sigit (Indonesische Studieclub)
25.
Dien Pantouw
26.
Siti Sundari
27.
Djuanda
28.
Sjahpuddin Latif
29.
Dr.Pijper
30.
Sjahrial (Adviseur voor inlandsch Zaken)
31.
Emma Puradiredja
32.
Soejono Djoenoed Poeponegoro
33.
Halim
34.
R.M. Djoko Marsaid
35.
Hamami
36.
Soekamto
37.
Jo Tumbuhan
38.
Soekmono
39.
Joesoepadi
40.
Soekowati (Volksraad)
41.
Jos Masdani
42.
Soemanang
43.
Kadir
44.
Soemarto
45.
Karto Menggolo
46.
Soenario (PAPI & INPO)
47.
Kasman Singodimedjo
48.
Soerjadi
49.
Koentjoro Poerbopranoto
50.
Soewadji Prawirohardjo
51.
Martakusuma
52.
Soewirjo
53.
Masmoen Rasid
54.
Soeworo
55.
Mohammad Ali Hanafiah
56.
Suhara
57.
Mohammad Nazif
58.
Sujono (Volksraad)
59.
Mohammad Roem
60.
Sulaeman
61.
Mohammad Tabrani
62.
Suwarni
63.
Mohammad Tamzil
64.
Tjahija
65.
Muhidin (Pasundan)
66.
Van der Plaas (Pemerintah Belanda)
67.
Mukarno
68.
Wilopo
69.
Muwardi
70.
Wage Rudolf Soepratman
71.
Nona Tumbel
Catatan :
Sebelum pembacaan teks Soempah Pemoeda diperdengarkan lagu"Indonesia Raya"
gubahan W.R. Soepratman dengan gesekan biolanya.
1. Teks Sumpah Pemuda dibacakan pada tanggal 28 Oktober 1928 bertempat
di Jalan Kramat Raya nomor 106 Jakarta Pusat sekarang menjadi Museum Sumpah
Pemuda, pada waktu itu adalah milik dari seorang Tionghoa yang bernama Sie
Kong Liong.
2. 2. Golongan Timur Asing Tionghoa yang turut hadir sebagai peninjau
Kongres Pemuda pada waktu pembacaan teks Sumpah Pemuda ada 4 (empat) orang
yaitu :
a. Kwee Thiam Hong
b. Oey Kay Siang
c. John Lauw Tjoan Hok
d. Tjio Djien kwie
Pertama :
- KAMI POETRA DAN POETRI INDONESIA MENGAKOE BERTOEMPAH DARAH JANG SATOE, TANAH AIR INDONESIA
Kedua :
- KAMI POETRA DAN POETRI INDONESIA, MENGAKOE BERBANGSA JANG SATOE, BANGSA INDONESIA
Ketiga :
- KAMI POETRA DAN POETRI INDONESIA MENGJOENJOENG BAHASA PERSATOEAN, BAHASA INDONESIA
Djakarta, 28 Oktober 1928
Teks Soempah Pemoeda dibacakan pada waktu Kongres Pemoeda yang diadakan di
Waltervreden (sekarang Jakarta) pada tanggal 27 - 28 Oktober 1928 1928.
Panitia Kongres Pemoeda terdiri dari :
Ketua : Soegondo Djojopoespito (PPPI)
Wakil Ketua : R.M. Djoko Marsaid (Jong Java)
Sekretaris : Mohammad Jamin (Jong Sumateranen Bond)
Bendahara : Amir Sjarifuddin (Jong Bataks Bond)
Pembantu I : Djohan Mohammad Tjai (Jong Islamieten Bond)
Pembantu II : R. Katja Soengkana (Pemoeda Indonesia)
Pembantu III : Senduk (Jong Celebes)
Pembantu IV : Johanes Leimena (yong Ambon)
Pembantu V : Rochjani Soe'oed (Pemoeda Kaoem Betawi)
Peserta :
1.
Abdul Muthalib Sangadji
2.
Purnama Wulan
3.
Abdul Rachman
4.
Raden Soeharto
5.
Abu Hanifah
6.
Raden Soekamso
7.
Adnan Kapau Gani
8.
Ramelan
9.
Amir (Dienaren van Indie)
10.
Saerun (Keng Po)
11.
Anta Permana
12.
Sahardjo
13.
Anwari
14.
Sarbini
15.
Arnold Manonutu
16.
Sarmidi Mangunsarkoro
17.
Assaat
18.
Sartono
19.
Bahder Djohan
20.
S.M. Kartosoewirjo
21.
Dali
22.
Setiawan
23.
Darsa
24.
Sigit (Indonesische Studieclub)
25.
Dien Pantouw
26.
Siti Sundari
27.
Djuanda
28.
Sjahpuddin Latif
29.
Dr.Pijper
30.
Sjahrial (Adviseur voor inlandsch Zaken)
31.
Emma Puradiredja
32.
Soejono Djoenoed Poeponegoro
33.
Halim
34.
R.M. Djoko Marsaid
35.
Hamami
36.
Soekamto
37.
Jo Tumbuhan
38.
Soekmono
39.
Joesoepadi
40.
Soekowati (Volksraad)
41.
Jos Masdani
42.
Soemanang
43.
Kadir
44.
Soemarto
45.
Karto Menggolo
46.
Soenario (PAPI & INPO)
47.
Kasman Singodimedjo
48.
Soerjadi
49.
Koentjoro Poerbopranoto
50.
Soewadji Prawirohardjo
51.
Martakusuma
52.
Soewirjo
53.
Masmoen Rasid
54.
Soeworo
55.
Mohammad Ali Hanafiah
56.
Suhara
57.
Mohammad Nazif
58.
Sujono (Volksraad)
59.
Mohammad Roem
60.
Sulaeman
61.
Mohammad Tabrani
62.
Suwarni
63.
Mohammad Tamzil
64.
Tjahija
65.
Muhidin (Pasundan)
66.
Van der Plaas (Pemerintah Belanda)
67.
Mukarno
68.
Wilopo
69.
Muwardi
70.
Wage Rudolf Soepratman
71.
Nona Tumbel
Catatan :
Sebelum pembacaan teks Soempah Pemoeda diperdengarkan lagu"Indonesia Raya"
gubahan W.R. Soepratman dengan gesekan biolanya.
1. Teks Sumpah Pemuda dibacakan pada tanggal 28 Oktober 1928 bertempat
di Jalan Kramat Raya nomor 106 Jakarta Pusat sekarang menjadi Museum Sumpah
Pemuda, pada waktu itu adalah milik dari seorang Tionghoa yang bernama Sie
Kong Liong.
2. 2. Golongan Timur Asing Tionghoa yang turut hadir sebagai peninjau
Kongres Pemuda pada waktu pembacaan teks Sumpah Pemuda ada 4 (empat) orang
yaitu :
a. Kwee Thiam Hong
b. Oey Kay Siang
c. John Lauw Tjoan Hok
d. Tjio Djien kwie
LPJ HUT himatro 2010
I. Pendahuluan
1.1 Latar Belakang
Himpunan Mahasiswa Teknik Elektro (Himatro) Unila merupakan organisasi yang menjadi wadah aspirasi dan apresiasi setiap mahasiswa Teknik Elektro dalam mengembangkan diri dan kreativitas untuk kemudian diwujudkan sebagai rangkaian program kerja organisasi demi kepentingan bersama.
Berdiri sejak tahun 1999 atau tepat satu tahun setelah diresmikannya Jurusan Teknik Elektro, pada saat itu Robir Rohim, mahasiswa Teknik Elektro angkatan 1998 terpilih sebagai ketua pertama Himatro. Di tahun 2010 ini, Himatro genap berusia 11 tahun. Meskipun relatif terbilang muda, Himatro telah memberikan sedikit banyak peran bagi mahasiswa Teknik Elektro, dosen dan karyawan serta masyarakat yang terlibat dalam kegiatan yang diadakan selama ini.
Dalam rangka memperingati Hari Jadi Himpunan Mahasiswa Teknik Elektro (Himatro) Universitas Lampung yang ke-XI pada tahun 2010 ini, maka dengan ini kami Mahasiswa Teknik Elektro Universitas Lampung bermaksud mengadakan serangkaian kegiatan untuk memeriahkan pelaksanaan HUT Himatro ini. Diharapkan melalui serangkaian kegiatan tersebut mampu meningkatkan kerjasama, solidaritas, kreativitas, dan kualitas seluruh Civitas Akademika Teknik Elektro Universitas Lampung.
1.2 Tujuan Kegiatan
• Memperingati HUT Himatro XI,
• Meningkatkan kerjasama, solidaritas, kreativitas, dan kualitas Civitas Akademika Teknik Elektro Universitas Lampung,
• Memperkuat ikatan persaudaraan antar mahasiswa Teknik Elektro Universitas Lampung
1.3 Dasar Kegiatan
AD/ART Keluarga Besar Mahasiswa (KBM) Jurusan Teknik Elektro Universitas Lampung
Tri Dharma Mahasiswa
SK Rektor Universitas Lampung No. 120/KPTS/J26/2000
SK Dekan Fakultas Teknik No.10/J26/KM/1999
Program Kerja Himatro Unila periode 2009 – 2010
II. Pelaksanaan Kegiatan
2.1 Nama Kegiatan
“Peringatan HUT Himatro XI”
2.2 Tema Kegiatan
“Melalui HUT Himatro XI, mari kita tingkatkan kerjasama, solidaritas, kreativitas, dan kualitas seluruh Civitas Akademika Teknik Elektro Universitas Lampung”.
2.3 Bentuk Kegiatan
Bentuk kegiatan ini adalah syukuran, kegiatan perlombaan Futsal dan Tennis Meja serta kebersihan lingkungan bersama di lingkungan Teknik.
2.4 Waktu Kegiatan
Kebersihan Lingkungan
Hari / tanggal : Minggu, 28 Februari 2010
Waktu : Pukul 06.30 WIB s.d 08.00
Syukuran
Hari / tanggal : Minggu, 28 Februari 2010
Waktu : Pukul 09.45 WIB s.d Selesai
Kejuaraan Futsal
Hari / tanggal : Sabtu – Minggu, 6-7 Maret & 13 – 14 Maret 2010
Waktu : Pukul 07.30 – 10.00 WIB & 15.00 – 17.30 WIB
Kejuaraan Tenis Meja
Hari / tanggal : Sabtu – Minggu, 6 – 7 Maret 2010
Waktu : Pukul 07.30 – 10.00 WIB & 15.00 – 17.30 WIB
2.5 Peserta Kegiatan
Seluruh Civitas Akademika Teknik Elektro dan Alumni Civitas Akademika Teknik Elektro
2.6 Susunan Panitia Pelaksana
SUSUNAN KEPANITIAAN
PERINGATAN HUT HIMATRO KE-XI
Pelindung : Prof. Dr. Ir. Sugeng P. Harianto, M.S.
(Rektor Universitas Lampung)
Penasehat : Prof. Dr. Sunarto, S.H., M.H.
(Pembantu Rektor III Universitas Lampung)
Drs. Sugiyanto, M.T.
(Pembantu Dekan III Fakultas Teknik Unila)
Ir. Abdul Haris, M.T.
(Ketua Jurusan Teknik Elektro Unila)
Penanggung Jawab : Khotibul Umam Fahmi (0715031052)
Panitia Pengarah : Rahmat Hidayat (0815031024)
Ketua : Rendi Agung Wijaya (0915031069)
Sekretaris : Aris Aditama (0915031081)
Bendahara :Rhodiat Nurul Aini (0915031070)
Seksi-Seksi
Seksi Acara
Koordinator : Rifqi Annora M. (0915031071)
Anggota : Ferridon Nugraha (0915031084)
Layla Febri H. (0915031051)
Flesi Arnoldi (0915031039)
Trisno Handoko (0915031024)
M. Rizky F (0915031055)
Brando M. Sinaga (0915031026)
Ari Alfian (0915031025)
Anwar kholidi (0915031002)
Nurhadi Sukmana (0915031066)
Rudy Dermawan (0915031072)
Dewi Sartika D. (0915031031)
Luqvi Rizky S (0915031015)
Hadi Prayogo (0915031085)
Helmi Aziz (0915031042)
Dedy Irawan (0915031083)
Seksi Publikasi Dan Dokumentasi
Koordinator : Ranny Dwidayanti (0915031097)
Anggota : Mualif Wicaksono (0915031093)
Fredyan Rinaldi F (0915031038)
Robert Lie N (0915031099)
Albert A (0915031078)
Davina Olivia (0915031030)
Juvicho Harja (0915031049)
Surya Hadi P (0915031074)
Binsar Daniel (0915031082)
Hendi Setiawan (0915031043)
Dimas Adityawarman (0915031007)
M Widi (0915031064)
Muhamad Wahidi (0915031061)
Seksi Perlengkapan
Koordinator : Moh. Cahyonyo (0915031059)
Anggota : M. Arief Kusuma (0915031054)
Jumanto P (0915031048)
Brillian Unggul W (0915031027)
Jaka Kusuma (0915031090)
Hendri Setiawan (0915031044)
Eko Kurniawan (0915031033)
Dani Erfan (0915031028)
Riyo Handoko (0915031098)
Imawan Avicena (0915031045)
Iman Baldi P (0915031089)
David Estu (0915031029)
Linggom Gultom (0915031052
Achmad Taufik Prabowo (0915031077)
Seksi Konsumsi
Koordinator : Supriyadi (0915031073)
Anggota : Daimatul Khoiriyah (0915031006)
Ibnu Nadir (0915031012)
Alfi Faizu (0915031079)
Hanang Priambodo (0915031086)
M Thaha Ayub (0915031092)
Oktaviana Damayanti (0915031067)
M. Rifqi (0915031060)
Febri Yogi Ismanti (0915031037)
Mardiyah Azzahra (0915031058)
M. syafruddin (0915031094)
Edo Damara (0915031032)
Jimmy A (0915031047)
Husni Yusuf (0915031088)
Eko Susanto (0915031035)
2.7 Susunan Acara
Susunan Acara Rangkaian Kegiatan
HUT HIMATRO ke XI
NO HARI / TANGGAL KEGIATAN WAKTU SUSUNAN ACARA KETERANGAN
1 Sabtu, 27 Febuari 2010 Bersih-bersih Lingkungan 07.30 - 11.30 Membersihkan Lingkungan sekitar wilayah Gedung H panitia
2 Minggu, 28 Febuari 2010 Syukuran dan Nonton Bareng Film Dokumenter 09.45 – 10.00
10.00 – 10.10
10.10 – 10.15
10.15 – 10.30
10.30 – 10.45
10.45 – 11.00
11.00 – 11.15
11.15 – 11.30
11.30 – 12.15
12.15 – 12.30 Pengkondisian Acara
Pembukaan
Pembacaan Tilawah Quran
Sambutan Ketua Pelaksana
Sambutan Ketua Himatro
Sambutan Ketua Jurusan Elektro
Sambutan PD III
Acara Inti (Pemotongan Tumpeng)
Film Dokumenter
Doa + Penutup Panitia
Panitia (MC)
Panitia
Panitia
Himatro
Kajur Elektro
PD III
Kajur & Himatro
Panitia
Panitia
3 Sabtu, 6 Maret 2010 Futsal
Tennis Meja 08.00 – 10.00
15.00 – selesai
08.00 – 10.00
15.00 - selesai Penyisihan
Lanjutan Penyisihan
Penyisihan
Lanjutan penyisihan
Panitia
Panitia
Panitia
Panitia
4 Minggu, 7 Maret 2010 Futsal
Tennis Meja 08.00 – 10.00
15.00 – selesai
08.00 – 10.00
15.00 - selesai Penyisihan
Lanjutan penyisihan
Penyisihan
Perempat final sampai Final Panitia
Panitia
Panitia
Panitia
5 Sabtu, 13 Maret 2010 Futsal
Tennis Meja
08.00 – 10.00
10.00 - selesai Penyisihan
Final Panitia
Panitia
6 Minggu, 14 Maret 2010 futsal 08.00 - selesai Delapan besar sampai Final Panitia
III. ESTIMASI ANGGARAN BIAYA
3.1 Pengeluaran Dana
1. Proposal 6 @ Rp 5.000 Rp 30.000,-
2. LPJ 6 @ Rp 5.000 Rp 30.000,-
3. Undangan Rp 15.000,-
4. Kertas A4 Rp 35.000,-
5. Tinta Printer Rp 25.000,-
6. Kertas Karton 2 @ Rp 2.500 Rp 5.000,-
7. Alat Tulis Rp 10.000,-
8. Dokumentasi
- Baterai 4 pasang @ Rp 10.000 Rp 40.000,-
- Cuci Cetak Foto Rp 15.000,-
9. Syukuran
- Nasi Tumpeng Rp 200.000,-
- Snack Dosen 20 @ Rp 3.000 Rp 60.000,-
- Snack Peserta 180 @ Rp 1.500 Rp 270.000,-
- Air Mineral Botol 20 @ Rp 1.500 Rp 30.000,-
- Air Mineral Gelas 5 dus @ Rp 14.000 Rp 60.000,-
- Kardus Kue 2 pack @ Rp 7.000 Rp 14.000,-
- Plastik Kue 200 buah Rp 20.000,-
- Tissue + pipet Rp 6.000,-
- Sewa Gedung Rp 200.000,-
10. Perlombaan
- Air Galon 10 @ Rp 5.000 Rp 50.000,-
- Gelas Plastik Rp 10.000,-
- Bola Futsal Rp 100.000,-
- Bola Tenis Meja Rp 15.000,-
- P3K Rp 30.000,-
- Hadiah Total Rp 200.000,-
11. Biaya tak terduga Rp 40.000,- +
Jumlah Total Pengeluaran Rp 1.600.000,-
3.2 Sumber Dana Kegiatan
1. Iuran Mahasiswa Teknik Elektro 2009 Rp 630.000,-
2. Biaya Pendaftaran 16 @ Rp 10.000 Rp 160.000,-
3. Dana Kemahasiswaan Rp 810.000,-+
Jumlah Total Pemasukan Rp 1.600.000,-
IV. PENUTUP
4.1 Uraian Penutup
Demikian laporan pertanggung jawaban kegiatan “Peringatan HUT Himatro XI” ini kami buat untuk dapat dipergunakan sebagai bahan pertimbangan dan dapat digunakan seagaimana mestinya. Besar harapan kami atas dukungan terhadap kegiatan ini baik secara moril maupun materil. Tanpa hal tersebut tentunya kegiatan ini tidak akan dapat berjalan maksimal dan mencapai sasaran. Atas perhatian dan partisipasinya kami sampaikan terima kasih.
4.2 Ringkasan Acara
1. Acara Syukuran HUT Himatro ke XI
Kegiatan ini berjalan dengan lancar sesuai dengan yang diharapkan. Acara ini dihadiri oleh mahasiswa Teknik Elektro Unila. Selain itu juga dihadiri oleh Rektor Unila, Dekan FT Unila, PD III FT Unila, Ketua Jurusan Teknik Elektro,serta alumni. Acara berlangsung pada pukul 09.00 – selesai. Pada acara ini, Rektor Unila memberikan sambutan sekaligus membuka acara syukuran. Acara puncak pada kegiatan ini adalah pemotongan tumpeng oleh Rektor Unila dan diserahkan secara simbolis kepada Ketua Himatro 2009-2010. Acara ini ditutup dengan pemutaran film Dokumenter Mahasiswa Teknik Elektro.
2. Lomba Futsal
Kejuaraan Futsal antar angkatan mahasiswa Teknik Elektro yang digelar pada 6-7 Maret dan 13-14 Maret 2010 ini diikuti oleh 16 Team dari seluruh angkatan 2004-2009 yang terbagi dalam 4 (empat ) Grup Penyisihan. Adapun team peserta dari masing-masing Grup adalah : Grup A : PB’06, Power Ranger’07, Basing Team’08, Narsis Team’09;
Grup B : Pencari Beras III’08, Pasti Menangan II’05, Partial Discharge’06, Bentar Lagi Lulus I’04; Grup C : pencari Beras I’08,
Kicon FC’07, Noise FC’06, Pasti Menangan III’05; dan Grup D : Bangke’07, Bentar Lagi Lulus II’04, Pencari beras II’08, Pasti Menangan I’05. Putaran Final berlangsung mulai tanggal 13-14 maret 2010 yang dimenangkan oleh team Pencari Beras III dan meraih Piala Bergilir Elektro Cup serta hadiah lainnya.
3. Lomba Tennis Meja
Kejuaraan ini diikuti 17peserta yakni : Ari Alfian, M.Syafruddin, luqvi Rizki Saputra (2009); Redolf (2008); Ahmad Said (2007); Timo, Taufan F (2006); Arief, Tri, Wari W, Dedi, Maharianto (2005); Rizki, Dedi, Yomas, Mawan (2004) dan CP (Alumni).
Pertandingan digelar pada 6-7 Maret dan 13-14 Maret 2010. Kejuaraan ini menggunakan sistem gugur dan pada pertandingan final mempertemukan Tri ’05 dan Taufan ’06 yang dimenangkan oleh Tri ’05.
4.2 Lembar Pengesahan
Nama Kegiatan : “HUT HIMATRO XI”
Ketua Pelaksana Kegiatan
Nama : Rendi Agung Wijaya
NPM : 0915031069
Lembaga : Himatro
Fakultas : Teknik
Total Dana Yang Dibutuhkan : Rp. 1.600.000,-
Dana Kemahasiswaan : Rp. 810.000,-
Jangka Waktu : 14 Maret 2010
Bandar Lampung, 22 Maret 2010
Panitia Pelaksana HUT Himatro XI
Universitas Lampung
Ketua Pelaksana Sekretaris
Rendi Agung Wijaya Aris Aditama
NPM. 0915031069 NPM. 0915031081
Menyetujui,
Ketua Himatro
Khotibul Umam Fahmi
NPM. 071031052
Mengetahui,
a.n. Dekan Fakultas Teknik Unila Ketua Jurusan
Pembantu Dekan III Teknik Elektro Unila
Drs.Sugiyanto,M.T. Ir. Abdul Haris, M.T.
NIP 19570411 198610 1 001 NIP 19630801 199603 1 001
L A M P I R A N
1. Dokumentasi Kegiatan
1.1 Latar Belakang
Himpunan Mahasiswa Teknik Elektro (Himatro) Unila merupakan organisasi yang menjadi wadah aspirasi dan apresiasi setiap mahasiswa Teknik Elektro dalam mengembangkan diri dan kreativitas untuk kemudian diwujudkan sebagai rangkaian program kerja organisasi demi kepentingan bersama.
Berdiri sejak tahun 1999 atau tepat satu tahun setelah diresmikannya Jurusan Teknik Elektro, pada saat itu Robir Rohim, mahasiswa Teknik Elektro angkatan 1998 terpilih sebagai ketua pertama Himatro. Di tahun 2010 ini, Himatro genap berusia 11 tahun. Meskipun relatif terbilang muda, Himatro telah memberikan sedikit banyak peran bagi mahasiswa Teknik Elektro, dosen dan karyawan serta masyarakat yang terlibat dalam kegiatan yang diadakan selama ini.
Dalam rangka memperingati Hari Jadi Himpunan Mahasiswa Teknik Elektro (Himatro) Universitas Lampung yang ke-XI pada tahun 2010 ini, maka dengan ini kami Mahasiswa Teknik Elektro Universitas Lampung bermaksud mengadakan serangkaian kegiatan untuk memeriahkan pelaksanaan HUT Himatro ini. Diharapkan melalui serangkaian kegiatan tersebut mampu meningkatkan kerjasama, solidaritas, kreativitas, dan kualitas seluruh Civitas Akademika Teknik Elektro Universitas Lampung.
1.2 Tujuan Kegiatan
• Memperingati HUT Himatro XI,
• Meningkatkan kerjasama, solidaritas, kreativitas, dan kualitas Civitas Akademika Teknik Elektro Universitas Lampung,
• Memperkuat ikatan persaudaraan antar mahasiswa Teknik Elektro Universitas Lampung
1.3 Dasar Kegiatan
AD/ART Keluarga Besar Mahasiswa (KBM) Jurusan Teknik Elektro Universitas Lampung
Tri Dharma Mahasiswa
SK Rektor Universitas Lampung No. 120/KPTS/J26/2000
SK Dekan Fakultas Teknik No.10/J26/KM/1999
Program Kerja Himatro Unila periode 2009 – 2010
II. Pelaksanaan Kegiatan
2.1 Nama Kegiatan
“Peringatan HUT Himatro XI”
2.2 Tema Kegiatan
“Melalui HUT Himatro XI, mari kita tingkatkan kerjasama, solidaritas, kreativitas, dan kualitas seluruh Civitas Akademika Teknik Elektro Universitas Lampung”.
2.3 Bentuk Kegiatan
Bentuk kegiatan ini adalah syukuran, kegiatan perlombaan Futsal dan Tennis Meja serta kebersihan lingkungan bersama di lingkungan Teknik.
2.4 Waktu Kegiatan
Kebersihan Lingkungan
Hari / tanggal : Minggu, 28 Februari 2010
Waktu : Pukul 06.30 WIB s.d 08.00
Syukuran
Hari / tanggal : Minggu, 28 Februari 2010
Waktu : Pukul 09.45 WIB s.d Selesai
Kejuaraan Futsal
Hari / tanggal : Sabtu – Minggu, 6-7 Maret & 13 – 14 Maret 2010
Waktu : Pukul 07.30 – 10.00 WIB & 15.00 – 17.30 WIB
Kejuaraan Tenis Meja
Hari / tanggal : Sabtu – Minggu, 6 – 7 Maret 2010
Waktu : Pukul 07.30 – 10.00 WIB & 15.00 – 17.30 WIB
2.5 Peserta Kegiatan
Seluruh Civitas Akademika Teknik Elektro dan Alumni Civitas Akademika Teknik Elektro
2.6 Susunan Panitia Pelaksana
SUSUNAN KEPANITIAAN
PERINGATAN HUT HIMATRO KE-XI
Pelindung : Prof. Dr. Ir. Sugeng P. Harianto, M.S.
(Rektor Universitas Lampung)
Penasehat : Prof. Dr. Sunarto, S.H., M.H.
(Pembantu Rektor III Universitas Lampung)
Drs. Sugiyanto, M.T.
(Pembantu Dekan III Fakultas Teknik Unila)
Ir. Abdul Haris, M.T.
(Ketua Jurusan Teknik Elektro Unila)
Penanggung Jawab : Khotibul Umam Fahmi (0715031052)
Panitia Pengarah : Rahmat Hidayat (0815031024)
Ketua : Rendi Agung Wijaya (0915031069)
Sekretaris : Aris Aditama (0915031081)
Bendahara :Rhodiat Nurul Aini (0915031070)
Seksi-Seksi
Seksi Acara
Koordinator : Rifqi Annora M. (0915031071)
Anggota : Ferridon Nugraha (0915031084)
Layla Febri H. (0915031051)
Flesi Arnoldi (0915031039)
Trisno Handoko (0915031024)
M. Rizky F (0915031055)
Brando M. Sinaga (0915031026)
Ari Alfian (0915031025)
Anwar kholidi (0915031002)
Nurhadi Sukmana (0915031066)
Rudy Dermawan (0915031072)
Dewi Sartika D. (0915031031)
Luqvi Rizky S (0915031015)
Hadi Prayogo (0915031085)
Helmi Aziz (0915031042)
Dedy Irawan (0915031083)
Seksi Publikasi Dan Dokumentasi
Koordinator : Ranny Dwidayanti (0915031097)
Anggota : Mualif Wicaksono (0915031093)
Fredyan Rinaldi F (0915031038)
Robert Lie N (0915031099)
Albert A (0915031078)
Davina Olivia (0915031030)
Juvicho Harja (0915031049)
Surya Hadi P (0915031074)
Binsar Daniel (0915031082)
Hendi Setiawan (0915031043)
Dimas Adityawarman (0915031007)
M Widi (0915031064)
Muhamad Wahidi (0915031061)
Seksi Perlengkapan
Koordinator : Moh. Cahyonyo (0915031059)
Anggota : M. Arief Kusuma (0915031054)
Jumanto P (0915031048)
Brillian Unggul W (0915031027)
Jaka Kusuma (0915031090)
Hendri Setiawan (0915031044)
Eko Kurniawan (0915031033)
Dani Erfan (0915031028)
Riyo Handoko (0915031098)
Imawan Avicena (0915031045)
Iman Baldi P (0915031089)
David Estu (0915031029)
Linggom Gultom (0915031052
Achmad Taufik Prabowo (0915031077)
Seksi Konsumsi
Koordinator : Supriyadi (0915031073)
Anggota : Daimatul Khoiriyah (0915031006)
Ibnu Nadir (0915031012)
Alfi Faizu (0915031079)
Hanang Priambodo (0915031086)
M Thaha Ayub (0915031092)
Oktaviana Damayanti (0915031067)
M. Rifqi (0915031060)
Febri Yogi Ismanti (0915031037)
Mardiyah Azzahra (0915031058)
M. syafruddin (0915031094)
Edo Damara (0915031032)
Jimmy A (0915031047)
Husni Yusuf (0915031088)
Eko Susanto (0915031035)
2.7 Susunan Acara
Susunan Acara Rangkaian Kegiatan
HUT HIMATRO ke XI
NO HARI / TANGGAL KEGIATAN WAKTU SUSUNAN ACARA KETERANGAN
1 Sabtu, 27 Febuari 2010 Bersih-bersih Lingkungan 07.30 - 11.30 Membersihkan Lingkungan sekitar wilayah Gedung H panitia
2 Minggu, 28 Febuari 2010 Syukuran dan Nonton Bareng Film Dokumenter 09.45 – 10.00
10.00 – 10.10
10.10 – 10.15
10.15 – 10.30
10.30 – 10.45
10.45 – 11.00
11.00 – 11.15
11.15 – 11.30
11.30 – 12.15
12.15 – 12.30 Pengkondisian Acara
Pembukaan
Pembacaan Tilawah Quran
Sambutan Ketua Pelaksana
Sambutan Ketua Himatro
Sambutan Ketua Jurusan Elektro
Sambutan PD III
Acara Inti (Pemotongan Tumpeng)
Film Dokumenter
Doa + Penutup Panitia
Panitia (MC)
Panitia
Panitia
Himatro
Kajur Elektro
PD III
Kajur & Himatro
Panitia
Panitia
3 Sabtu, 6 Maret 2010 Futsal
Tennis Meja 08.00 – 10.00
15.00 – selesai
08.00 – 10.00
15.00 - selesai Penyisihan
Lanjutan Penyisihan
Penyisihan
Lanjutan penyisihan
Panitia
Panitia
Panitia
Panitia
4 Minggu, 7 Maret 2010 Futsal
Tennis Meja 08.00 – 10.00
15.00 – selesai
08.00 – 10.00
15.00 - selesai Penyisihan
Lanjutan penyisihan
Penyisihan
Perempat final sampai Final Panitia
Panitia
Panitia
Panitia
5 Sabtu, 13 Maret 2010 Futsal
Tennis Meja
08.00 – 10.00
10.00 - selesai Penyisihan
Final Panitia
Panitia
6 Minggu, 14 Maret 2010 futsal 08.00 - selesai Delapan besar sampai Final Panitia
III. ESTIMASI ANGGARAN BIAYA
3.1 Pengeluaran Dana
1. Proposal 6 @ Rp 5.000 Rp 30.000,-
2. LPJ 6 @ Rp 5.000 Rp 30.000,-
3. Undangan Rp 15.000,-
4. Kertas A4 Rp 35.000,-
5. Tinta Printer Rp 25.000,-
6. Kertas Karton 2 @ Rp 2.500 Rp 5.000,-
7. Alat Tulis Rp 10.000,-
8. Dokumentasi
- Baterai 4 pasang @ Rp 10.000 Rp 40.000,-
- Cuci Cetak Foto Rp 15.000,-
9. Syukuran
- Nasi Tumpeng Rp 200.000,-
- Snack Dosen 20 @ Rp 3.000 Rp 60.000,-
- Snack Peserta 180 @ Rp 1.500 Rp 270.000,-
- Air Mineral Botol 20 @ Rp 1.500 Rp 30.000,-
- Air Mineral Gelas 5 dus @ Rp 14.000 Rp 60.000,-
- Kardus Kue 2 pack @ Rp 7.000 Rp 14.000,-
- Plastik Kue 200 buah Rp 20.000,-
- Tissue + pipet Rp 6.000,-
- Sewa Gedung Rp 200.000,-
10. Perlombaan
- Air Galon 10 @ Rp 5.000 Rp 50.000,-
- Gelas Plastik Rp 10.000,-
- Bola Futsal Rp 100.000,-
- Bola Tenis Meja Rp 15.000,-
- P3K Rp 30.000,-
- Hadiah Total Rp 200.000,-
11. Biaya tak terduga Rp 40.000,- +
Jumlah Total Pengeluaran Rp 1.600.000,-
3.2 Sumber Dana Kegiatan
1. Iuran Mahasiswa Teknik Elektro 2009 Rp 630.000,-
2. Biaya Pendaftaran 16 @ Rp 10.000 Rp 160.000,-
3. Dana Kemahasiswaan Rp 810.000,-+
Jumlah Total Pemasukan Rp 1.600.000,-
IV. PENUTUP
4.1 Uraian Penutup
Demikian laporan pertanggung jawaban kegiatan “Peringatan HUT Himatro XI” ini kami buat untuk dapat dipergunakan sebagai bahan pertimbangan dan dapat digunakan seagaimana mestinya. Besar harapan kami atas dukungan terhadap kegiatan ini baik secara moril maupun materil. Tanpa hal tersebut tentunya kegiatan ini tidak akan dapat berjalan maksimal dan mencapai sasaran. Atas perhatian dan partisipasinya kami sampaikan terima kasih.
4.2 Ringkasan Acara
1. Acara Syukuran HUT Himatro ke XI
Kegiatan ini berjalan dengan lancar sesuai dengan yang diharapkan. Acara ini dihadiri oleh mahasiswa Teknik Elektro Unila. Selain itu juga dihadiri oleh Rektor Unila, Dekan FT Unila, PD III FT Unila, Ketua Jurusan Teknik Elektro,serta alumni. Acara berlangsung pada pukul 09.00 – selesai. Pada acara ini, Rektor Unila memberikan sambutan sekaligus membuka acara syukuran. Acara puncak pada kegiatan ini adalah pemotongan tumpeng oleh Rektor Unila dan diserahkan secara simbolis kepada Ketua Himatro 2009-2010. Acara ini ditutup dengan pemutaran film Dokumenter Mahasiswa Teknik Elektro.
2. Lomba Futsal
Kejuaraan Futsal antar angkatan mahasiswa Teknik Elektro yang digelar pada 6-7 Maret dan 13-14 Maret 2010 ini diikuti oleh 16 Team dari seluruh angkatan 2004-2009 yang terbagi dalam 4 (empat ) Grup Penyisihan. Adapun team peserta dari masing-masing Grup adalah : Grup A : PB’06, Power Ranger’07, Basing Team’08, Narsis Team’09;
Grup B : Pencari Beras III’08, Pasti Menangan II’05, Partial Discharge’06, Bentar Lagi Lulus I’04; Grup C : pencari Beras I’08,
Kicon FC’07, Noise FC’06, Pasti Menangan III’05; dan Grup D : Bangke’07, Bentar Lagi Lulus II’04, Pencari beras II’08, Pasti Menangan I’05. Putaran Final berlangsung mulai tanggal 13-14 maret 2010 yang dimenangkan oleh team Pencari Beras III dan meraih Piala Bergilir Elektro Cup serta hadiah lainnya.
3. Lomba Tennis Meja
Kejuaraan ini diikuti 17peserta yakni : Ari Alfian, M.Syafruddin, luqvi Rizki Saputra (2009); Redolf (2008); Ahmad Said (2007); Timo, Taufan F (2006); Arief, Tri, Wari W, Dedi, Maharianto (2005); Rizki, Dedi, Yomas, Mawan (2004) dan CP (Alumni).
Pertandingan digelar pada 6-7 Maret dan 13-14 Maret 2010. Kejuaraan ini menggunakan sistem gugur dan pada pertandingan final mempertemukan Tri ’05 dan Taufan ’06 yang dimenangkan oleh Tri ’05.
4.2 Lembar Pengesahan
Nama Kegiatan : “HUT HIMATRO XI”
Ketua Pelaksana Kegiatan
Nama : Rendi Agung Wijaya
NPM : 0915031069
Lembaga : Himatro
Fakultas : Teknik
Total Dana Yang Dibutuhkan : Rp. 1.600.000,-
Dana Kemahasiswaan : Rp. 810.000,-
Jangka Waktu : 14 Maret 2010
Bandar Lampung, 22 Maret 2010
Panitia Pelaksana HUT Himatro XI
Universitas Lampung
Ketua Pelaksana Sekretaris
Rendi Agung Wijaya Aris Aditama
NPM. 0915031069 NPM. 0915031081
Menyetujui,
Ketua Himatro
Khotibul Umam Fahmi
NPM. 071031052
Mengetahui,
a.n. Dekan Fakultas Teknik Unila Ketua Jurusan
Pembantu Dekan III Teknik Elektro Unila
Drs.Sugiyanto,M.T. Ir. Abdul Haris, M.T.
NIP 19570411 198610 1 001 NIP 19630801 199603 1 001
L A M P I R A N
1. Dokumentasi Kegiatan
Pengenalan PLC
PENGENALAN
PROGRAMMABLE LOGIC CONTROLLER
(PLC)
HIMPUNAN MAHASISWA ELEKTRO
UNIVERSITAS SATYAGAMA
2001
PENGANTAR PLC
Dalam bidang industri penggunaan mesin otomatis dan pemrosesan secara otomatis merupakan hal yang umum. Sistem prengontrolan dengan elektromekanik yang menggunakan relay-relay mempunyai banyak kelemahan, diantaranya kontak-kontak yang dipakai mudah aus karena panas / terbakar atau karena hubung singkat, membutuhkan biaya yang besar saat instalasi, pemeliharaan dan modifikasi dari sistem yang telah dibuat jika dikemudian hari dipertlukan modifikasi.
Dengan menggunakan PLC hal-hal ini dapat diatasii, karena sistem PLC mengintegrasikan berbagai macam komponen yang berdiri sendiri menjadi suatu sistem kendali terpadu dan dengan mudah merenovasi tanpa harus mengganti semua instrumen yang ada.
KONSEP PROGRAMMABLE LOGIC CONTROLLERS (PLC)
Konsep dari PLC sesuai dengan namanya adsalah sebagai berikut :
Programmable : menunjukkan kemampuannya yang dapat dengan mudah diubah-ubah sesuai program yang dibuat dan kemampuannya dalam hal memori program yang telah dibuat.
Logic : menunjukkan kemampuannya dalam memproses input secara aritmetik (ALU), yaitu melakukjan operasi membandingkan, menjumlahkan, mengalikan, membagi, mengurangi dan negasi.
Controller : menunjukkan kemampuannya dalam mengontrol dan mengatur proses sehingga menghasilkan output yang diinginkan.
FUNGSI PROGRAMMABLE LOGIC CONTROLLERS (PLC)
Fungsi dan kegunaan dari PLC dapat dikatakan hampir tidak terbatas. Tapi dalam prakteknya dapat dibagi secara umum dan khusus.
Secara umum fungsi dari PLC adalah sebagai berikut :
1. Kontrol Sekensial
PLC memroses input sinyal biner menjadi output yang digunakan untuk keperluan pemrosesan teknik secara berurutan (sekuensial), disini PLC menjaga agar semua step / langkah dalam proses sekuensial berlangsung dalam urutan yang tepat.
2. Monitoring Plant
PLC secara terus menerus memonitor suatu sistem (misalnya temperatur, tekanan, tingkat ketinggian) dan mengambil tindakan yang diperlukan sehubungan dengan proses yang dikontrol (misalnya nilai sudah melebihi batas) atau menampilkan pesan tersebut ke operator.
BAHASA PEMOGRAMAN
Terdapat banyak pilihan bahasa untuk membuat program dalam PLC. Masing-masing bahasa mempunyai keuntungan dan kerugian tergantung dari sudut pandang kita sebagai user / pemogram. Pada umumnya terdapat 2 bahasa pemograman sederhana dari PLC , yaitu pemograman diagram ladder dan bahasa instruction list. (mnemonic code).Diagram Ladder adalah bahasa yang dimiliki oleh setiap PLC.
LADDER DIAGRAM
Diagram Ladder menggambarkan program dalam bentuk grafik. Diagram ini dikembangkan dari kontak-kontak relay yang terstruktur yang menggambarkan aliran arus listrik. Dalam diagram ladder terdapat dua buah garis vertical dimana garis vertical sebelah kiri dihubungkan dengan sumber tegangan positip catu daya dan garis sebelah kanan dihubungkan dengan sumber tegangan negatip catu daya.
Program ladder ditulis menggunakan bentuk pictorial atau simbol yang secara umum mirip dengan rangkaian kontrol relay. Program ditampilkan pada layar dengan elemen-elemen seperti normally open contact, normally closed contact, timer, counter, sequencer dll ditampilkan seperti dalam bentuk pictorial.
Dibawah kondisi yang benar, listrik dapat mengalir dari rel sebelah kiri ke rel sebelah kanan, jalur rel seperti ini disebut sebagai ladder line (garis tangga). Peraturan secara umum di dalam menggambarkan program ladder diagram adalah :
Daya mengalir dari rel kiri ke rel kanan
Output koil tidak boleh dihubungkan secara langsung di rel sebelah kiri.
Tidak ada kontak yang diletakkan disebelah kanan output coil
Hanya diperbolehkan satu output koil pada ladder line.
Dengan diagram ladder, gambar diatas direpresantisak menjadi
Gambar 1. Diagram Ladder
Diantar dua garis ini dipasang kontak-kontak yang menggambarkan kontrol dari switch, sensor atau output. Satu baris dari diagram disebut dengan satu rung. Input menggunakan symbol [ ] (kontak normally open) dan [/] (kontak normally close). Output mempunyai symbol ( ) yang terletak paling kanan.
2. Prinsip-prinsip Ladder Diagram PLC
Untuk memperlihatkan hubungan antara satu rangkaian fisik dengan ladder diagram yang mempresentasikannya, lihatlah rangkaian motor listrik pada gambar dibawah ini.
Motor dihubungkan ke sumber daya melalui 3 saklar yang dirangkai secara seri ditambah saklar over load sebagai pengaman. Motor akan menyala bila seluruh saklar dalam kondisi menutup.
Gambar 2. rangkaian start – stop motor
Kesimpulan :
Ladder diagram tersusun dari dua garis vertical yang mewakili rel daya
Diantara garis vertikal tersebut disusun garis horizontal yang disebut rung (anak tangga) yang berfungsi untukmenempatkan komponen kontrol sistem.
3. Praktek memori Circuit (Latch)
Rangkaian yang bersifat mengingat kondisi sebelumnya seringkali dibutuhkan dalam kontrol logic. Pada rangkaian ini hasil keluaran dikunci (latching) dengan menggunakan kontak hasil keluaran itu sendiri, sehingga walaupun input sudah berubah, kondisi output tetap.
Gambar 3. Latching Circuit
OPERASI LOGIKA P L C
I. TUJUAN :
Mampu memahami dasar-dasar unit rancang bangun PLC
Mampu memasukan dan menjalankan program dasar di PLC
Mampu membuat program atu diagram ladder dari suatu masalah sederhana
II. PRAKTEK :
A. PRAKTEK INPUT / OUTPUT
Setelah melakukan praktek ini , peserta diharapkan mampu :
Menjadikan PLC sebagai pengontrol terhadap suatu kondisi input tertentu.
Program :
Lampu 1 akan menyala bila saklar 1 ON dan mati bila OFF
Lampu 2 akan menyala bila saklar 2 OFF dan mati bila ON
Lampu dan saklar diandaikan suatu kondisi dalam suatu proses dalam mesin.
Gambar 4. Kontak lampu on –off
B. OPERASI LOGIKA
B.1. OR
1. Rangkaian disusun seperti pada gambar
2. terminal output dihubungkan ke modul I/O train (input ke output)
3. PLC dihidupkan lalu operasi + OFFLINE MODE dipilih
4. Buatlah program untuk diagram ladder di bawah ini :
Gambar 5. Operasi Logika – OR
5. Kemudian jalankan program untuk diagram ladder di bawah ini :
Tabel 1. Tabel logika
No Input Output
X2 X1 X0 OR AND NOR NAND
1 Off Off Off
2 Off Off On
3 Off On Off
4 Off On On
5 On Off Off
6 On Off On
7 On On Off
8 On On On
B.2. AND
6. Buatlah program untuk diagram ladder di bawah ini :
Gambar 6. Operasi Logika – AND
7. Jalankan program tersebut, lalu isi dan lengkapi tabel 1
B.3. NOR
8. Buatlah program yang sesuai untuk diagram ladder dibawah ini :
Gambar 7. Operasi Logika – AND
9. Kemudian jalankan program tersebut lalu isi dan lengkapi tabel 1.
B.4. EXOR
10. Buatlah program yang sesuai untuk diagram ladder dibawah ini
Gambar 8. Operasi Logika – EXOR
11. Kemudian jalankan program tersebut lalu isi dan lengkapi tabel 2
B.5. EXNOR
12. Buatlah program yang sesuai untuk diagram ladder di bawah ini
Gambar 9. Operasi Logika – EXNOR
13. Kemudian jalankan program tersebut lalu isi dan lengkapi tabel 2
Tabel 2. Tabel kebenaran lanjutan
No Input Output
X2 X1 EXOR EXNOR
1 Off Off
2 Off On
3 On Off
4 On On
TIMER
Timer berfungsi untuk mengaktifkan suatu keluaran dengan interval waktu yang dapat diatur. Pengaturan waktu dilakukan melaui nilai setting (preset value). Timer tersebut akan bekerja bila diberi input dan mendapat pulsa clock. Untuk pulsa clock sudah disediakan oleh pembuat PLC. Besarnya nilai pulsa clock pada setiap timer tergantung pada nomor timer yang digunakan. Saat input timer ON maka timer mulai mencacah pulsa dari 0 sampai preset value. Bila sudah mencapai preset value maka akan mengaktifkan Outputyang telah ditentukan.
COUNTER
Fungsi counter adalah mencacah pulsa yang masuk. Sepintas cara kerja counter dan timer mirip. Perbedaannya adalah timer mencacah pulsa internal sedangkan counter mencacah pulsa dari luar.
PROGRAMMABLE LOGIC CONTROLLER
(PLC)
HIMPUNAN MAHASISWA ELEKTRO
UNIVERSITAS SATYAGAMA
2001
PENGANTAR PLC
Dalam bidang industri penggunaan mesin otomatis dan pemrosesan secara otomatis merupakan hal yang umum. Sistem prengontrolan dengan elektromekanik yang menggunakan relay-relay mempunyai banyak kelemahan, diantaranya kontak-kontak yang dipakai mudah aus karena panas / terbakar atau karena hubung singkat, membutuhkan biaya yang besar saat instalasi, pemeliharaan dan modifikasi dari sistem yang telah dibuat jika dikemudian hari dipertlukan modifikasi.
Dengan menggunakan PLC hal-hal ini dapat diatasii, karena sistem PLC mengintegrasikan berbagai macam komponen yang berdiri sendiri menjadi suatu sistem kendali terpadu dan dengan mudah merenovasi tanpa harus mengganti semua instrumen yang ada.
KONSEP PROGRAMMABLE LOGIC CONTROLLERS (PLC)
Konsep dari PLC sesuai dengan namanya adsalah sebagai berikut :
Programmable : menunjukkan kemampuannya yang dapat dengan mudah diubah-ubah sesuai program yang dibuat dan kemampuannya dalam hal memori program yang telah dibuat.
Logic : menunjukkan kemampuannya dalam memproses input secara aritmetik (ALU), yaitu melakukjan operasi membandingkan, menjumlahkan, mengalikan, membagi, mengurangi dan negasi.
Controller : menunjukkan kemampuannya dalam mengontrol dan mengatur proses sehingga menghasilkan output yang diinginkan.
FUNGSI PROGRAMMABLE LOGIC CONTROLLERS (PLC)
Fungsi dan kegunaan dari PLC dapat dikatakan hampir tidak terbatas. Tapi dalam prakteknya dapat dibagi secara umum dan khusus.
Secara umum fungsi dari PLC adalah sebagai berikut :
1. Kontrol Sekensial
PLC memroses input sinyal biner menjadi output yang digunakan untuk keperluan pemrosesan teknik secara berurutan (sekuensial), disini PLC menjaga agar semua step / langkah dalam proses sekuensial berlangsung dalam urutan yang tepat.
2. Monitoring Plant
PLC secara terus menerus memonitor suatu sistem (misalnya temperatur, tekanan, tingkat ketinggian) dan mengambil tindakan yang diperlukan sehubungan dengan proses yang dikontrol (misalnya nilai sudah melebihi batas) atau menampilkan pesan tersebut ke operator.
BAHASA PEMOGRAMAN
Terdapat banyak pilihan bahasa untuk membuat program dalam PLC. Masing-masing bahasa mempunyai keuntungan dan kerugian tergantung dari sudut pandang kita sebagai user / pemogram. Pada umumnya terdapat 2 bahasa pemograman sederhana dari PLC , yaitu pemograman diagram ladder dan bahasa instruction list. (mnemonic code).Diagram Ladder adalah bahasa yang dimiliki oleh setiap PLC.
LADDER DIAGRAM
Diagram Ladder menggambarkan program dalam bentuk grafik. Diagram ini dikembangkan dari kontak-kontak relay yang terstruktur yang menggambarkan aliran arus listrik. Dalam diagram ladder terdapat dua buah garis vertical dimana garis vertical sebelah kiri dihubungkan dengan sumber tegangan positip catu daya dan garis sebelah kanan dihubungkan dengan sumber tegangan negatip catu daya.
Program ladder ditulis menggunakan bentuk pictorial atau simbol yang secara umum mirip dengan rangkaian kontrol relay. Program ditampilkan pada layar dengan elemen-elemen seperti normally open contact, normally closed contact, timer, counter, sequencer dll ditampilkan seperti dalam bentuk pictorial.
Dibawah kondisi yang benar, listrik dapat mengalir dari rel sebelah kiri ke rel sebelah kanan, jalur rel seperti ini disebut sebagai ladder line (garis tangga). Peraturan secara umum di dalam menggambarkan program ladder diagram adalah :
Daya mengalir dari rel kiri ke rel kanan
Output koil tidak boleh dihubungkan secara langsung di rel sebelah kiri.
Tidak ada kontak yang diletakkan disebelah kanan output coil
Hanya diperbolehkan satu output koil pada ladder line.
Dengan diagram ladder, gambar diatas direpresantisak menjadi
Gambar 1. Diagram Ladder
Diantar dua garis ini dipasang kontak-kontak yang menggambarkan kontrol dari switch, sensor atau output. Satu baris dari diagram disebut dengan satu rung. Input menggunakan symbol [ ] (kontak normally open) dan [/] (kontak normally close). Output mempunyai symbol ( ) yang terletak paling kanan.
2. Prinsip-prinsip Ladder Diagram PLC
Untuk memperlihatkan hubungan antara satu rangkaian fisik dengan ladder diagram yang mempresentasikannya, lihatlah rangkaian motor listrik pada gambar dibawah ini.
Motor dihubungkan ke sumber daya melalui 3 saklar yang dirangkai secara seri ditambah saklar over load sebagai pengaman. Motor akan menyala bila seluruh saklar dalam kondisi menutup.
Gambar 2. rangkaian start – stop motor
Kesimpulan :
Ladder diagram tersusun dari dua garis vertical yang mewakili rel daya
Diantara garis vertikal tersebut disusun garis horizontal yang disebut rung (anak tangga) yang berfungsi untukmenempatkan komponen kontrol sistem.
3. Praktek memori Circuit (Latch)
Rangkaian yang bersifat mengingat kondisi sebelumnya seringkali dibutuhkan dalam kontrol logic. Pada rangkaian ini hasil keluaran dikunci (latching) dengan menggunakan kontak hasil keluaran itu sendiri, sehingga walaupun input sudah berubah, kondisi output tetap.
Gambar 3. Latching Circuit
OPERASI LOGIKA P L C
I. TUJUAN :
Mampu memahami dasar-dasar unit rancang bangun PLC
Mampu memasukan dan menjalankan program dasar di PLC
Mampu membuat program atu diagram ladder dari suatu masalah sederhana
II. PRAKTEK :
A. PRAKTEK INPUT / OUTPUT
Setelah melakukan praktek ini , peserta diharapkan mampu :
Menjadikan PLC sebagai pengontrol terhadap suatu kondisi input tertentu.
Program :
Lampu 1 akan menyala bila saklar 1 ON dan mati bila OFF
Lampu 2 akan menyala bila saklar 2 OFF dan mati bila ON
Lampu dan saklar diandaikan suatu kondisi dalam suatu proses dalam mesin.
Gambar 4. Kontak lampu on –off
B. OPERASI LOGIKA
B.1. OR
1. Rangkaian disusun seperti pada gambar
2. terminal output dihubungkan ke modul I/O train (input ke output)
3. PLC dihidupkan lalu operasi + OFFLINE MODE dipilih
4. Buatlah program untuk diagram ladder di bawah ini :
Gambar 5. Operasi Logika – OR
5. Kemudian jalankan program untuk diagram ladder di bawah ini :
Tabel 1. Tabel logika
No Input Output
X2 X1 X0 OR AND NOR NAND
1 Off Off Off
2 Off Off On
3 Off On Off
4 Off On On
5 On Off Off
6 On Off On
7 On On Off
8 On On On
B.2. AND
6. Buatlah program untuk diagram ladder di bawah ini :
Gambar 6. Operasi Logika – AND
7. Jalankan program tersebut, lalu isi dan lengkapi tabel 1
B.3. NOR
8. Buatlah program yang sesuai untuk diagram ladder dibawah ini :
Gambar 7. Operasi Logika – AND
9. Kemudian jalankan program tersebut lalu isi dan lengkapi tabel 1.
B.4. EXOR
10. Buatlah program yang sesuai untuk diagram ladder dibawah ini
Gambar 8. Operasi Logika – EXOR
11. Kemudian jalankan program tersebut lalu isi dan lengkapi tabel 2
B.5. EXNOR
12. Buatlah program yang sesuai untuk diagram ladder di bawah ini
Gambar 9. Operasi Logika – EXNOR
13. Kemudian jalankan program tersebut lalu isi dan lengkapi tabel 2
Tabel 2. Tabel kebenaran lanjutan
No Input Output
X2 X1 EXOR EXNOR
1 Off Off
2 Off On
3 On Off
4 On On
TIMER
Timer berfungsi untuk mengaktifkan suatu keluaran dengan interval waktu yang dapat diatur. Pengaturan waktu dilakukan melaui nilai setting (preset value). Timer tersebut akan bekerja bila diberi input dan mendapat pulsa clock. Untuk pulsa clock sudah disediakan oleh pembuat PLC. Besarnya nilai pulsa clock pada setiap timer tergantung pada nomor timer yang digunakan. Saat input timer ON maka timer mulai mencacah pulsa dari 0 sampai preset value. Bila sudah mencapai preset value maka akan mengaktifkan Outputyang telah ditentukan.
COUNTER
Fungsi counter adalah mencacah pulsa yang masuk. Sepintas cara kerja counter dan timer mirip. Perbedaannya adalah timer mencacah pulsa internal sedangkan counter mencacah pulsa dari luar.
Avr Gcc
AVR-GCC Plug-In Hands-On
WinAVR Version
AVR Applications Group
October 2005
Introduction
The objective of this Hands-on session is to guide you through the different steps of using the AVR-GCC Plug-In for AVR Studio. It includes step-by-step instructions to point you in the right direction, but does not always include all necessary information to complete the tasks. In many situations you will therefore need to seek answers elsewhere to completely solve the problem. A very useful source for information is the on-line help system in AVR Studio. Always remember to check the help system if you have any questions on how a feature in used.
This training assumes you are somewhat familiar with AVR Studio, stk500 and JTAGICEmkII. Note that it is a step-by-step training and it is therefore very important that you read and complete all tasks before you continue with the next step.
Getting Started
Install Software
This training is based on this software:
AVR Studio 4.12
WinAVR 2005-02-14
Sample code files for the training
In the hands-on text it is assumed that you have used the default installation settings, and that you have copied the sample codes here: C:\avrgcc\code\
Install Hardware
The training is based on the use of this hardware:
STK500
JTAGICEmkII
ATmega32
Before proceeding with the hands-on please install the hardware like this:
STK500
Verify that an ATmega32 is inserted in the correct socket.
Connect the STK500 to the PC with the serial cable.
Connect the ISP/SPI cable.
Connect a 10 pin flat cable between PORTB and LEDS.
Power up and use the AVR Studio programming interface to program the fuses to;
Enable JTAG Interface,
Disable BootReset Vector,
Boot Flash Section Size = 2048 words,
Enable Internal RC Oscillator @ 8MHz
(High fuse: 0x99, Low fuse: 0xD4)
JTAGICEmkII
Connect the STK500/JTAG adapter to the EXPAND0 slot.
Connect the JTAGICEmkII cable to the correct header in the adapter.
Connect the JTAGICEmkII to the PC with the USB cable.
Power up and use the AVR Studio Programming interface to verify the communication with the target AVR.
Task 1: My First Project
Here we will demonstrate the basic steps of creating a GCC project, compiling and debugging it.
Create a new project
Use the Project Wizard
Select New Project
Project Type
AVR-GCC
Project Name
Select your code folder and type a name for your new project.
Select to create initial file.
Use the AVR Simulator & ATmega32
Add code
Type this code into the new file.
MyFirstProject
#include
volatile int MyCounter;
int main()
{
DDRB = 0xFF; /* Set PORTB as output */
while(1)
{
PORTB = MyCounter++; /* Increment MyCounter and */
} /* put it out on PORTB */
}
Compile
Select Build.
AVR Studio will run the compiler and show the output messages in the Build window.
Since the code has no errors you can now select Start Debugging.
Debugging with the simulator
In the code window, select MyCounter variable inside the while loop.
Press F9 to place a Breakpoint at this location.
Right click the mouse on MyCounter and select [Add Watch: “MyCounter”]
Repeatedly clicking F5 will now run the code and stop execution each time it reaches the breakpoint.
Notice that the variable is incrementing in the watch window.
On-chip debugging
Use the JTAGICEmkII to verify correct operation on the real device.
Go to the Debug menu and “Select Device and Debug Platform”.
Change platform to JTAGICEmkII.
Single step the code by pressing F11 repeatedly and verify correct operation on PORTB.
The Generated Files
Open an explorer window to view what files that now have been generated.
All source files must be located in the Project folder together with the AVR Studio project file.
However all other files are generated in a sub folder with the name of the saved configuration.
You will learn more about this later in the hands on training.
All listed files are automatically generated and will be overwritten each time you build the project.
Makefile This is the makefile that includes all the compiler settings for this project.
###.eep A hex file containing the eeprom content. Download this file with a programmer.
###.elf The object file containing all debug data. This file is in the ELF format with DWARF debug data. Open this file to start debugging.
###.hex A hex file containing the flash content. Download this file with a programmer.
###.o Basic object file containing all debug data. Used to generate all other debug files.
You can delete these files by using the Clean option in the Build menu in AVR Studio.
Select Build to re-generate/compile the files.
Task 1 completed
Task 2: Open existing files
Create a new empty project without creating the initial source file.
Call it “Interrupt” and place it in the hands-on code folder called “Interrupt”.
There are 2 ways to add the existing files to the empty project.
-1-
Either by right clicking and selecting “Add Existing File”.
-2-
Or by first opening the folder with your project files in the explorer window.
Select all C files, and use the mouse to Drag-N-Drop all the files into the AVR-GCC Project Tree.
Notice how all C files are automatically added to the Source Files tab.
Compile the project and notice that External Dependences is automatically updated with links to all the included header files.
Notice that if the compilation fails the error messages are tagged RED in the Build window.
Double click the error message and the failing code line will be directly pin pointed.
Correct the error and re-build the project.
Task 2 completed
Task 3: Data Breakpoints
Start Debugging and open the IO view.
Right click the mouse on PORTB, and select [Add Data Breakpoint:”PORTB”]
Run the code, and it will break operation, pointing to the position AFTER the instruction accessing PORTB.
By default it will break on any type of access to this data location.
The AVR Simulator and ICE50 have additional advanced features for data breakpoints.
Lets say we want to only break if bit 4 in PORTB is written to 0.
To do this, find the new Data Breakpoint on the “Breakpoints and Tracepoints” window.
Double click it to enter the properties window.
Select “Bits of location is equal to a value”.
Value = 0
Bitmask = 0x10
Run the project and check if it breaks as expected.
Task 3 completed
Task 4: AVR Libc
The AVR Libc is the standard library package providing a subset of the standard C library targeted for the AVR’s.
Open the AVR-Libc Referance Manual from the on-line help menu in AVR Studio.
This document is the key reference for all code development with the AVR’s.
Here you can find loads of information and code samples on how to use almost all the features.
In AVR-GCC there are two types of macros used for writing interrupts.
What type did we use in the last code example?
What is the difference between the two types?
Use the AVR-Libc Reference Manual to find the answers.
Task 4 completed
Task 5: Compiler Options
Normally customizing compiler options with a GCC compiler involves editing “makefiles”.
However in the AVR Studio plug-in many of these features are automated into a GUI.
To edit the project compiler options; select “Configuration Options”.
The project options is a dialog consisting of five property pages:
General is comprised of options concerned with options controlling the output of a project build.
Include Directories is used for setting up the search path that avr-gcc uses when looking for header files.
Libraries controls the avr-gcc search paths for libraries and sets up libraries to link with.
Memory Settings are used to define new memory segments, relocate standard segments and set up bootloaders.
Custom Options enables individual compiler options for each project source file. Linker options and avr-gcc/make setup is also contained here.
Before proceeding with the hands-on, you MUST read the on-line help describing all these dialogs and options.
Task 5 completed
Task 6: External Makefiles
Writing your own makefiles is a fairly complicated matter. WinAVR has included the MFile tool that can assist you in this process. We will not cover that tool in this training, but you can find more info on the tool in the MFile sub folder of WinAVR.
E.g. C:/Program Files/WinAVR/MFile/README
Instead we will use a pre-made makefile and only slightly modify it for our use.
Still assuming you are in the Interrupt project.
Open the Project Options dialog.
Select “Use External Makefile” and select the new makefile that is in the project root folder.
Note now that it pops up in the “Other Files” tab in the Project tree.
Double click it to open it.
Find the section where you specify the device and change it to ATmega32.
Save the makefile and Build.
Notice the different output that this makefile generates.
Task 6 completed
Task 7: Library Functions
The includes some basic math constants and functions.
Open the main.c file and add the square root function call just after the “led=9;”
Update main.c with this code
(…)
led = sqrt(led);
(…)
Remember to include the file at the top of main.c.
Build the project.
Why do you get an Undefined Reference to sqrt when you compile?
Open the Project Options window and go to the Libraries section.
Library’s made available in the WinAVR distribution are already listed.
Select the libm.a, and move it to the “Link with These Objects” section.
Now re-build the project.
Add a watch to the led variable.
Place a breakpoint before and after the square root function call.
Verify that the math function really works.
Task 7 completed
Task 8: Memory Settings
Create a new empty project without creating the initial source file.
Call it “BootSection” and place it in the hands-on code folder called “BootSection”.
Select JTAGICEmkII and ATmega32 as target.
Add the 2 files (main.c and BootSection.c) to the project.
This is a simple program demonstrating how to program the flash from the application code.
The code first reads a location in flash and puts the content out on PORTB.
Then it programs the complete page with 0xAA.
Finally it reads the same initial location in flash and puts the content out on PORTB.
This simple program will be used to test if we can get the application code to program into its own flash.
Compile and Run the code.
Notice that there are no compile errors, but still PORTB is “dark” indicating that the flash variable is 0xFF and not 0xAA as intended.
Use the Watch feature on the “targetpage” variable to find out what location in flash the code is trying to program.
Open the Memory view and find this memory location in the flash segment.
Notice that the targetpage stores the byte address, while the default view in the memory window shows the word address.
What is the word address of our target page?
Place a breakpoint on each pgm_read_byte() function call.
Run the code while observing the program memory window.
Is the flash updated with 0xAA? Why not?
The code used for programming the flash (BootSection.c) is a pure copy-n-paste from the bootloader example code in the AVR-Libc Reference Manual.
The nature of the SPM instruction is that it is disabled while executed in the Read While Write (RWW) section. I.e. the flash programming code must be placed in the bootloader section of the flash memory.
To instruct the linker to place the boot_program_page() function in the No Read While Write (NRWW) section, first add the following line to the header of the BootSection.c file.
Tell the compiler to place the code in the section called “.bootloader”
void boot_program_page (uint32_t page, uint8_t *buf) BOOTLOADER_SECTION;
The BOOTLOADER_SECTION is defined like this:
#define BOOTLOADER_SECTION __attribute__ ((section (".bootloader")))
By default, code is placed in the .text segment.
We now need to define a memory segment in the flash called “.bootloader” and give it the address of the NRWW section.
Open the Project Options dialog, and the Memory Settings tab.
Create a Memory Segment called “.bootloader” in the flash.
The address is the start address of the Boot Loader Section.
What address should we use? (Tip: look in the bootloader section in the datasheet)
Re-build the project and verify that both PORTB, and the targeted flash page in the memory now view shows 0xAA.
Open the Project Options dialog and enable “Generate Map file” and “Generate List file”.
Re-build the project, and notice that the Map(*.map) and List (*.lss) file is now available in the Other Files tab of the project tree.
Open then List file.
Notice that here you can see information on size and location of the different memory segments.
“Size” shows the size of compiled code, and LMA shows the start address.
Why does it say 0x7000?
Extra task on boot loader debugging
Open the BootSection.c file.
Place a breakpoint on the “for loop”.
Run to this breakpoint.
Look at program/flash in the Memory view.
Why are absolutely all locations of the flash 0xFF?
Task 8 completed
Task 9: Custom Options
The Custom Options tab in the Project Options dialog gives a convenient way of setting different compiler options on different files.
Open the Project Options dialog.
Set optimization level to 0 (-O0), and select to Generate List file.
Build the project.
Open the BootSection.lss file.
Take note of the memory size of the .text and .bootloader segments.
Open the Project Options dialog.
Keep the general optimization level at –O0.
Open the Custom Options tab.
Select the BootSection.c file, type –Os next to the Add button and click Add.
Build the project.
Notice that the .text segment is not effected.
But how much smaller is the bootloader code now as the speed optimization is on here?
Task 9 completed
Task 10: Different Configurations
In the Project Option you can save all settings as different configurations.
This can be used in many ways. E.g.
Debug vs Release configuration
Same project/code on different devices
Different memory mappings (e.g. bootloader location)
etc
Use the same BootSection project. Leave the default configuration for ATmega32 as is, and make a new custom configuration called “m16_boot”.
Set the new configuration to compile for ATmega16, Speed Optimized and with the .bootloader segment pointing at the largest bootloader start address in ATmega16.
Task 10 completed
Task 11: Mixing C and assembly
C and assembly files can be mixed in the same project.
The plug-in will automatically compile all *.c files with c compiler and all *.s files with the assembler.
Create a new empty project without creating the initial source file.
Call it “C_Assembler” and place it in the hands-on code folder called “C_Assembler”.
Add the 3 files (main.c, test_func1.c and test_func2_asm.s) to the project.
Build the project.
Notice that even the assembler files are syntax highlighted.
Single step through the code.
Notice how execution focus moves to the external c file, but NOT the external assembler file.
By looking in the disassembly view you can see that the code is actually being executed correctly.
The reason you can not debug the assembly source file is that there is a bug in the avr-gcc assembler.
It is simply not adding the required debug information to the object file.
Task 11 completed
WinAVR Version
AVR Applications Group
October 2005
Introduction
The objective of this Hands-on session is to guide you through the different steps of using the AVR-GCC Plug-In for AVR Studio. It includes step-by-step instructions to point you in the right direction, but does not always include all necessary information to complete the tasks. In many situations you will therefore need to seek answers elsewhere to completely solve the problem. A very useful source for information is the on-line help system in AVR Studio. Always remember to check the help system if you have any questions on how a feature in used.
This training assumes you are somewhat familiar with AVR Studio, stk500 and JTAGICEmkII. Note that it is a step-by-step training and it is therefore very important that you read and complete all tasks before you continue with the next step.
Getting Started
Install Software
This training is based on this software:
AVR Studio 4.12
WinAVR 2005-02-14
Sample code files for the training
In the hands-on text it is assumed that you have used the default installation settings, and that you have copied the sample codes here: C:\avrgcc\code\
Install Hardware
The training is based on the use of this hardware:
STK500
JTAGICEmkII
ATmega32
Before proceeding with the hands-on please install the hardware like this:
STK500
Verify that an ATmega32 is inserted in the correct socket.
Connect the STK500 to the PC with the serial cable.
Connect the ISP/SPI cable.
Connect a 10 pin flat cable between PORTB and LEDS.
Power up and use the AVR Studio programming interface to program the fuses to;
Enable JTAG Interface,
Disable BootReset Vector,
Boot Flash Section Size = 2048 words,
Enable Internal RC Oscillator @ 8MHz
(High fuse: 0x99, Low fuse: 0xD4)
JTAGICEmkII
Connect the STK500/JTAG adapter to the EXPAND0 slot.
Connect the JTAGICEmkII cable to the correct header in the adapter.
Connect the JTAGICEmkII to the PC with the USB cable.
Power up and use the AVR Studio Programming interface to verify the communication with the target AVR.
Task 1: My First Project
Here we will demonstrate the basic steps of creating a GCC project, compiling and debugging it.
Create a new project
Use the Project Wizard
Select New Project
Project Type
AVR-GCC
Project Name
Select your code folder and type a name for your new project.
Select to create initial file.
Use the AVR Simulator & ATmega32
Add code
Type this code into the new file.
MyFirstProject
#include
volatile int MyCounter;
int main()
{
DDRB = 0xFF; /* Set PORTB as output */
while(1)
{
PORTB = MyCounter++; /* Increment MyCounter and */
} /* put it out on PORTB */
}
Compile
Select Build.
AVR Studio will run the compiler and show the output messages in the Build window.
Since the code has no errors you can now select Start Debugging.
Debugging with the simulator
In the code window, select MyCounter variable inside the while loop.
Press F9 to place a Breakpoint at this location.
Right click the mouse on MyCounter and select [Add Watch: “MyCounter”]
Repeatedly clicking F5 will now run the code and stop execution each time it reaches the breakpoint.
Notice that the variable is incrementing in the watch window.
On-chip debugging
Use the JTAGICEmkII to verify correct operation on the real device.
Go to the Debug menu and “Select Device and Debug Platform”.
Change platform to JTAGICEmkII.
Single step the code by pressing F11 repeatedly and verify correct operation on PORTB.
The Generated Files
Open an explorer window to view what files that now have been generated.
All source files must be located in the Project folder together with the AVR Studio project file.
However all other files are generated in a sub folder with the name of the saved configuration.
You will learn more about this later in the hands on training.
All listed files are automatically generated and will be overwritten each time you build the project.
Makefile This is the makefile that includes all the compiler settings for this project.
###.eep A hex file containing the eeprom content. Download this file with a programmer.
###.elf The object file containing all debug data. This file is in the ELF format with DWARF debug data. Open this file to start debugging.
###.hex A hex file containing the flash content. Download this file with a programmer.
###.o Basic object file containing all debug data. Used to generate all other debug files.
You can delete these files by using the Clean option in the Build menu in AVR Studio.
Select Build to re-generate/compile the files.
Task 1 completed
Task 2: Open existing files
Create a new empty project without creating the initial source file.
Call it “Interrupt” and place it in the hands-on code folder called “Interrupt”.
There are 2 ways to add the existing files to the empty project.
-1-
Either by right clicking and selecting “Add Existing File”.
-2-
Or by first opening the folder with your project files in the explorer window.
Select all C files, and use the mouse to Drag-N-Drop all the files into the AVR-GCC Project Tree.
Notice how all C files are automatically added to the Source Files tab.
Compile the project and notice that External Dependences is automatically updated with links to all the included header files.
Notice that if the compilation fails the error messages are tagged RED in the Build window.
Double click the error message and the failing code line will be directly pin pointed.
Correct the error and re-build the project.
Task 2 completed
Task 3: Data Breakpoints
Start Debugging and open the IO view.
Right click the mouse on PORTB, and select [Add Data Breakpoint:”PORTB”]
Run the code, and it will break operation, pointing to the position AFTER the instruction accessing PORTB.
By default it will break on any type of access to this data location.
The AVR Simulator and ICE50 have additional advanced features for data breakpoints.
Lets say we want to only break if bit 4 in PORTB is written to 0.
To do this, find the new Data Breakpoint on the “Breakpoints and Tracepoints” window.
Double click it to enter the properties window.
Select “Bits of location is equal to a value”.
Value = 0
Bitmask = 0x10
Run the project and check if it breaks as expected.
Task 3 completed
Task 4: AVR Libc
The AVR Libc is the standard library package providing a subset of the standard C library targeted for the AVR’s.
Open the AVR-Libc Referance Manual from the on-line help menu in AVR Studio.
This document is the key reference for all code development with the AVR’s.
Here you can find loads of information and code samples on how to use almost all the features.
In AVR-GCC there are two types of macros used for writing interrupts.
What type did we use in the last code example?
What is the difference between the two types?
Use the AVR-Libc Reference Manual to find the answers.
Task 4 completed
Task 5: Compiler Options
Normally customizing compiler options with a GCC compiler involves editing “makefiles”.
However in the AVR Studio plug-in many of these features are automated into a GUI.
To edit the project compiler options; select “Configuration Options”.
The project options is a dialog consisting of five property pages:
General is comprised of options concerned with options controlling the output of a project build.
Include Directories is used for setting up the search path that avr-gcc uses when looking for header files.
Libraries controls the avr-gcc search paths for libraries and sets up libraries to link with.
Memory Settings are used to define new memory segments, relocate standard segments and set up bootloaders.
Custom Options enables individual compiler options for each project source file. Linker options and avr-gcc/make setup is also contained here.
Before proceeding with the hands-on, you MUST read the on-line help describing all these dialogs and options.
Task 5 completed
Task 6: External Makefiles
Writing your own makefiles is a fairly complicated matter. WinAVR has included the MFile tool that can assist you in this process. We will not cover that tool in this training, but you can find more info on the tool in the MFile sub folder of WinAVR.
E.g. C:/Program Files/WinAVR/MFile/README
Instead we will use a pre-made makefile and only slightly modify it for our use.
Still assuming you are in the Interrupt project.
Open the Project Options dialog.
Select “Use External Makefile” and select the new makefile that is in the project root folder.
Note now that it pops up in the “Other Files” tab in the Project tree.
Double click it to open it.
Find the section where you specify the device and change it to ATmega32.
Save the makefile and Build.
Notice the different output that this makefile generates.
Task 6 completed
Task 7: Library Functions
The
Open the main.c file and add the square root function call just after the “led=9;”
Update main.c with this code
(…)
led = sqrt(led);
(…)
Remember to include the
Build the project.
Why do you get an Undefined Reference to sqrt when you compile?
Open the Project Options window and go to the Libraries section.
Library’s made available in the WinAVR distribution are already listed.
Select the libm.a, and move it to the “Link with These Objects” section.
Now re-build the project.
Add a watch to the led variable.
Place a breakpoint before and after the square root function call.
Verify that the math function really works.
Task 7 completed
Task 8: Memory Settings
Create a new empty project without creating the initial source file.
Call it “BootSection” and place it in the hands-on code folder called “BootSection”.
Select JTAGICEmkII and ATmega32 as target.
Add the 2 files (main.c and BootSection.c) to the project.
This is a simple program demonstrating how to program the flash from the application code.
The code first reads a location in flash and puts the content out on PORTB.
Then it programs the complete page with 0xAA.
Finally it reads the same initial location in flash and puts the content out on PORTB.
This simple program will be used to test if we can get the application code to program into its own flash.
Compile and Run the code.
Notice that there are no compile errors, but still PORTB is “dark” indicating that the flash variable is 0xFF and not 0xAA as intended.
Use the Watch feature on the “targetpage” variable to find out what location in flash the code is trying to program.
Open the Memory view and find this memory location in the flash segment.
Notice that the targetpage stores the byte address, while the default view in the memory window shows the word address.
What is the word address of our target page?
Place a breakpoint on each pgm_read_byte() function call.
Run the code while observing the program memory window.
Is the flash updated with 0xAA? Why not?
The code used for programming the flash (BootSection.c) is a pure copy-n-paste from the bootloader example code in the AVR-Libc Reference Manual.
The nature of the SPM instruction is that it is disabled while executed in the Read While Write (RWW) section. I.e. the flash programming code must be placed in the bootloader section of the flash memory.
To instruct the linker to place the boot_program_page() function in the No Read While Write (NRWW) section, first add the following line to the header of the BootSection.c file.
Tell the compiler to place the code in the section called “.bootloader”
void boot_program_page (uint32_t page, uint8_t *buf) BOOTLOADER_SECTION;
The BOOTLOADER_SECTION is defined like this:
#define BOOTLOADER_SECTION __attribute__ ((section (".bootloader")))
By default, code is placed in the .text segment.
We now need to define a memory segment in the flash called “.bootloader” and give it the address of the NRWW section.
Open the Project Options dialog, and the Memory Settings tab.
Create a Memory Segment called “.bootloader” in the flash.
The address is the start address of the Boot Loader Section.
What address should we use? (Tip: look in the bootloader section in the datasheet)
Re-build the project and verify that both PORTB, and the targeted flash page in the memory now view shows 0xAA.
Open the Project Options dialog and enable “Generate Map file” and “Generate List file”.
Re-build the project, and notice that the Map(*.map) and List (*.lss) file is now available in the Other Files tab of the project tree.
Open then List file.
Notice that here you can see information on size and location of the different memory segments.
“Size” shows the size of compiled code, and LMA shows the start address.
Why does it say 0x7000?
Extra task on boot loader debugging
Open the BootSection.c file.
Place a breakpoint on the “for loop”.
Run to this breakpoint.
Look at program/flash in the Memory view.
Why are absolutely all locations of the flash 0xFF?
Task 8 completed
Task 9: Custom Options
The Custom Options tab in the Project Options dialog gives a convenient way of setting different compiler options on different files.
Open the Project Options dialog.
Set optimization level to 0 (-O0), and select to Generate List file.
Build the project.
Open the BootSection.lss file.
Take note of the memory size of the .text and .bootloader segments.
Open the Project Options dialog.
Keep the general optimization level at –O0.
Open the Custom Options tab.
Select the BootSection.c file, type –Os next to the Add button and click Add.
Build the project.
Notice that the .text segment is not effected.
But how much smaller is the bootloader code now as the speed optimization is on here?
Task 9 completed
Task 10: Different Configurations
In the Project Option you can save all settings as different configurations.
This can be used in many ways. E.g.
Debug vs Release configuration
Same project/code on different devices
Different memory mappings (e.g. bootloader location)
etc
Use the same BootSection project. Leave the default configuration for ATmega32 as is, and make a new custom configuration called “m16_boot”.
Set the new configuration to compile for ATmega16, Speed Optimized and with the .bootloader segment pointing at the largest bootloader start address in ATmega16.
Task 10 completed
Task 11: Mixing C and assembly
C and assembly files can be mixed in the same project.
The plug-in will automatically compile all *.c files with c compiler and all *.s files with the assembler.
Create a new empty project without creating the initial source file.
Call it “C_Assembler” and place it in the hands-on code folder called “C_Assembler”.
Add the 3 files (main.c, test_func1.c and test_func2_asm.s) to the project.
Build the project.
Notice that even the assembler files are syntax highlighted.
Single step through the code.
Notice how execution focus moves to the external c file, but NOT the external assembler file.
By looking in the disassembly view you can see that the code is actually being executed correctly.
The reason you can not debug the assembly source file is that there is a bug in the avr-gcc assembler.
It is simply not adding the required debug information to the object file.
Task 11 completed
aplication example PIC 16F48
Examples
Introduction
Examples given in this chapter will show you how to connect the PIC microcontroller with other peripheral components or devices when developing your own microcontroller system. Each example contains detailed description of hardware with electrical outline and comments on the program. All programs can be taken directly from the 'MikroElektronika' Internet presentation.
7.1 Supplying the microcontroller
Generally speaking, the correct voltage supply is of utmost importance for the proper functioning of the microcontroller system. It can easily be compared to a man breathing in the air. It is more likely that a man who is breathing in fresh air will live longer than a man who's living in a polluted environment.
For a proper function of any microcontroller, it is necessary to provide a stable source of supply, a sure reset when you turn it on and an oscillator. According to technical specifications by the manufacturer of PIC microcontroller, supply voltage should move between 2.0V to 6.0V in all versions. The simplest solution to the source of supply is using the voltage stabilizer LM7805 which gives stable +5V on its output. One such source is shown in the picture below.
In order to function properly, or in order to have stable 5V at the output (pin 3), input voltage on pin 1 of LM7805 should be between 7V through 24V. Depending on current consumption of device we will use the appropriate type of voltage stabilizer LM7805. There are several versions of LM7805. For current consumption of up to 1A we should use the version in TO-220 case with the capability of additional cooling. If the total consumption is 50mA, we can use 78L05 (stabilizer version in small TO - 92 packaging for current of up to 100mA).
7.2 LED diodes
LEDs are surely one of the most commonly used elements in electronics. LED is an abbreviation for 'Light Emitting Diode'. When choosing a LED, several parameters should be looked at: diameter, which is usually 3 or 5 mm (millimeters), working current which is usually about 10mA (It can be as low as 2mA for LEDs with high efficiency - high light output), and color of course, which can be red or green though there are also orange, blue, yellow....
LEDs must be connected around the correct way, in order to emit light and the current-limiting resistor must be the correct value so that the LED is not damaged or burn out (overheated). The positive of the supply is taken to the anode, and the cathode goes to the negative or ground of the project (circuit). In order to identify each lead, the cathode is the shorter lead and the LED "bulb" usually has a cut or "flat" on the cathode side. Diodes will emit light only if current is flowing from anode to cathode. Otherwise, its PN junction is reverse biased and current won't flow. In order to connect a LED correctly, a resistor must be added in series that to limit the amount of current through the diode, so that it does not burn out. The value of the resistor is determined by the amount of current you want to flow through the LED. Maximum current flow trough LED was defined by manufacturer.
To determine the value of the dropper-resistor, we need to know the value of the supply voltage. From this we subtract the characteristic voltage drop of a LED. This value will range from 1.2v to 1.6v depending on the color of the LED. The answer is the value of Ur. Using this value and the current we want to flow through the LED (0.002A to 0.01A) we can work out the value of the resistor from the formula R=Ur/I.
LEDs are connected to a microcontroller in two ways. One is to switch them on with logic zero, and other to switch them on with logic one. The first is called NEGATIVE logic and the other is called POSITIVE logic. The next diagram shows how to connect POSITIVE logic. Since POSITIVE logic provides a voltage of +5V to the diode and dropper resistor, it will emit light each time a pin of port B is provided with a logic 1. The other way is to connect all anodes to +5V and to deliver logical zero to cathodes.
Connecting LED diodes to PORTB microcontroller
The following example initializes port B as output and alternately switches on and off LED diodes every 0.5sec. For pause we used macro pausems, which is defined in the file mikroel84.inc.
7.3 Push buttons
Buttons are mechanical devices used to execute a break or make connection between two points. They come in different sizes and with different purposes. Buttons that are used here are also called "dip-buttons". They are soldered directly onto a printed board and are common in electronics. They have four pins (two for each contact) which give them mechanical stability.
Example of connecting buttons to microcontroller pins
Button function is simple. When we push a button, two contacts are joined together and connection is made. Still, it isn't all that simple. The problem lies in the nature of voltage as an electrical dimension, and in the imperfection of mechanical contacts. That is to say, before contact is made or cut off, there is a short time period when vibration (oscillation) can occur as a result of unevenness of mechanical contacts, or as a result of the different speed in pushing a button (this depends on person who pushes the button). The term given to this phenomena is called SWITCH (CONTACT) DEBOUNCE. If this is overlooked when program is written, an error can occur, or the program can produce more than one output pulse for a single button push. In order to avoid this, we can introduce a small delay when we detect the closing of a contact. This will ensure that the push of a button is interpreted as a single pulse. The debounce delay is produced in software and the length of the delay depends on the button, and the purpose of the button. The problem can be partially solved by adding a capacitor across the button, but a well-designed program is a much-better answer. The program can be adjusted until false detection is completely eliminated. Image below shows what actually happens when button is pushed.
As buttons are very common element in electronics, it would be smart to have a macro for detecting the button is pushed. Macro will be called button. Button has several parameters that deserve additional explanation.
button macro port, pin, hilo, label
Port is a microcontroller's port to which a button is connected. In case of a PIC16F84 microcontroller, it can be PORTA or PORTB.
Pin is port's pin to which the button is connected.
HiLo can be '0' or '1' which represents the state when the button is pushed.
Label is a destination address for jump to a service subprogram which will handle the event (button pushed).
Example 1:
button PORTA, 3, 1, Button1
Button T1 is connected to pin RA3 and to the mass across a pull-down resistor, so it generates logical one upon push. When the button is released, program jumps to the label Button1.
Example 2:
button PORTA, 2, 0, Button2
Button T1 is connected to pin RA1 and to the mass across a pull-up resistor, so it generates logical zero upon push. When the button is released, program jumps to the label Button2.
The following example illustrates use of macro button in a program. Buttons are connected to the supply across pull-up resistors and connect to the mass when pushed. Variable cnt is displayed on port B LEDs; cnt is incremented by pushing the button RA0, and is decremented by pushing the button RA1.
It is important to note that this kind of debouncing has certain drawbacks, mainly concerning the idle periods of microcontroller. Namely, microcontroller is in the state of waiting from the moment the button is pushed until it is released, which can be a very long time period in certain applications. if you want the program to be attending to a number of things at the same time, different approach should be used from the start. Solution is to use the interrupt routine for each push of a button, which will occur periodically with pause adequate to compensate for repeated pushes of button.
The idea is simple. Every 10ms, button state will be checked upon and compared to the previous input state. This comparison can detect rising or falling edge of the signal. In case that states are same, there were apparently no changes. In case of change from 0 to a 1, rising edge occurred. If succeeding 3 or 4 checks yield the same result (logical one), we can be positive that the button is pushed.
7.4 Optocouplers
Optocouplers were discovered right after photo-transistors (like any other transistor, except it is stimulated by light), by combining a LED and photo-transistor in the same case. The purpose of an optocoupler is to separate two parts of a circuit.
This is done for a number of reasons:
• Interference. Typical examples are industrial units with lots of interferences which affect signals in the wires. If these interferences affected the function of control section, errors would occur and the unit would stop working.
• Simultaneous separation and intensification of a signal. Typical examples are relays which require higher current than microcontroller pin can provide. Usually, optocoupler is used for separating microcontroller supply and relay supply.
• In case of a breakdown, optocoupled part of device stays safe in its casing, reducing the repair costs.
Optocouplers can be used as either input or output devices. They can have additional functions such as intensification of a signal or Schmitt triggering (the output of a Schmitt trigger is either 0 or 1 - it changes slow rising and falling waveforms into definite low or high values). Optocouplers come as a single unit or in groups of two or more in one casing.
Each optocoupler needs two supplies in order to function. They can be used with one supply, but the voltage isolation feature, which is their primary purpose, is lost.
7.4.1 Optocoupler on an input line
The way it works is simple: when a signal arrives, the LED within the optocoupler is turned on, and it illuminates the base of a photo-transistor within the same case. When the transistor is activated, the voltage between collector and emitter falls to 0.7V or less and the microcontroller sees this as a logic zero on its RA4 pin.
The example below is a simplified model of a counter, element commonly utilized in industry (it is used for counting products on a production line, determining motor speed, counting the number of revolutions of an axis, etc). We will have sensor set off the LED every time axis makes a full revolution. LED in turn will 'send' a signal by means of photo-transistor to a microcontroller input RA4 (TOCKI). As prescaler is set to 1:2 in this example, every second signal will increment TMR0. Current status of the counter is displayed on PORTB LEDs.
Example of optocoupler on an input line
7.4.2 Optocoupler on an output line
An Optocoupler can be also used to separate the output signals. If optocoupler LED is connected to microcontroller pin, logical zero on pin will activate optocoupler LED, thus activating the transistor. This will consequently switch on LED in the part of device working on 12V. Layout of this connection is shown below.
Example of optocoupler on output line
The program for this example is simple. By delivering a logical one to the third pin of port A, the transistor will be activated in the optocoupler, switching on the LED in the part of device working on 12V.
7.5 Relay
The relay is an electromechanical device, which transforms an electrical signal into mechanical movement. It consists of a coil of insulated wire on a metal core, and a metal armature with one or more contacts. When a supply voltage was delivered to the coil, current would flow and a magnetic field would be produced that moves the armature to close one set of contacts and/or open another set. When power is removed from the relay, the magnetic flux in the coil collapses and produces a fairly high voltage in the opposite direction. This voltage can damage the driver transistor and thus a reverse-biased diode is connected across the coil to "short-out" the spike when it occurs.
Connecting a relay to the microcontroller via transistor
Since microcontroller cannot provide sufficient supply for a relay coil (approx. 100+mA is required; microcontroller pin can provide up to 25mA), a transistor is used for adjustment purposes, its collector circuit containing the relay coil. When a logical one is delivered to transistor base, transistor activates the relay, which then, using its contacts, connects other elements in the circuit. Purpose of the resistor at the transistor base is to keep a logical zero on base to prevent the relay from activating by mistake. This ensures that only a clean logical one on RA3 activates the relay.
Connecting the optocoupler and relay to a microcontroller
A relay can also be activated via an optocoupler which at the same time amplifies the current related to the output of the microcontroller and provides a high degree of isolation. High current optocouplers usually contain a 'Darlington' output transistor to provide high output current.
Connecting via an optocoupler is recommended especially for microcontroller applications, where relays are used fro starting high power load, such as motors or heaters, whose voltage instability can put the microcontroller at risk. In our example, when LED is activated on some of the output port pins, the relay is started. Below is the program needed to activate the relay, and includes some of the already discussed macros.
7.6 Generating sound
In microcontroller systems, beeper is used for indicating certain occurrences, such as push of a button or an error. To have the beeper started, it needs to be delivered a string in binary code - in this way, you can create sounds according to your needs. Connecting the beeper is fairly simple: one pin is connected to the mass, and the other to the microcontroller pin through a capacitor, as shown on the following image.
As with a button, you can employ a macro that will deliver a BEEP ROUTINE into a program when needed. Macro BEEP has two arguments:
BEEP macro freq , duration:
freq: frequency of the sound. The higher number produces higher frequency
duration: sound duration. Higher the number, longer the sound.
Example 1: BEEP 0xFF, 0x02
The output has the highest frequency and duration at 2 cycles per 65.3mS which gives 130.6 mS
Example2: BEEP 0x90, 0x05
The output has a frequency of 0x90 and duration of 5 cycles per 65.3mS. It is best to determine these macro parameters through experimentation and select the sound that best suits the application.
The following is the BEEP Macro listing:
The following example shows the use of a macro in a program. The program produces two melodies which are obtained by pressing T1 or T2. Some of the previously discussed macros are included in the program.
7.7 Shift registers
There are two types of shift registers: input and output. Input shift registers receive data in parallel, through 8 lines and then send it serially through two lines to a microcontroller. Output shift registers work in the opposite direction; they receive serial data and on a "latch" line signal, they turn it into parallel data. Shift registers are generally used to expand the number of input-output lines of a microcontroller. They are not so much in use any more though, because most modern microcontrollers have a large number of pins. However, their use with microcontrollers such as PIC16F84 is very important.
7.7.1 Input shift register 74HC597
Input shift registers transform parallel data into serial data and transfers it to a microcontroller. Their working is quite simple. There are four lines for the transfer of data: Clock, Latch, Load and Data. Data is first read from the input pins by an internal register through a 'latch' signal. Then, with a 'load' signal, data is transferred from the input latch register to the shift register, and from there it is serially transferred to a microcontroller via 'data' and 'clock' lines.
An outline of the connection of the shift register 74HC597 to a micro, is shown below.
In order to simplify the main program, a macro can be used for the input shift register. Macro HC597 has two parameters:
HC597 macro Var, Var1
Var variable where data from shift register input pins is transferred
Var1 loop counter
Example: HC597 data, counter
Data from the input pins of the shift register is stored in data variable. Timer/counter variable is used as a loop counter.
Macro listing:
Example of how to use the HC597 macro is given in the following program. Program receives data from a parallel input of the shift register and moves it serially into the RX variable of the microcontroller. LEDs connected to port B will indicate the result of the data input.
7.7.2 Output shift register
Output shift registers transform serial data into parallel data. On every rising edge of the clock, the shift register reads the value from data line, stores it in temporary register, and then repeats this cycle 8 times. On a signal from 'latch' line, data is copied from the shift register to input register, thus data is transformed from serial into parallel data.
An outline of the 74HC595 shift register connections is shown on the diagram below:
Macro used in this example can be found in hc595.inc file, and is called HC595.
Macro HC595 has two parameters:
HC595 macro Var, Var1
Var variable whose contents is transferred to outputs of shift register.
Var1 loop counter
Example: HC595 Data, counter
The data we want to transfer is stored in data variable, and counter variable is used as a loop counter.
An example of how to use the HC595 macro is given in the following program. Data from variable TX is serially transferred to shift register. LEDs connected to the parallel output of the shift register will indicate the state of the lines. In this example value 0xCB (1100 1011) is sent so that the seventh, sixth, third, first, and zero LEDs are illuminated.
7.8 Seven-Segment Display (multiplexing)
The segments in a 7-segment display are arranged to form a single digit from 0 to F as shown in the animation:
We can display a multi-digit number by connecting additional displays. Even though LCD displays are more comfortable to work with, 7-segment displays are still standard in the industry. This is due to their temperature robustness, visibility and wide viewing angle. Segments are marked with non-capital letters: a, b, c, d, e, f, g and dp, where dp is the decimal point. The 8 LEDs inside each display can be arranged with a common cathode or common anode. With a common cathode display, the common cathode must be connected to the 0V rail and the LEDs are turned on with a logic one. Common anode displays must have the common anode connected to the +5V rail. The segments are turned on with a logic zero. The size of a display is measured in millimeters, the height of the digit itself (not the housing, but the digit!). Displays are available with a digit height of 7,10, 13.5, 20, or 25 millimeters. They come in different colors, including: red, orange, and green.
The simplest way to drive a display is via a display driver. These are available for up to 4 displays. Alternatively displays can be driven by a microcontroller and if more than one display is required, the method of driving them is called "multiplexing."
The main difference between the two methods is the number of "drive lines." A special driver may need only a single "clock" line and the driver chip will access all the segments and increment the display. If a single display is to be driven from a microcontroller, 7 lines will be needed plus one for the decimal point. For each additional display, only one extra line is needed. To produce a 4, 5 or 6 digit display, all the 7-segment displays are connected in parallel. The common line (the common-cathode line) is taken out separately and this line is taken low for a short period of time to turn on the display. Each display is turned on at a rate above 100 times per second, and it will appear that all the displays are turned on at the same time. As each display is turned on, the appropriate information must be delivered to it so that it will give the correct reading. Up to 6 displays can be accessed like this without the brightness of each display being affected. Each display is turned on very hard for one-sixth the time and the POV (persistence of vision) of our eye thinks the display is turned on the whole time. Therefore, the program has to ensure the proper timing, else the unpleasant blinking of display will occur.
Connecting a microcontroller to 7-segment displays in multiplex mode
Program "7seg.asm" displays decimal value of a number stored in variable D.
Example:
movlw .21
movlw D ; number 21 will be printed on 7seg display
Displaying digits is carried out in multiplex mode which means that the microcontroller alternately prints ones digit and tens digit. TMR0 interrupt serves for generating a time period, so that the program enters the interrupt routine every 5ms and performs multiplexing. In the interrupt routine, first step is deciding which segment should be turned on. In case that the tens digit was previously on, it should be turned off, set the mask for printing the ones digit on 7seg display which lasts 5ms, i.e. until the next interrupt.
For extracting the ones digit and the tens digit, macro digbyte is used. It stores the hundreds digit, the tens digit, and the ones digit into variables Dig1, Dig2, and Dig3. In our case, upon macro execution, Dig1 will equal 0, Dig2 will equal 2, and Dig3 will equal 1.
Realization of the macro is given in the following listing:
The following example shows the use of the macro in a program. Program prints a specified 2-digit number on a 7seg display in multiplex mode.
7.9 LCD Display
More microcontroller devices are using 'smart LCD' displays to output visual information. The following discussion covers the connection of a Hitachi LCD display to a PIC microcontroller. LCD displays designed around Hitachi's LCD HD44780 module, are inexpensive, easy to use, and it is even possible to produce a readout using the 8 x 80 pixels of the display. Hitachi LCD displays have a standard
A 16x2 line Hitachi HD44780 display
For a 8-bit data bus, the display requires a +5V supply plus 11 I/O lines. For a 4-bit data bus it only requires the supply lines plus seven extra lines. When the LCD display is not enabled, data lines are tri-state which means they are in a state of high impendance (as though they are disconnected) and this means they do not interfere with the operation of the microcontroller when the display is not being addressed.
The LCD also requires 3 "control" lines from the microcontroller.
Enable (E) This line allows access to the display through R/W and RS lines. When this line is low, the LCD is disabled and ignores signals from R/W and RS. When (E) line is high, the LCD checks the state of the two control lines and responds accordingly.
Read/Write (R/W) This line determines the direction of data between the LCD and microcontroller. When it is low, data is written to the LCD. When it is high, data is read from the LCD.
Register select (RS) With the help of this line, the LCD interprets the type of data on data lines. When it is low, an instruction is being written to the LCD. When it is high, a character is being written to the LCD.
Logic status on control lines:
E 0 Access to LCD disabled
1 Access to LCD enabled
R/W 0 Writing data to LCD
1 Reading data from LCD
RS 0 Instruction
1 Character
Writing data to the LCD is done in several steps:
Set R/W bit to low
Set RS bit to logic 0 or 1 (instruction or character)
Set data to data lines (if it is writing)
Set E line to high
Set E line to low
Read data from data lines (if it is reading)
Reading data from the LCD is done in the same way, but control line R/W has to be high. When we send a high to the LCD, it will reset and wait for instructions. Typical instructions sent to LCD display after a reset are: turning on a display, turning on a cursor and writing characters from left to right. When the LCD is initialized, it is ready to continue receiving data or instructions. If it receives a character, it will write it on the display and move the cursor one space to the right. The Cursor marks the next location where a character will be written. When we want to write a string of characters, first we need to set up the starting address, and then send one character at a time. Characters that can be shown on the display are stored in data display (DD) RAM. The size of DDRAM is 80 bytes.
The LCD display also possesses 64 bytes of Character-Generator (CG) RAM. This memory is used for characters defined by the user. Data in CG RAM is represented as an 8-bit character bit-map. Each character takes up 8 bytes of CG RAM, so the total number of characters, which the user can define is eight. In order to read in the character bit-map to the LCD display, we must first set the CG RAM address to starting point (usually 0), and then write data to the display. The definition of a 'special' character is given in the picture.
Before we access DD RAM after defining a special character, the program must set the DD RAM address. Writing and reading data from any LCD memory is done from the last address which was set up using set-address instruction. Once the address of DD RAM is set, a new written character will be displayed at the appropriate place on the screen. Until now we discussed the operation of writing and reading to an LCD as if it were an ordinary memory. But this is not so. The LCD controller needs 40 to 120 microseconds (uS) for writing and reading. Other operations can take up to 5 mS. During that time, the microcontroller can not access the LCD, so a program needs to know when the LCD is busy. We can solve this in two ways.
One way is to check the BUSY bit found on data line D7. This is not the best method because LCD's can get stuck, and program will then stay forever in a loop checking the BUSY bit. The other way is to introduce a delay in the program. The delay has to be long enough for the LCD to finish the operation in process. Instructions for writing to and reading from an LCD memory are shown in the previous table.
At the beginning we mentioned that we needed 11 I/O lines to communicate with an LCD. However, we can communicate with an LCD through a 4-bit data bus. Thus we can reduce the total number of communication lines to seven. The wiring for connection via a 4-bit data bus is shown in the diagram below. In this example we use an LCD display with 2x16 characters, labeled LM16X212 by Japanese maker SHARP. The message 'character' is written in the first row: and two special characters '~' and '}' are displayed. In the second row we have produced the word 'mikroElektronika'.
Connecting an LCD display to a microcontroller
File lcd.inc contains a group of macros for use when working with LCD displays.
Using the macro for LCD support
lcdinit Macro used to initialize port connected to LCD. LCD is configured to work in 4-bit mode.
Example: lcdinit
lcdtext lcdtext prints the text of up to 16 characters, which is specified as a macro parameter. First parameter selects the line in which to start printing. If select is zero, text is printed from the current cursor position.
Example: lcdtext 1, "mikroelektronika"
lcdtext 1, "Temperature1" ;Print the text starting from line 1, character 1
lcdtext 2, "temp=" ;Print the text starting from line 2, character 1
lcdtext 0, " C" ;Print C in the rest of the line 2
lcdcmd Sends command instructions
LCDCLR = b'00000001' ;Clear display, cursor home
LCDCH = b'00000010' ;Cursor home
LCDCL = b'00000100' ;Move the cursor to the left
LCDCR = b'00000110' ;Move the cursor to the right
LCDSL = b'00011000' ;Move the content of display to the left
LCDSR = b'00011100' ;Move the content of display to the right
LCDL1 = b'10000000' ;Select line 1
LCDL2 = b'11000000' ;Select line 2
Example: lcdcmd LCDCH
lcdbyte Prints one byte variable and omits leading zeros
Example: lcdbyte Temperature
When working with a microcontroller the numbers are presented in a binary form. As such, they cannot be displayed on a display. That's why it is necessary to change the numbers from a binary system into a decimal system so they can be easily understood. For printing the variables lcdbyte and lcdword we have used the macros digbyte and digword which convert the numbers from binary system into a decimal system and print the result on LCD. Main program has the purpose of demonstrating use of LCD display. At the start it's necessary to declare variables LCDbuf, LCDtemp, Digtemp, Dig1, Dig2, and Dig3 used by the macros for LCD support. It is also necessary to state the port of microcontroller that LCD is connected to. Program initializes the LCD and demonstrates printing text and 8-bit variable temp.
7.10 Serial Communication
SCI is an abbreviation for Serial Communication Interface and, as a special subsystem, it exists on most microcontrollers. When it is not available, as is the case with PIC16F84, it can be created in software.
As with hardware communication, we use standard NRZ (Non Return to Zero) format also known as 8 (9)-N-1, or 8 or 9 data bits, without parity bit and with one stop bit. Free line is defined as the status of logic one. Start of transmission - Start Bit, has the status of logic zero. The data bits follow the start bit (the first bit is the low significant bit), and after the bits we place the Stop Bit of logic one. The duration of the stop bit 'T' depends on the transmission rate and is adjusted according to the needs of the transmission. For the transmission speed of 9600 baud, T is 104 uS.
Pin designations on RS232 connector
1. CD (Carrier Detect)
2. RXD (Receive Data)
3. TXD (Transmit Data)
4. DTR (Data terminal Ready)
5. GND (Ground)
6. DSR (Data Set Ready)
7. RTS (Request To Send)
8. CTS (Clear To Send)
9. RI (Ring Indicator)
In order to connect a microcontroller to a serial port on a PC computer, we need to adjust the level of the signals so communicating can take place. The signal level on a PC is -10V for logic zero, and +10V for logic one. Since the signal level on the microcontroller is +5V for logic one, and 0V for logic zero, we need an intermediary stage that will convert the levels. One chip specially designed for this task is MAX232. This chip receives signals from -10 to +10V and converts them into 0 and 5V.
The circuit for this interface is shown in the diagram below:
Connecting a microcontroller to a PC via a MAX232 line interface chip
File RS232.inc contains a group of macros used for serial communication.
Using the macro for serial communication:
rs232init Macro for initializing the pin for transmitting data (TX-pin).
Example: RS232init
Sendw Sending ASCII value of data found in W register.
Example: movlw 't'
call Sendw
rs232text Sending ASCII value of a specified text
Example: rs232 "mikroelektronika"
rs232byte Sending ASCII value of decimal digits of 8-bit variable
Example: movlw .123
movwf TXdata
rs232byte TXdata ;Send '1', '2', '3'
When rs232.inc file is used, it is necessary to declare variables Rstemp and TXD at the beginning of the main program.
Example:
As a demonstration of a serial communication, we have an example which sends text and the content of variable cnt. Text is sent via macro rs232text, while variable cnt is sent via macro rs232byte. This operation repeats itself after 500ms, with incrementing cnt in the process. This example can be easily modified to have button(s) for sending specified data.
Introduction
Examples given in this chapter will show you how to connect the PIC microcontroller with other peripheral components or devices when developing your own microcontroller system. Each example contains detailed description of hardware with electrical outline and comments on the program. All programs can be taken directly from the 'MikroElektronika' Internet presentation.
7.1 Supplying the microcontroller
Generally speaking, the correct voltage supply is of utmost importance for the proper functioning of the microcontroller system. It can easily be compared to a man breathing in the air. It is more likely that a man who is breathing in fresh air will live longer than a man who's living in a polluted environment.
For a proper function of any microcontroller, it is necessary to provide a stable source of supply, a sure reset when you turn it on and an oscillator. According to technical specifications by the manufacturer of PIC microcontroller, supply voltage should move between 2.0V to 6.0V in all versions. The simplest solution to the source of supply is using the voltage stabilizer LM7805 which gives stable +5V on its output. One such source is shown in the picture below.
In order to function properly, or in order to have stable 5V at the output (pin 3), input voltage on pin 1 of LM7805 should be between 7V through 24V. Depending on current consumption of device we will use the appropriate type of voltage stabilizer LM7805. There are several versions of LM7805. For current consumption of up to 1A we should use the version in TO-220 case with the capability of additional cooling. If the total consumption is 50mA, we can use 78L05 (stabilizer version in small TO - 92 packaging for current of up to 100mA).
7.2 LED diodes
LEDs are surely one of the most commonly used elements in electronics. LED is an abbreviation for 'Light Emitting Diode'. When choosing a LED, several parameters should be looked at: diameter, which is usually 3 or 5 mm (millimeters), working current which is usually about 10mA (It can be as low as 2mA for LEDs with high efficiency - high light output), and color of course, which can be red or green though there are also orange, blue, yellow....
LEDs must be connected around the correct way, in order to emit light and the current-limiting resistor must be the correct value so that the LED is not damaged or burn out (overheated). The positive of the supply is taken to the anode, and the cathode goes to the negative or ground of the project (circuit). In order to identify each lead, the cathode is the shorter lead and the LED "bulb" usually has a cut or "flat" on the cathode side. Diodes will emit light only if current is flowing from anode to cathode. Otherwise, its PN junction is reverse biased and current won't flow. In order to connect a LED correctly, a resistor must be added in series that to limit the amount of current through the diode, so that it does not burn out. The value of the resistor is determined by the amount of current you want to flow through the LED. Maximum current flow trough LED was defined by manufacturer.
To determine the value of the dropper-resistor, we need to know the value of the supply voltage. From this we subtract the characteristic voltage drop of a LED. This value will range from 1.2v to 1.6v depending on the color of the LED. The answer is the value of Ur. Using this value and the current we want to flow through the LED (0.002A to 0.01A) we can work out the value of the resistor from the formula R=Ur/I.
LEDs are connected to a microcontroller in two ways. One is to switch them on with logic zero, and other to switch them on with logic one. The first is called NEGATIVE logic and the other is called POSITIVE logic. The next diagram shows how to connect POSITIVE logic. Since POSITIVE logic provides a voltage of +5V to the diode and dropper resistor, it will emit light each time a pin of port B is provided with a logic 1. The other way is to connect all anodes to +5V and to deliver logical zero to cathodes.
Connecting LED diodes to PORTB microcontroller
The following example initializes port B as output and alternately switches on and off LED diodes every 0.5sec. For pause we used macro pausems, which is defined in the file mikroel84.inc.
7.3 Push buttons
Buttons are mechanical devices used to execute a break or make connection between two points. They come in different sizes and with different purposes. Buttons that are used here are also called "dip-buttons". They are soldered directly onto a printed board and are common in electronics. They have four pins (two for each contact) which give them mechanical stability.
Example of connecting buttons to microcontroller pins
Button function is simple. When we push a button, two contacts are joined together and connection is made. Still, it isn't all that simple. The problem lies in the nature of voltage as an electrical dimension, and in the imperfection of mechanical contacts. That is to say, before contact is made or cut off, there is a short time period when vibration (oscillation) can occur as a result of unevenness of mechanical contacts, or as a result of the different speed in pushing a button (this depends on person who pushes the button). The term given to this phenomena is called SWITCH (CONTACT) DEBOUNCE. If this is overlooked when program is written, an error can occur, or the program can produce more than one output pulse for a single button push. In order to avoid this, we can introduce a small delay when we detect the closing of a contact. This will ensure that the push of a button is interpreted as a single pulse. The debounce delay is produced in software and the length of the delay depends on the button, and the purpose of the button. The problem can be partially solved by adding a capacitor across the button, but a well-designed program is a much-better answer. The program can be adjusted until false detection is completely eliminated. Image below shows what actually happens when button is pushed.
As buttons are very common element in electronics, it would be smart to have a macro for detecting the button is pushed. Macro will be called button. Button has several parameters that deserve additional explanation.
button macro port, pin, hilo, label
Port is a microcontroller's port to which a button is connected. In case of a PIC16F84 microcontroller, it can be PORTA or PORTB.
Pin is port's pin to which the button is connected.
HiLo can be '0' or '1' which represents the state when the button is pushed.
Label is a destination address for jump to a service subprogram which will handle the event (button pushed).
Example 1:
button PORTA, 3, 1, Button1
Button T1 is connected to pin RA3 and to the mass across a pull-down resistor, so it generates logical one upon push. When the button is released, program jumps to the label Button1.
Example 2:
button PORTA, 2, 0, Button2
Button T1 is connected to pin RA1 and to the mass across a pull-up resistor, so it generates logical zero upon push. When the button is released, program jumps to the label Button2.
The following example illustrates use of macro button in a program. Buttons are connected to the supply across pull-up resistors and connect to the mass when pushed. Variable cnt is displayed on port B LEDs; cnt is incremented by pushing the button RA0, and is decremented by pushing the button RA1.
It is important to note that this kind of debouncing has certain drawbacks, mainly concerning the idle periods of microcontroller. Namely, microcontroller is in the state of waiting from the moment the button is pushed until it is released, which can be a very long time period in certain applications. if you want the program to be attending to a number of things at the same time, different approach should be used from the start. Solution is to use the interrupt routine for each push of a button, which will occur periodically with pause adequate to compensate for repeated pushes of button.
The idea is simple. Every 10ms, button state will be checked upon and compared to the previous input state. This comparison can detect rising or falling edge of the signal. In case that states are same, there were apparently no changes. In case of change from 0 to a 1, rising edge occurred. If succeeding 3 or 4 checks yield the same result (logical one), we can be positive that the button is pushed.
7.4 Optocouplers
Optocouplers were discovered right after photo-transistors (like any other transistor, except it is stimulated by light), by combining a LED and photo-transistor in the same case. The purpose of an optocoupler is to separate two parts of a circuit.
This is done for a number of reasons:
• Interference. Typical examples are industrial units with lots of interferences which affect signals in the wires. If these interferences affected the function of control section, errors would occur and the unit would stop working.
• Simultaneous separation and intensification of a signal. Typical examples are relays which require higher current than microcontroller pin can provide. Usually, optocoupler is used for separating microcontroller supply and relay supply.
• In case of a breakdown, optocoupled part of device stays safe in its casing, reducing the repair costs.
Optocouplers can be used as either input or output devices. They can have additional functions such as intensification of a signal or Schmitt triggering (the output of a Schmitt trigger is either 0 or 1 - it changes slow rising and falling waveforms into definite low or high values). Optocouplers come as a single unit or in groups of two or more in one casing.
Each optocoupler needs two supplies in order to function. They can be used with one supply, but the voltage isolation feature, which is their primary purpose, is lost.
7.4.1 Optocoupler on an input line
The way it works is simple: when a signal arrives, the LED within the optocoupler is turned on, and it illuminates the base of a photo-transistor within the same case. When the transistor is activated, the voltage between collector and emitter falls to 0.7V or less and the microcontroller sees this as a logic zero on its RA4 pin.
The example below is a simplified model of a counter, element commonly utilized in industry (it is used for counting products on a production line, determining motor speed, counting the number of revolutions of an axis, etc). We will have sensor set off the LED every time axis makes a full revolution. LED in turn will 'send' a signal by means of photo-transistor to a microcontroller input RA4 (TOCKI). As prescaler is set to 1:2 in this example, every second signal will increment TMR0. Current status of the counter is displayed on PORTB LEDs.
Example of optocoupler on an input line
7.4.2 Optocoupler on an output line
An Optocoupler can be also used to separate the output signals. If optocoupler LED is connected to microcontroller pin, logical zero on pin will activate optocoupler LED, thus activating the transistor. This will consequently switch on LED in the part of device working on 12V. Layout of this connection is shown below.
Example of optocoupler on output line
The program for this example is simple. By delivering a logical one to the third pin of port A, the transistor will be activated in the optocoupler, switching on the LED in the part of device working on 12V.
7.5 Relay
The relay is an electromechanical device, which transforms an electrical signal into mechanical movement. It consists of a coil of insulated wire on a metal core, and a metal armature with one or more contacts. When a supply voltage was delivered to the coil, current would flow and a magnetic field would be produced that moves the armature to close one set of contacts and/or open another set. When power is removed from the relay, the magnetic flux in the coil collapses and produces a fairly high voltage in the opposite direction. This voltage can damage the driver transistor and thus a reverse-biased diode is connected across the coil to "short-out" the spike when it occurs.
Connecting a relay to the microcontroller via transistor
Since microcontroller cannot provide sufficient supply for a relay coil (approx. 100+mA is required; microcontroller pin can provide up to 25mA), a transistor is used for adjustment purposes, its collector circuit containing the relay coil. When a logical one is delivered to transistor base, transistor activates the relay, which then, using its contacts, connects other elements in the circuit. Purpose of the resistor at the transistor base is to keep a logical zero on base to prevent the relay from activating by mistake. This ensures that only a clean logical one on RA3 activates the relay.
Connecting the optocoupler and relay to a microcontroller
A relay can also be activated via an optocoupler which at the same time amplifies the current related to the output of the microcontroller and provides a high degree of isolation. High current optocouplers usually contain a 'Darlington' output transistor to provide high output current.
Connecting via an optocoupler is recommended especially for microcontroller applications, where relays are used fro starting high power load, such as motors or heaters, whose voltage instability can put the microcontroller at risk. In our example, when LED is activated on some of the output port pins, the relay is started. Below is the program needed to activate the relay, and includes some of the already discussed macros.
7.6 Generating sound
In microcontroller systems, beeper is used for indicating certain occurrences, such as push of a button or an error. To have the beeper started, it needs to be delivered a string in binary code - in this way, you can create sounds according to your needs. Connecting the beeper is fairly simple: one pin is connected to the mass, and the other to the microcontroller pin through a capacitor, as shown on the following image.
As with a button, you can employ a macro that will deliver a BEEP ROUTINE into a program when needed. Macro BEEP has two arguments:
BEEP macro freq , duration:
freq: frequency of the sound. The higher number produces higher frequency
duration: sound duration. Higher the number, longer the sound.
Example 1: BEEP 0xFF, 0x02
The output has the highest frequency and duration at 2 cycles per 65.3mS which gives 130.6 mS
Example2: BEEP 0x90, 0x05
The output has a frequency of 0x90 and duration of 5 cycles per 65.3mS. It is best to determine these macro parameters through experimentation and select the sound that best suits the application.
The following is the BEEP Macro listing:
The following example shows the use of a macro in a program. The program produces two melodies which are obtained by pressing T1 or T2. Some of the previously discussed macros are included in the program.
7.7 Shift registers
There are two types of shift registers: input and output. Input shift registers receive data in parallel, through 8 lines and then send it serially through two lines to a microcontroller. Output shift registers work in the opposite direction; they receive serial data and on a "latch" line signal, they turn it into parallel data. Shift registers are generally used to expand the number of input-output lines of a microcontroller. They are not so much in use any more though, because most modern microcontrollers have a large number of pins. However, their use with microcontrollers such as PIC16F84 is very important.
7.7.1 Input shift register 74HC597
Input shift registers transform parallel data into serial data and transfers it to a microcontroller. Their working is quite simple. There are four lines for the transfer of data: Clock, Latch, Load and Data. Data is first read from the input pins by an internal register through a 'latch' signal. Then, with a 'load' signal, data is transferred from the input latch register to the shift register, and from there it is serially transferred to a microcontroller via 'data' and 'clock' lines.
An outline of the connection of the shift register 74HC597 to a micro, is shown below.
In order to simplify the main program, a macro can be used for the input shift register. Macro HC597 has two parameters:
HC597 macro Var, Var1
Var variable where data from shift register input pins is transferred
Var1 loop counter
Example: HC597 data, counter
Data from the input pins of the shift register is stored in data variable. Timer/counter variable is used as a loop counter.
Macro listing:
Example of how to use the HC597 macro is given in the following program. Program receives data from a parallel input of the shift register and moves it serially into the RX variable of the microcontroller. LEDs connected to port B will indicate the result of the data input.
7.7.2 Output shift register
Output shift registers transform serial data into parallel data. On every rising edge of the clock, the shift register reads the value from data line, stores it in temporary register, and then repeats this cycle 8 times. On a signal from 'latch' line, data is copied from the shift register to input register, thus data is transformed from serial into parallel data.
An outline of the 74HC595 shift register connections is shown on the diagram below:
Macro used in this example can be found in hc595.inc file, and is called HC595.
Macro HC595 has two parameters:
HC595 macro Var, Var1
Var variable whose contents is transferred to outputs of shift register.
Var1 loop counter
Example: HC595 Data, counter
The data we want to transfer is stored in data variable, and counter variable is used as a loop counter.
An example of how to use the HC595 macro is given in the following program. Data from variable TX is serially transferred to shift register. LEDs connected to the parallel output of the shift register will indicate the state of the lines. In this example value 0xCB (1100 1011) is sent so that the seventh, sixth, third, first, and zero LEDs are illuminated.
7.8 Seven-Segment Display (multiplexing)
The segments in a 7-segment display are arranged to form a single digit from 0 to F as shown in the animation:
We can display a multi-digit number by connecting additional displays. Even though LCD displays are more comfortable to work with, 7-segment displays are still standard in the industry. This is due to their temperature robustness, visibility and wide viewing angle. Segments are marked with non-capital letters: a, b, c, d, e, f, g and dp, where dp is the decimal point. The 8 LEDs inside each display can be arranged with a common cathode or common anode. With a common cathode display, the common cathode must be connected to the 0V rail and the LEDs are turned on with a logic one. Common anode displays must have the common anode connected to the +5V rail. The segments are turned on with a logic zero. The size of a display is measured in millimeters, the height of the digit itself (not the housing, but the digit!). Displays are available with a digit height of 7,10, 13.5, 20, or 25 millimeters. They come in different colors, including: red, orange, and green.
The simplest way to drive a display is via a display driver. These are available for up to 4 displays. Alternatively displays can be driven by a microcontroller and if more than one display is required, the method of driving them is called "multiplexing."
The main difference between the two methods is the number of "drive lines." A special driver may need only a single "clock" line and the driver chip will access all the segments and increment the display. If a single display is to be driven from a microcontroller, 7 lines will be needed plus one for the decimal point. For each additional display, only one extra line is needed. To produce a 4, 5 or 6 digit display, all the 7-segment displays are connected in parallel. The common line (the common-cathode line) is taken out separately and this line is taken low for a short period of time to turn on the display. Each display is turned on at a rate above 100 times per second, and it will appear that all the displays are turned on at the same time. As each display is turned on, the appropriate information must be delivered to it so that it will give the correct reading. Up to 6 displays can be accessed like this without the brightness of each display being affected. Each display is turned on very hard for one-sixth the time and the POV (persistence of vision) of our eye thinks the display is turned on the whole time. Therefore, the program has to ensure the proper timing, else the unpleasant blinking of display will occur.
Connecting a microcontroller to 7-segment displays in multiplex mode
Program "7seg.asm" displays decimal value of a number stored in variable D.
Example:
movlw .21
movlw D ; number 21 will be printed on 7seg display
Displaying digits is carried out in multiplex mode which means that the microcontroller alternately prints ones digit and tens digit. TMR0 interrupt serves for generating a time period, so that the program enters the interrupt routine every 5ms and performs multiplexing. In the interrupt routine, first step is deciding which segment should be turned on. In case that the tens digit was previously on, it should be turned off, set the mask for printing the ones digit on 7seg display which lasts 5ms, i.e. until the next interrupt.
For extracting the ones digit and the tens digit, macro digbyte is used. It stores the hundreds digit, the tens digit, and the ones digit into variables Dig1, Dig2, and Dig3. In our case, upon macro execution, Dig1 will equal 0, Dig2 will equal 2, and Dig3 will equal 1.
Realization of the macro is given in the following listing:
The following example shows the use of the macro in a program. Program prints a specified 2-digit number on a 7seg display in multiplex mode.
7.9 LCD Display
More microcontroller devices are using 'smart LCD' displays to output visual information. The following discussion covers the connection of a Hitachi LCD display to a PIC microcontroller. LCD displays designed around Hitachi's LCD HD44780 module, are inexpensive, easy to use, and it is even possible to produce a readout using the 8 x 80 pixels of the display. Hitachi LCD displays have a standard
A 16x2 line Hitachi HD44780 display
For a 8-bit data bus, the display requires a +5V supply plus 11 I/O lines. For a 4-bit data bus it only requires the supply lines plus seven extra lines. When the LCD display is not enabled, data lines are tri-state which means they are in a state of high impendance (as though they are disconnected) and this means they do not interfere with the operation of the microcontroller when the display is not being addressed.
The LCD also requires 3 "control" lines from the microcontroller.
Enable (E) This line allows access to the display through R/W and RS lines. When this line is low, the LCD is disabled and ignores signals from R/W and RS. When (E) line is high, the LCD checks the state of the two control lines and responds accordingly.
Read/Write (R/W) This line determines the direction of data between the LCD and microcontroller. When it is low, data is written to the LCD. When it is high, data is read from the LCD.
Register select (RS) With the help of this line, the LCD interprets the type of data on data lines. When it is low, an instruction is being written to the LCD. When it is high, a character is being written to the LCD.
Logic status on control lines:
E 0 Access to LCD disabled
1 Access to LCD enabled
R/W 0 Writing data to LCD
1 Reading data from LCD
RS 0 Instruction
1 Character
Writing data to the LCD is done in several steps:
Set R/W bit to low
Set RS bit to logic 0 or 1 (instruction or character)
Set data to data lines (if it is writing)
Set E line to high
Set E line to low
Read data from data lines (if it is reading)
Reading data from the LCD is done in the same way, but control line R/W has to be high. When we send a high to the LCD, it will reset and wait for instructions. Typical instructions sent to LCD display after a reset are: turning on a display, turning on a cursor and writing characters from left to right. When the LCD is initialized, it is ready to continue receiving data or instructions. If it receives a character, it will write it on the display and move the cursor one space to the right. The Cursor marks the next location where a character will be written. When we want to write a string of characters, first we need to set up the starting address, and then send one character at a time. Characters that can be shown on the display are stored in data display (DD) RAM. The size of DDRAM is 80 bytes.
The LCD display also possesses 64 bytes of Character-Generator (CG) RAM. This memory is used for characters defined by the user. Data in CG RAM is represented as an 8-bit character bit-map. Each character takes up 8 bytes of CG RAM, so the total number of characters, which the user can define is eight. In order to read in the character bit-map to the LCD display, we must first set the CG RAM address to starting point (usually 0), and then write data to the display. The definition of a 'special' character is given in the picture.
Before we access DD RAM after defining a special character, the program must set the DD RAM address. Writing and reading data from any LCD memory is done from the last address which was set up using set-address instruction. Once the address of DD RAM is set, a new written character will be displayed at the appropriate place on the screen. Until now we discussed the operation of writing and reading to an LCD as if it were an ordinary memory. But this is not so. The LCD controller needs 40 to 120 microseconds (uS) for writing and reading. Other operations can take up to 5 mS. During that time, the microcontroller can not access the LCD, so a program needs to know when the LCD is busy. We can solve this in two ways.
One way is to check the BUSY bit found on data line D7. This is not the best method because LCD's can get stuck, and program will then stay forever in a loop checking the BUSY bit. The other way is to introduce a delay in the program. The delay has to be long enough for the LCD to finish the operation in process. Instructions for writing to and reading from an LCD memory are shown in the previous table.
At the beginning we mentioned that we needed 11 I/O lines to communicate with an LCD. However, we can communicate with an LCD through a 4-bit data bus. Thus we can reduce the total number of communication lines to seven. The wiring for connection via a 4-bit data bus is shown in the diagram below. In this example we use an LCD display with 2x16 characters, labeled LM16X212 by Japanese maker SHARP. The message 'character' is written in the first row: and two special characters '~' and '}' are displayed. In the second row we have produced the word 'mikroElektronika'.
Connecting an LCD display to a microcontroller
File lcd.inc contains a group of macros for use when working with LCD displays.
Using the macro for LCD support
lcdinit Macro used to initialize port connected to LCD. LCD is configured to work in 4-bit mode.
Example: lcdinit
lcdtext lcdtext prints the text of up to 16 characters, which is specified as a macro parameter. First parameter selects the line in which to start printing. If select is zero, text is printed from the current cursor position.
Example: lcdtext 1, "mikroelektronika"
lcdtext 1, "Temperature1" ;Print the text starting from line 1, character 1
lcdtext 2, "temp=" ;Print the text starting from line 2, character 1
lcdtext 0, " C" ;Print C in the rest of the line 2
lcdcmd Sends command instructions
LCDCLR = b'00000001' ;Clear display, cursor home
LCDCH = b'00000010' ;Cursor home
LCDCL = b'00000100' ;Move the cursor to the left
LCDCR = b'00000110' ;Move the cursor to the right
LCDSL = b'00011000' ;Move the content of display to the left
LCDSR = b'00011100' ;Move the content of display to the right
LCDL1 = b'10000000' ;Select line 1
LCDL2 = b'11000000' ;Select line 2
Example: lcdcmd LCDCH
lcdbyte Prints one byte variable and omits leading zeros
Example: lcdbyte Temperature
When working with a microcontroller the numbers are presented in a binary form. As such, they cannot be displayed on a display. That's why it is necessary to change the numbers from a binary system into a decimal system so they can be easily understood. For printing the variables lcdbyte and lcdword we have used the macros digbyte and digword which convert the numbers from binary system into a decimal system and print the result on LCD. Main program has the purpose of demonstrating use of LCD display. At the start it's necessary to declare variables LCDbuf, LCDtemp, Digtemp, Dig1, Dig2, and Dig3 used by the macros for LCD support. It is also necessary to state the port of microcontroller that LCD is connected to. Program initializes the LCD and demonstrates printing text and 8-bit variable temp.
7.10 Serial Communication
SCI is an abbreviation for Serial Communication Interface and, as a special subsystem, it exists on most microcontrollers. When it is not available, as is the case with PIC16F84, it can be created in software.
As with hardware communication, we use standard NRZ (Non Return to Zero) format also known as 8 (9)-N-1, or 8 or 9 data bits, without parity bit and with one stop bit. Free line is defined as the status of logic one. Start of transmission - Start Bit, has the status of logic zero. The data bits follow the start bit (the first bit is the low significant bit), and after the bits we place the Stop Bit of logic one. The duration of the stop bit 'T' depends on the transmission rate and is adjusted according to the needs of the transmission. For the transmission speed of 9600 baud, T is 104 uS.
Pin designations on RS232 connector
1. CD (Carrier Detect)
2. RXD (Receive Data)
3. TXD (Transmit Data)
4. DTR (Data terminal Ready)
5. GND (Ground)
6. DSR (Data Set Ready)
7. RTS (Request To Send)
8. CTS (Clear To Send)
9. RI (Ring Indicator)
In order to connect a microcontroller to a serial port on a PC computer, we need to adjust the level of the signals so communicating can take place. The signal level on a PC is -10V for logic zero, and +10V for logic one. Since the signal level on the microcontroller is +5V for logic one, and 0V for logic zero, we need an intermediary stage that will convert the levels. One chip specially designed for this task is MAX232. This chip receives signals from -10 to +10V and converts them into 0 and 5V.
The circuit for this interface is shown in the diagram below:
Connecting a microcontroller to a PC via a MAX232 line interface chip
File RS232.inc contains a group of macros used for serial communication.
Using the macro for serial communication:
rs232init Macro for initializing the pin for transmitting data (TX-pin).
Example: RS232init
Sendw Sending ASCII value of data found in W register.
Example: movlw 't'
call Sendw
rs232text Sending ASCII value of a specified text
Example: rs232 "mikroelektronika"
rs232byte Sending ASCII value of decimal digits of 8-bit variable
Example: movlw .123
movwf TXdata
rs232byte TXdata ;Send '1', '2', '3'
When rs232.inc file is used, it is necessary to declare variables Rstemp and TXD at the beginning of the main program.
Example:
As a demonstration of a serial communication, we have an example which sends text and the content of variable cnt. Text is sent via macro rs232text, while variable cnt is sent via macro rs232byte. This operation repeats itself after 500ms, with incrementing cnt in the process. This example can be easily modified to have button(s) for sending specified data.
ANALISIS OUTPUT
ANALISIS OUTPUT
Model simulasi kejadian diskrit berbeda dari tipe model lainnya. Model simulasi kejadian diskrit menggabungkan banyak variabel acak sehingga hasil (output) model merupakan variabel acak juga. Sebagai hasilnya, perkiraan output dalam penjalanan simulasi tertentu dapat sangat berbeda dari karakteristik model sebenarnya. Karena itu menggunakan output simulasi kejadian diskrit untuk menjawab pertanyaan pemodelan yang merupakan perilaku dan karakteristik sistem nyata bisa menjadi pekerjaan yang sangat sulit. Output model simulasi seperti ini bisa dengan mudah disalahinterpresentasikan.
Dalam berbagai studi simulasi, waktu dan dana besar biasanya dikelurkan saat pengembangan model dan pembuatan program, tapi sangat sedikit usaha yagn dilakukan dalam menganalisis output simulasi dengan tepat. Ada beberapa alasan kenapa analisis data output belum dilakukan dengan benar. Pertama, pengguna sering membayangkan bahwa simulasi hanya latihan dalam pemrograman komputer, bahkan untuk yang sangat kompleks. Akibatnya, banyak studi simulasi dimulai dengan pembangunan dan pengkodean model heuristik dan diakhiri dengan penjalanan tunggal mode untuk menghasilkan “jawaban”. Padahal, simulasi adalah percobaan contoh statistik berbasis komputer. Oleh karena itu, jika hasil simulasi tidka mempunyai arti, teknik statistik harus digunakan untuk merancang dan menganalisis percobaan simulasi. Alasan kedua adalah output proses semua simulasi maya bersifat dinamis dan otokorelasi. Oelh karena itu teknik statistik klasik yang didasarkan pada pengamatan IID (Identics and independent distribution) tidak secara langsung dapat diaplikasikan. Masih ada juga beberapa permasalahan analisis output dimana tidak ada solusi lengkap yang dapat diterima, dan metode yang tersedia biasanya terlalu kompleks untuk digunakan. Kegagalan lainnya adalah biaya waktu komputer yang dibutuhkan untuk mengumpulkan jumlah cukup data output. Bahkan kadang-kadang ada situasi dimana prosedur statistik yang tersedia sesuai, tetapi biaya mengumpulkan data yang dibutuhkan prosedur itu terlalu mahal. Permasalahan terakhir ini memang sudah mulai mendapatkan penyelesaian karena kebanyakan analis mempunyai mikrokomputer atau stasiun kerja dengan kecepatan tinggi. Komputer seperti ini sudah tidak terlalu mahal dan dapat dijalankan sepanjang malam atau selama akhir pekan untuk menghasilkan data output simulasi yang sangat besar pada biaya marjinal nol.
Tujuan Analisis Output
Dari awal kita sudah memahami bahwa langkah awal dan penting dalam analisis simulasi adalah mendefinisikan dengan jelas pertanyaan model simulasi yang diharapkan untuk dijawab. Analis harus selalu mempunyai pemahaman yang jelas pertanyaan apa yang harus dijawab ketika analisis diselesaikan dan menggunakan pertanyaan sebagai arahan melakukan analisis data, pengembangan model, validasi dan analisis output. Tujuan dari analisis output oleh karenanya adalah menjawab pertanyaan yang diajukan di awal pembentukan model dengan benar. Bentuk pertanyaan mengindikasikan pengujian hipotesis, selang kepercayaan atau pendugaan parameter.
Kita kembali ke simulasi sistem komputer time-shared. Kita asumsikan bahwa waktu aktif server adalah 24 jam sehari. Pertanyaan-pertanyaan yang mungkin perlu untuk dijawab analis adalah:
1. berapa lama seorang pengguna harus menunggu untuk terkoneksi dengan sistem?
2. berapa persen pengguna yang menunggu?
3. berapa peluang bahwa pengguna akan menunggu lebih dari 1 menit untuk terkoneksi?
4. berapa rata-rata pengguna yang menunggu terkoneksi?
5. berapa rata-rata waktu seorang pengguna terkoneksi dalam setiap koneksi yang dibuat?
6. apakah dengan menambah jumlah port akan dapat mengurangi waktu menunggu koneksi pengguna secara signifikan?
7. apakah dengan memperbesar memori CPU akan dapat mengurangi waktu menunggu koneksi pengguna secara signifikan?
8. apakah dengan mempercepat transmisi akan dapat mengurangi waktu menunggu koneksi pengguna secara signifikan?
9. berapa waktu rata-rata port kosong?
10. berapa banyak waktu menunggu akan naik jika pemanggilan pengguna bertambah 10%?
Dan banyak lagi pertanyaan yang mungkin diajukan sesuai dengan kebutuhan analisis. Jika model dirancang dengan benar, setiap pertanyaan itu akan dapat dijawab tetapi mungkin membutuhkan data yang berbeda yang harus dikumpulkan selama penjalanan simulasi. Untuk menjawab pertanyaan itu dengan beanr, analisis harus memutuskan berapa lama simulasi akan dijalankan, mengontrol laju kedatangan dan waktu terkoneksi, dan keakuratan statistik jawaban (tingkat kesalahan yang biasa disebut dengan signifikansi dalam statistik).
Permasalahan Analisis Output Model Simulasi
Untuk menggambarkan permasalahan analisis output model simulasi kita kembali ke model sistem komputer time-shared. Kita mengasumsikan (berdasarkan data historis atau perhitungan lainnya) bahwa laju pemanggilan pengguna untuk koneksi ke sistem adalah 75 per jam dan waktu rata-rata terkoneksi 35 menit. Kedua waktu ini (pemanggilan dan koneksi) berdisribusi secara eksponensial. Hasil penjalanan model simulasi ditunjukkan Tabel 1.
Kapanpun kita melakukan analisis data statistik, asumsi tentang proses darimana data itu ditarik dan pengamatannya harus dibuat. Jika asumsi yang dibuat tidak benar, maka akan dihasilkan kesimpulan karakteristik dan perilaku proses yang tidak benar. Ketika menganalisis data statistik adalah umum menggunakan asumsi:
1. pengamatan saling bebas.
2. waktu proses bervariasi.
3. untuk pengamatan dalam jumlah besar (lebih besar atau sama dengan 30), rata-rata sampel menyebar normal.
Jika ketiga asumsi ini dipenuhi, maka titik penduga rata-rata dan ragam waktu menunggu pengguna dalam antrian untuk koneksi adalah:
Rata-rata : (1)
Ragam : (2)
Dimana wi adalah waktu menunggu pengguna ke-i untuk terkoneksi. Jika pengamatan besar (n 30), maka waktu menunggu rata-rata dapat diduga untuk tingkat kepercayaan 95% sebagai berikut:
(3)
sayangnya, dalam simulasi kejadian diskrit semua asumsi itu pada umumnya tidak benar.
Untuk kasus sistem komputer time-shared yang juga merupakan kasus antrian, sebelum melanjutkan analisis waktu menunggu yang dihasilkan dari simulasi, karena laju pemanggilan dan waktu terkoneksi berdistribusi eksponensial, kita dapat menggunakan model antrian analitik untuk mendapatkan rata-rata, ragam dan selang kepercayaan. Untuk menggunakan model antrian analitik, kita harus membatasi terlebih dahulu jumlah server (dalam hal ini port) paralel yang digunakan. Model antrian yang cocok dengan model sistem komputer time-shared ini adalah M/M/C. Rata-rata waktu menunggu, ragam dan selang kepercayaan dengan model analitik ini adalah (untuk rumus yang digunakan dapat melihat di buku-buku Operation Research):
Jika kita menggunakan persamaan 1, 2 dan 3 di atas untuk menghitung waktu menunggu rata-rata, ragam dan selang kepercayaan, maka nilai-nilai ini akan diperoleh:
Nilai-nilai itu....
Penyelesaian sederhana untuk permasalahan data berkorelasi dan dinamis adalah melakukan simulasi jamak dan saling bebas.
Sistem terminating vs nonterminating
Semua sistem dinamis dapat dikategorikan sebagai sistem terminating atau nonterminating. Sistem diklasifikasikan terminating jika kejadian yang menggerakkan sistem menghentikan kejadian dalam suatu waktu tertentu, sedangkan sistem diklasifikasikan nonterminating jika kejadian diskrit terjadi berulang-ulang tanpa batasan. Mungkin ada sesi kejadian berulang yang disebut dengan regenerasi dalam sistem terminating, tetapi setiap sesi itu akan mulai dari awal lagi. Dalam sistem kejadian diskrit terminating, suatu kejadian TE menandai akhir dari suatu sesi. Kejadian TE mungkin selalu terjadi pada waktu yang sama, selama setiap sesi, atau waktu kejadiannya mungkin variabel acak. Dalam sistem terminating, status akhir sesi sebelumnya tidak mempengaruhi status awal sesi berikutnya. Sebaliknya dalam sistem nonterminating, kejadian diskrit menggerakkan sistem terjadi terus tanpa batas. Bagian tunggal sistem berlangsung terus tanpa batas dan tidak ada kejadian yang mengakhiri.
Adalah penting untuk membedakan sistem terminating atau nonterminating, karena masing-masing menggunakan metode analisis output berbeda. Perlu diperhatikan juga perbedaan antara sistem dan simulasi sistem. Setiap simulasi merupakan proses terminating tetapi tidak semua sistem bersifat terminating. Untuk setiap simulasi, selanjutnya kita perlu membedakan apakah simulasi steady-state (status stabil) atau transient (sementara).
Cara menganalisis output model simulasi tergantung dari keadaan sistem (terminating atau nonterminating) dan karakteristik perilakunya (steady-state atau transient).
Contoh-contoh sistem terminating:
1. bank: bank buak setiap hari dari jam 9.00 pagi dengan keadaan awal tidak ada nasabah dan ditutup jam 4.00 sore dan menyelesaikan layanan nasabah yang terakhir ada di antrian. Lama setiap sesi (hari) akan berbeda (tergantung dari jumlah nasabah yang masih mengantri jam 4.00 sore itu) tetapi setiap hari akan selalu dimulai dan diakhiri dengan tidak ada nasabah dalam antrian. Kejadian yang mengakhiri adalah penyelesaian pelayanan nasabah terakhir. Dalam simulasi seperti ini kita akan menyukai memilih mengukur kinerja yang menaksir waktu rata-rata semua nasabah menunggu, sama halnya dengan waktu rata-rata nasabah tiba pada waktu berbeda setiap harinya.
2. sistem komputer: sistem komputer mulai bekerja pagi hari ketika pengguna pertama masuk ke dalam sistem (log on), dan berakhir ketika pengguna terakhir hari itu keluar dari sistem (log off). Meskipun selama detik-detik akhir dan jam-jam lebih awal kadang-kadang pengguna mungkin akan masuk ke sistem (log on), perhatian kita hanya selama jam kerja normal dan kinerja sistem selama bukan ja kerja tidak diperhatikan. Setiap sesi mungkin mulai jam 8.00 pagi dengan sejumlah acak pengguna (sudah masuk lebih awal dalam sistem) dan sesi diakhiri ketika pengguna terakhir keluar dari sistem jam 5 sore. Ukuran kinerja yang mungkin adalah jumlah rata-rata pengguna terhubung ke sistem apda waktu yang berbeda dalam satu hari, peluang seorang pengguna tidak bisa masuk ke dalam sistem dalam waktu berbeda dalam satu hari, jumlah rata-rata pengguna yang terhubung ke sistem setiap hari dan peluang total seorang pengguna tidak dapat terhubung ke sistem.
3. permainan peluang: dua pemain dua melempar koin. Jika kedua koin sama (menunjukkan kepala atau ekor), pemain pertama akan memenangka satu dolar. Jika satu koin menunjukkan kepala dan satunya lagi ekor, maka pemain kedua akan memenangkan satu dolar. Permainan berlangsung selama satu jam atau sampai salah satu pemain kehabisan uangnya. Lama satu sesi oleh karenanya adalah satu jam atau sampai keadaan dimana salah satu pemain tidak dapat melanjutkan karena sudah kehabisan uang. Kejadian yang mengakhiri terjadi ketika salah satu pemain memenangkan uang terakhir pemain lainnya atau satu jam telah berlangsung. Ukuran kinerja bisa berupa rata-rata waktu permainan dan peluang memenangkan permainan.
4. inventori komponen: seorang produsen membeli mesin berfungsi tunggal (special-purposes machine) bersamaan dengan 5 komponen pengganti untuk komponen mesin kritis. Mesin akan digunakan selama 2 tahun mendatang. Jika komponen kritis rusak, komponen itu akan digantikan. Pengusaha itu tidak akan mendapatkan komponen pengganti dengan cepat dan dengan biaya murah setelah pembelian awal itu. Lama setiap sesi oleh akrenanya adalah 2 tahun atau sampai kelima komponen pengganti sudah rusak. Kejadian yang mengakhiri adalah waktu 2 tahun atau sampai kelima komponen rusak, tergantung yang mana yang terjadi lebih dulu. Ukuran kinerja sistem bisa berupa peluang komponen akan bertahan selama 2 tahun dan waktu rata-rata sistem beroperasi.
5. sistem basis data: dalam basis data terkomputerisasi data didistribusikan di dalam beberapa file. Data dihubungkan menggunakan field kunci dan pointer. Ketika pertanyaan basis data terjadi, pencarian dilakukan di semua file yang mengandung data menggunakan field kunci dan pointer untuk mencari lokasi data yang diminta. Kejadian yang mengakhiri adalah lokasi data yang dibutuhkan. Ukuran kinerja termasuk jumlah rata-rata file yang diakses dan waktu rata-rata menemukan lokasi.
Contoh sistem nonterminating
1. jobshop: fasilitas produksi terdiri dari beberapa stasiun kerja. Ketika suatu pekerjaan tiba pada fasilitas, pekerjaan itu akan melewati beberapa stasiun sampai diselesaikan. Meskipun shop hanya beroperasi satu shift dan tidak beroperasi pada hari Sabtu atau minggu, jobshop ini tergolong sistem nonterminating. Ketika operasi akan diakhiri (seperti pada Jumat malam), status akhir sistem akan menjadi status awal ketika operasi dimulai lagi. Siklus hidup sistem tidak terbatas dan sistem disimulasikan selama pengakumulasian statistik yang dibutuhkan untu ukuran kinerja. Ukuran kinerja bsia dalam bentuk utilisasi berbagai stasiun kerja, waktu rata-rata penyelesaian satu pekerjaan dan rata-rata pekerjaan dalam proses.
2. sistem inventori: peritel menimbun barang dagangan dan melakukan pemesanan ulang ketika level inventori mencapai atau lebih rendah dari level yang ditentukan. Meskipun aktifitas jualan hanya 8 jam sehari dan 5 hari dalams atu minggu, inventori akhir pada hari tertentu akan menjadi inventori awal pada hari berikutnya. Kejadian diskrit yang menggerakkan sistem berlangsung tanpa batas, dan ukuran kinerja termasuk rata-rata inventori, fraksi order yang harus memesan ulang atau berlebih dan jumlah rata-rata order per tahun.
3. bandar udara: selama 24 jam per hari, pesawat tiba dan berangkat dari bandara. Meskipun ada periode aktivitas ringan dan berat, keadaan pagi di bandara tergantung dari bagus tidaknya manajemen dilakukan sore sebelumnya dengan tidak ada pengakhiran sistem. Ukuran kinerja termasuk rata-rata waktu satu pesawat harus menunggu untuk lepas landas atau mendarat dan rata-rata jumlah pesawat menunggu untuk mendarat atau lepas landas.
4. rumah sakit: pasien masuk rumah sakit dengan asumsi kamar inap tersedia. Begitu satu tempat tidur sudah diisi, tempat tidur itu tidak akan tersedia lagi sampai pasien tersebut sudah pulang atau pindah kamar. Pasien yang tidak dapat diterima karena tidak ada tempat tidur lagi akan masuk ke rumah sakit lainnya jika memerlukan perawatan segera atau menunggu sampai ada tempat tidur yang kosong berikutnya. Jumlah pasien yang masuk dan keluar setiap pagi tergantung dari jumlah pasien di rumah sakit dan panjang daftar tunggu sore sebelumnya. Ukuran kinerja termasuk rata-rata jumlah pasien dalam klinik dan rata-rata waktu menunggu pasien untuk mendapatkan perawatan.
5. sistem status tetap: dosen direkrut oleh suatu universtas dan beberapa tahun diberikan sebagai tahapan menuju status tetap. Pada akhir setiap tahun pengajaran dan penelitian dosen menerima tahun berikutnya sebagai tahapan menuju status tetap. Setelah 6 tahun, evaluasi dilakukan, dosen akan diangakt menjadi status tetap atau hanya akan diberikan kontrak satu tahun lagi. Selama 6 tahun itu, dosen dapat meninggalkan universitas. Setelah menerima status tetap, dosen dapat tinggal sampai pensiun atau pindah ke universitas lain. Ini adalah sistem nonterminating (kecuali untuk sdosen yang akhirnya tidak mendapatkan status tetap) karena universitas mempunyai masa hidup tidak terbatas.pada akhir sembarang tahun, jumlah dosen dalam universitas tergantung dari jumlah pada awal tahun dan status permanen mereka dan jumlah tahun menuju status permanen. Ukuran kinerja adalah jumlah dosen status permanen dan bukan permanen dan peluang bahwa seorang dosen akan mendapatkan status permanen.
Karakteristik perilaku sistem seperti yang diuraikan di atas bisa steady-state (status stabil) atau transient. Untuk memahami perbedaan steady-state dan transient, perhatikan definisi ini:
Asumsikan:
s(t) adalah status sistem pada waktu t.
Ps(t) adalah peluang bahwa sistem akan berada pada status s pada waktu t.
Sistem akan berada dalam status stabil relatif terhadap variabel status s ketika
(4)
jika tidak sistem tidak akan mencapai status stabil dan dikatakan menunjukkan perilaku transient. Ketika distribusi peluang variabel status tidak berubah lagi sepanjang waktu, maka variabel status sudah mencapai status stabil atau lebih tepatnya mencapai distribusi status stabilnya.
Terminologi status stabil juga sering disalahartikan, menyarankan bahwa sistem akan lebih terkontrol (tidak berubah), menyebabkan hanya sedikit perubahan radikal dalam statusnya. Kita tidak bisa menerima saja pemikiran bahwa sistem mantap setelah periode dasar operasi. Meskipun distribusi peluang variabel status stabil sepanjang waktu, sistem berpindah dari satu keadaan ke keadaan lainnya sama aktifnya dengan fase status stabil saat sistem dalam keadaan fase transient. Faktanya, ragam status sistem lebih besar pada keadaan stabil dibandingkan selama dalam keadaan transient.
Contoh sistem yang dapat mencapai status stabil adalah:
1. jobshop menerima order pada laju rata-rata konstan. Awalnya, pada simulasi, jobshop mungkin tidak mempunyai pekerjaan dalam proses. Asumsinya jobshop meneruskan operasi secara tidak terbatas. Sistem ini nonterminating dan mencapai perilaku status stabil.
2. bank darah mengumpulkan dan menyimpan darah, mendistribusikannya ke anggota rumah sakit yang membutuhkannya. Dengan menganggap permintaan akan darah seragam sepanjang tahun, inventori darah akan memenuhi distribusi status stabil. Sistem adalah nonterminating.
3. pembayaran tol dikumpulkan di boks tol pada pintu masuk tol selama jam sibuk (jam 7 sampai jam 9). Jika intensitas lalu lintas tidak berubah selama 2 jam, dan laju kedatangan cukup besar, sistem akan melewati fase transientnya dengan cepat dan analisis status stabil akan sesuai, meskipun simulasi hanya untuk 2 jam. Ketika dianalisis dalam bentuk seperti ini, sistem adalah terminating dan kejadian yang menghentikan adalah kesimpulan jam sibuk.
Contoh sistem yang tidak akan mencapai status stabil adalah:
1. pengguna sistem komputer time-shared terhubung ke sistem jam 8 pagi sampai jam 5 sore. Laju pengguna terhubung ke sistem bervariasi sepanjang hari, dengan permintaan padatnya pertengahan pagi dan sore. Sistem ini adalah terminating yang tidak akan mencapai distribusi status stabil karena variasi permintaan sistem komputer dan jam operasi yang terbatas 9 jam.
2. perusahaan penerbangan punya kebijakan untuk menerima reservasi lebih 5% dari total tempat duduk yang tersedia untuk mengantisipasi penumpang yang tidak muncul pada jam penerbangan. Setiap hari merupakan sesi terminating, diakhiri dengan sejumlah acak penumpang yang tidak dapat tiket. Kondisi akhir hari tertentu tidak akan mempengaruhi kondisi awal hari berikutnya (dengan asumsi penumpang yang tidak dapat tiket hari tertentu sudah terakomodasi dengan penerbangan lainnya hari itu juga). Dalam simulasi ini tidak ada distribusi status stabil maupun transient dan waktu buakn inti simulasi.
Analisis Output untuk Sistem Terminating
Metode paling umum memperkirakan karakteristik sistem menggunakan model simulasi adalah mengumpulkan sampel karakteristik selama mode simulasi dijalankan. Sekali data dikumpulkan, data itu dapat digunakannya untuk membangun titik dan selang perkiraan karakteristik.
Ingat kembali sifat dua titik penduga paling umum, rata-rata contoh dan standar deviasi contoh (s):
(5) dan (6)
akan menjadi titik penduga rata-rata populasi () dan s2 akan menjadi titik penduga ragam populasi ().
Untuk simulasi terminating, metode paling digunakan untuk meyakinkan bahwa pengamatan xi bersifat independen dan mempunyai nilai ekspektasi umum adalah pengulangan. Oleh karena itu simulasi dijalankan beberapa kali, dimana setiap ulangan bebas dari ulangan lainnya. Selama penjalanan tiap simulasi, pengamatan dilakukan untuk setiap titik waktu yang dirancang atau atas terjadinya kejadian yang dirancang.
Untuk simulasi yang diulang R kali, dengan K pengamatan intermediat dalam setiap simulasi, asumsikan:
Xij = pengamatan ke-j ulangan ke-i
Dimana i = 1, 2, ..., R dan j = 1, 2, ..., K
Yi = ukuran kinerja keseluruhan selama ulangan ke-i
Maka,
j = 1, 2, ..., K (7)
(8)
(9)
(10)
maka interval pendugaan untuk E(xij) dan e(yi) adalah:
(11) dan
(12)
contoh analisis sistem komputer time-shared
Analisis Output Sistem Nonterminating
Kita akan menghadapi beberapa permasalahan ketika melakukan analisis ouput sistem nonterminating yang tidak ditemukan dalam sistem terminating, yaitu:
kondisi awal bias. Data awal yang dikumpulkan selama bagian awal simulasi mungkin bias karena status awal sistem. Perilaku sistem selama fase awal ini mungkin salah arah atau tidak relevan dengan pertanyaan yang diharapkan untuk dijawab.
Kovarians antara sampel. Kelompok data yang dikumpulkan selama simulasi pada umumnya tidak saling bebas. Jika kumpulan sampel tidak saling bebas, perkiraan ragam akan bias.
Lama penjalanan. Meskipun sistem nonterminating, simualsi sistem harus diakhiri. Jika simulasi dihentikan lebih awal, mungkin kita tidak akan mendapatkan simulasi yang mewakili.
Metode yang digunakan untuk menganalisis output simulasi sistem nonterminating adalah pengulangan, batching, otokorelasi dan status regenerasi.
Metode Pengulangan
Metode pengulanan yang digunakan sama dengan yang digunakan pada sistem terminating, tapi harus mengabaikan (paling tidak meminimumkan) pengaruh kondisi awal pada output model. Hal ini dapat dilakukan dengan membuang pengamatan yang dikumpulkan pada fase awal simulasi dan hanya menggunakan data yang dkumpulkan setelah mencapai status stabil. Meskipun secara prinsip metode ini relatif sederhana, tapi dalam prakteknya sejumlah permasalahan muncul. Pertama, kita harus punya cara untuk memutuskan sampai mana data awal dan kapan mulai data status stabil. Disamping itu, biaya yang terbuang karena penjalanan fase awal mungkin cukup signifikan.
Metode Batch
Permasalahan yang dihadapi jika menggunakan metode pengulangan (biaya pengulangan untuk mengawali simulasi dan ketidakpastian lamanya fase transient) dapat dikurangi dengan metode batch, tapi tidak menghilangkan. Dalam metode batch, satu simulasi panjang dijalankan dan kita mencatat ukuran statistik secara perodik dan kemudian mengembalikannya ke titik awal. Pengembalian ke titik awal ini bsia didasarkan pada jangka waktu simulasi tertentu ayng ditetapkan atau berdasarkan terjadinya sejumlah kejadian tertentu. Jika jarak antara dua pengulangan berurutan cukup besar, statistik yang diakumulasikan selama tiap interval dapat dipertimbangkan independen. Tentu saja mereka tidak benar-benar saling bebas, karena akhir dari suatu status interval i merupakan awal dari status interval i+1. dalam metode batch, statistik yang dikumpulkan selama interval kecil pertama dibuang, untuk memungkinkan sistem melewati fase transient ke fase status stabil. Fase transient hanya akan dijalani sekali, menghasilkan penghematan perhitungan, dan jika lamanya fase transient tidak terukur, pengaruhnya akan berkurang sejalan dengan peningkatan batch. Kesulitan dalam metode batch adalah penentuan lama atau ukuran setiap batch. Jika memilih batch terlalu kecil, hasilnya tidak akan cukup saling bebas, sementara dengan menetapkan batch besar akan membutuhkan penambahan biaya yang lebih tinggi dibanding kebutuhan.
Metode Batch Berurutan
Dengan maksud mengurangi separuh lebar interval pendugaan kita perlu mengurangi ragam pengamatan atau meningkatkan jumlah pengamatan. Jumlah pengamatan dapat ditingkatkan dengan mensimulasikan sistem lebih lama atau mengurangi ukuran batch. Jika kita mengurangi ukuran batch, batch mungkin tidak akan saling bebas secara statistik.
Metode batch berurutan disarankan oleh Law dan Carson, berusaha menentukan ukuran batch terkecil sehingga batch mean paralel tampak independen secara statistik. Mereka menyarankan menggunakan koefisien korelasi lag:
(13)
Bi adalah rata-rata batch ke-i dan .
Untuk mengurangi bias p1 mereka menyarankan menggunakan penduga jacknifed :
(14)
dimana dihitung dari persamaan (13) untuk separuh pertama L (L/2) dan untuk separuh L berikutnya.
Untuk menggunakan prosedur batch berurutan secara iteratif kita:
1. Mensimulasikan sistem sampai batch L pengamatan k dibentuk.
2. Menggunakan , uji batch mean dapat dianggap sudah saling bebas.
3. Jika batch mean independen, atur interval kepercayaan dan jika lebar interval kepercayaan ada dalam tingkat keakuratan yang diinginkan, lalu berhenti. Jika tidak, naikkan k dan kembali ke langkah pertama.
4. jika batch mean tidak independen, naikkan k dan kembali ke langkah pertama.
Pada prosedur ini, pengamatan yang lalu tidak dibuang pada setiap iterasi. Bahkan pengamatan tambahan ditambahkan ke pengamatan lalu. Kemudian pengamatan dipartisi berdasarkan ukuran batch baru. Peningkatan ukuran batch dilanjutkan, membuat pengamatan tambahan, dan kemudian mempartisi pengamatan ke batch yang lebih besar sampai batch kelihatannya sudah saling bebas dan interval kepercayaan cukup kecil.
Metode Otokorelasi
Selain mengurangi korelasi antara sampel paralel, metode otokorelasi juga mengurangi pengaruh korelasi antara pengamatan untuk memperkirakan ragam proses yang sedang disimulasikan.
Metode Regenerasi
Metode regenerasi menghindari bias awal menggunakan titik regenerasi. Titik regenerasi (kadang-kadang disebut dengan titik pembaharuan) adalah status sistem dimana perilaku masa mendatang sistem bebas (independen) dari sebelumnya. Tidak mungkin mengidentifikasikan titik regenerasi untuk semua sistem, tetapi jika sistem benar-benar mempunyai titik regenerasi, itu dapat dieksploitasi untuk mendapatkan perkiraan titik dan interval sifat sistem.
Model simulasi kejadian diskrit berbeda dari tipe model lainnya. Model simulasi kejadian diskrit menggabungkan banyak variabel acak sehingga hasil (output) model merupakan variabel acak juga. Sebagai hasilnya, perkiraan output dalam penjalanan simulasi tertentu dapat sangat berbeda dari karakteristik model sebenarnya. Karena itu menggunakan output simulasi kejadian diskrit untuk menjawab pertanyaan pemodelan yang merupakan perilaku dan karakteristik sistem nyata bisa menjadi pekerjaan yang sangat sulit. Output model simulasi seperti ini bisa dengan mudah disalahinterpresentasikan.
Dalam berbagai studi simulasi, waktu dan dana besar biasanya dikelurkan saat pengembangan model dan pembuatan program, tapi sangat sedikit usaha yagn dilakukan dalam menganalisis output simulasi dengan tepat. Ada beberapa alasan kenapa analisis data output belum dilakukan dengan benar. Pertama, pengguna sering membayangkan bahwa simulasi hanya latihan dalam pemrograman komputer, bahkan untuk yang sangat kompleks. Akibatnya, banyak studi simulasi dimulai dengan pembangunan dan pengkodean model heuristik dan diakhiri dengan penjalanan tunggal mode untuk menghasilkan “jawaban”. Padahal, simulasi adalah percobaan contoh statistik berbasis komputer. Oleh karena itu, jika hasil simulasi tidka mempunyai arti, teknik statistik harus digunakan untuk merancang dan menganalisis percobaan simulasi. Alasan kedua adalah output proses semua simulasi maya bersifat dinamis dan otokorelasi. Oelh karena itu teknik statistik klasik yang didasarkan pada pengamatan IID (Identics and independent distribution) tidak secara langsung dapat diaplikasikan. Masih ada juga beberapa permasalahan analisis output dimana tidak ada solusi lengkap yang dapat diterima, dan metode yang tersedia biasanya terlalu kompleks untuk digunakan. Kegagalan lainnya adalah biaya waktu komputer yang dibutuhkan untuk mengumpulkan jumlah cukup data output. Bahkan kadang-kadang ada situasi dimana prosedur statistik yang tersedia sesuai, tetapi biaya mengumpulkan data yang dibutuhkan prosedur itu terlalu mahal. Permasalahan terakhir ini memang sudah mulai mendapatkan penyelesaian karena kebanyakan analis mempunyai mikrokomputer atau stasiun kerja dengan kecepatan tinggi. Komputer seperti ini sudah tidak terlalu mahal dan dapat dijalankan sepanjang malam atau selama akhir pekan untuk menghasilkan data output simulasi yang sangat besar pada biaya marjinal nol.
Tujuan Analisis Output
Dari awal kita sudah memahami bahwa langkah awal dan penting dalam analisis simulasi adalah mendefinisikan dengan jelas pertanyaan model simulasi yang diharapkan untuk dijawab. Analis harus selalu mempunyai pemahaman yang jelas pertanyaan apa yang harus dijawab ketika analisis diselesaikan dan menggunakan pertanyaan sebagai arahan melakukan analisis data, pengembangan model, validasi dan analisis output. Tujuan dari analisis output oleh karenanya adalah menjawab pertanyaan yang diajukan di awal pembentukan model dengan benar. Bentuk pertanyaan mengindikasikan pengujian hipotesis, selang kepercayaan atau pendugaan parameter.
Kita kembali ke simulasi sistem komputer time-shared. Kita asumsikan bahwa waktu aktif server adalah 24 jam sehari. Pertanyaan-pertanyaan yang mungkin perlu untuk dijawab analis adalah:
1. berapa lama seorang pengguna harus menunggu untuk terkoneksi dengan sistem?
2. berapa persen pengguna yang menunggu?
3. berapa peluang bahwa pengguna akan menunggu lebih dari 1 menit untuk terkoneksi?
4. berapa rata-rata pengguna yang menunggu terkoneksi?
5. berapa rata-rata waktu seorang pengguna terkoneksi dalam setiap koneksi yang dibuat?
6. apakah dengan menambah jumlah port akan dapat mengurangi waktu menunggu koneksi pengguna secara signifikan?
7. apakah dengan memperbesar memori CPU akan dapat mengurangi waktu menunggu koneksi pengguna secara signifikan?
8. apakah dengan mempercepat transmisi akan dapat mengurangi waktu menunggu koneksi pengguna secara signifikan?
9. berapa waktu rata-rata port kosong?
10. berapa banyak waktu menunggu akan naik jika pemanggilan pengguna bertambah 10%?
Dan banyak lagi pertanyaan yang mungkin diajukan sesuai dengan kebutuhan analisis. Jika model dirancang dengan benar, setiap pertanyaan itu akan dapat dijawab tetapi mungkin membutuhkan data yang berbeda yang harus dikumpulkan selama penjalanan simulasi. Untuk menjawab pertanyaan itu dengan beanr, analisis harus memutuskan berapa lama simulasi akan dijalankan, mengontrol laju kedatangan dan waktu terkoneksi, dan keakuratan statistik jawaban (tingkat kesalahan yang biasa disebut dengan signifikansi dalam statistik).
Permasalahan Analisis Output Model Simulasi
Untuk menggambarkan permasalahan analisis output model simulasi kita kembali ke model sistem komputer time-shared. Kita mengasumsikan (berdasarkan data historis atau perhitungan lainnya) bahwa laju pemanggilan pengguna untuk koneksi ke sistem adalah 75 per jam dan waktu rata-rata terkoneksi 35 menit. Kedua waktu ini (pemanggilan dan koneksi) berdisribusi secara eksponensial. Hasil penjalanan model simulasi ditunjukkan Tabel 1.
Kapanpun kita melakukan analisis data statistik, asumsi tentang proses darimana data itu ditarik dan pengamatannya harus dibuat. Jika asumsi yang dibuat tidak benar, maka akan dihasilkan kesimpulan karakteristik dan perilaku proses yang tidak benar. Ketika menganalisis data statistik adalah umum menggunakan asumsi:
1. pengamatan saling bebas.
2. waktu proses bervariasi.
3. untuk pengamatan dalam jumlah besar (lebih besar atau sama dengan 30), rata-rata sampel menyebar normal.
Jika ketiga asumsi ini dipenuhi, maka titik penduga rata-rata dan ragam waktu menunggu pengguna dalam antrian untuk koneksi adalah:
Rata-rata : (1)
Ragam : (2)
Dimana wi adalah waktu menunggu pengguna ke-i untuk terkoneksi. Jika pengamatan besar (n 30), maka waktu menunggu rata-rata dapat diduga untuk tingkat kepercayaan 95% sebagai berikut:
(3)
sayangnya, dalam simulasi kejadian diskrit semua asumsi itu pada umumnya tidak benar.
Untuk kasus sistem komputer time-shared yang juga merupakan kasus antrian, sebelum melanjutkan analisis waktu menunggu yang dihasilkan dari simulasi, karena laju pemanggilan dan waktu terkoneksi berdistribusi eksponensial, kita dapat menggunakan model antrian analitik untuk mendapatkan rata-rata, ragam dan selang kepercayaan. Untuk menggunakan model antrian analitik, kita harus membatasi terlebih dahulu jumlah server (dalam hal ini port) paralel yang digunakan. Model antrian yang cocok dengan model sistem komputer time-shared ini adalah M/M/C. Rata-rata waktu menunggu, ragam dan selang kepercayaan dengan model analitik ini adalah (untuk rumus yang digunakan dapat melihat di buku-buku Operation Research):
Jika kita menggunakan persamaan 1, 2 dan 3 di atas untuk menghitung waktu menunggu rata-rata, ragam dan selang kepercayaan, maka nilai-nilai ini akan diperoleh:
Nilai-nilai itu....
Penyelesaian sederhana untuk permasalahan data berkorelasi dan dinamis adalah melakukan simulasi jamak dan saling bebas.
Sistem terminating vs nonterminating
Semua sistem dinamis dapat dikategorikan sebagai sistem terminating atau nonterminating. Sistem diklasifikasikan terminating jika kejadian yang menggerakkan sistem menghentikan kejadian dalam suatu waktu tertentu, sedangkan sistem diklasifikasikan nonterminating jika kejadian diskrit terjadi berulang-ulang tanpa batasan. Mungkin ada sesi kejadian berulang yang disebut dengan regenerasi dalam sistem terminating, tetapi setiap sesi itu akan mulai dari awal lagi. Dalam sistem kejadian diskrit terminating, suatu kejadian TE menandai akhir dari suatu sesi. Kejadian TE mungkin selalu terjadi pada waktu yang sama, selama setiap sesi, atau waktu kejadiannya mungkin variabel acak. Dalam sistem terminating, status akhir sesi sebelumnya tidak mempengaruhi status awal sesi berikutnya. Sebaliknya dalam sistem nonterminating, kejadian diskrit menggerakkan sistem terjadi terus tanpa batas. Bagian tunggal sistem berlangsung terus tanpa batas dan tidak ada kejadian yang mengakhiri.
Adalah penting untuk membedakan sistem terminating atau nonterminating, karena masing-masing menggunakan metode analisis output berbeda. Perlu diperhatikan juga perbedaan antara sistem dan simulasi sistem. Setiap simulasi merupakan proses terminating tetapi tidak semua sistem bersifat terminating. Untuk setiap simulasi, selanjutnya kita perlu membedakan apakah simulasi steady-state (status stabil) atau transient (sementara).
Cara menganalisis output model simulasi tergantung dari keadaan sistem (terminating atau nonterminating) dan karakteristik perilakunya (steady-state atau transient).
Contoh-contoh sistem terminating:
1. bank: bank buak setiap hari dari jam 9.00 pagi dengan keadaan awal tidak ada nasabah dan ditutup jam 4.00 sore dan menyelesaikan layanan nasabah yang terakhir ada di antrian. Lama setiap sesi (hari) akan berbeda (tergantung dari jumlah nasabah yang masih mengantri jam 4.00 sore itu) tetapi setiap hari akan selalu dimulai dan diakhiri dengan tidak ada nasabah dalam antrian. Kejadian yang mengakhiri adalah penyelesaian pelayanan nasabah terakhir. Dalam simulasi seperti ini kita akan menyukai memilih mengukur kinerja yang menaksir waktu rata-rata semua nasabah menunggu, sama halnya dengan waktu rata-rata nasabah tiba pada waktu berbeda setiap harinya.
2. sistem komputer: sistem komputer mulai bekerja pagi hari ketika pengguna pertama masuk ke dalam sistem (log on), dan berakhir ketika pengguna terakhir hari itu keluar dari sistem (log off). Meskipun selama detik-detik akhir dan jam-jam lebih awal kadang-kadang pengguna mungkin akan masuk ke sistem (log on), perhatian kita hanya selama jam kerja normal dan kinerja sistem selama bukan ja kerja tidak diperhatikan. Setiap sesi mungkin mulai jam 8.00 pagi dengan sejumlah acak pengguna (sudah masuk lebih awal dalam sistem) dan sesi diakhiri ketika pengguna terakhir keluar dari sistem jam 5 sore. Ukuran kinerja yang mungkin adalah jumlah rata-rata pengguna terhubung ke sistem apda waktu yang berbeda dalam satu hari, peluang seorang pengguna tidak bisa masuk ke dalam sistem dalam waktu berbeda dalam satu hari, jumlah rata-rata pengguna yang terhubung ke sistem setiap hari dan peluang total seorang pengguna tidak dapat terhubung ke sistem.
3. permainan peluang: dua pemain dua melempar koin. Jika kedua koin sama (menunjukkan kepala atau ekor), pemain pertama akan memenangka satu dolar. Jika satu koin menunjukkan kepala dan satunya lagi ekor, maka pemain kedua akan memenangkan satu dolar. Permainan berlangsung selama satu jam atau sampai salah satu pemain kehabisan uangnya. Lama satu sesi oleh karenanya adalah satu jam atau sampai keadaan dimana salah satu pemain tidak dapat melanjutkan karena sudah kehabisan uang. Kejadian yang mengakhiri terjadi ketika salah satu pemain memenangkan uang terakhir pemain lainnya atau satu jam telah berlangsung. Ukuran kinerja bisa berupa rata-rata waktu permainan dan peluang memenangkan permainan.
4. inventori komponen: seorang produsen membeli mesin berfungsi tunggal (special-purposes machine) bersamaan dengan 5 komponen pengganti untuk komponen mesin kritis. Mesin akan digunakan selama 2 tahun mendatang. Jika komponen kritis rusak, komponen itu akan digantikan. Pengusaha itu tidak akan mendapatkan komponen pengganti dengan cepat dan dengan biaya murah setelah pembelian awal itu. Lama setiap sesi oleh akrenanya adalah 2 tahun atau sampai kelima komponen pengganti sudah rusak. Kejadian yang mengakhiri adalah waktu 2 tahun atau sampai kelima komponen rusak, tergantung yang mana yang terjadi lebih dulu. Ukuran kinerja sistem bisa berupa peluang komponen akan bertahan selama 2 tahun dan waktu rata-rata sistem beroperasi.
5. sistem basis data: dalam basis data terkomputerisasi data didistribusikan di dalam beberapa file. Data dihubungkan menggunakan field kunci dan pointer. Ketika pertanyaan basis data terjadi, pencarian dilakukan di semua file yang mengandung data menggunakan field kunci dan pointer untuk mencari lokasi data yang diminta. Kejadian yang mengakhiri adalah lokasi data yang dibutuhkan. Ukuran kinerja termasuk jumlah rata-rata file yang diakses dan waktu rata-rata menemukan lokasi.
Contoh sistem nonterminating
1. jobshop: fasilitas produksi terdiri dari beberapa stasiun kerja. Ketika suatu pekerjaan tiba pada fasilitas, pekerjaan itu akan melewati beberapa stasiun sampai diselesaikan. Meskipun shop hanya beroperasi satu shift dan tidak beroperasi pada hari Sabtu atau minggu, jobshop ini tergolong sistem nonterminating. Ketika operasi akan diakhiri (seperti pada Jumat malam), status akhir sistem akan menjadi status awal ketika operasi dimulai lagi. Siklus hidup sistem tidak terbatas dan sistem disimulasikan selama pengakumulasian statistik yang dibutuhkan untu ukuran kinerja. Ukuran kinerja bsia dalam bentuk utilisasi berbagai stasiun kerja, waktu rata-rata penyelesaian satu pekerjaan dan rata-rata pekerjaan dalam proses.
2. sistem inventori: peritel menimbun barang dagangan dan melakukan pemesanan ulang ketika level inventori mencapai atau lebih rendah dari level yang ditentukan. Meskipun aktifitas jualan hanya 8 jam sehari dan 5 hari dalams atu minggu, inventori akhir pada hari tertentu akan menjadi inventori awal pada hari berikutnya. Kejadian diskrit yang menggerakkan sistem berlangsung tanpa batas, dan ukuran kinerja termasuk rata-rata inventori, fraksi order yang harus memesan ulang atau berlebih dan jumlah rata-rata order per tahun.
3. bandar udara: selama 24 jam per hari, pesawat tiba dan berangkat dari bandara. Meskipun ada periode aktivitas ringan dan berat, keadaan pagi di bandara tergantung dari bagus tidaknya manajemen dilakukan sore sebelumnya dengan tidak ada pengakhiran sistem. Ukuran kinerja termasuk rata-rata waktu satu pesawat harus menunggu untuk lepas landas atau mendarat dan rata-rata jumlah pesawat menunggu untuk mendarat atau lepas landas.
4. rumah sakit: pasien masuk rumah sakit dengan asumsi kamar inap tersedia. Begitu satu tempat tidur sudah diisi, tempat tidur itu tidak akan tersedia lagi sampai pasien tersebut sudah pulang atau pindah kamar. Pasien yang tidak dapat diterima karena tidak ada tempat tidur lagi akan masuk ke rumah sakit lainnya jika memerlukan perawatan segera atau menunggu sampai ada tempat tidur yang kosong berikutnya. Jumlah pasien yang masuk dan keluar setiap pagi tergantung dari jumlah pasien di rumah sakit dan panjang daftar tunggu sore sebelumnya. Ukuran kinerja termasuk rata-rata jumlah pasien dalam klinik dan rata-rata waktu menunggu pasien untuk mendapatkan perawatan.
5. sistem status tetap: dosen direkrut oleh suatu universtas dan beberapa tahun diberikan sebagai tahapan menuju status tetap. Pada akhir setiap tahun pengajaran dan penelitian dosen menerima tahun berikutnya sebagai tahapan menuju status tetap. Setelah 6 tahun, evaluasi dilakukan, dosen akan diangakt menjadi status tetap atau hanya akan diberikan kontrak satu tahun lagi. Selama 6 tahun itu, dosen dapat meninggalkan universitas. Setelah menerima status tetap, dosen dapat tinggal sampai pensiun atau pindah ke universitas lain. Ini adalah sistem nonterminating (kecuali untuk sdosen yang akhirnya tidak mendapatkan status tetap) karena universitas mempunyai masa hidup tidak terbatas.pada akhir sembarang tahun, jumlah dosen dalam universitas tergantung dari jumlah pada awal tahun dan status permanen mereka dan jumlah tahun menuju status permanen. Ukuran kinerja adalah jumlah dosen status permanen dan bukan permanen dan peluang bahwa seorang dosen akan mendapatkan status permanen.
Karakteristik perilaku sistem seperti yang diuraikan di atas bisa steady-state (status stabil) atau transient. Untuk memahami perbedaan steady-state dan transient, perhatikan definisi ini:
Asumsikan:
s(t) adalah status sistem pada waktu t.
Ps(t) adalah peluang bahwa sistem akan berada pada status s pada waktu t.
Sistem akan berada dalam status stabil relatif terhadap variabel status s ketika
(4)
jika tidak sistem tidak akan mencapai status stabil dan dikatakan menunjukkan perilaku transient. Ketika distribusi peluang variabel status tidak berubah lagi sepanjang waktu, maka variabel status sudah mencapai status stabil atau lebih tepatnya mencapai distribusi status stabilnya.
Terminologi status stabil juga sering disalahartikan, menyarankan bahwa sistem akan lebih terkontrol (tidak berubah), menyebabkan hanya sedikit perubahan radikal dalam statusnya. Kita tidak bisa menerima saja pemikiran bahwa sistem mantap setelah periode dasar operasi. Meskipun distribusi peluang variabel status stabil sepanjang waktu, sistem berpindah dari satu keadaan ke keadaan lainnya sama aktifnya dengan fase status stabil saat sistem dalam keadaan fase transient. Faktanya, ragam status sistem lebih besar pada keadaan stabil dibandingkan selama dalam keadaan transient.
Contoh sistem yang dapat mencapai status stabil adalah:
1. jobshop menerima order pada laju rata-rata konstan. Awalnya, pada simulasi, jobshop mungkin tidak mempunyai pekerjaan dalam proses. Asumsinya jobshop meneruskan operasi secara tidak terbatas. Sistem ini nonterminating dan mencapai perilaku status stabil.
2. bank darah mengumpulkan dan menyimpan darah, mendistribusikannya ke anggota rumah sakit yang membutuhkannya. Dengan menganggap permintaan akan darah seragam sepanjang tahun, inventori darah akan memenuhi distribusi status stabil. Sistem adalah nonterminating.
3. pembayaran tol dikumpulkan di boks tol pada pintu masuk tol selama jam sibuk (jam 7 sampai jam 9). Jika intensitas lalu lintas tidak berubah selama 2 jam, dan laju kedatangan cukup besar, sistem akan melewati fase transientnya dengan cepat dan analisis status stabil akan sesuai, meskipun simulasi hanya untuk 2 jam. Ketika dianalisis dalam bentuk seperti ini, sistem adalah terminating dan kejadian yang menghentikan adalah kesimpulan jam sibuk.
Contoh sistem yang tidak akan mencapai status stabil adalah:
1. pengguna sistem komputer time-shared terhubung ke sistem jam 8 pagi sampai jam 5 sore. Laju pengguna terhubung ke sistem bervariasi sepanjang hari, dengan permintaan padatnya pertengahan pagi dan sore. Sistem ini adalah terminating yang tidak akan mencapai distribusi status stabil karena variasi permintaan sistem komputer dan jam operasi yang terbatas 9 jam.
2. perusahaan penerbangan punya kebijakan untuk menerima reservasi lebih 5% dari total tempat duduk yang tersedia untuk mengantisipasi penumpang yang tidak muncul pada jam penerbangan. Setiap hari merupakan sesi terminating, diakhiri dengan sejumlah acak penumpang yang tidak dapat tiket. Kondisi akhir hari tertentu tidak akan mempengaruhi kondisi awal hari berikutnya (dengan asumsi penumpang yang tidak dapat tiket hari tertentu sudah terakomodasi dengan penerbangan lainnya hari itu juga). Dalam simulasi ini tidak ada distribusi status stabil maupun transient dan waktu buakn inti simulasi.
Analisis Output untuk Sistem Terminating
Metode paling umum memperkirakan karakteristik sistem menggunakan model simulasi adalah mengumpulkan sampel karakteristik selama mode simulasi dijalankan. Sekali data dikumpulkan, data itu dapat digunakannya untuk membangun titik dan selang perkiraan karakteristik.
Ingat kembali sifat dua titik penduga paling umum, rata-rata contoh dan standar deviasi contoh (s):
(5) dan (6)
akan menjadi titik penduga rata-rata populasi () dan s2 akan menjadi titik penduga ragam populasi ().
Untuk simulasi terminating, metode paling digunakan untuk meyakinkan bahwa pengamatan xi bersifat independen dan mempunyai nilai ekspektasi umum adalah pengulangan. Oleh karena itu simulasi dijalankan beberapa kali, dimana setiap ulangan bebas dari ulangan lainnya. Selama penjalanan tiap simulasi, pengamatan dilakukan untuk setiap titik waktu yang dirancang atau atas terjadinya kejadian yang dirancang.
Untuk simulasi yang diulang R kali, dengan K pengamatan intermediat dalam setiap simulasi, asumsikan:
Xij = pengamatan ke-j ulangan ke-i
Dimana i = 1, 2, ..., R dan j = 1, 2, ..., K
Yi = ukuran kinerja keseluruhan selama ulangan ke-i
Maka,
j = 1, 2, ..., K (7)
(8)
(9)
(10)
maka interval pendugaan untuk E(xij) dan e(yi) adalah:
(11) dan
(12)
contoh analisis sistem komputer time-shared
Analisis Output Sistem Nonterminating
Kita akan menghadapi beberapa permasalahan ketika melakukan analisis ouput sistem nonterminating yang tidak ditemukan dalam sistem terminating, yaitu:
kondisi awal bias. Data awal yang dikumpulkan selama bagian awal simulasi mungkin bias karena status awal sistem. Perilaku sistem selama fase awal ini mungkin salah arah atau tidak relevan dengan pertanyaan yang diharapkan untuk dijawab.
Kovarians antara sampel. Kelompok data yang dikumpulkan selama simulasi pada umumnya tidak saling bebas. Jika kumpulan sampel tidak saling bebas, perkiraan ragam akan bias.
Lama penjalanan. Meskipun sistem nonterminating, simualsi sistem harus diakhiri. Jika simulasi dihentikan lebih awal, mungkin kita tidak akan mendapatkan simulasi yang mewakili.
Metode yang digunakan untuk menganalisis output simulasi sistem nonterminating adalah pengulangan, batching, otokorelasi dan status regenerasi.
Metode Pengulangan
Metode pengulanan yang digunakan sama dengan yang digunakan pada sistem terminating, tapi harus mengabaikan (paling tidak meminimumkan) pengaruh kondisi awal pada output model. Hal ini dapat dilakukan dengan membuang pengamatan yang dikumpulkan pada fase awal simulasi dan hanya menggunakan data yang dkumpulkan setelah mencapai status stabil. Meskipun secara prinsip metode ini relatif sederhana, tapi dalam prakteknya sejumlah permasalahan muncul. Pertama, kita harus punya cara untuk memutuskan sampai mana data awal dan kapan mulai data status stabil. Disamping itu, biaya yang terbuang karena penjalanan fase awal mungkin cukup signifikan.
Metode Batch
Permasalahan yang dihadapi jika menggunakan metode pengulangan (biaya pengulangan untuk mengawali simulasi dan ketidakpastian lamanya fase transient) dapat dikurangi dengan metode batch, tapi tidak menghilangkan. Dalam metode batch, satu simulasi panjang dijalankan dan kita mencatat ukuran statistik secara perodik dan kemudian mengembalikannya ke titik awal. Pengembalian ke titik awal ini bsia didasarkan pada jangka waktu simulasi tertentu ayng ditetapkan atau berdasarkan terjadinya sejumlah kejadian tertentu. Jika jarak antara dua pengulangan berurutan cukup besar, statistik yang diakumulasikan selama tiap interval dapat dipertimbangkan independen. Tentu saja mereka tidak benar-benar saling bebas, karena akhir dari suatu status interval i merupakan awal dari status interval i+1. dalam metode batch, statistik yang dikumpulkan selama interval kecil pertama dibuang, untuk memungkinkan sistem melewati fase transient ke fase status stabil. Fase transient hanya akan dijalani sekali, menghasilkan penghematan perhitungan, dan jika lamanya fase transient tidak terukur, pengaruhnya akan berkurang sejalan dengan peningkatan batch. Kesulitan dalam metode batch adalah penentuan lama atau ukuran setiap batch. Jika memilih batch terlalu kecil, hasilnya tidak akan cukup saling bebas, sementara dengan menetapkan batch besar akan membutuhkan penambahan biaya yang lebih tinggi dibanding kebutuhan.
Metode Batch Berurutan
Dengan maksud mengurangi separuh lebar interval pendugaan kita perlu mengurangi ragam pengamatan atau meningkatkan jumlah pengamatan. Jumlah pengamatan dapat ditingkatkan dengan mensimulasikan sistem lebih lama atau mengurangi ukuran batch. Jika kita mengurangi ukuran batch, batch mungkin tidak akan saling bebas secara statistik.
Metode batch berurutan disarankan oleh Law dan Carson, berusaha menentukan ukuran batch terkecil sehingga batch mean paralel tampak independen secara statistik. Mereka menyarankan menggunakan koefisien korelasi lag:
(13)
Bi adalah rata-rata batch ke-i dan .
Untuk mengurangi bias p1 mereka menyarankan menggunakan penduga jacknifed :
(14)
dimana dihitung dari persamaan (13) untuk separuh pertama L (L/2) dan untuk separuh L berikutnya.
Untuk menggunakan prosedur batch berurutan secara iteratif kita:
1. Mensimulasikan sistem sampai batch L pengamatan k dibentuk.
2. Menggunakan , uji batch mean dapat dianggap sudah saling bebas.
3. Jika batch mean independen, atur interval kepercayaan dan jika lebar interval kepercayaan ada dalam tingkat keakuratan yang diinginkan, lalu berhenti. Jika tidak, naikkan k dan kembali ke langkah pertama.
4. jika batch mean tidak independen, naikkan k dan kembali ke langkah pertama.
Pada prosedur ini, pengamatan yang lalu tidak dibuang pada setiap iterasi. Bahkan pengamatan tambahan ditambahkan ke pengamatan lalu. Kemudian pengamatan dipartisi berdasarkan ukuran batch baru. Peningkatan ukuran batch dilanjutkan, membuat pengamatan tambahan, dan kemudian mempartisi pengamatan ke batch yang lebih besar sampai batch kelihatannya sudah saling bebas dan interval kepercayaan cukup kecil.
Metode Otokorelasi
Selain mengurangi korelasi antara sampel paralel, metode otokorelasi juga mengurangi pengaruh korelasi antara pengamatan untuk memperkirakan ragam proses yang sedang disimulasikan.
Metode Regenerasi
Metode regenerasi menghindari bias awal menggunakan titik regenerasi. Titik regenerasi (kadang-kadang disebut dengan titik pembaharuan) adalah status sistem dimana perilaku masa mendatang sistem bebas (independen) dari sebelumnya. Tidak mungkin mengidentifikasikan titik regenerasi untuk semua sistem, tetapi jika sistem benar-benar mempunyai titik regenerasi, itu dapat dieksploitasi untuk mendapatkan perkiraan titik dan interval sifat sistem.
Langganan:
Postingan (Atom)