tag:blogger.com,1999:blog-70981671716864738002024-03-19T11:52:51.766+07:00AriSulistiono.ComLet's Share Knowledge and Experiences about Electrical Engineering & Automation.Ari Sulistionohttp://www.blogger.com/profile/00609115698913694796noreply@blogger.comBlogger6125tag:blogger.com,1999:blog-7098167171686473800.post-39037444483382968972010-11-18T12:34:00.001+07:002010-11-19T18:04:32.446+07:00Antarmuka Keypad Matrix dengan Mikrokontroler<ul> <li> <h3>Pendahuluan</h3> </li> </ul> <p>Keypad (papan tombol) merupakan salah satu bagian HMI atau Human Machine Interface dan memainkan peranan yang sangat penting pada sebuah sistem terpadu dimana input/masukan dari manusia diperlukan di dalam sistem, misal: pintu elektronik, elevator, kalkulator, microwave, dan masih banyak lagi.</p> <p>Keypad Matrix memang sangat akrab digunakan dalam aplikasi-aplikasi mikrokontroler karena aritekturnya yang sederhana dan mudah untuk digabungkan dengan segala macam mikrokontroler.</p> <p>Di dalam bagian dari tutorial ini, kita akan coba mempelajari bagaimana caranya untuk membuat interface/antarmuka sebuah keypad matrix 4x4 dan mikrokontroler seri 8051. Serta kita juga akan pelajari disini bagaimana cara memprogramnya dalam bahasa Assembly dan C.</p> <ul> <li> <h3>Merakit Keypad Matrix</h3> </li> </ul> <p>Pembuatan sebuah keypad matrix umumnya sangat mudah. Seperti yang ditunjukkan oleh gambar dibawah, kita punya empat baris serta empat kolom sebagai tahapan awalnya. Diantara setiap persimpangan baris dan kolom disana kita tempatkan sebuah tombol.</p> <p><a href="http://lh5.ggpht.com/_gWMAlrMzovc/TOS6zz0ViaI/AAAAAAAACI4/sdCA-W3TmGY/s1600-h/keypad2.gif" target="_blank"><img style="background-image: none; border-right-width: 0px; margin: 10px auto 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="keypad" border="0" alt="keypad" src="http://lh3.ggpht.com/_gWMAlrMzovc/TOS61B2CidI/AAAAAAAACI8/Pkca3lWCKvY/keypad_thumb.gif?imgmax=800" width="130" height="126" /></a></p> <p>Berdasarkan dari sketsa diatas, maka dapat kita buat sebuah keypad dengan beberapa buah SPST Switch seperti yang ditunjukkan oleh rangkaian dibawah ini:</p> <p><a href="http://lh5.ggpht.com/_gWMAlrMzovc/TOS62TCDIlI/AAAAAAAACJA/iXvt4HAJii8/s1600-h/keypad-schematic4.gif" target="_blank"><img style="background-image: none; border-right-width: 0px; margin: 10px 15px 0px 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="keypad-schematic" border="0" alt="keypad-schematic" src="http://lh3.ggpht.com/_gWMAlrMzovc/TOS63ehVEBI/AAAAAAAACJE/TeOyASn6Oag/keypad-schematic_thumb2.gif?imgmax=800" width="463" height="303" /></a></p> <p>Sekarang keypad kita sudah siap, yang kita butuhkan sekarang adalah menghubungkan baris dan kolom ke dalam port sebuah mikrokontroler dan memprogram mikrokontroler untuk membaca input dari keypad.</p> <h3>Scanning atau Membaca Keypad Matrix ke dalam Mikrokontroler</h3> <p>Disana ada banyak sekali metode yang digunakan untuk membaca keypad matrix, tergantung kepada bagaimana keypad itu sendiri dihubungkan dengan mikrokontroler, namun logika dasarnya tetaplah sama. Kita buat kolom sebagai input dan kita jadikan baris sebagai output, seluruh prosedur dalam pembacaan keyboard dinamakan sebagai scanning.</p> <p>Dalam rangka mendeteksi tombol yang mana yang tengah ditekan dari rangkaian matrix, kita buat jalur pada sisi baris menjadi low “0” satu per satu dan seketika itu juga membaca nilai kolomnya “0” atau “1”. Katakanlah untuk pertama kita coba buat program dimana baris pertama menjadi “0”, kemudian pembacaan kolom dilakukan oleh mikrokontroler. Jika salah satu tombol pada baris pertama yang ditekan maka kolom yang terkait akan ikut menjadi “0”, semisal tombol kedua pada baris pertama ditekan, maka kolom ke dua akan menjadi low atau “0”. Sehingga kita bisa tahu bahwa tombol nomor 2 telah ditekan. Ini adalah konsep dasar bagaimana keypad scanning dilakukan dalam mikrokontroler.</p> <p>Sehingga untuk men-scan keypad secara keseluruhan, kita perlu untuk membuat nilai baris menjadi lowatau “0” satu per satu dan membaca nilai kolom yanh terkait. Jika ada salah satu dari tombol yang ditekan, hal ini akan membuat korespondensi dengan kolom untuk berubah ke posisi low, yang mana hal inilah yang akan memberi kita informasi bahwa sebuah tombol telah ditekan pada baris itu. Jika baris 1 di buat = “0” dan tombol pada kolom 1 ditekan maka nilai pin mikro untuk kolom 1 akan = “0”, apabila tombol pada kolom 2 yang ditekan maka pin mikro untuk kolom 2 akan = “0”, begitu seterusnya..</p> <p>Okay, jika sudah cukup mengerti, sekarang mari kita mulai berpindah ke sesi berikutnya yaitu pokok bahasan pemrograman keypad.</p> <h3>Koneksi Keypad Matrix ke AVR Mikrokontroler</h3> <p><a href="http://www.8051projects.net/keypad-interfacing/keypad-avr.gif"><img style="background-image: none; border-right-width: 0px; margin: 10px 15px 0px 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="keypad-avr-th" border="0" alt="keypad-avr-th" src="http://lh6.ggpht.com/_gWMAlrMzovc/TOS64zyK-XI/AAAAAAAACJU/nXDDY435ibo/keypad-avr-th%5B1%5D.gif?imgmax=800" width="242" height="126" /></a></p> <p><em>Silahkan klik gambar untuk melihat dalam ukuran sebenarnya.</em></p> <p>Rangkaian diatas hanya untuk menunjukkan bagian koneksi keypad ke mikrokontroler saja dan tidak meliputi rangkaian reset dan kristal. Untuk yang masih latihan, kamu harus memiliki rangkaian mikro lengkap dengan tombol reset dan kristal. </p> <h3>►Keypad Connections with 8051 Microcontroller</h3> <p><a href="http://www.8051projects.net/keypad-interfacing/keypad-8051.gif"><img style="background-image: none; border-right-width: 0px; margin: 10px 15px 0px 0px; padding-left: 0px; padding-right: 0px; display: inline; float: left; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="keypad-8051-th" border="0" alt="keypad-8051-th" align="left" src="http://lh5.ggpht.com/_gWMAlrMzovc/TOS66Axg7pI/AAAAAAAACJM/Aft998_Mva8/keypad-8051-th3.gif?imgmax=800" width="244" height="128" /></a></p> <p>Please click on the image to enlarge it</p> <p>Circuit shown above is for demonstration and does not include any reset and crystal circuit. For practical use you need to have a reset circuit and crystal.</p> <p> </p> <h2>Bab Pemrogramman Mikrokontroler AVR</h2> <h3>AVR Assembly Programming for ADC0804</h3> <div class="code_asm">CODE:</div> <div style="unicode-bidi: embed; direction: ltr" class="code_highlight"> <div style="font-family: monospace" class="asm">keyport <span style="color: rgb(0,0,0); font-weight: bold">equ</span> <span style="color: rgb(0,0,127)">P2</span>                  <span style="font-style: italic; color: rgb(102,102,102)">;Keypad port connected here</span> <br />col1 <span style="color: rgb(0,0,0); font-weight: bold">equ</span> <span style="color: rgb(0,0,127)">P2</span><span style="color: rgb(51,153,51)">.</span>0                   <span style="font-style: italic; color: rgb(102,102,102)">;Column 1</span> <br />col2 <span style="color: rgb(0,0,0); font-weight: bold">equ</span> <span style="color: rgb(0,0,127)">P2</span><span style="color: rgb(51,153,51)">.</span>1                   <span style="font-style: italic; color: rgb(102,102,102)">;Column 2</span> <br />col3 <span style="color: rgb(0,0,0); font-weight: bold">equ</span> <span style="color: rgb(0,0,127)">P2</span><span style="color: rgb(51,153,51)">.</span>2                   <span style="font-style: italic; color: rgb(102,102,102)">;Column 3</span> <br />col4 <span style="color: rgb(0,0,0); font-weight: bold">equ</span> <span style="color: rgb(0,0,127)">P2</span><span style="color: rgb(51,153,51)">.</span>3                   <span style="font-style: italic; color: rgb(102,102,102)">;Column 4</span> <br /> <br />keyval <span style="color: rgb(0,0,0); font-weight: bold">equ</span> <span style="color: rgb(0,0,255)">30H</span>                  <span style="font-style: italic; color: rgb(102,102,102)">;To store key number</span> <br />pressed <span style="color: rgb(0,0,0); font-weight: bold">bit</span> <span style="color: rgb(0,0,255)">0H</span>                  <span style="font-style: italic; color: rgb(102,102,102)">;Flag</span> <br /> <br />key_init<span style="color: rgb(51,153,51)">:</span> <br />        <span style="color: rgb(0,0,127); font-weight: bold">mov</span> keyport<span style="color: rgb(51,153,51)">,#</span><span style="color: rgb(0,0,255)">0FH</span>        <span style="font-style: italic; color: rgb(102,102,102)">;Make rows as o/p and col as i/p</span> <br />        <span style="color: rgb(0,0,127); font-weight: bold">ret</span> <br /> <br />get_key<span style="color: rgb(51,153,51)">:</span> <br />        <span style="color: rgb(0,0,127); font-weight: bold">mov</span> keyval<span style="color: rgb(51,153,51)">,#</span><span style="color: rgb(0,0,255)">0</span>           <span style="font-style: italic; color: rgb(102,102,102)">;reset the number</span> <br />        <span style="color: rgb(0,0,127); font-weight: bold">mov</span> keyport<span style="color: rgb(51,153,51)">,#</span><span style="color: rgb(0,0,255)">7FH</span>        <span style="font-style: italic; color: rgb(102,102,102)">;make Row1 low</span> <br />        <span style="color: rgb(0,0,127); font-weight: bold">acall</span> read_col          <span style="font-style: italic; color: rgb(102,102,102)">;read columns</span> <br /> <br />        <span style="color: rgb(0,0,127); font-weight: bold">jb</span> pressed<span style="color: rgb(51,153,51)">,</span> done        <span style="font-style: italic; color: rgb(102,102,102)">;check if flag is set</span> <br /> <br />        <span style="color: rgb(0,0,127); font-weight: bold">mov</span> keyval<span style="color: rgb(51,153,51)">,#</span><span style="color: rgb(0,0,255)">4</span>           <span style="font-style: italic; color: rgb(102,102,102)">;if not then read next row</span> <br />        <span style="color: rgb(0,0,127); font-weight: bold">mov</span> keyport<span style="color: rgb(51,153,51)">,#</span><span style="color: rgb(0,0,255)">0BFH</span>       <span style="font-style: italic; color: rgb(102,102,102)">;make Row2 low</span> <br />        <span style="color: rgb(0,0,127); font-weight: bold">acall</span> read_col          <span style="font-style: italic; color: rgb(102,102,102)">;read columns</span> <br /> <br />        <span style="color: rgb(0,0,127); font-weight: bold">jb</span> pressed<span style="color: rgb(51,153,51)">,</span> done        <span style="font-style: italic; color: rgb(102,102,102)">;check if flag is set</span> <br /> <br />        <span style="color: rgb(0,0,127); font-weight: bold">mov</span> keyval<span style="color: rgb(51,153,51)">,#</span><span style="color: rgb(0,0,255)">8</span>           <span style="font-style: italic; color: rgb(102,102,102)">;if not then read next row</span> <br />        <span style="color: rgb(0,0,127); font-weight: bold">mov</span> keyport<span style="color: rgb(51,153,51)">,#</span><span style="color: rgb(0,0,255)">0DFH</span>       <span style="font-style: italic; color: rgb(102,102,102)">;make row3 low</span> <br />        <span style="color: rgb(0,0,127); font-weight: bold">acall</span> read_col          <span style="font-style: italic; color: rgb(102,102,102)">;read columns</span> <br /> <br />        <span style="color: rgb(0,0,127); font-weight: bold">jb</span> pressed<span style="color: rgb(51,153,51)">,</span> done        <span style="font-style: italic; color: rgb(102,102,102)">;check if flag is set</span> <br /> <br />        <span style="color: rgb(0,0,127); font-weight: bold">mov</span> keyval<span style="color: rgb(51,153,51)">,#</span><span style="color: rgb(0,0,255)">12</span>          <span style="font-style: italic; color: rgb(102,102,102)">;if not read row4</span> <br />        <span style="color: rgb(0,0,127); font-weight: bold">mov</span> keyport<span style="color: rgb(51,153,51)">,#</span><span style="color: rgb(0,0,255)">0EFH</span>       <span style="font-style: italic; color: rgb(102,102,102)">;make row4 low</span> <br />        <span style="color: rgb(0,0,127); font-weight: bold">acall</span> read_col          <span style="font-style: italic; color: rgb(102,102,102)">;read columns</span> <br /> <br />done<span style="color: rgb(51,153,51)">:</span> <br />        <span style="color: rgb(0,0,127); font-weight: bold">ret</span> <br /> <br />read_col<span style="color: rgb(51,153,51)">:</span>                       <span style="font-style: italic; color: rgb(102,102,102)">;read columns routine</span> <br />        <span style="color: rgb(0,0,127); font-weight: bold">clr</span> pressed             <span style="font-style: italic; color: rgb(102,102,102)">;reset the flag</span> <br /> <br />        <span style="color: rgb(0,0,127); font-weight: bold">jb</span> col1<span style="color: rgb(51,153,51)">,</span> nextcol        <span style="font-style: italic; color: rgb(102,102,102)">;check if first key is pressed</span> <br />        <span style="color: rgb(0,0,127); font-weight: bold">jnb</span> col1<span style="color: rgb(51,153,51)">,</span>$              <span style="font-style: italic; color: rgb(102,102,102)">;if yes then wait for key release       </span> <br />        <span style="color: rgb(0,0,127); font-weight: bold">setb</span> pressed            <span style="font-style: italic; color: rgb(102,102,102)">;set the flag</span> <br />        <span style="color: rgb(0,0,127); font-weight: bold">ret</span> <br /> <br />nextcol<span style="color: rgb(51,153,51)">:</span>                        <span style="font-style: italic; color: rgb(102,102,102)">;read col2</span> <br />        <span style="color: rgb(0,0,127); font-weight: bold">jb</span> col2<span style="color: rgb(51,153,51)">,</span> nextcol1       <span style="font-style: italic; color: rgb(102,102,102)">;check if second key is pressed</span> <br />        <span style="color: rgb(0,0,127); font-weight: bold">jnb</span> col2<span style="color: rgb(51,153,51)">,</span>$              <span style="font-style: italic; color: rgb(102,102,102)">;if yes then wait for key release</span> <br />        <span style="color: rgb(0,0,127); font-weight: bold">inc</span> keyval              <span style="font-style: italic; color: rgb(102,102,102)">;its key number 2</span> <br />        <span style="color: rgb(0,0,127); font-weight: bold">setb</span> pressed            <span style="font-style: italic; color: rgb(102,102,102)">;set the flag</span> <br />        <span style="color: rgb(0,0,127); font-weight: bold">ret</span> <br /> <br />nextcol1<span style="color: rgb(51,153,51)">:</span>                       <span style="font-style: italic; color: rgb(102,102,102)">;read col3</span> <br />        <span style="color: rgb(0,0,127); font-weight: bold">jb</span> col3<span style="color: rgb(51,153,51)">,</span> nextcol2       <span style="font-style: italic; color: rgb(102,102,102)">;check if third key is pressed</span> <br />        <span style="color: rgb(0,0,127); font-weight: bold">jnb</span> col3<span style="color: rgb(51,153,51)">,</span>$              <span style="font-style: italic; color: rgb(102,102,102)">;if yes then wait for key release</span> <br />        <span style="color: rgb(0,0,127); font-weight: bold">inc</span> keyval              <span style="font-style: italic; color: rgb(102,102,102)">;its key 3</span> <br />        <span style="color: rgb(0,0,127); font-weight: bold">inc</span> keyval <br />        <span style="color: rgb(0,0,127); font-weight: bold">setb</span> pressed            <span style="font-style: italic; color: rgb(102,102,102)">;set the flag</span> <br />        <span style="color: rgb(0,0,127); font-weight: bold">ret</span> <br /> <br />nextcol2<span style="color: rgb(51,153,51)">:</span>                       <span style="font-style: italic; color: rgb(102,102,102)">;read column 4</span> <br />        <span style="color: rgb(0,0,127); font-weight: bold">jb</span> col4<span style="color: rgb(51,153,51)">,</span> <span style="color: rgb(0,0,0); font-weight: bold">exit</span>           <span style="font-style: italic; color: rgb(102,102,102)">;check if fourth key pressed</span> <br />        <span style="color: rgb(0,0,127); font-weight: bold">jnb</span> col4<span style="color: rgb(51,153,51)">,</span>$              <span style="font-style: italic; color: rgb(102,102,102)">;if yes then wait for key release</span> <br />        <span style="color: rgb(0,0,127); font-weight: bold">inc</span> keyval              <span style="font-style: italic; color: rgb(102,102,102)">;its key 4</span> <br />        <span style="color: rgb(0,0,127); font-weight: bold">inc</span> keyval <br />        <span style="color: rgb(0,0,127); font-weight: bold">inc</span> keyval <br />        <span style="color: rgb(0,0,127); font-weight: bold">setb</span> pressed            <span style="font-style: italic; color: rgb(102,102,102)">;set the flag</span> <br />        <span style="color: rgb(0,0,127); font-weight: bold">ret</span> <br /> <br /><span style="color: rgb(0,0,0); font-weight: bold">exit</span><span style="color: rgb(51,153,51)">:</span>                           <span style="font-style: italic; color: rgb(102,102,102)">;if no key is pressed</span> <br />        <span style="color: rgb(0,0,127); font-weight: bold">clr</span> pressed             <span style="font-style: italic; color: rgb(102,102,102)">;clr the flag</span> <br />        <span style="color: rgb(0,0,127); font-weight: bold">clr</span> keyval              <span style="font-style: italic; color: rgb(102,102,102)">;reset the number</span> <br />        <span style="color: rgb(0,0,127); font-weight: bold">ret</span> <br /> <br />        <span style="color: rgb(0,0,0); font-weight: bold">end</span> <br /> </div> </div> <h3>Programming AVR in C for ADC0804</h3> <div class="code_asm">CODE:</div> <div style="unicode-bidi: embed; direction: ltr" class="code_highlight"> <div style="font-family: monospace" class="c"><span style="color: rgb(51,153,51)">#include <AT89X51.H>    //Include file for 8051</span> <br /><span style="color: rgb(51,153,51)">#define keyport P2      //keypad connected to P2</span> <br /><span style="color: rgb(51,153,51)">#define col1 P2_0       //column 1</span> <br /><span style="color: rgb(51,153,51)">#define col2 P2_1       //column 2</span> <br /><span style="color: rgb(51,153,51)">#define col3 P2_2       //column 3</span> <br /><span style="color: rgb(51,153,51)">#define col4 P2_3       //column 4</span> <br /><span style="color: rgb(51,153,51)">#define TRUE 1          //some defines</span> <br /><span style="color: rgb(51,153,51)">#define FALSE 0</span> <br /> <br /><span style="font-style: italic; color: rgb(128,128,128)">/* <br />+---------------------------------------+ <br />| Prototype: void key_init(void);       | <br />| Return Type: void                     | <br />| Arguments: None                       | <br />| Description: Initialize ports and     | <br />|              Keypad.                  | <br />+---------------------------------------+ <br />*/</span> <br /><span style="color: rgb(153,51,51)">void</span> key_init<span style="color: rgb(0,153,0)">(</span><span style="color: rgb(0,153,0)">)</span><span style="color: rgb(0,153,0)">{</span> <br />        keyport <span style="color: rgb(51,153,51)">&=</span><span style="color: rgb(32,128,128)">0x0F</span><span style="color: rgb(51,153,51)">;</span> <span style="font-style: italic; color: rgb(102,102,102)">//make Rows as o/p and cols are i/p</span> <br /><span style="color: rgb(0,153,0)">}</span> <br /> <br /><span style="font-style: italic; color: rgb(128,128,128)">/* <br />+-----------------------------------------------+ <br />| Prototype: unsigned char get_key(void);       | <br />| Return Type: unsigned char                    | <br />| Arguments: None                               | <br />| Description: To read key from the keypad      | <br />+-----------------------------------------------+ <br />*/</span> <br /><span style="color: rgb(153,51,51)">unsigned</span> <span style="color: rgb(153,51,51)">char</span> get_key<span style="color: rgb(0,153,0)">(</span><span style="color: rgb(0,153,0)">)</span><span style="color: rgb(0,153,0)">{</span> <br />        <span style="color: rgb(153,51,51)">unsigned</span> <span style="color: rgb(153,51,51)">char</span> i<span style="color: rgb(51,153,51)">,</span>k<span style="color: rgb(51,153,51)">,</span>key<span style="color: rgb(51,153,51)">=</span><span style="color: rgb(0,0,221)">0</span><span style="color: rgb(51,153,51)">;</span> <br />        k<span style="color: rgb(51,153,51)">=</span><span style="color: rgb(0,0,221)">1</span><span style="color: rgb(51,153,51)">;</span> <br />        <span style="color: rgb(177,177,0)">for</span><span style="color: rgb(0,153,0)">(</span>i<span style="color: rgb(51,153,51)">=</span><span style="color: rgb(0,0,221)">0</span><span style="color: rgb(51,153,51)">;</span>i<span style="color: rgb(51,153,51)"><</span><span style="color: rgb(0,0,221)">4</span><span style="color: rgb(51,153,51)">;</span>i<span style="color: rgb(51,153,51)">++</span><span style="color: rgb(0,153,0)">)</span><span style="color: rgb(0,153,0)">{</span>               <span style="font-style: italic; color: rgb(102,102,102)">//loop for 4 rows</span> <br />                keyport <span style="color: rgb(51,153,51)">&=</span>~<span style="color: rgb(0,153,0)">(</span><span style="color: rgb(32,128,128)">0x80</span><span style="color: rgb(51,153,51)">>></span>i<span style="color: rgb(0,153,0)">)</span><span style="color: rgb(51,153,51)">;</span>   <span style="font-style: italic; color: rgb(102,102,102)">//to make rows low 1 by 1</span> <br />                        <span style="color: rgb(177,177,0)">if</span><span style="color: rgb(0,153,0)">(</span><span style="color: rgb(51,153,51)">!</span>col1<span style="color: rgb(0,153,0)">)</span><span style="color: rgb(0,153,0)">{</span>      <span style="font-style: italic; color: rgb(102,102,102)">//check if key1 is pressed</span> <br />                                key <span style="color: rgb(51,153,51)">=</span> k<span style="color: rgb(51,153,51)">+</span><span style="color: rgb(0,0,221)">0</span><span style="color: rgb(51,153,51)">;</span>      <span style="font-style: italic; color: rgb(102,102,102)">//set key number</span> <br />                                <span style="color: rgb(177,177,0)">while</span><span style="color: rgb(0,153,0)">(</span><span style="color: rgb(51,153,51)">!</span>col1<span style="color: rgb(0,153,0)">)</span><span style="color: rgb(51,153,51)">;</span>   <span style="font-style: italic; color: rgb(102,102,102)">//wait for release</span> <br />                                <span style="color: rgb(177,177,0)">return</span> key<span style="color: rgb(51,153,51)">;</span>     <span style="font-style: italic; color: rgb(102,102,102)">//return key number</span> <br />                        <span style="color: rgb(0,153,0)">}</span> <br />                        <span style="color: rgb(177,177,0)">if</span><span style="color: rgb(0,153,0)">(</span><span style="color: rgb(51,153,51)">!</span>col2<span style="color: rgb(0,153,0)">)</span><span style="color: rgb(0,153,0)">{</span>      <span style="font-style: italic; color: rgb(102,102,102)">//check if key2 is pressed</span> <br />                                key <span style="color: rgb(51,153,51)">=</span> k<span style="color: rgb(51,153,51)">+</span><span style="color: rgb(0,0,221)">1</span><span style="color: rgb(51,153,51)">;</span>      <span style="font-style: italic; color: rgb(102,102,102)">//set key number</span> <br />                                <span style="color: rgb(177,177,0)">while</span><span style="color: rgb(0,153,0)">(</span><span style="color: rgb(51,153,51)">!</span>col2<span style="color: rgb(0,153,0)">)</span><span style="color: rgb(51,153,51)">;</span>   <span style="font-style: italic; color: rgb(102,102,102)">//wait for release</span> <br />                                <span style="color: rgb(177,177,0)">return</span> key<span style="color: rgb(51,153,51)">;</span>     <span style="font-style: italic; color: rgb(102,102,102)">//return key number</span> <br />                        <span style="color: rgb(0,153,0)">}</span> <br />                        <span style="color: rgb(177,177,0)">if</span><span style="color: rgb(0,153,0)">(</span><span style="color: rgb(51,153,51)">!</span>col3<span style="color: rgb(0,153,0)">)</span><span style="color: rgb(0,153,0)">{</span>      <span style="font-style: italic; color: rgb(102,102,102)">//check if key3 is pressed</span> <br />                                key <span style="color: rgb(51,153,51)">=</span> k<span style="color: rgb(51,153,51)">+</span><span style="color: rgb(0,0,221)">2</span><span style="color: rgb(51,153,51)">;</span>      <span style="font-style: italic; color: rgb(102,102,102)">//set key number</span> <br />                                <span style="color: rgb(177,177,0)">while</span><span style="color: rgb(0,153,0)">(</span><span style="color: rgb(51,153,51)">!</span>col3<span style="color: rgb(0,153,0)">)</span><span style="color: rgb(51,153,51)">;</span>   <span style="font-style: italic; color: rgb(102,102,102)">//wait for release</span> <br />                                <span style="color: rgb(177,177,0)">return</span> key<span style="color: rgb(51,153,51)">;</span>     <span style="font-style: italic; color: rgb(102,102,102)">//return key number</span> <br />                        <span style="color: rgb(0,153,0)">}</span> <br />                        <span style="color: rgb(177,177,0)">if</span><span style="color: rgb(0,153,0)">(</span><span style="color: rgb(51,153,51)">!</span>col4<span style="color: rgb(0,153,0)">)</span><span style="color: rgb(0,153,0)">{</span>      <span style="font-style: italic; color: rgb(102,102,102)">//check if key4 is pressed</span> <br />                                key <span style="color: rgb(51,153,51)">=</span> k<span style="color: rgb(51,153,51)">+</span><span style="color: rgb(0,0,221)">3</span><span style="color: rgb(51,153,51)">;</span>      <span style="font-style: italic; color: rgb(102,102,102)">//set key number</span> <br />                                <span style="color: rgb(177,177,0)">while</span><span style="color: rgb(0,153,0)">(</span><span style="color: rgb(51,153,51)">!</span>col4<span style="color: rgb(0,153,0)">)</span><span style="color: rgb(51,153,51)">;</span>   <span style="font-style: italic; color: rgb(102,102,102)">//wait for release</span> <br />                                <span style="color: rgb(177,177,0)">return</span> key<span style="color: rgb(51,153,51)">;</span>     <span style="font-style: italic; color: rgb(102,102,102)">//return key number</span> <br />                        <span style="color: rgb(0,153,0)">}</span> <br />                k<span style="color: rgb(51,153,51)">+=</span><span style="color: rgb(0,0,221)">4</span><span style="color: rgb(51,153,51)">;</span>                   <span style="font-style: italic; color: rgb(102,102,102)">//next row key number</span> <br />                keyport <span style="color: rgb(51,153,51)">|=</span> <span style="color: rgb(32,128,128)">0x80</span><span style="color: rgb(51,153,51)">>></span>i<span style="color: rgb(51,153,51)">;</span>     <span style="font-style: italic; color: rgb(102,102,102)">//make the row high again</span> <br />        <span style="color: rgb(0,153,0)">}</span> <br />        <span style="color: rgb(177,177,0)">return</span> FALSE<span style="color: rgb(51,153,51)">;</span>                   <span style="font-style: italic; color: rgb(102,102,102)">//return false if no key pressed</span> <br /><span style="color: rgb(0,153,0)">}</span> <br /> </div> </div> <p>Selamat mencoba dan terimakasih telah mebaca tulisan saya. Semoga bermanfaat.</p> <div class="blogger-post-footer"><p align="left"><a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_US"><img align="left" style="border-width: 0px; margin: 8px 20px 0px 0px; display: inline;" src="http://i.creativecommons.org/l/by-nc-sa/3.0/88x31.png" alt="Creative Commons License"/></a><i> You may share this document under Creative Commons License – </i>Terima kasih telah membaca tulisan ini. © 2011 Ari Sulistiono, <em>Indonesian Electrical Engineer</em>.</p></div>Ari Sulistionohttp://www.blogger.com/profile/00609115698913694796noreply@blogger.com3tag:blogger.com,1999:blog-7098167171686473800.post-34149196217846419732010-02-18T07:00:00.000+07:002010-02-22T15:33:29.973+07:00Pulse Width Modulation (PWM): Contoh Program Mikon<p></p> <p><img style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; margin: 5px 25px 10px 0px; border-right-width: 0px" height="100" src="http://lh6.ggpht.com/_gWMAlrMzovc/S3z0gaH0jOI/AAAAAAAABa8/xP4aQFJkylI/image_thumb[10].png?imgmax=800" width="100" align="left" border="0" />Artikel ini merupakan sambungan artikel saya yang berjudul “<strong><em><a href="http://www.ari-sty.cz.cc/2010/02/pulse-width-modulation-pwm-pengenalan.html" target="_blank">Pulse Width Modulation (PWM): Pengenalan</a></em></strong>”. Jika <em>readers</em> telah memahami dengan baik inti utama di balik PWM, maka kali ini saya ingin mengajak <em>readers</em> untuk praktek langsung dan mencoba mengimplementasikan pemahaman tersebut ke dalam sebuah program <em>microcontroller</em>.</p> <h3></h3> <h3>Gagasan dibalik Implementasi</h3> <p>Gagasan/ide dasar dibalik implementasi PWM pada microcontroller adalah penggunaan timer dan perubahan status (<em>switching</em>) <em>high </em>dan<em> low</em> ke dalam salah satu pin I/O yang terdapat pada salah satu port microcontroller dengan interval tertentu yang sudah didefinisikan. Seperti yang telah kita bahas pada artikel pengenalan PWM, bahwasanya dengan pengubahan waktu T<sub>on</sub>, kita dapat memvariasikan lebar gelombang kotak dengan menjaga periode gelombang yang sama/tetap. Sehingga diperoleh nilai tegangan yang bervariasi pula.</p> <p> </p> <font face="Arial" color="#397a44" size="4">►Contoh Kode ASM</font> <br /> <br /><font face="Arial" color="#397a44">►Inisialisasi Timer untuk PWM</font> <br /> <div class="code_asm">CODE:</div> <table cellspacing="0" cellpadding="2" width="400" border="0"><tbody> <tr> <td valign="top" width="400"> <div class="code_highlight" style="direction: ltr; unicode-bidi: embed"> <div class="asm" style="font-family: monospace">        PWMPIN <span style="font-weight: bold; color: rgb(0,0,0)">EQU</span> <span style="color: rgb(0,0,127)">P1</span><span style="color: rgb(51,153,51)">.</span>0         <span style="color: rgb(102,102,102); font-style: italic">; PWM output pin</span> <br />PWM_SETUP<span style="color: rgb(51,153,51)">:</span> <br />        <span style="font-weight: bold; color: rgb(0,0,127)">MOV</span> <span style="color: rgb(0,0,127)">TMOD</span><span style="color: rgb(51,153,51)">,#</span><span style="color: rgb(0,0,255)">00H</span>           <span style="color: rgb(102,102,102); font-style: italic">; Timer0 in Mode 0</span> <br />        <span style="font-weight: bold; color: rgb(0,0,127)">MOV</span> <span style="color: rgb(0,0,127)">R7</span><span style="color: rgb(51,153,51)">,</span> <span style="color: rgb(51,153,51)">#</span><span style="color: rgb(0,0,255)">160</span>             <span style="color: rgb(102,102,102); font-style: italic">; Set pulse width control</span> <br />                                <span style="color: rgb(102,102,102); font-style: italic">; The value loaded in R7 is value X as</span> <br />                                <span style="color: rgb(102,102,102); font-style: italic">; discussed above.</span> <br />        <span style="font-weight: bold; color: rgb(0,0,127)">SETB</span> EA                 <span style="color: rgb(102,102,102); font-style: italic">; Enable Interrupts</span> <br />        <span style="font-weight: bold; color: rgb(0,0,127)">SETB</span> ET0                <span style="color: rgb(102,102,102); font-style: italic">; Enable Timer 0 Interrupt</span> <br />        <span style="font-weight: bold; color: rgb(0,0,127)">SETB</span> TR0                <span style="color: rgb(102,102,102); font-style: italic">; Start Timer</span> <br />        <span style="font-weight: bold; color: rgb(0,0,127)">RET</span> </div> </div> </td> </tr> </tbody></table> <div class="code_highlight" style="direction: ltr; unicode-bidi: embed"><font face="Arial" color="#397a44">►Interrupt Service Routine</font> <br />CODE:</div> <table cellspacing="0" cellpadding="2" width="604" border="0"><tbody> <tr> <td valign="top" width="602"><font face="Courier">TIMER_0_INTERRUPT<span style="color: rgb(51,153,51)">:</span> <br />        <span style="font-weight: bold; color: rgb(0,0,127)">JB</span> F0<span style="color: rgb(51,153,51)">,</span> HIGH_DONE   <span style="color: rgb(102,102,102); font-style: italic">; If F0 flag is set then we just finished</span>  <br />                           <span style="color: rgb(102,102,102); font-style: italic">; the high section of the</span> <br />LOW_DONE<span style="color: rgb(51,153,51)">:</span>                  <span style="color: rgb(102,102,102); font-style: italic">; cycle so Jump to HIGH_DONE</span> <br />        <span style="font-weight: bold; color: rgb(0,0,127)">SETB</span> F0            <span style="color: rgb(102,102,102); font-style: italic">; Make F0=1 to indicate start of high section</span> <br />        <span style="font-weight: bold; color: rgb(0,0,127)">SETB</span> PWMPIN        <span style="color: rgb(102,102,102); font-style: italic">; Make PWM output pin High</span> <br />        <span style="font-weight: bold; color: rgb(0,0,127)">MOV</span> <span style="color: rgb(0,0,127)">TH0</span><span style="color: rgb(51,153,51)">,</span> <span style="color: rgb(0,0,127)">R7</span>        <span style="color: rgb(102,102,102); font-style: italic">; Load high byte of timer with R7</span>  <br />                           <span style="color: rgb(102,102,102); font-style: italic">; (pulse width control value)</span> <br />        <span style="font-weight: bold; color: rgb(0,0,127)">CLR</span> TF0            <span style="color: rgb(102,102,102); font-style: italic">; Clear the Timer 0 interrupt flag</span> <br />        <span style="font-weight: bold; color: rgb(0,0,127)">RETI</span>               <span style="color: rgb(102,102,102); font-style: italic">; Return from Interrupt to where</span>  <br />                            <span style="color: rgb(102,102,102); font-style: italic">; the program came from</span> <br />HIGH_DONE<span style="color: rgb(51,153,51)">:</span> <br />        <span style="font-weight: bold; color: rgb(0,0,127)">CLR</span> F0              <span style="color: rgb(102,102,102); font-style: italic">; Make F0=0 to indicate start of low section</span> <br />        <span style="font-weight: bold; color: rgb(0,0,127)">CLR</span> PWMPIN          <span style="color: rgb(102,102,102); font-style: italic">; Make PWM output pin low</span> <br />        <span style="font-weight: bold; color: rgb(0,0,127)">MOV</span> <span style="color: rgb(0,0,127)">A</span><span style="color: rgb(51,153,51)">,</span> <span style="color: rgb(51,153,51)">#</span><span style="color: rgb(0,0,255)">0FFH</span>        <span style="color: rgb(102,102,102); font-style: italic">; Move FFH (255) to A</span> <br />        <span style="font-weight: bold; color: rgb(0,0,127)">CLR</span> <span style="font-weight: bold; color: rgb(0,0,0)">C</span>               <span style="color: rgb(102,102,102); font-style: italic">; Clear C (the carry bit) so it does</span>  <br />                             <span style="color: rgb(102,102,102); font-style: italic">; not affect the subtraction</span> <br />        <span style="font-weight: bold; color: rgb(0,0,127)">SUBB</span> <span style="color: rgb(0,0,127)">A</span><span style="color: rgb(51,153,51)">,</span> <span style="color: rgb(0,0,127)">R7</span>          <span style="color: rgb(102,102,102); font-style: italic">; Subtract R7 from A. A = 255 - R7.</span> <br />        <span style="font-weight: bold; color: rgb(0,0,127)">MOV</span> <span style="color: rgb(0,0,127)">TH0</span><span style="color: rgb(51,153,51)">,</span> <span style="color: rgb(0,0,127)">A</span>          <span style="color: rgb(102,102,102); font-style: italic">; so the value loaded into TH0 + R7 = 255</span> <br />        <span style="font-weight: bold; color: rgb(0,0,127)">CLR</span> TF0             <span style="color: rgb(102,102,102); font-style: italic">; Clear the Timer 0 interrupt flag</span> <br />        <span style="font-weight: bold; color: rgb(0,0,127)">RETI</span>                <span style="color: rgb(102,102,102); font-style: italic">; Return from Interrupt to where</span>  <br />                             <span style="color: rgb(102,102,102); font-style: italic">; the program came from</span></font> </td> </tr> </tbody></table> <div class="code_highlight" style="direction: ltr; unicode-bidi: embed"> <div class="asm" style="font-family: monospace"> </div> </div> <p>Di dalam program utama, kamu harus memanggil <em>routine</em> “PWM_SETUP” dan microcontroller kamu akan mengeluarkan PWM output pada pin yang ditunjuk. Pada kode diatas, keluaran PWM diberikan pada port 1 bit ke 1 (P1.1), pilih pin yang akan digunakan sesuka hati sesuai alur program diatas.</p> <p><em>Timer Interrupt service routine</em> akan menangani pengendalian lebar pulsa (PWM) di belakang layar. Lebar pulsa dapat dirubah dengan merubah nilai register R7. Pada contoh diatas, saya gunakan 160, kamu dapat memilih nilai sembarang dari 0 s/d 255. R7 = 0 akan memberikan nilai keluaran tegangan sebesar 0 Volt, dan sebailknya R7 = 255 akan memberikan nilai tegangan kurang lebih sebesar 5 Volt.</p> <p>Kamu juga dapat menggunakan Timer1 jika dirasa perlu. Jumlah pin <em>microcontroller</em> sangat beraneka ragam, sebaiknya merujuk ke <em>datasheet</em> <em>microcontroller</em> yang digunakan. Disini hanya diterangkan <em>alogarithm</em> programnya saja, untuk skematik silahkan kembangkan sesuai keinginan masing-masing.</p> <p> </p> <p><font face="Arial" color="#397a44" size="4">►Contoh Kode Bahasa C</font> <br /> <br /><font face="Arial" color="#397a44">►Inisialisasi Timer untuk PWM dalam bahasa C</font> </p> <div class="code_box">CODE:</div> <table cellspacing="0" cellpadding="2" width="400" border="0"><tbody> <tr> <td valign="top" width="400"> <div class="code_box"><span style="color: rgb(102,102,102); font-style: italic">//Global variables and definition</span> <br /><span style="color: rgb(51,153,51)">#define PWMPIN P1_0</span> <br /> <br /><span style="color: rgb(153,51,51)">unsigned</span> <span style="color: rgb(153,51,51)">char</span> pwm_width<span style="color: rgb(51,153,51)">;</span> <br /> <br /><span style="color: rgb(153,51,51)">void</span> pwm_setup<span style="color: rgb(0,153,0)">(</span><span style="color: rgb(0,153,0)">)</span><span style="color: rgb(0,153,0)">{</span> <br />        TMOD <span style="color: rgb(51,153,51)">=</span> <span style="color: rgb(0,0,221)">0</span><span style="color: rgb(51,153,51)">;</span> <br />        pwm_width <span style="color: rgb(51,153,51)">=</span> <span style="color: rgb(0,0,221)">160</span><span style="color: rgb(51,153,51)">;</span> <br />        EA <span style="color: rgb(51,153,51)">=</span> <span style="color: rgb(0,0,221)">1</span><span style="color: rgb(51,153,51)">;</span> <br />        ET0 <span style="color: rgb(51,153,51)">=</span> <span style="color: rgb(0,0,221)">1</span><span style="color: rgb(51,153,51)">;</span> <br />        TR0 <span style="color: rgb(51,153,51)">=</span> <span style="color: rgb(0,0,221)">1</span><span style="color: rgb(51,153,51)">;</span> <br /><span style="color: rgb(0,153,0)">}</span> </div> </td> </tr> </tbody></table> <font face="Arial" color="#397a44">►Interrupt Service Routine</font> <br /> <div class="code_box">CODE:</div> <table cellspacing="0" cellpadding="2" width="400" border="0"><tbody> <tr> <td valign="top" width="400"><span style="color: rgb(153,51,51)">void</span> timer0<span style="color: rgb(0,153,0)">(</span><span style="color: rgb(0,153,0)">)</span> <span style="color: rgb(177,177,0)">interrupt</span> <span style="color: rgb(0,0,221)">1</span> <span style="color: rgb(0,153,0)">{</span> <br />        <span style="color: rgb(177,177,0)">if</span><span style="color: rgb(0,153,0)">(</span><span style="color: rgb(51,153,51)">!</span>F0<span style="color: rgb(0,153,0)">)</span> <span style="color: rgb(0,153,0)">{</span>                                    <span style="color: rgb(102,102,102); font-style: italic">//Start of High level</span> <br />                F0 <span style="color: rgb(51,153,51)">=</span> <span style="color: rgb(0,0,221)">1</span><span style="color: rgb(51,153,51)">;                            </span> <span style="color: rgb(102,102,102); font-style: italic">//Set flag</span> <br />                PWMPIN <span style="color: rgb(51,153,51)">=</span> <span style="color: rgb(0,0,221)">1</span><span style="color: rgb(51,153,51)">;</span>                    <span style="color: rgb(102,102,102); font-style: italic">//Set PWM o/p pin</span> <br />                TH0 <span style="color: rgb(51,153,51)">=</span> pwm_width<span style="color: rgb(51,153,51)">;</span>           <span style="color: rgb(102,102,102); font-style: italic">//Load timer</span> <br />                TF0 <span style="color: rgb(51,153,51)">=</span> <span style="color: rgb(0,0,221)">0</span><span style="color: rgb(51,153,51)">;</span>                          <span style="color: rgb(102,102,102); font-style: italic">//Clear interrupt flag</span> <br />                <span style="color: rgb(177,177,0)">return</span><span style="color: rgb(51,153,51)">;</span>                            <span style="color: rgb(102,102,102); font-style: italic">//Return</span> <br />        <span style="color: rgb(0,153,0)">}</span> <br />        <span style="color: rgb(177,177,0)">else</span> <span style="color: rgb(0,153,0)">{</span>                                      <span style="color: rgb(102,102,102); font-style: italic">//Start of Low level</span> <br />                F0 <span style="color: rgb(51,153,51)">=</span> <span style="color: rgb(0,0,221)">0</span><span style="color: rgb(51,153,51)">;</span>                            <span style="color: rgb(102,102,102); font-style: italic">//Clear flag</span> <br />                PWMPIN <span style="color: rgb(51,153,51)">=</span> <span style="color: rgb(0,0,221)">0</span><span style="color: rgb(51,153,51)">;</span>                   <span style="color: rgb(102,102,102); font-style: italic">//Clear PWM o/p pin</span> <br />                TH0 <span style="color: rgb(51,153,51)">=</span> <span style="color: rgb(0,0,221)">255</span> <span style="color: rgb(51,153,51)">-</span> pwm_width<span style="color: rgb(51,153,51)">;</span>  <span style="color: rgb(102,102,102); font-style: italic">//Load timer</span> <br />                TF0 <span style="color: rgb(51,153,51)">=</span> <span style="color: rgb(0,0,221)">0</span><span style="color: rgb(51,153,51)">;</span>                         <span style="color: rgb(102,102,102); font-style: italic">//Clear Interrupt flag</span> <br />                <span style="color: rgb(177,177,0)">return</span><span style="color: rgb(51,153,51)">;</span>                           <span style="color: rgb(102,102,102); font-style: italic">//return</span> <br />        <span style="color: rgb(0,153,0)">}</span> <br /><span style="color: rgb(0,153,0)">}</span> </td> </tr> </tbody></table> <div class="code_highlight" style="direction: ltr; unicode-bidi: embed"> <div class="c" style="font-family: monospace"> </div> </div> <blockquote> <p><em>Catatan:</em></p> <p><em>Tanda “ ; ” Merupakan tanda awal comment atau keterangan untuk memperjelas detil program. Berlaku pada satu baris dan dipakai dalam bahasa pemrograman ASM saja. Semua yang berada dibelakang tanda ini (dalam satu baris) tidak akan dieksekusi oleh compiler atau dabaikan.</em></p> <p><em>Tanda “//” <em>Merupakan tanda awal comment atau keterangan untuk memperjelas detil program. Berlaku pada satu baris dan biasanya terdapat pada bahasa pemrograman C saja. Semua yang berada dibelakang tanda ini (dalam satu baris) tidak akan dieksekusi oleh compiler atau dabaikan.</em></em></p> </blockquote> <p><em>Compile</em> dan <em>transfer</em> program kamu tersebut ke dalam <em>microcontroller.</em> Sekarang <em>microcontroller</em> kamu sudah dapat menghasilkan keluaran PWM. Untuk melihatnya, gunakan modul LED atau multimeter sebagai indicator tegangan keluaran yang dihasilkan oleh PWM <em>microcontroller</em>, rubah dan variasikan sesukamu nilai R7 atau “pwm_width” dengan nilai antara 0 s/d 255. </p> <p>Untuk aplikasi berikutnya, coba gunakan motor DC dan atur kecepatanya. Dan tentunya diperlukan rangkaian motor driver, ingat motor atau perangkat luar lainya jangan dipasang langsung ke <em>microcontroller</em> meski motor “<em>tamiya</em>” sekalipun <img title=":hammer" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="19" alt=":hammer" src="http://lh6.ggpht.com/_gWMAlrMzovc/S4Io4ihFTsI/AAAAAAAABgE/tAAILGd6rtk/hammer%5B3%5D.gif?imgmax=800" width="19" border="0" />. Kejutan listrik di tiap pin <em>microcontroller</em> ataupun fluktuasi tegangan dapat membuat <em>microcontroller</em> mudah <em>“hung”</em> (baca: heng) dan cepat rusak.  <img title=":nangis" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="20" alt=":nangis" src="http://lh4.ggpht.com/_gWMAlrMzovc/S4Io553Wz0I/AAAAAAAABgI/4UdX474RICg/nangis%5B3%5D.gif?imgmax=800" width="20" border="0" /> (end.)</p> <p><font color="#c0c0c0">-::|Tks-Ari|::-</font></p> <table cellspacing="0" cellpadding="0" width="664" border="0"><tbody> <tr> <td align="center" width="38"><a href="http://www.ari-sty.cz.cc/feeds/posts/default/-/Microcontroller"><img title="Silahkan baca artikel saya yang lain mengenai microcontroller via RSS Feed.." height="40" alt="Silahkan baca artikel saya yang lain mengenai microcontroller via RSS Feed.." src="http://lh5.ggpht.com/_gWMAlrMzovc/S3znwfFPioI/AAAAAAAABbI/oMlaCAjQ8BY/baca%20RSS%5B1%5D.png?imgmax=800" width="37" border="0" /></a></td> <td valign="top" width="624"> <p><em><img title="Informasi!" height="16" alt="Informasi!" src="http://lh3.ggpht.com/_gWMAlrMzovc/S3znxLx2EcI/AAAAAAAABaU/WuN8Jvbrr6o/comment5.png?imgmax=800" width="16" align="left" border="0" /> Artikel ini adalah tulisan rintisan, <img title="Artikel ini adalah untuk semua orang" height="16" alt="Artikel ini adalah untuk semua orang" src="http://lh6.ggpht.com/_gWMAlrMzovc/S3znxn4zfzI/AAAAAAAABaY/s1TAV0oyKPE/users_164.png?imgmax=800" width="16" border="0" /> saran, pertanyaan dan kritik anda sangat berguna dalam mengembangkan artikel ini.   Postingan ini dibagi ke dalam beberapa sub pokok bahasan. <br /><img title="Under "Microcontroller Projects" Folder" height="15" alt="Under "Microcontroller Projects" Folder" src="http://lh5.ggpht.com/_gWMAlrMzovc/S3znypc6ApI/AAAAAAAABac/0lfklPknytk/button4.png?imgmax=800" width="80" border="0" /> <img title="Creative Commons (cc), Share Alike (sa)" height="15" alt="Creative Commons (cc), Share Alike (sa)" src="http://lh6.ggpht.com/_gWMAlrMzovc/S3znzA1drtI/AAAAAAAABag/JFfQzdj8kqA/80x15a4.png?imgmax=800" width="30" border="0" /></em></p> </td> </tr> </tbody></table> <div class="blogger-post-footer"></div> <div class="blogger-post-footer"><p align="left"><a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_US"><img align="left" style="border-width: 0px; margin: 8px 20px 0px 0px; display: inline;" src="http://i.creativecommons.org/l/by-nc-sa/3.0/88x31.png" alt="Creative Commons License"/></a><i> You may share this document under Creative Commons License – </i>Terima kasih telah membaca tulisan ini. © 2011 Ari Sulistiono, <em>Indonesian Electrical Engineer</em>.</p></div>Ari Sulistionohttp://www.blogger.com/profile/00609115698913694796noreply@blogger.com0tag:blogger.com,1999:blog-7098167171686473800.post-33837924992681110192010-02-17T19:02:00.000+07:002010-02-18T15:30:00.284+07:00Pulse Width Modulation (PWM): Pengenalan<h2>Pengenalan</h2> <p><a href="http://lh5.ggpht.com/_gWMAlrMzovc/S3z0fWDP-cI/AAAAAAAABa4/QN6hfWhMJIw/s1600-h/image%5B18%5D.png"><img title="image" style="border-right: 0px; border-top: 0px; display: inline; margin: 0px 0px 0px 25px; border-left: 0px; border-bottom: 0px" height="103" alt="image" src="http://lh6.ggpht.com/_gWMAlrMzovc/S3z0gaH0jOI/AAAAAAAABa8/xP4aQFJkylI/image_thumb%5B10%5D.png?imgmax=800" width="103" align="right" border="0" /></a> Pengaturan lebar pulsa modulasi atau PWM merupakan salah satu teknik yang “a<em>mpuh</em>” yang digunakan dalam sistem kendali (<em>control system</em>) saat ini. Pengaturan lebar modulasi dipergunakan di berbagai bidang yang sangat luas, salah satu diantaranya adalah: <em>speed control (kendali kecepatan), power control (kendali sistem tenaga), measurement and communication (pengukuran atau instrumentasi dan telekomunikasi)</em>. </p> <p>Di dalam tutorial yang akan saya bahas kali ini akan mengajak anda mengenal dasar-dasar PWM dan implementasi PWM dengan menggunakan <em>microcontroller</em>. <img title="Yuk! mari kita belajar santai di internet.." style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="16" alt="Yuk! mari kita belajar santai di internet.." src="http://lh4.ggpht.com/_gWMAlrMzovc/S3znohWF9II/AAAAAAAABZs/5wfNgzw7Z2U/glass4.png?imgmax=800" width="16" border="0" /> </p> <h2></h2> <a name='more'></a> <h2>Prinsip Dasar PWM</h2> <p>Modulasi lebar pulas (PWM) dicapai/diperoleh dengan bantuan sebuah gelombang kotak yang mana siklus kerja (<em>duty cycle</em>) gelombang dapat diubah-ubah untuk mendapatkan sebuah tegangan keluaran yang bervariasi yang merupakan nilai rata-rata dari gelombang tersebut. </p> <p>Lebih jelasnya mari kita simak gambar dibawah ini,</p> <p></p> <div class="wlWriterEditableSmartContent" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:d2e5ec77-58c6-4037-9568-57081c93f11e" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"><a href="http://lh4.ggpht.com/_gWMAlrMzovc/S3znpmKpe_I/AAAAAAAABZw/07_qLfY3wk4/squarewave8x6.gif?imgmax=800" title="Perhatikan gambar gelombang kotak (pulsa) yang ditunjukan oleh gambar diatas." rel="thumbnail"><img border="0" src="http://lh5.ggpht.com/_gWMAlrMzovc/S3znqi4KaSI/AAAAAAAABZ0/V5eJx6Novtw/squarewave4.png?imgmax=800" width="580" height="305" /></a></div> <p></p> <p><b>T<sub>on</sub></b> adalah waktu dimana tegangan keluaran berada pada posisi tinggi (baca: <em>high</em> atau <em>1</em>) dan,</p> <p><b>T<sub>off</sub></b> adalah waktu dimana tegangan keluaran berada pada posisi rendah (baca: <em>low</em> atau <em>0</em>).</p> <p>Anggap <b>T<sub>total</sub></b> adalah waktu satu siklus atau penjumlahan antara <b>T<sub>on </sub></b>dengan <b>T<sub>off </sub></b>, biasa dikenal dengan istilah “periode satu gelombang”.</p> <p><img title="Rumus T-total" style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" height="22" alt="Rumus T-total" src="http://lh3.ggpht.com/_gWMAlrMzovc/S3znrsmgvxI/AAAAAAAABZ4/p2UmeKTF1oE/eq13.gif?imgmax=800" width="119" border="0" /> </p> <p>Siklus kerja atau <em>duty cycle</em> sebuah gelombang di definisikan sebagai,</p> <p><img title="Rumus duty-cycle" style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" height="42" alt="Rumus duty-cycle" src="http://lh4.ggpht.com/_gWMAlrMzovc/S3znsKW7l6I/AAAAAAAABZ8/UzH5ZOCDJIA/dutycycle3.gif?imgmax=800" width="168" border="0" /> </p> <p>Tegangan keluaran dapat bervariasi dengan <em>duty-cycle</em> dan dapat dirumusan sebagai berikut,</p> <p><img title="Rumus Vout dengan duty-cycle" style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" height="20" alt="Rumus Vout dengan duty-cycle" src="http://lh5.ggpht.com/_gWMAlrMzovc/S3zntIqwp9I/AAAAAAAABaA/eXur2dXoha8/eq23.gif?imgmax=800" width="95" border="0" />sehingga: <img title="Rumus Vout" style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" height="45" alt="Rumus Vout" src="http://lh3.ggpht.com/_gWMAlrMzovc/S3znt0WXY_I/AAAAAAAABaE/Y_BjQ5jVV5c/eq33.gif?imgmax=800" width="122" border="0" /></p> <p>Dari rumus diatas dapat ditarik kesimpulan bahwa tegangan keluaran dapat diubah-ubah secara langsung dengan mengubah nilai <b>T<sub>on</sub></b>. </p> <p>Apabila <b>T<sub>on</sub></b> adalah 0, <b>V<sub>out</sub></b> juga akan 0. <br />Apabila <b>T<sub>on</sub></b> adalah <b>T<sub>total</sub></b> maka <b>V<sub>out</sub></b> adalah <b>V<sub>in</sub></b> atau katakanlah nilai maksimumnya.</p> <p>Penjelasan tersebut diatas merupakan keseluruhan dari teori dasar dibalik sistem PWM. Sekarang, mari kita kita lihat pada implementasi praktek dari teori PWM tersebut diatas pada sebuah microcontroller. </p> <p>(<em>to be continued..<img title="Nantikan di postingan berikutnya..." style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="16" alt="Nantikan di postingan berikutnya..." src="http://lh3.ggpht.com/_gWMAlrMzovc/S3znusb8w9I/AAAAAAAABaI/OmR76bbR1lQ/wink4.png?imgmax=800" width="16" border="0" /> </em>)</p> <p> </p> <p>-::|Tks-Ari|::-</p> <table cellspacing="0" cellpadding="2" width="686" border="0"><tbody> <tr> <td align="center" width="51"><a href="http://www.ari-sty.cz.cc/feeds/posts/default/-/Microcontroller" target="_blank"><img title="Silahkan baca artikel saya yang lain mengenai microcontroller via RSS Feed.." style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="40" alt="Silahkan baca artikel saya yang lain mengenai microcontroller via RSS Feed.." src="http://lh5.ggpht.com/_gWMAlrMzovc/S3znwfFPioI/AAAAAAAABbI/oMlaCAjQ8BY/baca%20RSS%5B1%5D.png?imgmax=800" width="37" border="0" /></a> </td> <td valign="top" width="633"><em><img title="Informasi!" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; margin-left: 0px; margin-right: 0px; border-right-width: 0px" height="16" alt="Informasi!" src="http://lh3.ggpht.com/_gWMAlrMzovc/S3znxLx2EcI/AAAAAAAABaU/WuN8Jvbrr6o/comment5.png?imgmax=800" width="16" align="left" border="0" /> Artikel ini adalah tulisan rintisan, <img title="Artikel ini adalah untuk semua orang" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="16" alt="Artikel ini adalah untuk semua orang" src="http://lh6.ggpht.com/_gWMAlrMzovc/S3znxn4zfzI/AAAAAAAABaY/s1TAV0oyKPE/users_164.png?imgmax=800" width="16" border="0" /> saran, pertanyaan dan kritik anda sangat berguna dalam mengembangkan artikel ini.   Postingan ini dibagi ke dalam beberapa sub pokok bahasan. <br /><img title="Under "Microcontroller Projects" Folder" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="15" alt="Under "Microcontroller Projects" Folder" src="http://lh5.ggpht.com/_gWMAlrMzovc/S3znypc6ApI/AAAAAAAABac/0lfklPknytk/button4.png?imgmax=800" width="80" border="0" />  <img title="Creative Commons (cc), Share Alike (sa)" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="15" alt="Creative Commons (cc), Share Alike (sa)" src="http://lh6.ggpht.com/_gWMAlrMzovc/S3znzA1drtI/AAAAAAAABag/JFfQzdj8kqA/80x15a4.png?imgmax=800" width="30" border="0" /> </em></td> </tr> </tbody></table> <div class="blogger-post-footer"><p align="left"><a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_US"><img align="left" style="border-width: 0px; margin: 8px 20px 0px 0px; display: inline;" src="http://i.creativecommons.org/l/by-nc-sa/3.0/88x31.png" alt="Creative Commons License"/></a><i> You may share this document under Creative Commons License – </i>Terima kasih telah membaca tulisan ini. © 2011 Ari Sulistiono, <em>Indonesian Electrical Engineer</em>.</p></div>Ari Sulistionohttp://www.blogger.com/profile/00609115698913694796noreply@blogger.com4tag:blogger.com,1999:blog-7098167171686473800.post-36498162175214586502010-01-30T11:35:00.002+07:002010-02-10T13:45:48.651+07:00Mengenal Dasar Pemrograman LCD (Liquid Crystal Display)<blockquote>Naskah berikut ini adalah hasil terjemahan kasar dan belum sempet dirapihkan. Mudah-mudahan besok dah kelar, lagi kekurangan bandwidth hari ini, tolong-tolong!</blockquote>Sekilas Tentang LCD<br />
<div class="wlWriterEditableSmartContent" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:9d936aa9-7ae7-4f13-8774-0056aacdf00f" style="display: inline; float: none; margin: 0px; padding: 0px;"><a 2x16="" href="http://lh5.ggpht.com/_gWMAlrMzovc/S2OOr762roI/AAAAAAAABWA/izd8w-j-TJM/lcd162byhy8x6.jpg?imgmax=800" rel="thumbnail" title="Contoh bentuk fisik LCD "><img border="0" height="291" src="http://lh4.ggpht.com/_gWMAlrMzovc/S2O3INcUMkI/AAAAAAAABWE/E1MFVUyvA9k/lcd162byhy13.png?imgmax=800" width="335" /></a></div>Umumnya, sebuah program <i>microcontroller</i> harus berinteraksi dengan dunia luar menggunakan perangkat input dan output yang menjadi antarmuka antara peralatan dengan manusia secara langsung. Salah satu perangkat yang paling umum yang melekat (terangkai) bersama rangkaian <i>microcontroller</i> adalah sebuah layar LCD. Beberapa LCD yang paling umum dihubungkan ke rangkaian <i>microcontroller</i> adalah <i>display</i> (layar LCD) <i>16x2</i> dan<i> 20x2</i>. Nilai-nilai ini masing-masing mempunyai arti sebagai berikut:<br />
<ul><li>16x2 adalah 16 karakter per baris dengan 2 baris dan, </li>
<li>20x2 adalah 20 karakter per baris dengan 2 baris. </li>
</ul>Kebetulan, dalam pemrograman LCD sudah ada standarisasi yang sangat populer digunakan dan memungkinkan kita untuk berkomunikasi dengan sebagian besar LCD terlepas dari datasheet pabrikan LCD. Standar tersebut mengacu kepada standar pemrograman <i>HD44780U</i>, <i>chip</i> <i>controller</i> yang menerima data dari sumber eksternal (dalam kasus ini adalah <i>microcontroller</i>) dan berkomunikasi langsung dengan LCD. Hampir semua pabrikan LCD mengacu pada standar ini.<br />
Sekilas Tentang “44780”<a href="" name="44780 Background"></a><br />
Standar 44780 membutuhkan 3 baris/pin/kaki kontrol dan 4 atau 8 garis/pin I/O garis untuk data (bus). Pengguna dapat memilih menggunakan LCD dengan operasi 4-bit data bus atau 8-bit data bus. Jika LCD dengan 4-bit data bus yang digunakan maka dibutuhkan 7 baris kabel (3 baris kontrol ditambah 4 baris untuk data bus). Jika yang digunakan adalah LCD dengan 8-bit data bus maka diperlukan total 11 baris kabel (3 baris untuk kontrol ditambah 8 baris untuk data bus) untuk dapat mengirimkan data ke dalam LCD.<br />
Tiga garis kontrol tersebut dikenal dengan istilah <b>EN, RS,</b> dan <b>RW.</b><br />
Garis <b>EN</b> disebut "Enable." Garis kontrol ini digunakan untuk memberitahu LCD bahwa Anda sedang mengirimkan data kepadanya. Untuk mengirim data ke LCD, pastikan pada program Anda, pada garis ini harus dalam kondisi <i>low</i> (0) dan kemudian <i>set</i> dua baris kontrol lainya dan atau kirimkan data pada bus data (8-bit atau 4-bit). Ketika data telah selesai dikirimkan, buat garis <b>EN</b> menjadi <i>high</i> (1) kembali dan tunggu dalam jangka waktu minimum yang diperlukan oleh LCD, lihat datasheet (karena nilai ini bervariasi dari LCD satu ke LCD lainya), dan akhiri program dengan membawa baris EN menjadi <i>low</i> (0) lagi.<br />
---------------<i>break line</i>-----------------<br />
The <b>RS</b> line is the "Register Select" line. Garis <b>RS</b> adalah "Daftar Pilih" baris. When RS is low (0), the data is to be treated as a command or special instruction (such as clear screen, position cursor, etc.). Ketika RS rendah (0), data harus diperlakukan sebagai perintah atau instruksi khusus (seperti yang jelas layar, posisi kursor, dll). When RS is high (1), the data being sent is text data which sould be displayed on the screen. Ketika RS tinggi (1), data yang dikirim adalah data teks yang dapat ditampilkan pada layar. For example, to display the letter "T" on the screen you would set RS high. Sebagai contoh, untuk menampilkan huruf "T" pada layar Anda akan menetapkan RS tinggi.<br />
The <b>RW</b> line is the "Read/Write" control line. Garis <b>RW</b> adalah "Baca / Tulis" garis kontrol. When RW is low (0), the information on the data bus is being written to the LCD. Ketika RW rendah (0), informasi pada bus data sedang ditulis ke LCD. When RW is high (1), the program is effectively querying (or reading) the LCD. Ketika RW tinggi (1), program ini secara efektif query (atau membaca) LCD. Only one instruction ("Get LCD status") is a read command. Hanya satu instruksi ( "Get LCD status") adalah perintah membaca. All others are write commands--so RW will almost always be low. Semua yang lain akan menulis perintah - jadi RW akan hampir selalu rendah.<br />
Finally, the data bus consists of 4 or 8 lines (depending on the mode of operation selected by the user). Akhirnya, bus data terdiri dari 4 atau 8 jalur (tergantung pada mode operasi yang dipilih oleh pengguna). In the case of an 8-bit data bus, the lines are referred to as DB0, DB1, DB2, DB3, DB4, DB5, DB6, and DB7. Dalam kasus 8-bit data bus, garis disebut sebagai DB0, DB1, DB2, DB3, DB4, DB5, DB6 dan DB7.<br />
<a href="" name="Example Hardware"></a>AN EXAMPLE HARDWARE CONFIGURATION CONTOH HARDWARE CONFIGURATION<br />
As we've mentioned, the LCD requires either 8 or 11 I/O lines to communicate with. Seperti yang telah kami sebutkan, LCD membutuhkan baik 8 atau 11 I / O baris untuk berkomunikasi dengan. For the sake of this tutorial, we are going to use an 8-bit data bus--so we'll be using 11 of the 8051's I/O pins to interface with the LCD. Demi tutorial ini, kita akan menggunakan 8-bit data bus - jadi kita akan menggunakan 11 dari 8.051's I / O pin untuk interface dengan LCD.<br />
Let's draw a sample psuedo-schematic of how the LCD will be connected to the 8051. Mari kita menggambar sampel psuedo-skema tentang bagaimana LCD akan terhubung ke 8.051.<br />
<img src="http://www.8052.com/images/lcd8051.gif" /><br />
As you can see, we've established a 1-to-1 relation between a pin on the 8051 and a line on the 44780 LCD. Seperti yang Anda lihat, kami telah mendirikan sebuah 1-ke-1 hubungan antara pin di 8.051 dan garis di LCD 44.780. Thus as we write our assembly program to access the LCD, we are going to equate constants to the 8051 ports so that we can refer to the lines by their 44780 name as opposed to P0.1, P0.2, etc. Let's go ahead and write our initial equates: Jadi ketika kita menulis program assembly kami untuk mengakses LCD, kita akan menyamakan konstanta ke port 8.051 sehingga kita dapat merujuk pada garis-garis dengan nama 44.780 mereka sebagai lawan dari P0.1, P0.2, dll Ayo maju dan menulis awal kami menyamakan:<br />
<ul><b>DB0 EQU P1.0</b> <b>DB0 EQU P1.0</b> <b> </b><b>DB1 EQU P1.1</b> <b>DB1 EQU P1.1</b> <b> </b><b>DB2 EQU P1.2</b> <b>DB2 EQU P1.2</b> <b> </b><b>DB3 EQU P1.3</b> <b>DB3 EQU P1.3</b> <b> </b><b>DB4 EQU P1.4</b> <b>DB4 EQU P1.4</b> <b> </b><b>DB5 EQU P1.5</b> <b>DB5 EQU P1.5</b> <b> </b><b>DB6 EQU P1.6</b> <b>DB6 EQU P1.6</b> <b> </b><b>DB7 EQU P1.7</b> <b>DB7 EQU P1.7</b> <b> </b><b>EN EQU P3.7</b> <b>EN EQU P3.7</b> <b> </b><b>RS EQU P3.6</b> <b>RS EQU P3.6</b> <b> </b><b>RW EQU P3.5</b> <b>RW EQU P3.5</b> <b> </b><b>DATA EQU P1</b> <b>DATA EQU P1</b> <b> </b></ul>Having established the above equates, we may now refer to our I/O lines by their 44780 name. Setelah menyamakan didirikan di atas, kita mungkin sekarang merujuk ke I / O garis oleh nama 44.780. For example, to set the RW line high (1), we can execute the following insutrction: Misalnya, untuk mengatur garis RW tinggi (1), kita dapat mengeksekusi insutrction berikut: <br />
<ul><b>SETB RW</b> <b>SETB RW</b></ul><a href="" name="EN"></a>HANDLING THE EN CONTROL LINE PENANGANAN THE EN CONTROL LINE <br />
As we mentioned above, the EN line is used to tell the LCD that you are ready for it to execute an instruction that you've prepared on the data bus and on the other control lines. Note that the EN line must be raised/lowered before/after each instruction sent to the LCD regardless of whether that instruction is read or write, text or instruction. Seperti yang telah disebutkan di atas, baris EN digunakan untuk memberitahu LCD bahwa Anda sudah siap untuk itu untuk mengeksekusi sebuah instruksi bahwa Anda telah menyiapkan data bus dan pada garis kontrol lainnya. Perhatikan bahwa garis EN harus dinaikkan / diturunkan sebelum / setelah setiap instruksi yang dikirim ke LCD terlepas dari apakah itu perintah membaca atau menulis, teks atau instruksi. In short, you must always manipulate EN when communicating with the LCD. Singkatnya, Anda harus selalu memanipulasi EN ketika berkomunikasi dengan LCD. EN is the LCD's way of knowing that you are talking to it. EN adalah LCD cara untuk mengetahui bahwa Anda berbicara kepadanya. If you don't raise/lower EN, the LCD doesn't know you're talking to it on the other lines. Jika anda tidak menaikkan / menurunkan EN, LCD tidak tahu kau bicara pada baris yang lain.<br />
Thus, before we interact in any way with the LCD we will always bring the <b>EN</b> line low with the following instruction: Jadi, sebelum kita berinteraksi dengan cara apapun dengan LCD kita akan selalu membawa garis <b>EN</b> rendah dengan instruksi berikut:<br />
<ul><b>CLR EN</b> <b>CLR EN</b> <b> </b></ul>And once we've finished setting up our instruction with the other control lines and data bus lines, we'll always bring this line high: Dan begitu kami sudah selesai menyiapkan instruksi kami dengan garis kontrol lainnya dan data bus, kita akan selalu membawa baris ini tinggi: <br />
<ul><b>SETB EN</b> <b>SETB EN</b> <b> </b></ul>The line must be left high for the amount of time required by the LCD as specified in its datasheet. Garis harus dibiarkan tinggi untuk jumlah waktu yang dibutuhkan oleh LCD sebagaimana ditentukan dalam datasheet. This is normally on the order of about 250 nanoseconds, but check the datasheet. In the case of a typical 8051 running at 12 MHz, an instruction requires 1.08 microseconds to execute so the EN line can be brought low the very next instruction. Hal ini biasanya atas perintah dari sekitar 250 nanodetik, tetapi periksa datasheet. Dalam kasus yang khas 8.051 berjalan pada 12 MHz, memerlukan sebuah instruksi untuk mengeksekusi 1,08 mikrodetik sehingga garis EN dapat dibawa sangat rendah instruksi berikutnya. However, faster microcontrollers (such as the DS89C420 which executes an instruction in 90 nanoseconds given an 11.0592 Mhz crystal) will require a number of NOPs to create a delay while EN is held high. The number of NOPs that must be inserted depends on the microcontroller you are using and the crystal you have selected. Namun, lebih cepat Microcontrollers (seperti DS89C420 yang menjalankan instruksi dalam 90 nanodetik diberi kristal 11,0592 Mhz) akan membutuhkan sejumlah nops untuk membuat sebuah penundaan sementara EN yang terangkat tinggi. Jumlah nops yang harus dimasukkan tergantung pada mikrokontroler Anda menggunakan dan kristal yang telah Anda pilih. <br />
The instruction is executed by the LCD at the moment the EN line is brought low with a final CLR EN instruction. Instruksi dieksekusi oleh LCD pada saat garis EN dibawa rendah dengan EN CLR akhir instruksi.<br />
<ul><b>Programming Tip:</b> The LCD interprets and executes our command at the instant the <b>EN</b> line is brought low. <b>Programming Tip:</b> LCD menafsirkan dan menjalankan perintah kami pada saat garis <b>EN</b> dibawa rendah. If you never bring <b>EN</b> low, your instruction will never be executed. Jika Anda tidak pernah membawa <b>EN</b> rendah, instruksi Anda tidak akan pernah dieksekusi. Additionally, when you bring <b>EN</b> low and the LCD executes your instruction, it requires a certain amount of time to execute the command. Selain itu, ketika Anda membawa <b>EN</b> LCD rendah dan mengeksekusi instruksi Anda, itu memerlukan waktu tertentu untuk menjalankan perintah. The time it requires to execute an instruction depends on the instruction and the speed of the crystal which is attached to the 44780's oscillator input. Waktu yang diperlukan untuk mengeksekusi instruksi tergantung pada instruksi dan kecepatan kristal yang melekat pada 44.780's osilator masukan.</ul><a href="" name="BUSY">CHECKING THE BUSY STATUS OF THE LCD</a> <a href="" name="BUSY">PEMERIKSAAN THE BUSY STATUS OF THE LCD</a><br />
As previously mentioned, it takes a certain amount of time for each instruction to be executed by the LCD. Seperti yang disebutkan sebelumnya, dibutuhkan waktu tertentu untuk setiap instruksi yang akan dijalankan oleh LCD. The delay varies depending on the frequency of the crystal attached to the oscillator input of the 44780 as well as the instruction which is being executed. Keterlambatan bervariasi tergantung pada frekuensi kristal osilator melekat pada masukan dari 44.780 serta instruksi yang sedang dieksekusi.<br />
While it is possible to write code that waits for a specific amount of time to allow the LCD to execute instructions, this method of "waiting" is not very flexible. Walaupun mungkin untuk menulis kode yang menunggu untuk jumlah waktu tertentu untuk memungkinkan LCD untuk mengeksekusi instruksi, metode ini "menunggu" tidak sangat fleksibel. If the crystal frequency is changed, the software will need to be modified. Jika frekuensi kristal berubah, perangkat lunak perlu diubah. Additionally, if the LCD itself is changed for another LCD which, although 44780 compatible, requires more time to perform its operations, the program will not work until it is properly modified. Sebagai tambahan, jika LCD itu sendiri akan berubah untuk LCD yang lain, meskipun 44.780 kompatibel, membutuhkan lebih banyak waktu untuk melakukan operasinya, program ini tidak akan bekerja sampai benar dimodifikasi.<br />
A more robust method of programming is to use the "Get LCD Status" command to determine whether the LCD is still busy executing the last instruction received. Metode yang lebih kuat dari pemrograman adalah dengan menggunakan tombol "Dapatkan LCD Status" perintah untuk menentukan apakah LCD masih sibuk mengeksekusi instruksi terakhir diterima.<br />
The "Get LCD Status" command will return to us two tidbits of information; the information that is useful to us right now is found in DB7. Tombol "Dapatkan LCD Status" perintah akan kembali kepada kita dua tidbits informasi; informasi yang berguna untuk kita sekarang ditemukan di DB7. In summary, when we issue the "Get LCD Status" command the LCD will immediately raise DB7 if it's still busy executing a command or lower DB7 to indicate that the LCD is no longer occupied. Singkatnya, ketika kita mengeluarkan "Get LCD Status" perintah LCD akan segera menaikkan DB7 kalau masih sibuk melaksanakan suatu perintah atau DB7 lebih rendah untuk menunjukkan bahwa LCD tidak lagi ditempati. Thus our program can query the LCD until DB7 goes low, indicating the LCD is no longer busy. Jadi program kami dapat query LCD sampai DB7 pergi rendah, menunjukkan LCD tidak lagi sibuk. At that point we are free to continue and send the next command. Pada saat itu kita bebas untuk melanjutkan dan mengirim perintah selanjutnya.<br />
Since we will use this code every time we send an instruction to the LCD, it is useful to make it a subroutine. Karena kita akan menggunakan kode ini setiap kali kita mengirim instruksi ke LCD, akan bermanfaat untuk membuat sebuah sub rutin. Let's write the code: Mari kita menulis kode:<br />
<ul><b>WAIT_LCD:</b> <b>WAIT_LCD:</b>
<ul><b>CLR EN</b> ;Start LCD command <b>CLR</b> <b>EN;</b> Mulai perintah LCD <b>CLR RS</b> ;It's a command <b>CLR</b> <b>RS;</b> It's a perintah <b>SETB RW</b> ;It's a read command <b>SETB</b> <b>RW;</b> Ini perintah membaca <b>MOV DATA,#0FFh</b> ;Set all pins to FF initially <b>MOV DATA, #</b> <b>0FFh;</b> Set semua pin untuk FF awalnya <b>SETB EN</b> ;Clock out command to LCD <b>SETB</b> <b>EN;</b> Jam keluar perintah untuk LCD <b>MOV A,DATA</b> ;Read the return value <b>MOV A,</b> <b>DATA;</b> Baca nilai pengembalian <b>JB ACC.7,WAIT_LCD</b> ;If bit 7 high, LCD still busy <b>JB ACC.7,</b> <b>WAIT_LCD;</b> Jika 7 bit tinggi, LCD masih sibuk <b>CLR EN</b> ;Finish the command <b>CLR</b> <b>EN;</b> Selesai perintah <b>CLR RW</b> ;Turn off RW for future commands <b>CLR</b> <b>RW;</b> Matikan RW untuk masa depan perintah <b>RET</b> <b>RET</b></ul></ul>Thus, our standard practice will be to send an instruction to the LCD and then call our <b>WAIT_LCD</b> routine to wait until the instruction is completely executed by the LCD. Jadi, praktik standar kami akan mengirim instruksi ke LCD dan kemudian memanggil rutin <b>WAIT_LCD</b> kami menunggu sampai instruksi benar-benar dilaksanakan oleh LCD. This will assure that our program gives the LCD the time it needs to execute instructions and also makes our program compatible with any LCD, regardless of how fast or slow it is. Ini akan memastikan bahwa program kami memberikan LCD waktu yang dibutuhkan untuk melaksanakan instruksi dan juga membuat program kami kompatibel dengan LCD, terlepas dari seberapa cepat atau lambat itu. <br />
<b>Programming Tip:</b> The above routine does the job of waiting for the LCD, but were it to be used in a real application a very definite improvement would need to be made: as written, if the LCD never becomes "not busy" the program will effectively "hang," waiting for DB7 to go low. <b>Programming Tip:</b> di atas melakukan pekerjaan rutin menunggu LCD, tetapi itu untuk digunakan dalam aplikasi nyata yang sangat pasti perbaikan perlu dilakukan: seperti yang tertulis, jika LCD tidak pernah menjadi "tidak sibuk" program akan efektif "menggantung," menunggu DB7 pergi rendah. If this never happens, the program will freeze. Jika hal ini tidak pernah terjadi, program akan membeku. Of course, this should never happen and <b>won't</b> happen when the hardware is working properly. Tentu saja, hal ini pernah terjadi dan <b>tidak akan</b> terjadi bila perangkat keras bekerja dengan benar. But in a real application it would be wise to put some kind of time limit on the delay--for example, a maximum of 256 attempts to wait for the busy signal to go low. Namun dalam aplikasi nyata akan bijaksana untuk menaruh beberapa jenis batas waktu penundaan itu - misalnya, dari 256 usaha maksimum untuk menunggu sinyal sibuk untuk pergi rendah. This would guarantee that even if the LCD hardware fails, the program would not lock up. Hal ini akan menjamin bahwa bahkan jika hardware LCD gagal, program tidak akan lock up.<br />
<a href="" name="EN"></a>INITIALIZING THE LCD Menginisialisasi LCD<br />
Before you may really use the LCD, you must initialize and configure it. Sebelum Anda dapat benar-benar menggunakan LCD, Anda harus menginisialisasi dan mengkonfigurasinya. This is accomplished by sending a number of initialization instructions to the LCD. Hal ini dilakukan dengan mengirimkan sejumlah instruksi untuk inisialisasi LCD.<br />
The first instruction we send must tell the LCD whether we'll be communicating with it with an 8-bit or 4-bit data bus. Instruksi pertama harus memberitahu kami mengirim LCD apakah kita akan berkomunikasi dengan dengan sebuah 8-bit atau 4-bit data bus. We also select a 5x8 dot character font. Kami juga memilih font karakter 5x8 titik. These two options are selected by sending the command 38h to the LCD as a command. Dua opsi ini dipilih dengan mengirimkan perintah 38h ke LCD sebagai perintah. As you will recall from the last section, we mentioned that the <b>RS</b> line must be low if we are sending a command to the LCD. Seperti yang Anda ingat dari bagian terakhir, kita menyebutkan bahwa garis <b>RS</b> harus rendah jika kita mengirimkan perintah ke LCD. Thus, to send this 38h command to the LCD we must execute the following 8051 instructions: Jadi, untuk mengirimkan perintah ke 38h ini LCD kita harus mengeksekusi instruksi 8.051 berikut:<br />
<ul><b>CLR RS</b> <b>CLR RS</b> <b> </b><b>MOV DATA,#38h</b> <b>MOV DATA, # 38h</b> <b> </b><b>SETB EN</b> <b>SETB EN</b> <b> </b><b>CLR EN</b> <b>CLR EN</b> <b> </b><b>LCALL WAIT_LCD</b> <b>LCALL WAIT_LCD</b> <b> </b></ul><b>Programming Tip:</b> The LCD command 38h is really the sum of a number of option bits. <b>Programming Tip:</b> 38h perintah LCD sebenarnya adalah jumlah dari sejumlah pilihan bit. The instruction itself is the instruction 20h ("Function set"). Instruksi itu sendiri adalah instruksi 20h ( "Fungsi set"). However, to this we add the values 10h to indicate an 8-bit data bus plus 08h to indicate that the display is a two-line display. Namun, untuk ini kita menambahkan nilai-nilai 10h untuk menunjukkan 8-bit data bus ditambah 08h untuk menunjukkan bahwa tampilan adalah dua baris layar.<br />
We've now sent the first byte of the initialization sequence. Sekarang kami telah mengirimkan byte pertama dari urutan inisialisasi. The second byte of the initialization sequence is the instruction 0Eh. Byte kedua dari urutan inisialisasi instruksi 0Eh. Thus we must repeat the initialization code from above, but now with the instruction. Jadi kita harus mengulangi kode inisialisasi dari atas, tapi sekarang dengan instruksi. Thus the the next code segment is: Dengan demikian, segmen kode berikutnya adalah:<br />
<ul><b>CLR RS</b> <b>CLR RS</b> <b> </b><b>MOV DATA,#0Eh</b> <b>MOV DATA, # 0Eh</b> <b> </b><b>SETB EN</b> <b>SETB EN</b> <b> </b><b>CLR EN</b> <b>CLR EN</b> <b> </b><b>LCALL WAIT_LCD</b> <b>LCALL WAIT_LCD</b> <b> </b></ul><b>Programming Tip:</b> The command 0Eh is really the instruction 08h plus 04h to turn the LCD on. To that an additional 02h is added in order to turn the cursor on. <b>Programming Tip:</b> 0Eh perintah sebenarnya adalah 04h ditambah 08h instruksi untuk mengaktifkan LCD di atas. Untuk itu 02h tambahan yang ditambahkan dalam rangka untuk mengubah kursor di atas.<br />
The last byte we need to send is used to configure additional operational parameters of the LCD. Byte terakhir kita perlu mengirim digunakan untuk mengkonfigurasi parameter operasional tambahan dari LCD. We must send the value 06h. Kita harus mengirimkan nilai 06h.<br />
<ul><b>CLR RS</b> <b>CLR RS</b> <b> </b><b>MOV DATA,#06h</b> <b>MOV DATA, # 06h</b> <b> </b><b>SETB EN</b> <b>SETB EN</b> <b> </b><b>CLR EN</b> <b>CLR EN</b> <b> </b><b>LCALL WAIT_LCD</b> <b>LCALL WAIT_LCD</b> <b> </b></ul><b>Programming Tip:</b> The command 06h is really the instruction 04h plus 02h to configure the LCD such that every time we send it a character, the cursor position automatically moves to the right. <b>Programming Tip:</b> 06h Perintah instruksi yang benar-benar 04h ditambah 02h untuk mengkonfigurasi LCD sedemikian rupa sehingga setiap kali kita kirimkan karakter, posisi kursor secara otomatis bergerak ke kanan.<br />
So, in all, our initialization code is as follows: Jadi, dalam semua, kami kode inisialisasi adalah sebagai berikut:<br />
<ul><b>INIT_LCD:</b> <b>INIT_LCD:</b> <b> </b>
<ul>CLR RS CLR RS MOV DATA,#38h MOV DATA, # 38h SETB EN SETB EN CLR EN CLR EN LCALL WAIT_LCD LCALL WAIT_LCD CLR RS CLR RS MOV DATA,#0Eh MOV DATA, # 0Eh SETB EN SETB EN CLR EN CLR EN LCALL WAIT_LCD LCALL WAIT_LCD CLR RS CLR RS MOV DATA,#06h MOV DATA, # 06h SETB EN SETB EN CLR EN CLR EN LCALL WAIT_LCD LCALL WAIT_LCD RET RET</ul></ul>Having executed this code the LCD will be fully initialized and ready for us to send display data to it. Setelah kode ini dieksekusi LCD akan sepenuhnya diinisialisasi dan siap untuk kita untuk mengirim data menampilkan itu. <br />
<a href="" name="CLS"></a>CLEARING THE DISPLAY KLIRING THE DISPLAY<br />
When the LCD is first initialized, the screen should automatically be cleared by the 44780 controller. Ketika pertama diinisialisasi LCD, layar akan secara otomatis dihapus oleh 44.780 controller. However, it's always a good idea to do things yourself so that you can be completely sure that the display is the way you want it. Namun, selalu ide yang baik untuk melakukan hal-hal diri Anda sehingga Anda bisa benar-benar yakin bahwa layar adalah cara Anda inginkan. Thus, it's not a bad idea to clear the screen as the very first opreation after the LCD has been initialiezd. Jadi, ini bukan ide buruk untuk membersihkan layar sebagai opreation pertama setelah LCD telah initialiezd.<br />
An LCD command exists to accomplish this function. Perintah LCD ada untuk mencapai fungsi ini. Not suprisingly, it is the command 01h. Tidak mengherankan, itu adalah perintah 01h. Since clearing the screen is a function we very likely will wish to call more than once, it's a good idea to make it a subroutine: Sejak membersihkan layar adalah fungsi kita sangat mungkin akan ingin untuk menghubungi lebih dari sekali, itu ide yang baik untuk menjadikannya sebuah subroutine:<br />
<ul>CLEAR_LCD: CLEAR_LCD:
<ul>CLR RS CLR RS MOV DATA,#01h MOV DATA, # 01h SETB EN SETB EN CLR EN CLR EN LCALL WAIT_LCD LCALL WAIT_LCD RET RET</ul></ul>How that we've written a "Clear Screen" routine, we may clear the LCD at any time by simply executing an <b>LCALL CLEAR_LCD</b> . Bagaimana bahwa kami telah menulis sebuah "Clear Screen" rutin, kita dapat menghapus LCD setiap saat dengan hanya menjalankan sebuah <b>LCALL CLEAR_LCD.</b> <br />
<b>Programming Tip:</b> Executing the "Clear Screen" instruction on the LCD also positions the cursor in the upper left-hand corner as we would expect. <b>Programming Tip:</b> Pelaksana tombol "Clear Screen" instruksi pada LCD juga posisi kursor di atas pojok kiri sebagaimana yang kita harapkan.<br />
<a href="" name="WRITE TEXT"></a>WRITING TEXT TO THE LCD MENULIS TEKS DENGAN LCD<br />
Now we get to the real meat of what we're trying to do: All this effort is really so we can display text on the LCD. Sekarang kita sampai daging yang sebenarnya dari apa yang kita coba lakukan: Semua upaya ini benar-benar sehingga kami dapat menampilkan teks pada LCD. Really, we're pretty much done. Sungguh, kita cukup banyak dilakukan.<br />
Once again, writing text to the LCD is something we'll almost certainly want to do over and over--so let's make it a subroutine. Sekali lagi, menulis teks ke LCD adalah sesuatu yang kita akan hampir pasti ingin melakukannya berulang - jadi mari kita membuat sebuah sub rutin.<br />
<ul>WRITE_TEXT: WRITE_TEXT:
<ul>SETB RS SETB RS MOV DATA,A MOV DATA, A SETB EN SETB EN CLR EN CLR EN LCALL WAIT_LCD LCALL WAIT_LCD RET RET</ul></ul>The <b>WRITE_TEXT</b> routine that we just wrote will send the character in the accumulator to the LCD which will, in turn, display it. Yang <b>WRITE_TEXT</b> rutin bahwa kita baru saja menulis akan mengirimkan karakter di akumulator ke LCD yang akan, pada gilirannya, tampilan itu. Thus to display text on the LCD all we need to do is load the accumulator with the byte to display and make a call to this routine. Jadi untuk menampilkan teks pada LCD semua yang perlu kita lakukan adalah beban akumulator dengan byte untuk menampilkan dan membuat panggilan ke rutinitas ini. Pretty easy, huh? Cukup mudah, ya? <br />
<a href="" name="HELLO WORLD"></a>A "HELLO WORLD" PROGRAM Sebuah "HALO WORLD" PROGRAM<br />
Now that we have all the component subroutines written, writing the classic "Hello World" program--which displays the text "Hello World" on the LCD is a relatively trivial matter. Sekarang bahwa kita memiliki semua komponen subrutin ditulis, menulis klasik "Hello World" program - yang menampilkan teks "Hello World" pada LCD adalah relatif sepele. Consider: Pertimbangkan:<br />
<ul>LCALL INIT_LCD LCALL INIT_LCD LCALL CLEAR_LCD LCALL CLEAR_LCD MOV A,#'H' MOV A, # 'H' LCALL WRITE_TEXT LCALL WRITE_TEXT MOV A,#'E' MOV A, # 'E' LCALL WRITE_TEXT LCALL WRITE_TEXT MOV A,#'L' MOV A, # 'L' LCALL WRITE_TEXT LCALL WRITE_TEXT MOV A,#'L' MOV A, # 'L' LCALL WRITE_TEXT LCALL WRITE_TEXT MOV A,#'O' MOV A, # 'O' LCALL WRITE_TEXT LCALL WRITE_TEXT MOV A,#' ' MOV A, # '' LCALL WRITE_TEXT LCALL WRITE_TEXT MOV A,#'W' MOV A, # 'W' LCALL WRITE_TEXT LCALL WRITE_TEXT MOV A,#'O' MOV A, # 'O' LCALL WRITE_TEXT LCALL WRITE_TEXT MOV A,#'R' MOV A, # 'R' LCALL WRITE_TEXT LCALL WRITE_TEXT MOV A,#'L' MOV A, # 'L' LCALL WRITE_TEXT LCALL WRITE_TEXT MOV A,#'D' MOV A, # 'D' LCALL WRITE_TEXT LCALL WRITE_TEXT</ul>The above "Hello World" program should, when executed, initialize the LCD, clear the LCD screen, and display "Hello World" in the upper left-hand corner of the display. Di atas "Hello World" program harus, jika dilaksanakan, menginisialisasi LCD, layar LCD yang jelas, dan menampilkan "Hello World" di bagian pojok kiri atas layar. <br />
<a href="" name="CURSOR POSITIONING"></a>CURSOR POSITIONING CURSOR POSITIONING<br />
The above "Hello World" program is simplistic in the sense that it prints its text in the upper left-hand corner of the screen. Di atas "Hello World" program sederhana dalam arti bahwa di cetak dengan teks pada bagian atas pojok kiri layar. However, what if we wanted to display the word "Hello" in the upper left-hand corner but wanted to display the word "World" on the second line at the tenth character? Namun, bagaimana jika kita ingin menampilkan kata "Halo" di bagian pojok kiri tetapi ingin menampilkan kata "World" pada baris kedua di sepuluh karakter? This sounds simple--and actually, it <b>is</b> simple. Ini kedengarannya sederhana - dan benar-benar, <b>adalah</b> sederhana. However, it requires a little more understanding of the design of the LCD. Namun, hal itu memerlukan sedikit lebih banyak pemahaman tentang desain LCD.<br />
The 44780 contains a certain amount of memory which is assigned to the display. All the text we write to the 44780 is stored in this memory, and the 44780 subsequently reads this memory to display the text on the LCD itself. Para 44.780 berisi sejumlah memori yang diberikan ke layar. Semua teks kita menulis surat kepada 44.780 tersimpan dalam memori ini, dan kemudian membaca 44.780 memori ini untuk menampilkan teks pada LCD itu sendiri. This memory can be represented with the following "memory map": Memori ini dapat diwakili dengan mengikuti "peta memori":<br />
<img src="http://www.8052.com/images/lcdmap.gif" /><br />
In the above memory map, the area shaded in blue is the visible display. Memori di atas peta, wilayah yang diarsir dengan warna biru adalah layar terlihat. As you can see, it measures 16 characters per line by 2 lines. Seperti yang anda lihat, ukuran 16 karakter per baris dengan 2 baris. The numbers in each box is the memory address that corresponds to that screen position. Angka dalam setiap kotak adalah alamat memori yang sesuai dengan posisi layar.<br />
Thus, the first character in the upper left-hanad corner is at address 00h. The following character position (character #2 on the first line) is address 01h, etc. Dengan demikian, karakter pertama di sudut kiri-sudut hanad di alamat 00h. Berikut posisi karakter (karakter # 2 pada baris pertama) adalah alamat 01h, dll This continues until we reach the 16th character of the first line which is at address 0Fh. Ini terus berlanjut sampai kita mencapai 16 karakter baris pertama yang merupakan alamat 0Fh.<br />
However, the first character of line 2, as shown in the memory map, is at address 40h. Namun, karakter pertama dari baris 2, seperti ditunjukkan pada peta memori adalah pada alamat 40h. This means if we write a character to the last position of the first line and then write a second character, the second character will <b>not</b> appear on the second line. Ini berarti jika kita menulis karakter ke posisi terakhir baris pertama dan kemudian menulis karakter kedua, karakter kedua <b>tidak</b> akan muncul pada baris kedua. That is because the second character will effectively be written to address 10h--but the second line begins at address 40h. Itu karena karakter kedua akan efektif ditulis ke alamat 10h - tetapi baris kedua dimulai pada alamat 40h.<br />
Thus we need to send a command to the LCD that tells it to position the cursor on the second line. Jadi kita perlu untuk mengirim perintah ke LCD yang memberitahu ke posisi kursor pada baris kedua. The "Set Cursor Position" instruction is 80h. The "Set Cursor Position" instruksi adalah 80h. To this we must add the address of the location where we wish to position the cursor. In our example, we said we wanted to display "World" on the second line on the tenth character position. Untuk ini kita harus menambahkan alamat lokasi dimana kita ingin posisi kursor. Pada contoh kita, kami berkata kami ingin menampilkan "World" pada baris kedua di posisi kesepuluh karakter.<br />
Referring again to the memory map, we see that the tenth character position of the second line is address 4Ah. Merujuk lagi ke peta memori, kita melihat bahwa karakter kesepuluh posisi baris kedua adalah alamat 4Ah. Thus, before writing the word "World" to the LCD, we must send a "Set Cursor Position" instruction--the value of this command will be 80h (the instruction code to position the cursor) plus the address 4Ah. Jadi, sebelum menulis kata "World" pada LCD, kita harus mengirim "Set Cursor Position" instruksi - nilai dari perintah ini akan 80h (kode instruksi untuk posisi kursor) plus alamat 4Ah. 80h + 4Ah = CAh. 80h + 4Ah = Cah. Thus sending the command CAh to the LCD will position the cursor on the second line at the tenth character position: Dengan demikian mengirimkan perintah Cah ke LCD akan posisi kursor pada baris kedua di posisi ke sepuluh karakter:<br />
<ul><b>CLR RS</b> <b>CLR RS</b> <b> </b><b>MOV DATA,#0CAh</b> <b>MOV DATA, # 0CAh</b> <b> </b><b>SETB EN</b> <b>SETB EN</b> <b> </b><b>CLR EN</b> <b>CLR EN</b> <b> </b><b>LCALL WAIT_LCD</b> <b>LCALL WAIT_LCD</b> <b> </b></ul>The above code will position the cursor on line 2, character 10. Kode diatas akan posisi kursor pada baris 2, karakter 10. To display "Hello" in the upper left-hand corner with the word "World" on the second line at character position 10 just requires us to insert the above code into our existing "Hello World" program. Untuk menampilkan "Halo" di bagian pojok kiri dengan kata "World" pada baris kedua di posisi 10 karakter hanya mengharuskan kita untuk memasukkan kode diatas ke kami yang ada "Hello World" program. This results in the following: Ini hasil sebagai berikut: <br />
<ul>LCALL INIT_LCD LCALL INIT_LCD LCALL CLEAR_LCD LCALL CLEAR_LCD MOV A,#'H' MOV A, # 'H' LCALL WRITE_TEXT LCALL WRITE_TEXT MOV A,#'E' MOV A, # 'E' LCALL WRITE_TEXT LCALL WRITE_TEXT MOV A,#'L' MOV A, # 'L' LCALL WRITE_TEXT LCALL WRITE_TEXT MOV A,#'L' MOV A, # 'L' LCALL WRITE_TEXT LCALL WRITE_TEXT MOV A,#'O' MOV A, # 'O' LCALL WRITE_TEXT LCALL WRITE_TEXT CLR RS CLR RS MOV DATA,#0CAh MOV DATA, # 0CAh SETB EN SETB EN CLR EN CLR EN LCALL WAIT_LCD LCALL WAIT_LCD MOV A,#'W' MOV A, # 'W' LCALL WRITE_TEXT LCALL WRITE_TEXT MOV A,#'O' MOV A, # 'O' LCALL WRITE_TEXT LCALL WRITE_TEXT MOV A,#'R' MOV A, # 'R' LCALL WRITE_TEXT LCALL WRITE_TEXT MOV A,#'L' MOV A, # 'L' LCALL WRITE_TEXT LCALL WRITE_TEXT MOV A,#'D' MOV A, # 'D' LCALL WRITE_TEXT LCALL WRITE_TEXT</ul><a href="" name="SUMMARY"></a>SUMMARY RINGKASAN <br />
This tutorial has presented the underlying concepts of programming an LCD display. Tutorial ini disajikan konsep-konsep yang mendasari pemrograman layar LCD. Obviously it has not addresses all issues. Jelas itu tidak alamat semua masalah. The 44780 LCD controller offers many other functions which are accessed using other commands, and some of the commands already presented include other options that were not discussed here. 44.780 LCD controller yang menawarkan banyak fungsi lainnya yang diakses menggunakan perintah lain, dan beberapa perintah telah disajikan mencakup pilihan lain yang tidak dibahas di sini. However, this tutorial should get you going in the right direction. Namun, tutorial ini harus segera Anda akan arah yang benar.<div class="blogger-post-footer"><p align="left"><a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_US"><img align="left" style="border-width: 0px; margin: 8px 20px 0px 0px; display: inline;" src="http://i.creativecommons.org/l/by-nc-sa/3.0/88x31.png" alt="Creative Commons License"/></a><i> You may share this document under Creative Commons License – </i>Terima kasih telah membaca tulisan ini. © 2011 Ari Sulistiono, <em>Indonesian Electrical Engineer</em>.</p></div>Ari Sulistionohttp://www.blogger.com/profile/00609115698913694796noreply@blogger.com0tag:blogger.com,1999:blog-7098167171686473800.post-48186174349136752272009-10-15T17:28:00.001+07:002010-02-02T12:24:39.907+07:00Tugas Akhir Saya Semasa di Politeknik Negeri Jakarta<a href="http://lh5.ggpht.com/_gWMAlrMzovc/Stb4bUwtSkI/AAAAAAAAAY0/YkEUq62pjHM/s1600-h/kuliah_Page_16_Image_00024.jpg"><img style="border-right-width: 0px; margin: 0px 15px 0px 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="foto sewaktu sidang akhir politeknik" border="0" alt="foto sewaktu sidang akhir politeknik" align="left" src="http://lh5.ggpht.com/_gWMAlrMzovc/Stb4dCwWlRI/AAAAAAAAAY4/uPkZY7SXeKc/kuliah_Page_16_Image_0002_thumb2.jpg?imgmax=800" width="162" height="320" /></a> <p></p> <p>Sudah empat tahun berlalu (artikel ini ditulis bulan Oktober 2009), seru dan penuh dengan kenangan rasanya kuliah di Politeknik tercinta. Ingin rasanya kembali berkunjung ke sana, namun apa daya kesibukan di proyek Muara Karang Repowering ini terus memaksa untuk tetap bekerja. Sekali lagi saya ingin mengucapkan banyak terima kasih kepada para Dosen yang senantiasa membimbing saya pada waktu itu meskipun saya pada waktu itu bisa dikatakan bengal dan tidak disiplin. Bpk. Kajur dan KPS yang terus memotivasi mahasiswa-mahasiswanya serta karyawan-karyawan yang kocak dan ibu kantin dalam (Gd. D), saya sudah kangen sama sup daging spesialnya.</p> <p>Meskipun penuh dengan dilema dan konflik yang terjadi dalam Tugas Akhir ini, namun buat saya itu adalah sebuah pelajaran terindah yang pernah saya alami. Dua kali sidang (sidang gelombang pertama dan kedua), tidak membuat saya berkecil-hati dan patah semangat. Karena kedua-duanya saya mendapat nilai A<img alt="thumbs_up" src="http://spaces.live.com/rte/emoticons/thumbs_up.gif" />. Sebelum membahas Tugas Akhir saya di artikel ini, sebelumnya saya meminta maaf karena telah menolak untuk menjadi pengajar di Politeknik. Saya merasa masih sangat jauh dari apa yang diharapkan sebagai seorang pengajar, baik dari segi ilmu, pengalaman serta jenjang pendidikan. Namun saya sangat berterima-kasih tentunya atas kepercayaan dan kesempatan yang telah kepada saya.</p> <p>Baiklah, saya tidak akan panjang lebar (karena bahasan Tugas Akhir ini cukup panjang). </p> <p>PEMBUATAN PROPOSAL TUGAS AKHIR</p> <p>Pertama kali yang harus dipertimbangkan dalam membuat Tugas Akhir adalah judul Tugas Akhir. Judul Tugas Akhir sebaiknya spesifik agar nantinya pembahasan materi tidak meluas dan tidak memancing banyak pertanyaan yang akhirnya menjadi boomerang keberhasilan sidang nantinya.</p> <p>Setelah judul Tugas Akhir ditetapkan, maka penulis harus bisa menjelaskan alasan pemilihan judul (latar belakang yang mendasari). Alasan harus jelas dan spesifik maksud dan tujuan dari tugas akhir tersebut. </p> <p align="center"><a href="http://lh4.ggpht.com/_gWMAlrMzovc/Stb4egjn2VI/AAAAAAAAAY8/ff0k8hcUBZY/s1600-h/image33.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="contoh latar belakang masalah" border="0" alt="contoh latar belakang masalah" src="http://lh5.ggpht.com/_gWMAlrMzovc/Stb4gslQIyI/AAAAAAAAAZA/TXHxXT0om2s/image_thumb25.png?imgmax=800" width="344" height="174" /></a> </p> <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:51CF81A4-8F44-4a2c-8837-198C090B9994:23fb864c-cc5b-466f-9293-d8322bd99584" class="wlWriterEditableSmartContent">Picasa Content</div> <p>Judul Tugas Akhir yang nantinya bisa diaplikasikan/dikembangkan untuk tujuan sosial akan lebih menarik dan mudah mendapat persetujuan. Terlebih lagi Tugas Akhir tersebut (jika berhasil) bisa diikutsertakan dalam PIMNAS (Penelitian Mahasiswa Tk. Nasional). Selain mendapatkan penghargaan seperti dibawah ini, biaya pembuatan Tugas Akhir tersebut juga akan dibiayai oleh DIKTI. Menarik bukan?</p> <p><a href="http://lh4.ggpht.com/_gWMAlrMzovc/Stb4sSGA8vI/AAAAAAAAAZE/ZiFu-H765WM/s1600-h/image11.png"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="Piagam Penghargaan PIMNAS DIKTI" border="0" alt="Piagam Penghargaan PIMNAS DIKTI" src="http://lh3.ggpht.com/_gWMAlrMzovc/Stb4xSyH0xI/AAAAAAAAAZI/c8wfDw32Gvw/image_thumb9.png?imgmax=800" width="345" height="245" /></a></p> <p>Berikutnya adalah yang perlu digaris-bawahi adalah perumusan masalah, jika judul dan latar belakang sudah ditetapkan maka penulis harus bisa merumuskan masalah yang terdapat dalam tugas akhir tersebut. Dalam pokok bahasan ini seorang penulis harus menjabarkan masalah-masalah apa saja yang akan diteliti dan dipecahkan dalam Tugas Akhir yang akan dibuat. </p> <p align="center"><a href="http://lh4.ggpht.com/_gWMAlrMzovc/Stb40nBDBiI/AAAAAAAAAZM/R6SDdjwf_jI/s1600-h/image29.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="contoh perumusan masalah" border="0" alt="contoh perumusan masalah" src="http://lh3.ggpht.com/_gWMAlrMzovc/Stb425QFqJI/AAAAAAAAAZQ/IU0JhFX6lNA/image_thumb23.png?imgmax=800" width="344" height="283" /></a> </p> <p>Semakin padat inti mata pelajaran yang akan diteliti maka Tugas Akhir tersebut akan semakin baik (misalkan dua atau lebih cakupan materi ini digabungkan dalam satu Tugas Akhir: elektronika daya, sistem kendali, mikroprosesor, sistem tenaga, dan motor listrik). Namun sekali saya tegaskan disini, pokok bahasan jangan sampai meluas atau diluar kemampuan penulis itu sendiri. Hal tersebut malah justru akan membuat Tugas Akhir anda ditolak atau anda tidak berhasil menduduki jatah kursi sidang gelombang pertama.</p> <p>Untuk menunjang penulisan Tugas Akhir tentunya harus tersedia aneka literatur yang mendukung, baik itu dari buku maupun dari internet atau media lainnya.</p> <p align="center"><a href="http://lh6.ggpht.com/_gWMAlrMzovc/Stb4-Eef-3I/AAAAAAAAAZU/c_cHp_KGG3o/s1600-h/image28.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="contoh daftar pustaka" border="0" alt="contoh daftar pustaka" src="http://lh4.ggpht.com/_gWMAlrMzovc/Stb5BOrNsMI/AAAAAAAAAZY/INoc9Wu_xHM/image_thumb22.png?imgmax=800" width="344" height="224" /></a> </p> <p></p> <p></p> <p>Jika sudah matang dengan semua hal tersebut diatas, maka sebaiknya penulis membuat blok diagram dan cara kerja alat secara umum (general). Untuk blok diagram yang lebih detil dan spesifik bisa diulas dalam tulisan Tugas Akhir. Untuk proposal usahakan sesingkat mungkin, apabila terlalu tebal maka tim panitia akan menolak proposal tersebut karena dianggap cakupan bahasan yang diambil terlalu luas.</p> <p><a href="http://lh4.ggpht.com/_gWMAlrMzovc/Stb5C24O2WI/AAAAAAAAAZc/sQRqFB4y-sk/s1600-h/image50.png"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="contoh blok diagram" border="0" alt="contoh blok diagram" src="http://lh3.ggpht.com/_gWMAlrMzovc/Stb5Erkah2I/AAAAAAAAAZg/-uLAkFkMPWc/image_thumb32.png?imgmax=800" width="344" height="221" /></a> </p> <p>Sketsa alat yang akan dibuat, diteliti dan dikerjakan (dalam masa proses pembuatan Tugas Akhir nanti) sebaiknya juga disertakan untuk memperjelas proposal. Penulis sebaiknya berusaha untuk membuat kalimat-kalimat yang padat dan jelas dalam proposal. Usahakan penulisan proposal singkat, padat dan mudah dimengerti agar tidak membingungkan tim panitia TA (ejaan dan kalimat sebaiknya baku sesuai buku pedoman penulisan TA).</p> <p><a href="http://lh4.ggpht.com/_gWMAlrMzovc/Stb5G5iCIiI/AAAAAAAAAZk/8p19kfFdklY/s1600-h/image37.png"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="contoh sketsa tugas akhir" border="0" alt="contoh sketsa tugas akhir" src="http://lh3.ggpht.com/_gWMAlrMzovc/Stb5JW9vkyI/AAAAAAAAAZo/FSoOjsCOx3Q/image_thumb27.png?imgmax=800" width="344" height="249" /></a></p> <p>Jika di dalam Tugas Akhir tersebut juga terdapat praktek pembuatan software (mengembangkan sendiri) maka sebaiknya sketsa software yang akan dibuat juga diikutsertakan (dalam bentuk sederhana saja kalau waktu sudah tidak mendukung).</p> <p align="center"><a href="http://lh6.ggpht.com/_gWMAlrMzovc/Stb5M_OIWQI/AAAAAAAAAZs/03hS6AfHOJI/s1600-h/image40.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/_gWMAlrMzovc/Stb5PvzIIWI/AAAAAAAAAZw/ep3ll7cZwAE/image_thumb28.png?imgmax=800" width="244" height="178" /></a> <a href="http://lh5.ggpht.com/_gWMAlrMzovc/Stb5SU2t9OI/AAAAAAAAAZ0/iZgT237_AVA/s1600-h/image43.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="contoh sketsa software" border="0" alt="contoh sketsa software" src="http://lh6.ggpht.com/_gWMAlrMzovc/Stb5VCUroBI/AAAAAAAAAZ4/GM4dd3u9FyY/image_thumb29.png?imgmax=800" width="244" height="180" /></a> </p> <p></p> <p></p> <p>Yang terakhir adalah, untuk apa sih penulis membuat Tugas Akhir tersebut? Sebaiknya di bagian ini penulis menekankan betapa pentingnya penelitian Tugas Akhir ini untuk dilakukan. Penulis sebaiknya memaparkan bahwa tulisan yang akan dibuat dapat digunakan untuk kemajuan pendidikan dan teknologi, membantu kehidupan sosial masyarakat dan lain sebagainya.</p> <p><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="contoh proyeksi aplikasi hasil" border="0" alt="contoh proyeksi aplikasi hasil" src="http://lh5.ggpht.com/_gWMAlrMzovc/Stb5WgY8L5I/AAAAAAAAAZ8/fpxIrXtrKWA/image_thumb34.png?imgmax=800" width="344" height="161" /></p> <p>Naskah proposal selesai, berikutnya tugas penulis adalah membuat rincian biaya yang nantinya wajib dilampirkan dalam proposal. Jika biaya pembuatan Tugas Akhir tersebut besar (meskipun penulis mempunyai cukup biaya), sebaiknya beberapa komponen harus dihilangkan agar proposal mendapat persetujuan. Hal ini dikarenakan bahwa tidak menutup kemungkinan seorang penulis akan kehabisan dana dan proses pembuatan Tugas Akhir terhenti. Sehingga tim panitia TA akan menolak TA dengan biaya besar sebagai usaha untuk menghindari hal ini terjadi.</p> <p>Usahakan dalam penulisan proposal diteliti dengan baik dari segi bahasa (untuk mendapat persetujuan tim panitia), segi pemahaman teknik (untuk persetujuan pembimbing) sebelum proposal tersebut diserahkan. Revisi proposal yang terlalu sering akan menyita waktu dan memperlambat proses kelulusan penulis. Karena semakin cepat penulis lulus maka semakin cepat pula penulis berkesempatan untuk mencari pekerjaan.</p> <p>Untuk lebih jelasnya anda bisa lihat contoh Proposal Tugas Akhir yang pernah saya ajukan dan disetujui oleh panitia. <a title="Klik disini untuk mengunduh/download naskah proposal TA" href="http://ari-sty.co.cc" target="_blank">Silahkan download disini…</a></p> <p>(Bersambung… >> Proses Pembuatan Tugas Akhir)       |        sumber artikel: <a href="http://ari-sty.co.cc">http://ari-sty.co.cc</a>     |     <a title="klik disini untuk menyimpan naskah artikel ini" href="http://ari-sty.co.cc" target="_blank">Simpan naskah artikel ini</a></p> <div class="blogger-post-footer"><p align="left"><a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_US"><img align="left" style="border-width: 0px; margin: 8px 20px 0px 0px; display: inline;" src="http://i.creativecommons.org/l/by-nc-sa/3.0/88x31.png" alt="Creative Commons License"/></a><i> You may share this document under Creative Commons License – </i>Terima kasih telah membaca tulisan ini. © 2011 Ari Sulistiono, <em>Indonesian Electrical Engineer</em>.</p></div>Ari Sulistionohttp://www.blogger.com/profile/00609115698913694796noreply@blogger.com0tag:blogger.com,1999:blog-7098167171686473800.post-2532016532828967462009-01-02T16:15:00.000+07:002009-11-26T21:24:10.322+07:00Atmel Seri AT89Sxxxx Sistem Minimum (Skematik & PCB Layout)<p><strong>In System Programming (ISP)</strong></p> <p>Apa sih ISP itu? ISP adalah singkatan dari diatas, lalu maksudnya? ISP adalah suatu cara memprogram sebuah mikrokontroller secara serial dan berlangsung ditempat, atau dengan kata lain tidak perlu melepas chip yg akan diprogram dari PCB nya. Chip tipe ISP lebih bisa memberikan solusi kepada mereka yg ingin belajar pemrogramman, membuat suatu project mikrokontroler, mencari kesalahan program (debug) dengan proses yg lebih cepat dan praktis serta sangat mudah dalam pembuatan sistem minimumnya di meski di rumah sekalipun.</p> <a name='more'></a> <p>Biasanya, flash memory dari sebuah chip mikrokokntroler ATMEL diprogram melalui antarmuka data parallel, yg mana data akan dikirim byte demi byte (menggunakan 8 line independen untuk data, alamat, control word dan input). Atau dengan kata lain ISP hanya membutuhkan 4 line, dan secara literal, data ditransfer melalui 2 line saya, seperti halnya antarmuka I2C, dimana data digeser bit demi bit. MOSI line adalah clock cycle diantara setiap bit dengan bit selanjutnya (didalam line SCK). Ah... teori-nya ntar aja dilanjutin ya. Mau pulang dulu niy, yg penting yg bawah dah komplit:</p> <p><b></b></p> <p><b>SCHEMATIC</b></p> <p>Untuk rangkaian skematiknya bisa di download disini: <a title="Free Download AT89S51 Minimum System" href="http://www.geocities.com/ddsaproject/electronics/8031-ah/at89s51_min_sch.pdf">AT89S51 Minimum System</a>.</p> <p><strong>SOFTWARE</strong></p> <p>Untuk software antarmuka pemrogrammannya bisa di download disini: </p> <ol> <li><a href="http://www.geocities.com/ddsaproject/electronics/8031-ah/aec_isp.zip">AEC-ISP software</a> (49.525 Bytes), masih versi DOS version, update terakhir bisa anda temukan di : <a href="http://www.aec.electronics.co.nz">AEC-Electronics</a>. </li> <li><a href="http://www.geocities.com/ddsaproject/electronics/8031-ah/isp-30a.zip">ISP-PGM software</a> (177.434 Bytes), versi windows version, untuk update terbaru bisa anda temukan di: <a href="http://www.kmitl.ac.th/%7Ekswichit/IspPgm30a/ISP-Pgm30a.html">Asim Khan's ISP software</a>. </li> <li>ISP-PROG software <a href="http://www.geocities.com/ddsaproject/electronics/8031-ah/ispprog_old.zip">lama</a> (166.763 Bytes) dan <a href="http://www.geocities.com/ddsaproject/electronics/8031-ah/ispprog_new.zip">baru</a> (182.470 Bytes), versi windows version, update terakhir bisa anda temukan di : <a href="http://www.amwaw.edu.pl/%7Eadybkows/">Adam's Home Page ISP PROG ATMEL89Sxx</a>. </li> </ol> <p><strong>PCB LAYOUT</strong></p> <p>Karena rangkaian ini tidak banyak memerlukan komponen, PCB untuk minimum system ini bisa memakai PCB single layer dengan ukuran 5.5x7.5 cm. Cukup kecil untuk sekedar bereksperimen. Layout PCB bisa menggunakan gambar tangan atau bisa juga dengan kertas toner transfer. Prototipe dibawah menggunakan gambar tangan ko, jadi ga usah ragu dalam bereksperimen (jangan takut dibilang jelek, yg bagus pun belum tentu bekerja dengan baik kan? Atau bisa-bisa itu dapet beli di pasar).</p> <p>Ini adalah <a href="http://www.geocities.com/ddsaproject/electronics/8031-ah/at89s51_min_pcb_layout.pdf">Desain PCB</a> and the <a href="http://www.geocities.com/ddsaproject/electronics/8031-ah/at89s51_min_pcb_artwork.pdf">PCB layout-nya.</a></p> <p><strong> <br />PART LISTS</strong></p> <p>List komponen untuk Minimum Sistem ISP ini adalah sbb:</p> <p>   <b><i><u>1. Resistors :</u></i></b>      </p> <ul> <ul> <li>R1 = 10 kOhm: 1 pcs       </li> <li>R2 = 470 Ohm: 1 pcs       </li> <li>RP1 = 8x10 kOhm: 1 pcs</li> </ul> </ul> <p>   <b><i><u>2. Capasitors :</u></i></b>      </p> <ul> <ul> <li>C1,C2 = 33 pF : 2 pcs       </li> <li>C3 = 10 uF/16 V : 1 pcs       </li> <li>C4 = 220 uF/16 V : 1 pcs       </li> <li>C5 = 100 uF/16 V : 1 pcs       </li> <li>C6 = 100 nF : 1 pcs</li> </ul> </ul> <p>   <b><i><u>3. Semiconductors :</u></i></b>   </p> <ul> <ul> <li>IC1 = AT89S52 (Microcontroller, another S-type) :   1 pcs       </li> <li>IC2 = 7805 (Variabel Regulator) :   1 pcs       </li> <li>IC3 = 74LS244 (2-Quad Buffer, optional) :   1 pcs       </li> <li>BD = 4 x 1N4007 (silicon diode) :   4 pcs       </li> <li>LED1 = Red 3mm :   1 pcs</li> </ul> </ul> <p>   <b><i><u>4. Others :</u></i></b>      </p> <ul> <ul> <li>Optional IC socket for 40-pins :   1 pcs       </li> <li>IDC connector, 10-pins (4 x I/O ports) :   4 pcs       </li> <li>SIP connector, 6-pins (ISP cable) :   1 pcs       </li> <li>SIP connector, 2-pins (power supply) :   1 pcs       </li> <li>X'tal = 11.0592 MHz (another kind) :   1 pcs       </li> <li>DB-25 connector type (male) with housing :   1 pcs       </li> <li>Single layer PCB, size about 5.5cm x 7.5cm :   1 pcs       </li> <li>Transformer P=220V, S=9~12V/0.5A (Adaptor) :   1 pcs</li> </ul> </ul> <h5><b></b></h5> <p><strong>KABEL ISP</strong></p> <p>Ada banyak jenis Kabel ISP dengan bermacam desain, tapi saya sarankan pilihlah tipe kabel yg tepat dan sesuai dengan PC / Komputer. Karena ada beberapa tipe desain yg tidak bisa bekerja dengan baik untuk beberapa tipe komputer, dan yg lainnya ok-ok saja. Dari pengalaman saya memang ada beberapa tipe motherboard PC yg port parallelnya mensuplai tegangan kurang dari 5V, untuk tipe baru biasanya menggunakan 3V (harus menggunakan buffer) dan yg tipe PC lama masih menggunakan tegangan 5V (semua tipe kabel OK).</p> <ol> <li>Kabel <a href="http://www.geocities.com/ddsaproject/electronics/8031-ah/aeg-isp_ika.jpg">AEC-ISP dengan buffer</a> (77.841 Bytes) di deasin oleh <a href="http://www.ikalogic.com/isp.php">Ibrahim Kamal</a>, <a href="http://www.geocities.com/ddsaproject/electronics/8031-ah/aec_isp.zip">AEC-ISP kabel direct/langsung</a> (49.525 Bytes) dari software-nya. </li> <li>Asim Khan <a href="http://www.geocities.com/ddsaproject/electronics/8031-ah/isp-pgm_asim_buffer.gif">Kabel ISP-PGM dengan buffer</a> (7.697 Bytes), <a href="http://www.geocities.com/ddsaproject/electronics/8031-ah/isp-pgm_asim_direct.gif">Kabel ISP-PGM direct</a> (25.752 Bytes). </li> <li><a href="http://www.geocities.com/ddsaproject/electronics/8031-ah/ispprog_new.zip">Beragam jenis koneksi kabel data</a> (182.470 Bytes) dari Adam's software. </li> </ol> <p><strong>PROTOTYPE</strong></p> <p>Prototipe ini kira-kira berukuran (5.5 x 7.5) cm PCB single layer. Ini adalah ukuran yg mungkin dan nyaman untuk digunakan apalagi pembuatannya masih memakai layout gambar tangan. Semua yg diperlukan adalah sebuah PCB kecil dengan mikon ATMEL seri-S, sebuah kabel parallel DIY, dan sebuah power supply kecil wallwart. Dan sudah bisa melakukan cukup eksperimen dengan mikon kecil ini.</p> <p><img height="240" alt="My prototype board size (5.5 x 7.5) cm" src="http://www.geocities.com/ddsaproject/electronics/8031-ah/min_sys_1.jpg" width="320" border="0" /></p> <p><img height="240" alt="Asim Khan ISP-PGM cable without buffer (direct connection)" src="http://www.geocities.com/ddsaproject/electronics/8031-ah/min_sys_2.jpg" width="320" border="0" /></p> <p><img height="240" alt="AEC-ISP cable without buffer (direct connection)" src="http://www.geocities.com/ddsaproject/electronics/8031-ah/min_sys_3.jpg" width="320" border="0" /></p> <p><img height="240" alt="A small wallwart power supply rating 9V-AC/500mA" src="http://www.geocities.com/ddsaproject/electronics/8031-ah/min_sys_4.jpg" width="320" border="0" /></p> <p><img height="240" alt="Overall prototype, I make 2, and more for next projects" src="http://www.geocities.com/ddsaproject/electronics/8031-ah/min_sys_5.jpg" width="320" border="0" /></p> <p><em>Contoh aplikasi dan program ASM / C++ belum sempet posting, jadi mohon sabar aja mungkin di postingan selanjutnya</em>. Selamat Mencoba & Selamat Tahun Baru 2009. Ari Sulistiono (TL Angk. 2002)</p> <div class="blogger-post-footer"><p align="left"><a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_US"><img align="left" style="border-width: 0px; margin: 8px 20px 0px 0px; display: inline;" src="http://i.creativecommons.org/l/by-nc-sa/3.0/88x31.png" alt="Creative Commons License"/></a><i> You may share this document under Creative Commons License – </i>Terima kasih telah membaca tulisan ini. © 2011 Ari Sulistiono, <em>Indonesian Electrical Engineer</em>.</p></div>Ari Sulistionohttp://www.blogger.com/profile/00609115698913694796noreply@blogger.com1