SISTEM PENAMPILAN PERGERAKAN DAN PENCATATAN LANGKAH BIDAK UNTUK TURNAMEN XIANG QI
S KRIPS I
Oleh ALBERT
1100003501
ANDREAS BUDI KURNIAWAN
1100046892
IGNATIUS ARIES KURNIAWAN
1100047453
UNIVERS ITAS BINA NUS ANTARA JAKARTA 2011
SISTEM PENAMPILAN PERGERAKAN DAN PENCATATAN LANGKAH BIDAK UNTUK TURNAMEN XIANG QI
S KRIPS I
diajukan sebagai salah satu syarat untuk gelar keserjanaan pada Jurusan Sistem Komputer Jenjang Pendidikan S trata-1
Oleh ALBERT
1100003501
ANDREAS BUDI KURNIAWAN
1100046892
IGNATIUS ARIES KURNIAWAN
1100047453
UNIVERS ITAS BINA NUS ANTARA JAKARTA 2011
ii
SISTEM PENAMPILAN PERGERAKAN DAN PENCATATAN LANGKAH BIDAK UNTUK TURNAMEN XIANG QI
S KRIPS I
Disusun Oleh:
Albert
Andreas Budi Kurniawan
Ignatius Aries Kurniawan
1100003501
1100046892
1100047453
Disetujui Oleh: Pembimbing
Wiedjaja, S.Kom, M .Kom Kode dosen : D1530
UNIVERS ITAS BINA NUS ANTARA JAKARTA 2011
iii
UNIVERSITAS Bina Nusantara _____________________________________________________________________ Perny ataan Kesiapan Tugas Ak hir untuk Ujian Pendadaran Perny ataan Peny usunan Tugas Ak hir Kami, A lbert A ndreas Budi Kurniawan Ignatius Aries Kurniawan dengan ini meny atak an bahwa Tugas Ak hir y ang berjudul : SISTEM PENAMPILAN PERGERA KA N DA N PENCA TA TAN LA NGKA H BIDA K UNTUK TURNA MEN XIANG QI adalah benar hasil k ary a k ami dan belum pernah diajuk an sebagai k ary a ilmiah, sebagian atau seluruhny a, atas nama k ami atau pihak lain
A lbert 1100003501
A ndreas Budi Kurniawan 1100046892
Disetujui oleh Pembimbing Kami setuju Tugas Akhir tersebut diajuk an untuk Ujian Pendadaran
Wiedjaja, S.Kom, M.Kom Pembimbing
, Januari 2011
Ignatius Aries Kurniawan 1100047453
PERNYATAAN
Dengan ini kami, Nama
: Albert
NIM
:1100003501
Nama
:Andreas Budi Kurniawan
NIM
:1100046892
Nama
:Ignatius Aries Kurniawan
NIM
:1100047453
Judul Skripsi : SISTEM PENAMPILAN PERGERAKAN DAN PENCATATAN LANGKAH BIDAK UNTUK TURNAM EN XIANG QI
M emberikan kepada Universitas Bina Nusantara hak non-ekslusif untuk menyimpan, memperbanyak, dan menyebarluaskan skripsi karya kami, secara keseluruhan atau hanya sebagian atau hanya ringkasannya saja, dalam bentuk format tercetak dan atau elektronik. M enyatakan bahwa kami, akan mempertahankan hak exclusive kami, untuk menggunakan seluruh atau sebagian isi skripsi kami, guna pengembangan karya di masa depan, misalnya bentuk artikel, buku, perangkat lunak, ataupun sistem informasi.
Jakarta, 10 M aret 2011
Albert
Andreas Budi Kurniawan
Ignatius Aries Kurniawan
1100003501
1100046892
1100047453
iv
PRAKATA Puji syukur penulis panjatkan kepada Tuhan Yang M aha Esa atas segala rahmat dan bimbingan-Nya, sehingga penulis dapat menyelesaikan skripsi ini dengan judul “SISTEM PENAM PILAN PERGERAKAN DAN PENCATATAN LANGKAH BIDAK UNTUK TURNAM EN XIANG QI” tepat pada waktunya. Skripsi ini merupakan karya ilmiah yang penulis susun pada jenjang pendidikan S1 (Strata-1) jurusan Sistem Komputer Universitas Bina Nusantara, Jakarta. Skripsi ini menerangkan latar belakang masalah atau tema yang penulis pilih serta landasan teori yang berhubungan dengan perancangan sistem. Dalam penyelesaian skripsi ini penulis menyadari sepenuhnya, penulis banyak mengalami halangan dan hambatan namun semuanya ini tidak akan dapat teratasi tanpa dukungan, bantuan dan nasihat dari berbagai pihak dari saat awal hingga akhir. Oleh karena itu, pada kesempatan ini penulis menyampaikan terima kasih kepada: 1. Orang tua, keluarga dan kerabat yang selalu memberikan semangat, dukungan baik moril maupun materil dan doa dalam proses penyusunan skripsi ini. 2. Bapak Prof. Dr. Ir. Harjanto Prabowo, MM , selaku Rektor Universitas Bina Nusantara. 3. Bapak Ir. Sablin Yusuf, M .Sc, M .Comp.Sc. selaku Dekan Fakultas Ilmu Komputer. 4. Bapak S.Wiedjaja, S.Kom, M .Kom selaku Ketua Jurusan Sistem Komputer dan pembimbing yang telah memberikan bimbingan dan dorongan semangat untuk dapat selalu berpikir selangkah ke depan.
vi
5. Bapak Robby Saleh, S.Kom, M T, selaku Sekretaris Jurusan Sistem Komputer yang telah memberikan dukungan dan kesempatan sehingga proses penulisan skripsi dapat terlaksana sebagaimana mestinya. 6. Bapak Rudi Susanto, S.Kom, MTI, selaku Kepala Computer Engineering Laboratory yang telah memberi sarana dan prasarana dalam pembuatan alat skripsi ini. 7. Bapak Anderes Gui atas masukan dan saran dalam pengembangan skripsi. 8. Staf dan rekan-rekan asisten Computer Engineering Laboratory. 9. Rekan-rekan seperjuangan jurusan Sistem Komputer yang selalu memberikan dukungan dan semangat, yang tidak dapat kami sebutkan satu persatu. 10. Teman-teman CIDU yang telah memberikan pinjaman alat-alat selama proses skripsi. 11. Pihak lain yang turut berperan dalam menyelesaikan skripsi ini, yang tidak dapat kami sebut satu persatu. Akhir kata, penulis menyadari bahwa penulisan skripsi ini masih terdapat kekurangan, tetapi penulis mengharapkan skripsi ini dapat berguna bagi pihak-pihak yang bersangkutan dan dapa memberikan informasi serta sebagai bahan acuan untuk pengembangan skripsi berikutnya. Jakarta, Januari 2011
Penulis
vii
DAFTAR ISI Halaman Judul Luar .................................................................................................................i Halaman Judul Dalam ..............................................................................................................ii Halaman Persetujuan ................................................................................................................iii Halaman Pemberian Hak Cipta Non Eksklusif dari M ahasiswa ke Universitas Bina Nusantara..................................................................................................................................iv Abstrak .....................................................................................................................................v Prakata ......................................................................................................................................vi Daftar Isi...................................................................................................................................viii Daftar Tabel..............................................................................................................................xiv Daftar Gambar ..........................................................................................................................xv Daftar Lampiran .......................................................................................................................xx
BAB1 PENDAHULUAN 1.1
Latar Belakang ....................................................................................................1
1.2
Ruang Lingkup....................................................................................................2
1.3
Tujuan dan M anfaat ............................................................................................3
1.4
M etodologi Penelitian ........................................................................................4
1.5
Sistematika Penulisan .........................................................................................4
BAB 2 LANDASAN TEORI 2.1
2.2
M ikrokontroller AVR .........................................................................................6 2.1.1
ATM ega 8535 ................................................................................8
2.1.2
Komunikasi Serial .........................................................................13
Transmisi Data ....................................................................................................16 viii
2.3
Reed Switch ........................................................................................................19
2.4
Catur China (Xiang Qi) .......................................................................................20 2.4.1
General (Raja) ...............................................................................21
2.4.2
Advisor (Perdana M enteri).............................................................22
2.4.3
Elephant (Gajah)............................................................................23
2.4.4
Horse (Kuda) .................................................................................24
2.4.5
Chariot (Benteng) .........................................................................25
2.4.6
Cannon (M eriam) ..........................................................................26
2.4.7
Soldier (Prajurit) ............................................................................27
2.5
Rangkaian M atrix................................................................................................28
2.6
Ghosting effect pada rangkaian matrix................................................................31
2.7
RS-485 ................................................................................................................34
2.8
IC CD4017 ..........................................................................................................38
2.9
IC MAX 232 .......................................................................................................40
2.10 74HC595 .............................................................................................................42 2.11 IC FT232RL........................................................................................................43 2.12 IC MAX487 ........................................................................................................46 2.13 Adobe Flash CS3 ................................................................................................47 2.14 XAM PP...............................................................................................................48 2.15 COMM Tunnel....................................................................................................49 2.16 Altium Designer ..................................................................................................50 2.17 M agnet ................................................................................................................50
ix
BAB 3 PERANCANGAN SISTEM 3.1
Gambaran Umum Sistem ....................................................................................54
3.2
Perancangan Perangkat Keras .............................................................................57
3.3
3.4
3.5
3.2.1
Perancangan Rangkaian Kontroller......................................................58
3.2.2
Perancangan Rangkaian Scanning........................................................60.
3.2.3
Perancangan Rangkaian M atriks Sensor M agnet .................................62
3.2.4
Perancangan Rangkaian Komunikasi Serial.........................................63
3.2.5
Perancangan Rangkaian Penunjuk Waktu............................................66
3.2.6
Perancangan Rangkaian Interrupt dan Reset........................................68
3.2.7
Perancangan Rangkaian Regulator.......................................................69
3.2.8
Perancangan Rangkaian Buzzer ...........................................................70
3.2.9
Perancangan Rangkaian Konverter 232 ke 485 ...................................71
Perancangan Piranti Lunak Pada M ikrokontroller..............................................72 3.3.1
Diagam Alir Sistem ..............................................................................73
3.3.2
Diagram Alir Scan Gerakan.................................................................76
3.3.3
Diagram Alir Error Checking ..............................................................78
3.3.4
Diagram Alir Pengiriman Data Pergerakan..........................................80
3.3.5
Diagram Alir Buzzer Alert....................................................................84
Perancangan Piranti Lunak Pada PC...................................................................87 3.4.1
Class Diagram Program........................................................................88
3.4.2
Rancangan Graphic User Interface......................................................90
Rancang Bangun .................................................................................................96
x
BAB 4 IMPLEMENTASI DAN EVALUASI 4.1
Spesifikasi Sistem ...............................................................................................97
4.2
Daftar Komponen................................................................................................98
4.3
Implementasi .......................................................................................................100 4.3.1
Prosedur Pemasangan ...........................................................................100
4.3.2
Board Setting ........................................................................................105
4.3.3
Host Setting ..........................................................................................107
4.3.4
Cara M enggunakan Papan Xiang Qi ....................................................109
4.3.5
Aturan M ain..........................................................................................109
4.3.6
Tampilan Program Utama.....................................................................111
4.3.7
Tampilan M enu Pertandingan...............................................................112
4.3.8
Tampilan M enu Option.........................................................................114
4.3.9
Tampilan M enu Log .............................................................................115
4.3.10 Tampilan Online ...................................................................................117 4.3.11 Struktur Tabel Database .......................................................................118 4.4
Tahapan Pengujian ..............................................................................................120 4.4.1
Pengukuran Sensitivitas Sensor Reed Switch .......................................121
4.4.2
Pengukuran Reliabilitas Push Button Player ........................................125
4.4.3
Uji Coba Pengiriman Data Secara Serial..............................................128
4.4.4
Pengujian Akurasi Timer Penunjuk Waktu ..........................................131
4.4.5
Pengujian Deteksi Error pada Buzzer ..................................................132
4.4.6
Pengukuran Tingkat Akurasi Sistem ...................................................132 xi
4.4.7
Pengukuran Daya pada Sistem .............................................................133
4.4.8
Pengukuran Waktu Komputer M endapat
Respon PING dari
board.....................................................................................................134 4.4.9
Pengukuran Waktu Komputer M endapat Respon POLLING dari board.....................................................................................................135
4.5 Evaluasi ..................................................................................................................137
BAB 5 SIMPULAN DAN SARAN 5.1 Simpulan...........................................................................................................138 5.2 Saran .................................................................................................................139
DAFTAR PUSTAKA .......................................................................................................140 RIWAYAT HIDUP ..........................................................................................................141 LAMPIRAN-LAMPIRAN
xii
DAFTAR TABEL Tabel 2.1 Fungsi alternatif Port A pada Atmega8535 .............................................................9 Tabel 2.2 Fungsi alternatif Port B pada Atmega8535............................................................10 Tabel 2.3 Fungsi alternatif Port C pada Atmega8535..............................................................11 Tabel 2.4 Fungsi alternatif Port D pada Atmega8535 .............................................................12 Tabel 2.5 Konfigurasi Serial pin-out pada konektor DB-9 ......................................................15 Tabel 2.6 Perbedaan spesifikasi antara RS232, RS423, RS422,RS485 ...................................17 Tabel 2.7 Keterangan Konfigurasi pin IC CD4017..................................................................38 Tabel 2.8 Keterangan konfigurasi pin IC M AX 232................................................................41 Tabel 2.9 Keterangan Konfigurasi pin IC 74HC595................................................................42 Tabel 2.10 USB interface group...............................................................................................44 Tabel 2.11 Power dan Ground group .......................................................................................44 Tabel 2.12 M iscellanous signal group......................................................................................45 Tabel 2.13 UART interface dan CBUS group .........................................................................45 Tabel 2.14 Konfigurasi pin IC MAX487 .................................................................................46 Tabel 4.1 Daftar Komponen.....................................................................................................98 Tabel 4.2 Hasil Percobaan M agnet Ferrite ke Reed Switch .................................................. 122 Tabel 4.3 Hasil Percobaan M agnet Neodymium ke Reed Switch ......................................... 122
xiv
Tabel 4.4 Percobaan M agnet Gabungan Ferrite & Neodymium ke Reed Switch ................. 124 Tabel 4.5 Hasil Percobaan Ujicoba Push Button Pemain .................................................... 126 Tabel 4.6 Hasil Uji Coba Board M endapatkan 100x Response............................................ 129 Tabel 4.7 Hasil Uji Coba Board M endapatkan 100x Time Out ............................................ 130 Tabel 4.8 Hasil Uji Coba Bunyi Buzzer ................................................................................ 132
xv
DAFTAR GAMBAR Gambar 2.1 Perbandingan feature dengan jumlah pin keluarga A VR.....................................7 Gambar 2.2 Blok Diagram AVR ..............................................................................................8 Gambar 2.3 Konfigurasi pin ATM ega8535 .............................................................................8 Gambar 2.4 Konfigurasi pin DB 9 Male dan Female ..............................................................15 Gambar 2.5 Reed Switch..........................................................................................................19 Gambar 2.6 Papan catur cina beserta bidaknya........................................................................21 Gambar 2.7 Bidak Raja ............................................................................................................21 Gambar 2.8 Contoh pergerakan Raja .......................................................................................22 Gambar 2.9 Bidak Perdana M enteri .........................................................................................22 Gambar 2.10 Contoh pergerakan Perdana M enteri ..................................................................23 Gambar 2.11 Bidak Gajah ........................................................................................................23 Gambar 2.12 Contoh pergerakan Gajah ...................................................................................24 Gambar 2.13 Bidak Kuda .........................................................................................................24 Gambar 2.14 Contoh pergerakan kuda.....................................................................................25 Gambar 2.15 Bidak Benteng ....................................................................................................25 Gambar 2.16 Contoh pergerakan Benteng ...............................................................................26
xvi
Gambar 2.17 Bidak Cannon .....................................................................................................26 Gambar 2.18 Contoh pergerakan Cannon ................................................................................27 Gambar 2.19 Bidak Peon .........................................................................................................27 Gambar 2.20 Contoh pergerakan Peon ....................................................................................28 Gambar 2.21 Simple matrix keyboard 4 tombol ......................................................................29 Gambar 2.22 Rangkaian switch open keyboard 4 tombol........................................................29 Gambar 2.23 Controller melakukan scanning kolom C1 ........................................................30 Gambar 2.24 Controller melakukan scanning kolom C2 ........................................................30 Gambar 2.25 Tombol A ditekan sehingga switch A tersambung.............................................31 Gambar 2.26 3 buah tombol ditekan pada saat bersamaan ......................................................31 Gambar 2.27 Switch A,B,dan D tersambung............................................................................32 Gambar 2.28 Kolom C1 aktif membuat tombol C seolah-olah tertekan..................................32 Gambar 2.29 Skematik rangkaian dengan dioda......................................................................33 Gambar 2.30 C1 aktif pada keyboard 4 tombol dengan dioda .................................................33 Gambar 2.31 C2 aktif pada keyboard 4 tombol dengan dioda .................................................34 Gambar 2.32 Topologi Jaringan komunikasi RS485 ...............................................................34 Gambar 2.33 General Purpose RS-485 Network .....................................................................36
xvii
Gambar 2.34 Konfigurasi pin IC CD4017 ...............................................................................38 Gambar 2.35 Timing Diagrams IC CD4017 ............................................................................39 Gambar 2.36 Konfigurasi pin IC M AX232..............................................................................40 Gambar 2.37 Operating Circuit M AX232...............................................................................40 Gambar 2.38 Konfigurasi pin IC 74HC595 .............................................................................41 Gambar 2.39 Tabel Kebenaran IC 74HC595 ...........................................................................42 Gambar 2.40 Konfigurasi pin IC FT232RL .............................................................................43 Gambar 2.41 Konfigurasi pin IC M AX487..............................................................................46 Gambar 2.42 Tampilan Utama Flash CS3................................................................................48 Gambar 2.43 Tampilan Utama XAMPP ..................................................................................48 Gambar 2.44 Tampilan Utama Comm Tunnel .........................................................................49 Gambar 2.45 Tampilan utama software Altium Designer .......................................................50 Gambar 3.1 Blok Diagram sistem ............................................................................................56 Gambar 3.2 Rangkaian Kontroller ...........................................................................................58 Gambar 3.3 Rangkaian Shift Register ......................................................................................60 Gambar 3.4 Rangkaian Board Reed Switch .............................................................................62 Gambar 3.5 Rangkaian Komunikasi Serial ..............................................................................63
xviii
Gambar 3.6 Rangkaian Penunjuk Waktu .................................................................................66 Gambar 3.7 Rangkaian Tombol Ganti Pemain dan Reset ........................................................68 Gambar 3.8 Rangkaian Regulator ............................................................................................69 Gambar 3.9 Rangkaian Buzzer ................................................................................................70 Gambar 3.10 Rangkaian Konverter USB ke RS-485..............................................................71 Gambar 3.11 Flowchart Sistem ...............................................................................................73 Gambar 3.12 Flowchart Scanning Gerakan .............................................................................76 Gambar 3.13 Flowchart Error Checking .................................................................................78 Gambar 3.14 Flowchart Pengiriman data pergerakan..............................................................80 Gambar 3.15 Flowchart Interrupt Timer 0 ..............................................................................84 Gambar 3.16 Flowchart Interrupt Timer1 ...............................................................................85 Gambar 3.17 Class Diagram Program. ...................................................................................88 Gambar 3.18 Rancangan Tampilan Program Utama................................................................90 Gambar 3.19 Rancangan Tampilan Pertandingan ....................................................................91 Gambar 3.20 Rancangan Tampilan Option ..............................................................................92 Gambar 3.21 Rancangan Tampilan Log...................................................................................93 Gambar 3.22 Rancangan Tampilan Online ..............................................................................94 Gambar 3.23 Rancang Bangun Sistem Keseluruhan................................................................96 Gambar 4.1 Papan Xiang Qi beserta sistem .............................................................................101 Gambar 4.2 Tampak Permukaan Atas Kontroller Xiang Qi ....................................................102 Gambar 4.3 Adaptor Variabel ..................................................................................................104 xix
Gambar 4.4 Kabel U SB to Serial .............................................................................................105 Gambar 4.5 Tampilan Awal Program Utama...........................................................................112 Gambar 4.6 Tampilan Pertandingan Board Nomor 2 ..............................................................113 Gambar 4.7 Tampilan Pertandingan Board Nomor 102 ..........................................................114 Gambar 4.8 Tampilan Pilihan Option ......................................................................................115 Gambar 4.9 Tampilan Pilihan Log ...........................................................................................115 Gambar 4.10 Tampilan Online .................................................................................................117 Gambar 4.11 Rancangan Tabel Matchlist ................................................................................118 Gambar 4.12 Rancangan Tabel Matchlog ................................................................................119 Gambar 4.13 Rancangan Tabel Player.....................................................................................119 Gambar 4.14 Rangkaian Percobaan Sensitivitas Reed Switch .................................................121 Gambar 4.15 Titik Tengah dan Ujung Reed Switch.................................................................121 Gambar 4.16 Percobaan Penghitungan Periode Timer Penunjuk Waktu .................................131 Gambar 4.17 Grafik Lamanya Respon Ping dari Board 1 sampai 100 ....................................135 Gambar 4.18 Grafik Lamanya Respon Polling dari Board 1 sampai 100 ................................136
xx
DAFTAR LAMPIRAN Lampiran A Listing Program M ikrokontroller ........................................................................LA-1 UART ................................................................................................................................LA-1 Buzzer.c.............................................................................................................................LA-22 Buzzer.h.............................................................................................................................LA-23 Global.h .............................................................................................................................LA-24 Scanner.c ...........................................................................................................................LA-26 Scanner.h ...........................................................................................................................LA-31 Comm.c .............................................................................................................................LA-32 Comm.h .............................................................................................................................LA-35 Timer.c ..............................................................................................................................LA-37 Timer.h ..............................................................................................................................LA-40 M ain.c................................................................................................................................LA-41 Lampiran B Listing Program PC .............................................................................................LB-1 ArrayCollectionDP.as........................................................................................................LB-1 SerialConnection.as ...........................................................................................................LB-2 SQLConnection.as .............................................................................................................LB-9 XiangQiBoard.as ...............................................................................................................LB-11 XiangQiM ain.as ................................................................................................................LB-14 XiangQiPiece.as ................................................................................................................LB-21 XiangQiSlaveM ain.as........................................................................................................LB-22 Lampiran C Datasheet..............................................................................................................LC-1
xxi