<?xml version="1.0" encoding="UTF-8"?> <rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
><channel><title>SulhanSetiawan.com &#187; Microcontroller</title> <atom:link href="http://www.sulhansetiawan.com/category/mikrokontroler/feed" rel="self" type="application/rss+xml" /><link>http://www.sulhansetiawan.com</link> <description></description> <lastBuildDate>Sun, 05 Feb 2012 17:08:53 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>MXLED &#8211; LED Matrix Simulator</title><link>http://www.sulhansetiawan.com/mxled</link> <comments>http://www.sulhansetiawan.com/mxled#comments</comments> <pubDate>Sat, 04 Feb 2012 14:16:04 +0000</pubDate> <dc:creator>Sulhan</dc:creator> <category><![CDATA[Microcontroller]]></category> <category><![CDATA[All]]></category> <category><![CDATA[Simulator]]></category> <category><![CDATA[LED matrix]]></category> <category><![CDATA[Moving Sign]]></category> <category><![CDATA[Simulation]]></category><guid isPermaLink="false">http://sulhansetiawan.com/?p=1127</guid> <description><![CDATA[MXLED version 1.6 MXLED is a simulation of the LED matrix that can be used with a microcontroller simulator on Micro .exe. With MXLED, the system design of LED matrix, commonly referred to as Running Text, or many also call it Moving Sign, be more easily implemented. MXLED on this version provides the size up [...]]]></description> <content:encoded><![CDATA[<h3>MXLED version 1.6</h3><div id="window" class="wp-caption aligncenter" style="width: 508px"><a href="http://resource.sulhansetiawan.com/img/MXLED.1.6.jpg"><img class=" " title="MXLED.exe" src="http://resource.sulhansetiawan.com/img/MXLED.1.6.jpg" alt="MXLED.exe" width="498" height="158" /></a><p class="wp-caption-text">MXLED.exe</p></div><p>MXLED is a simulation of the LED matrix that can be used with a microcontroller simulator on <a href="http://www.sulhansetiawan.com/en/microcontroller-project">Micro .exe</a>. With MXLED, the system design of LED matrix, commonly referred to as Running Text, or many also call it Moving Sign, be more easily implemented.</p><p>MXLED on this version provides the size up to 200 columns x 80 lines. With this size, we can perform simulations for the LED matrix which suffice to needs that more real.</p><p>Enlarge the size of the matrix on this version is done by reducing the size of the LED to be only of 10 x 10 pixels. However, if we use monitors with size 1360 x 768, then size that can be displayed only about 135 columns x 64 lines.</p><div id="download" class="wp-caption aligncenter" style="width: 97px"><a href="http://resource.sulhansetiawan.com/mikrokontroler/MXLED.7z"><img class="  " title="MXLED" src="http://resource.sulhansetiawan.com/img/download.gif" alt="MXLED" width="87" height="30" /></a><p class="wp-caption-text">MXLED</p></div> ]]></content:encoded> <wfw:commentRss>http://www.sulhansetiawan.com/mxled/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Simple Serial Downloader for AT89S51/AT89S52</title><link>http://www.sulhansetiawan.com/sdownldr</link> <comments>http://www.sulhansetiawan.com/sdownldr#comments</comments> <pubDate>Sat, 12 Nov 2011 09:51:14 +0000</pubDate> <dc:creator>Sulhan</dc:creator> <category><![CDATA[Development Tools]]></category> <category><![CDATA[IDE (Integrated Development Environment)]]></category> <category><![CDATA[Microcontroller]]></category> <category><![CDATA[All]]></category> <category><![CDATA[Microcontroller IDE]]></category> <category><![CDATA[Serial Downloader]]></category> <category><![CDATA[FREE! Software]]></category><guid isPermaLink="false">http://www.sulhansetiawan.com/?p=1217</guid> <description><![CDATA[The simplest serial downloader. SDownldr.exe is a software to program a AT89S51/AT89S52 serially through the parallel port. This Software is included in the Microcontroller Project Circuit diagram for this ISP downloader is as follow: The Serial Downloader circuit above using the power supply from the parallel port. However, not all parallel port capable of providing [...]]]></description> <content:encoded><![CDATA[<p><span style="display:none">The simplest serial downloader. </span>SDownldr.exe is a software to program a AT89S51/AT89S52 serially through the parallel port. This Software is included in the <a href="http://www.sulhansetiawan.com/microcontroller-project">Microcontroller Project</a></p><div id="window" class="wp-caption aligncenter" style="width: 438px"><a href="http://resource.sulhansetiawan.com/img/SerialDownloader.PNG"><img class=" " title="SDownldr.exe" src="http://resource.sulhansetiawan.com/img/SerialDownloader.PNG" alt="SDownldr.exe" width="428" height="275" /></a><p class="wp-caption-text">SDownldr.exe</p></div><p>Circuit diagram for this ISP downloader is as follow:</p><div id="diagram" class="wp-caption aligncenter" style="width: 391px"><a href="http://resource.sulhansetiawan.com/img/SerialDownloaderCircuit.PNG"><img class=" " title="ISP downloader circuit diagram" src="http://resource.sulhansetiawan.com/img/SerialDownloaderCircuit.PNG" alt="ISP downloader circuit diagram" width="381" height="407" /></a><p class="wp-caption-text">ISP downloader circuit diagram</p></div><p>The Serial Downloader circuit above using the power supply from the parallel port. However, not all parallel port capable of providing enough current for this purpose. If Your parallel port is not strong enough for this purpose, then you must provide a + 5V power supply for this circuit.</p><p>If the program is run from the IDE, then all the settings will be performed by the IDE. Whereas if it is executed as a standalone program, then the settings are as follows:</p><ul><li style="text-align: justify;"><strong>Default Hex File</strong><br /> If you are using the <a href="http://www.sulhansetiawan.com/microcontroller-project">&#8220;Microcontroller Poject&#8221;</a> IDE, so whenever performed a successful compilation, a hex file is created in the temp directory, i.e. TMPFILE.HEX. If the &#8220;Default Hex File&#8221; is checked, then the file will be sent if the Send button is clicked is the hex file of successful compilation result. Keep in mind that the hex file will exist only if the IDE is still running.<br /> If &#8220;Default Hex Files&#8221; is not checked, then you can determine which files will be sent by clicking on the Browse button.</li><li style="text-align: justify;"><strong>Send</strong><br /> Use this button to start sending the specified hex file.</li><li style="text-align: justify;"><strong>Read</strong><br /> Use this button to read the code on the chip. The reading will only succeed if the chip has not been locked.</li><li style="text-align: justify;"><strong>Lock</strong><br /> Use this button to lock the chip so that the code on the chip cannot be read again.</li><li style="text-align: justify;"><strong>Port</strong><br /> Select the appropriate port address for the port being used. Parallel port usually placed on the address 378H.</li><li style="text-align: justify;"><strong>Auto Lock</strong><br /> If checked, then after sending the data is complete and after verification, the chip will be locked automatically.</li><li style="text-align: justify;"><strong>Browse</strong><br /> Use this button to choose a hex file will be sent. This button will only be active if the &#8220;Default Hex Files&#8221; is not a check.</li><li style="text-align: justify;"><strong>Read data count</strong><br /> Used to determine the amount of data to be read if the Read button is clicked. It could use a decimal number or hexadesimal, i.e. if the &#8220;Hex&#8221; is checked.</li></ul> ]]></content:encoded> <wfw:commentRss>http://www.sulhansetiawan.com/sdownldr/feed</wfw:commentRss> <slash:comments>13</slash:comments> </item> <item><title>Designing LED Matrix Circuit</title><link>http://www.sulhansetiawan.com/merancang-rangkaian-matriks-led</link> <comments>http://www.sulhansetiawan.com/merancang-rangkaian-matriks-led#comments</comments> <pubDate>Mon, 09 Aug 2010 15:21:16 +0000</pubDate> <dc:creator>Sulhan</dc:creator> <category><![CDATA[Experiments]]></category> <category><![CDATA[Electronics]]></category> <category><![CDATA[All]]></category> <category><![CDATA[LED matrix]]></category> <category><![CDATA[Microcontroller]]></category><guid isPermaLink="false">http://sulhansetiawan.com/?p=1069</guid> <description><![CDATA[LED matrix is the number of LEDs arranged in columns and rows. Those LEDs are then used to display images or text that usually displayed with certain animation effects. Therefore, the LED matrix is often referred to as the Running Text or Moving Sign. Arrange LEDs as matrix MXLED is a simulator of the circuit [...]]]></description> <content:encoded><![CDATA[<p>LED matrix is the number of LEDs arranged in columns and rows. Those LEDs are then used to display images or text that usually displayed with certain animation effects. Therefore, the LED matrix is often referred to as the Running Text or Moving Sign.</p><h3>Arrange LEDs as matrix</h3><p><a href="http://sulhansetiawan.com/menggunakan-mxledexe-untuk-simulasi-matriks-led">MXLED</a> is a simulator of the circuit matrix of LEDs. With this simulator, we can try to program the LED matrix controllers even without the hardware. MXLED made LED matrix by arranging the LEDs on the vertical lines and horizontal lines. We must provide the number of rows of horizontal lines (we make eight lines). Then, we also make as many vertical lines of columns. Arrangement of vertical lines and horizontal images are as follows:</p><div id="vertikal-horisontal" class="wp-caption aligncenter" style="width: 405px"><a href="http://resource.sulhansetiawan.com/img/kabelmatriks.jpg"><img title="Vertical and Horizontal Line" src="http://resource.sulhansetiawan.com/img/kabelmatriks.jpg" alt="Vertical and Horizontal Line" width="395" height="276" /></a><p class="wp-caption-text">Vertical and Horizontal Line</p></div><p>Lines of vertical and horizontal are not connected. Then, at each meeting point between the vertical and horizontal lines, attach a LED by connecting its anode to the horizontal lines and its cathode to the vertical lines. Installation of these LEDs are as shown below:</p><div id="pemasangan-led" class="wp-caption aligncenter" style="width: 405px"><a href="http://resource.sulhansetiawan.com/img/LEDmatriks.jpg"><img title="Installation of LEDs" src="http://resource.sulhansetiawan.com/img/LEDmatriks.jpg" alt="Installation of LEDs" width="395" height="276" /></a><p class="wp-caption-text">Installation of LEDs</p></div><p>By installing LEDs as above, the light up LED is the LED where the anode is connected to the horizontal lines which is high (1) and the cathode is connected to the vertical lines which is low (0). There is only one low vertical line at a time, while other line must be kept high. This low vertical line we refer to as the active column. Unlike the vertical lines, horizontal lines consisting of eight lines may has high or low value without having to pay attention to the other horizontal lines.</p><h3>Horizontal Control</h3><p>To give the voltage on this horizontal line, we can not directly connect it to port. This is caused by the need for large electrical currents. Therefore, horizontal lines are the powered using a PNP transistor as shown below:</p><div id="catu-horisontal" class="wp-caption aligncenter" style="width: 398px"><a href="http://resource.sulhansetiawan.com/img/catuhoris.jpg"><img title="The power supply for the horizontal lines" src="http://resource.sulhansetiawan.com/img/catuhoris.jpg" alt="The power supply for the horizontal lines" width="388" height="130" /></a><p class="wp-caption-text">The power supply for the horizontal lines</p></div><p>Each horizontal line given a transistor like the picture above. In this way, to make the horizontal lines can give the current to the LED, then the base must be low state (0). Meanwhile, if the base was given a high state, then the line could not provide current to the LED.</p><h3>Vertikal Control</h3><p>As horisontol lines, vertical lines can not be controlled directly using the port. This is caused by the large amount of current that must be sunk into the ground. Therefore, we can use the NPN transistor to sink current from these vertical lines. Way of installation is as shown below:</p><div id="sink-vertikal" class="wp-caption aligncenter" style="width: 267px"><a href="http://resource.sulhansetiawan.com/img/sinkvertical.jpg"><img title="Vertical line current sink" src="http://resource.sulhansetiawan.com/img/sinkvertical.jpg" alt="Vertical line current sink" width="257" height="179" /></a><p class="wp-caption-text">Vertical line current sink</p></div><p>Each vertical line is controlled using a transistor as shown above. If the base was given a high condition (1), then the line (column) will be an active line. Conversely, if the base were given the condition of low (0), then the line becomes inactive column.</p><p>As already mentioned above, there is only one column that should be active, while the other columns must be inactive. There are many ICs that output works like that. One of the cheapest is the 4017.</p><div id="pengendalian-kolom" class="wp-caption aligncenter" style="width: 349px"><a href="http://resource.sulhansetiawan.com/img/kendali4017.jpg"><img title="Columns control using IC 4017" src="http://resource.sulhansetiawan.com/img/kendali4017.jpg" alt="Columns control using IC 4017" width="339" height="284" /></a><p class="wp-caption-text">Columns control using IC 4017</p></div><p>Too bad that this IC only has 10 outputs. Thus, we can only make the controls to 10 columns <img src='http://www.sulhansetiawan.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /></p><p>Relax, we can use other tricks to extend the control capabilities of this 4017. The trick is to make the block columns. The columns are grouped into block of columns. Each block columns consists of 10 columns. The columns in each block columns are numbered from 0 to 9. So, column 0 is the column 0 of block 0, column 10 is the column 0 of block 1, column 21 is column 1 of block 2, and so on.</p><p>Each base of the column with the same number are combined into one and is controlled by an output of 4017. For example, the base of the column 0 is connected to the base of the column 10, column 20, column 30, and so on. Then the bases which have become one, controlled by the Q0 of 4017.</p><div id="pengendalian-blok" class="wp-caption aligncenter" style="width: 443px"><a href="http://resource.sulhansetiawan.com/img/cascade4017.jpg"><img title="Block Columns" src="http://resource.sulhansetiawan.com/img/cascade4017.jpg" alt="Block Columns" width="433" height="282" /></a><p class="wp-caption-text">Block Columns</p></div><p>From the picture above, we can see that although the base of column 0 and column 10 are controlled concurrently, but the column that can sink current is only the column with the active block. Seen that way of controlling the &#8220;column&#8221; or &#8220;block columns&#8221; is the same. If the number of block columns is only a few, then the controlling block of columns can be done directly using the port of the microcontroller. However, if the number of block columns is quite a lot, then the block columns can also be controlled using the other 4017. So, we develop a multilevel 4017, ie 4017 units (control column) and 4017 tens (the controlling block of columns). And if the number of block columns more than 10, then we can make the next level, ie 4017 level in the hundreds.</p><p>To cascade 4017 as above, is by connecting the carry output of 4017 units level as the input clock for the 4017 of tens level. And if there is 4017 of hundreds level, then the carry output of 4017 of tens level is used as the input clock for the 4017 of hundreds level. And so on. While the reset input of all of 4017 are combined into one. Thus, the overall control system only requires two lines for columns control, ie the input clock (clock input for 4017 of unit level) and the reset input (composite of all reset of 4017). Thus, the preparation of the LED matrix is exactly the same as the <a href="http://sulhansetiawan.com/menggunakan-mxledexe-untuk-simulasi-matriks-led">MXLED</a> simulation.</p><h3>Power Current Calculation</h3><p>From the explanations above, we can see that there are three kinds of transistors viewed from the position. First is the row controller transistor, second is the column (unit) controller transistor, third is the column block (tens) controller transistor. Of course this calculation assuming that the number of columns are not more than 100 columns.</p><h4>Calculation of the row controller transistor current</h4><p>If each LED using a current of I, then the total maximum amount of current through the line control transistor is I x number of columns. For example, if each of our LEDs designed to use 5mA current and the number of columns are 30 columns, then the row controller transistor should be able to drain 5 x 30 = 150mA current.</p><p>The next question is, what is the value of collector resistor of the transistor?</p><p>To answer these questions, we should see the path of current from the power supply to get to the ground. First, the power supply current enter the PNP transistor through the emitter to the collector. Then passes through the collector resistor, then continues to enter into LED, enter into the collector of column controller, then enter the collector of the block columns controller.</p><p>If the power supply used is 5V, how much is the clamp voltage across the resistor? The voltage across the resistor is 5V &#8211; V on LED &#8211; VCE line controller tansistor &#8211; VCE of column controller transistor &#8211; VCE of column block controllers transistor. LED clamp voltage is typically about 1.7 V, but there are some types of LEDs which have a clamp voltage of up to 3V. While VCE transistors in saturation state is typically around 0.3 V. We assume that we use a regular LED with a clamp voltage of 1.7 V. Thus, the voltage across the resistor pin is 5 &#8211; 1.7 &#8211; (3 x 0.3) = 2.4 V.</p><p>Once we know the clamp voltage at the collector resistor of the line controller transistor, to calculate the magnitude of the resistor is R = V / I = 2.4 V / 150mA = 16 ohms. Too bad that we might be difficult to obtain this value of 16 ohms. So we can use a slightly lower value, eg 15 ohms, so that the LED current will be slightly higher, or use a little higher, for example 18 ohms, so that the LED current will be slightly lower.</p><p>Things should be kept on the LED matrix design like this is, that these calculations is the calculation of the current if the scanning is running. If scanning is not running, then a current of 150mA will be entered on one LED alone <img src='http://www.sulhansetiawan.com/wp-includes/images/smilies/icon_exclaim.gif' alt=':!:' class='wp-smiley' /> And currents of this magnitude would likely destroy the LED. So, we must take precautions so that the current should only flow if scanning process has been running. A little good news is, if we use the MCS-51 as a controller, so when the reset (the scanning process is not running) port is always in a state of high. So, if the base of line controller transistor is connected to the MCS-51 port, so it can be sure that the current will not flow to the LEDs on the reset state. However, you must ensure that the program will not hang. Because if the program hangs and stops the scanning process, then it means disaster for your LED matrix. And if you are not sure that your program can run smoothly, then you can reduce the LED current so that even if the scanning process is not running, current flows are still small enough to be able to be borne by one LED.</p><p>To calculate the base resistor value of the line controller transistor, we only consider the transistor to work as a transistor switch, which is so current that flows is the saturation current. With the calculation of the collector current of 150mA, then we can use the C9012 transistor that has a current gain of about 150. We can take a value of 100 to make it more secure. With the gain of 100 and the collector current of 150mA, then the base current should be about 1.5 mA. Clamp voltage at the base resistor is approximately 5V &#8211; VBE, where VBE is about 0.7 V. Thus, the clamp voltage at the base resistor is about 4.3 V. Thus, the base resistor value is 4.3 V / 1.5 mA = 2K8. And again that this value is not available values. So we could slightly reduce the value to the nearest number of available, namely 2k7.</p><h4>Calculation of the column controller transistor current</h4><p>Column controller will sink as much current number of rows in that column. And we have determined that the number is eight lines. If we have determined that the LED current is 5mA, then the maximum current to be sunk by the column controller transistor is 8 x 5mA, which is 40mA. With the value of this, we simply use the C9013 transistor to control the column. The Gain of C9013 transistor is also about 150. And as before, we take saver value to 100 only. With the gain of 100 and the collector current of 40mA, then the base current in the column controller transistor is 0.4 mA.</p><p>Clamp voltage at the base resistor of the column controller transistor is the output voltage of 4017 minus 2x the VBE voltage. If we use a 5V power supply, then the output voltage of 4017 is approximately 4.8 V. Thus, the clamp voltage at the base resitor is about 4.8 &#8211; 2 x 0.7 = 3.4 V. Thus, the base resistor value of the column controller transistor is 3.4 V / 0.4 mA = 8K5. And again, this value is not available values. So, just use the 8K2.</p><h4>Calculation of the block columns controller transistor current</h4><p>The block columns controller transistor will sink as much current in the column controller transistor x 10, which is 10 x 40mA = 400mA. From the datasheet, C9013 has a maximum collector current of 500mA. So, we can still use the C9013 to controll block columns.</p><p>Clamp voltage at the base resistor of the block columns controller transistor is the voltage used to control this transistor reduced by 1x VBE. If we also use 4017 to control the block column, then the clamp voltage across the base resistor of the block columns controller transistor is approximately 4.8 &#8211; 0.7 = 4.1 V. Thus, the value of the base resistor of the block columns controller transistor is 4.1 V / 4mA = 1K.</p><p>That&#8217;s it. Happy trying <img src='http://www.sulhansetiawan.com/wp-includes/images/smilies/icon_exclaim.gif' alt=':!:' class='wp-smiley' /></p> ]]></content:encoded> <wfw:commentRss>http://www.sulhansetiawan.com/merancang-rangkaian-matriks-led/feed</wfw:commentRss> <slash:comments>174</slash:comments> </item> <item><title>SSMaker, tool for creating seven segment constant</title><link>http://www.sulhansetiawan.com/ssmaker</link> <comments>http://www.sulhansetiawan.com/ssmaker#comments</comments> <pubDate>Sat, 26 Jun 2010 09:36:50 +0000</pubDate> <dc:creator>Sulhan</dc:creator> <category><![CDATA[IDE (Integrated Development Environment)]]></category> <category><![CDATA[Microcontroller]]></category> <category><![CDATA[All]]></category> <category><![CDATA[Microcontroller Learning]]></category> <category><![CDATA[Microcontroller IDE]]></category><guid isPermaLink="false">http://sulhansetiawan.com/?p=1017</guid> <description><![CDATA[SSMaker.exe is a program to help make a lighting table of seven segment. Click on the segment to be switched on or off. After that, the table to form the light will be instantly displayed. Lights are represented by the value bit 0. To make the light represented by the value bit 1, check the [...]]]></description> <content:encoded><![CDATA[<div class="wp-caption aligncenter" style="width: 214px"><img title="SSMaker.exe" src="http://resource.sulhansetiawan.com/img/SSMaker.PNG" alt="SSMaker.exe" width="204" height="286" /><p class="wp-caption-text">SSMaker.exe</p></div><p>SSMaker.exe is a program to help make a lighting table of seven segment.</p><p>Click on the segment to be switched on or off. After that, the table to form the light will be instantly displayed. Lights are represented by the value bit 0. To make the light represented by the value bit 1, check the <strong>Active High</strong>.</p><div class="wp-caption aligncenter" style="width: 422px"><img title="SSMaker.exe" src="http://resource.sulhansetiawan.com/img/SSMaker5.PNG" alt="SSMaker5.exe" width="204" height="286" /> <img title="SSMaker.exe" src="http://resource.sulhansetiawan.com/img/SSMaker5A.PNG" alt="SSMaker5A.exe" width="204" height="286" /><p class="wp-caption-text">Constants for the number 5 is 92H (light = 0) or 6DH (light = 1)</p></div><p>By default, bit 0 is for segment A, bit 1 is for the segment b, and so on. But you also can change the order. Of course this arrangement tailored to the hardware. To determine the bits to its segments, right click on the segment to be determined its bit, then from pupop menu that appears, choose the number of bits.</p><div class="wp-caption aligncenter" style="width: 214px"><img title="SSMaker.exe" src="http://resource.sulhansetiawan.com/img/SSMakerBit.PNG" alt="SSMaker.exe" width="204" height="286" /><p class="wp-caption-text">Right-click on a segment for selecting bits for the segment.</p></div><p>If we use the bits that are being used by another segment, the segment which bits are used will be made to not connected to any bit. Signs that the segment is not connected to the bit is the segment which is marked with the letter X.</p><p>This program is a package of <a href="http://sulhansetiawan.com/microcontroller-project">Microcontroller Project</a></p> ]]></content:encoded> <wfw:commentRss>http://www.sulhansetiawan.com/ssmaker/feed</wfw:commentRss> <slash:comments>5</slash:comments> </item> <item><title>Microcontroller Project</title><link>http://www.sulhansetiawan.com/microcontroller-project</link> <comments>http://www.sulhansetiawan.com/microcontroller-project#comments</comments> <pubDate>Sat, 26 Jun 2010 08:00:34 +0000</pubDate> <dc:creator>Sulhan</dc:creator> <category><![CDATA[IDE (Integrated Development Environment)]]></category> <category><![CDATA[Microcontroller]]></category> <category><![CDATA[All]]></category> <category><![CDATA[FREE! Software]]></category> <category><![CDATA[Microcontroller IDE]]></category><guid isPermaLink="false">http://sulhansetiawan.com/?p=1010</guid> <description><![CDATA[Microcontroller Project is a graphical IDE (Integrated Development Environment) for MCS-51 microcontroller family that uses the ASEMW.EXE compiler. Thus, the syntax used in the Microcontroller Project is ASEMW syntax if written using assembly language. In addition to using assembly language, Microcontroller Project can also use c language for writing programs, using SDCC. Microcontroller Project integrate [...]]]></description> <content:encoded><![CDATA[<p><strong>Microcontroller Project</strong> is a graphical IDE (Integrated Development Environment) for MCS-51 microcontroller family that uses the <a href="http://www.plit.de/asem-51/home.htm">ASEMW.EXE</a> compiler. Thus, the syntax used in the <strong>Microcontroller Project</strong> is ASEMW syntax if written using assembly language.</p><p>In addition to using assembly language, <strong>Microcontroller Project</strong> can also use c language for writing programs, using <a href="http://sdcc.sourceforge.net/">SDCC</a>.</p><p><strong>Microcontroller Project</strong> integrate editor that comes with code explorer, code hint, and auto-completion so that writing programs is easier. And with the simulator, you will be facilitated in understanding the course of the program and while tracking program logic error.</p><p><strong>Microcontroller Project</strong> provides additional features from previous versions that will add convenience you make microcontroller projects. New features include:</p><ul><li><strong>Code Explorer</strong><p>If we create a variable declaration, then automatically the variables will be listed and will appear in the left panel of each editor. Likewise, the label that we have created, a macro that we created and others.</p><p>The list was made in the left pane are sorted alphabetically, not position. By double-clicking on an object, the cursor will be placed in the position where the objects is written.</p></li><li><strong>Auto Completion</strong><p>With the auto completion, when we write programs, we will be treated to a choice with the objects we have created. Thus, writing the program can be more quickly and does not easily occur wrongly written.</p><div id="code-completion" class="wp-caption aligncenter" style="width: 370px"><a href="http://resource.sulhansetiawan.com/img/Completion.PNG"><img style="border: 0px none currentColor;" title="Code completion appear automatically or can be invoked with the Ctrl+Spasi" src="http://resource.sulhansetiawan.com/img/Completion.PNG" border="0" alt="" width="360" height="278" /></a><p class="wp-caption-text">Code completion appear automatically or can be invoked with the Ctrl+Spasi</p></div><p>Code completion will automatically appear if we create a space, and is the right part to add the code. For example, when we make a space after writing acall, then that will appear are all labels that have been made. Likewise, if we write mov, then after adding a space, will soon be raised all the variables we have made.</p><p>We can also invoke code completion by pressing the <strong>Ctrl+Spasi</strong>. If we write programs in C language, then the code completion will not appear automatically, we must call it to appear by pressing the Ctrl+Space.</p></li><li><strong>Code Hint</strong><p>If we create a macro or function on writing C programs, then sometimes we forget what the parameters are owned by the macro or function. When we write a macro or function call, it will automatically appear hint that indicates the parameters that are owned by the macro or function.</p><div id="code-hint" class="wp-caption aligncenter" style="width: 370px"><a href="http://resource.sulhansetiawan.com/img/Hint.PNG"><img style="border: 0px none currentColor;" title="Code Hint helps show the parameters in the macro or function. Appears automatically or can be invoked by pressing Ctrl+Shift+Space" src="http://resource.sulhansetiawan.com/img/Hint.PNG" border="0" alt="" width="360" height="367" /></a><p class="wp-caption-text">Code Hint helps show the parameters in the macro or function. Appears automatically or can be invoked by pressing Ctrl+Shift+Space</p></div><p>And just like code completion, if code hint does not appear automatically, then we can call it to appear by pressing the <strong>Ctrl+Shift+Spasi</strong>.</p></li></ul><p>The most interesting of the Microcontroller Project is the integration with simulators that can be linked to various programs / other simulators. Simulator capability that can be linked to other simulators makes Microcontroller Project very easy for us in designing microcontroller-based systems.</p><p style="text-align: center;"><a name="download" title="Micro V7.0" href="http://resource.sulhansetiawan.com/mikrokontroler/MicroV7.7z"><img class="aligncenter" src="http://resource.sulhansetiawan.com/img/download.gif" alt="" width="87" height="30" />Micro V7.0</a></p> ]]></content:encoded> <wfw:commentRss>http://www.sulhansetiawan.com/microcontroller-project/feed</wfw:commentRss> <slash:comments>61</slash:comments> </item> <item><title>Running Text on LED Matrix</title><link>http://www.sulhansetiawan.com/teks-berjalan-pada-matriks-led</link> <comments>http://www.sulhansetiawan.com/teks-berjalan-pada-matriks-led#comments</comments> <pubDate>Tue, 02 Mar 2010 10:57:32 +0000</pubDate> <dc:creator>Sulhan</dc:creator> <category><![CDATA[Experiments]]></category> <category><![CDATA[All]]></category> <category><![CDATA[Microcontroller Learning]]></category> <category><![CDATA[LED matrix]]></category> <category><![CDATA[Microcontroller]]></category> <category><![CDATA[Moving Sign]]></category> <category><![CDATA[Simulation]]></category> <category><![CDATA[Running Text]]></category><guid isPermaLink="false">http://sulhansetiawan.com/teks-berjalan-pada-matriks-led</guid> <description><![CDATA[In the example in Showing images on LED matrix using simulator, the note is displayed as an image. First we create a text image, then we create a constant from the text image. After that it displayed as an image. Displaying text in this way is only appropriate if the text to be displayed is [...]]]></description> <content:encoded><![CDATA[<p style="TEXT-ALIGN: center"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="494" height="178" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="menu" value="false" /><param name="quality" value="medium" /><param name="scale" value="exactfit" /><param name="src" value="http://resource.sulhansetiawan.com/swf/MXLED-2.swf" /><embed type="application/x-shockwave-flash" width="494" height="178" src="http://resource.sulhansetiawan.com/swf/MXLED-2.swf" menu="false" scale="exactfit" quality="medium"></embed></object></p><p>In the example in <a href="http://sulhansetiawan.com/menampilkan-gambar-pada-led-matriks-menggunakan-simulator">Showing images on LED matrix using simulator</a>, the note is displayed as an image. First we create a text image, then we create a constant from the text image. After that it displayed as an image.</p><p>Displaying text in this way is only appropriate if the text to be displayed is short. In addition, the displayed text will not be changed anymore. If the note to be displayed is a long text, or text that is displayed will be changed, then there is a better way than that way.</p><p>A better way is as follows: First, we create a character constant. In the example here, we make a character constant of 8 rows x 5 columns character size. The character constant was created using Karakter.bmp that you can edit to fit your desires.</p><p>Once we get a constant character, by compile the Karakter.bmp using <a title="ImgTable.zip" href="http://sulhansetiawan.com/mikrokontroler/ImgTable.zip"><strong>ImgTable.exe</strong></a>, then every time we will display the text, we do it by reading the text character-by-character. Each character is read, then displayed by looking at the character table. In this way, we can display any article and can be changed while the program is running. Of course you have to create a procedure to change the text to be displayed if you want to replace it.</p><p>Unfortunately <a title="the program listing" href="http://sulhansetiawan.com/microsource/RunningText.zip"><strong>the program listing</strong></a> only writen in assembly language. So, if you prefer to use the C language, please do the conversion yourself <img src='http://www.sulhansetiawan.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p><p>If you want to try the example program using MXLED, do the simulator settings as in <a href="http://sulhansetiawan.com/menampilkan-gambar-pada-led-matriks-menggunakan-simulator">Showing images on LED matrix using simulator</a></p><p>Good luck <img src='http://www.sulhansetiawan.com/wp-includes/images/smilies/icon_exclaim.gif' alt=':!:' class='wp-smiley' /></p> ]]></content:encoded> <wfw:commentRss>http://www.sulhansetiawan.com/teks-berjalan-pada-matriks-led/feed</wfw:commentRss> <slash:comments>64</slash:comments> </item> <item><title>Using MXLED.EXE for LED matrix simulation</title><link>http://www.sulhansetiawan.com/menggunakan-mxledexe-untuk-simulasi-matriks-led</link> <comments>http://www.sulhansetiawan.com/menggunakan-mxledexe-untuk-simulasi-matriks-led#comments</comments> <pubDate>Sat, 31 Jan 2009 23:37:14 +0000</pubDate> <dc:creator>Sulhan</dc:creator> <category><![CDATA[All]]></category> <category><![CDATA[Simulator]]></category> <category><![CDATA[Microcontroller Learning]]></category> <category><![CDATA[LED matrix]]></category> <category><![CDATA[Microcontroller]]></category> <category><![CDATA[Simulation]]></category><guid isPermaLink="false">http://sulhansetiawan.com/?p=467</guid> <description><![CDATA[MXLED controlled using two ports, a port as a data port and another as a control port. Both the data port and control port are received as a WM_USER message at the wParam. To determine that the received signal is a data or control, MXLED will look at the lParam. If lParam = 2, then [...]]]></description> <content:encoded><![CDATA[<p>MXLED controlled using two ports, a port as a data port and another as a control port. Both the data port and control port are received as a WM_USER message at the wParam. To determine that the received signal is a data or control, MXLED will look at the lParam. If lParam = 2, then the received signal is a signal to the data. Whereas if lParam = 1, then the received signal is a control signal.</p><p>There are six sizes provided by MXLED, ie 8 × 16, 8 × 32, 8 × 48, 16 × 16, 16 × 32, and 16 × 48. For each size there are two choices of orientation, ie landscape and portrait.</p><p>Control signals only use bit.0 and bit.1. Bit.0 used to reset the counter, while bit.1 used to increase the counter.</p><p>Data signal used to determine which LED where lit and LED where off. For each time, there were only eight LED that are controlled, which LED on the current column. To determine which columns is active, we use a counter. At the time counter is reset, then the column 0 is active. then if we provide the clock signal, the signal on bit.1, then the active column will move to column 1. Then if given the clock signal again, the active column will be column 2. and so on.</p><p>There are two choices of the clock signal, ie the L to H transition or the H to L transition.</p><p>The arrangement of the columns of LEDs depends on the size and orientation. For landscape orientation, then the left column is a lower column and the right column is a higher column. This applies to the size of 8x. As for the size of 16x, then the LED array is divided into two blocks of rows. The first column number of the second row block is the column number of the last column of the first row block plus 1.</p><p>More details are as follows:</p><pre class='notrnaslate'>16 x 16

Row 0..7 : 0  1  2  ......15

Row 8..15: 16 17 18 ......31

16 x 32

Row 0..7 : 0  1  2  ......31

Row 8..15: 32 33 34 ......63

16 x 48

Row 0..7 : 0  1  2  ......47

Row 8..15: 48 49 50 ......95
</pre><p>For each block row, bit.0 will control the LED at the top, while bit.7 will control the LED at the bottom.</p><p>For portrait orientation, we divide the LED into a column or a block of columns and rows. Counter will determine which row is active. Top row is row 0, and will be active if the reset signal is activated. The active row increase along with the clock signal acquisition.</p><p>For the 8x size, column 0 is the leftmost column and activated by bit.0. Whereas column 7 is the rightmost column and activated by bit.7</p><p>Rule for the 16x size could be analogous to the position of landscape orientation.</p><p>MXLED simulated on the system to work like a real matrix. If we managed to change the active row or column  slowly, then it can be seen only eight moving lights jumping around. However, if the changes is fast enough, then the lit changes of the LED will be seen steady not blinking. So the simulation MXLED will feel like a real LED matrix.</p><p>You can see examples of the use of this MXLED in the example <a href="http://www.sulhansetiawan.com/menampilkan-gambar-pada-led-matriks-menggunakan-simulator">Showing Images on LED Matrix using Simulator</a></p></p> ]]></content:encoded> <wfw:commentRss>http://www.sulhansetiawan.com/menggunakan-mxledexe-untuk-simulasi-matriks-led/feed</wfw:commentRss> <slash:comments>35</slash:comments> </item> <item><title>Showing Images on LED Matrix using Simulator</title><link>http://www.sulhansetiawan.com/menampilkan-gambar-pada-led-matriks-menggunakan-simulator</link> <comments>http://www.sulhansetiawan.com/menampilkan-gambar-pada-led-matriks-menggunakan-simulator#comments</comments> <pubDate>Tue, 04 Nov 2008 06:59:46 +0000</pubDate> <dc:creator>Sulhan</dc:creator> <category><![CDATA[Experiments]]></category> <category><![CDATA[All]]></category> <category><![CDATA[Microcontroller Learning]]></category> <category><![CDATA[LED matrix]]></category> <category><![CDATA[Microcontroller]]></category> <category><![CDATA[Moving Sign]]></category> <category><![CDATA[Simulation]]></category><guid isPermaLink="false">http://sulhansetiawan.com/?p=257</guid> <description><![CDATA[Controlling the LED matrix is actually almost the same as controlling seven segment. The difference is that the LEDs of seven segment are organized into seven sections which could form the figures. While the LED matrix, LEDs are arranged into a matrix that can be referenced by column and row. The columns on the LED [...]]]></description> <content:encoded><![CDATA[<p style="text-align: center;"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="494" height="178" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="menu" value="false" /><param name="quality" value="high" /><param name="src" value="http://resource.sulhansetiawan.com/swf/MXLED.swf" /><param name="vspace" value="10" /><param name="hspace" value="10" /><embed type="application/x-shockwave-flash" width="494" height="178" src="http://resource.sulhansetiawan.com/swf/MXLED.swf" hspace="10" vspace="10" quality="high" menu="false"></embed></object></p><p>Controlling the LED matrix is actually almost the same as controlling seven segment. The difference is that the LEDs of seven segment are organized into seven sections which could form the figures. While the LED matrix, LEDs are arranged into a matrix that can be referenced by column and row. The columns on the LED matrix can be equated with the digits on the seven segment. While the lines on the LED matrix can be equated with LED a through LED g plus a decimal point LED on seven segment. Thus between the seven segment and LED matrix is basically the same, especially if the number of rows are only eight.</p><p>Then how to display images on the LED matrix? Yes basically the same as displaying the numbers on the seven segment. If you are already familiar with how to display data on the seven segment display using the buffer as is done in discussion about seven segment in the <strong><a title="Easy and Fun Learning Microcontroller" href="http://www.sulhansetiawan.com/mudah-dan-menyenangkan-belajar-mikrokontroler/">Easy and Fun Learning Microcontroller</a></strong> book, in which to display data on the seven segment, all we have to do is fill the display buffers, then to display image on the LED matrix, all we need to do is also just fill data on corresponding display buffers.</p><p>In the picture above, the size of the LED matrix that we use is 8 rows x 32 columns. This size is equivalent to seven segment which the number of digits are 32 digits. Thus basically we need a total of 32 bytes of display buffers. The LEDs on the top line we associate with bit 0 of port and successively LEDs on the lines below to bit 1, bit 2, and so on until bit 7. To make a LED lit on a particular line, then we need only fill the correlated bits with 0 or 1 depending on the configuration of the matrix that we use, active low or active high. For ease of understanding, we usually use active high so to lit the LED on the top line then we have to make the bit 0 to has the value of 1.</p><p>As an example, consider the logo below. The logo size is 32 x 32. Therefore, the logo may not be displayed on the LED matrix with the size of 32 x 8 at once. To display it, we have to split the logo into four parts. After that we have to show four parts one by one.</p><p>To the left of the logo there is a number from 0 to 7 and repeated up to four times. While above the logo are the numbers from 0 to 31. These figures will show us how to display the parts of the logo on the LED matrix. The figure above the logo shows the buffer index, while the figure at left of the logo shows the bit position. Thus, to show the first part of the logo (the top), then the buffer [0] must be filled with data 11111111b, buffer [1] = 00000001b, buffer [10] = 00011001b, and so on.</p><pre style="TEXT-ALIGN: center" class='notranslate'>  0.        1.        2.        3.
  01234567890123456789012345678901<span style="color:red;">
0 ©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©
1 © .............................©
2 ©..........©©©©..©©©©..........©
3 ©........©©©©©©..©©©©©©........©
4 ©......©©©©©©©©..©©©©©©©©......©
5 ©.....©©©©...©©..©©...©©©©.....©
6 ©....©©©.....©©..©©.....©©©....©
7 ©...©©©......©©..©©......©©©...©</span><span style="color:brown;">
0 ©..©©©.......©©..©©.......©©©..©
1 ©..©©........©©..©©........©©..©
2 ©.©©©............©©............©
3 ©.©©.............©©............©
4 ©.©©©©©©©©©©©©©..©©©©©©©©©©©©©.©
5 ©.©©©©©©©©©©©©©..©©©©©©©©©©©©©.©
6 ©............©©.............©©.©
7 ©............©©............©©©.©</span><span style="color:green;">
0 ©..©©........©©..©©........©©..©
1 ©..©©©.......©©..©©.......©©©..©
2 ©...©©©......©©..©©......©©©...©
3 ©....©©©.....©©..©©.....©©©....©
4 ©.....©©©©...©©..©©...©©©©.....©
5 ©......©©©©©©©©..©©©©©©©©......©
6 ©........©©©©©©..©©©©©©........©
7 ©..........©©©©..©©©©..........©</span><span style="color:blue;">
0 ©..............................©
1 ©..©©©.©..©..©©..©...©.©..©©©©.©
2 ©.©....©..©.©..©.©©..©.©.©.....©
3 ©.©....©©©©.©©©©.©.©.©....©©©..©
4 ©.©....©..©.©..©.©..©©.......©.©
5 ©..©©©.©..©.©..©.©...©...©©©©..©
6 ©..............................©
7 ©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©</span>
The Logo.</pre><p>To be able to fill these data to the buffer with ease, then we can create an image data table. This technique is similar to how to show the variation of Running LED on exercise 5 of the <strong><a title="Easy and Fun Learning Microcontroller" href="http://www.sulhansetiawan.com/mudah-dan-menyenangkan-belajar-mikrokontroler/">Easy and Fun Learning Microcontroller</a></strong> book or on the <strong><a title="Running LED simulation on Microcontroller" href="http://www.sulhansetiawan.com/simulasi-led">LED Simulation</a></strong> article. Each image table has the same size with the size of the buffer. And for the case of the logo above, we need four 32 bytes size image tables.</p><p>Like on the Running LED exercise, the work of preparing the table is a tedious job and requires precision. But you should not be discouraged if you want to make the table of the large and complicated image because you can use the aid program <a title="ImgTable.zip" href="http://resource.sulhansetiawan.com/mikrokontroler/ImgTable.zip"><strong>ImgTable.exe</strong></a>. The program will help you to convert bmp format images into an image table that we can use it in the program using either the M51 format or using the SDCC format. So to get an image table, you simply create an image using MSPaint, and then do the conversion using ImgTable.exe.</p><p>ImgTable.exe can do the conversion from bmp file with a monochrome format up to 24 bits format. But because the table will be used to lit the LED which of course is equivalent to a monochrome format, the 24 bits format would be first converted by ImgTable.exe into the monochrome format. Therefore, it is better if you save the images you create with monochrome format to save on file size.</p><p>Rules applied by ImgTable is that the pixels that are black will be converted into 1, while the white pixels into 0. For colors other than black and white, then the three basic color elements will be summed first, then divided by three. After that, if the value is closer to the black will be interpreted as black, and if it is closer to white will be interpreted as white.</p><p>Table creation sequence is from left to right and from top to bottom. From top to bottom means every eight pixels will be taken as one byte. For example, an image with a size of 32 x 32, it will be four tables with the size of 32 bytes. The first table stores the data of the coordinates (0,0) to (31,7) by the rule that the upper left pixel is (0,0) and the lower right pixel is (31.31). The second table is (0,8) to (31,15). So forth.</p><p>In this example, all tables store the entire image data appropriately because the high of the image size is a multiples of eight. If the size of the image is not a multiples of eight, then the final table will have the remaining bits. For example if the image size is 32 (width) x 33 (height), then the number of tables are five tables with size of 32 bytes. And the last table only use bit 0. While bit 1 to bit 7 will be filled with 0.</p><p>Return to the LED matrix, we must display the four parts of the logo one by one. But if we display them alternately, then the shape of the logo will not be seen clearly. We will only see the incomplete images that appear alternately. Therefore we have to show by shifting it up or down. However, we have created tables that contains the data of the image blocks. So we can not retrieve data from the image coordinates (0,1) to (31,8) directly. For that, we need one more buffer with the same size as the first buffer. If we call the first buffer as the display buffer, then we call the second buffer as hidden buffer because it was not for displaying data to the LED matrix. This buffer is only used as an aid in manipulating the display data.</p><p>In case we want to shift the image up, then we can describe the arrangement as if the buffer is as follows:</p><pre style="TEXT-ALIGN: center" class='notranslate'>01245...
abcde...
Numbers = the display buffer, alfabets = hidden buffer.</pre><p>The first time, we fill the display buffer with data 0, so that all the LEDs will be turned off. Then we put the first image block table on hidden buffer. After that do a bit shifting between a and 0, b and 1, c and 2, and so on. Do these shifts of up to eight times, which means that all parts of the image block has been on display buffer. And before doing the ninth shift, we must place the second image block into the hidden buffer. And the next step is an iteration of the previous step.</p><p>For more details, you can see the <strong><a title="LedMatriks.zip" href="http://resource.sulhansetiawan.com/microsource/LedMatriks.zip">program listing</a></strong> for the demo above that is written in the format of M51 and c. In the listing, there is DelayTime constants that you can replace to change the speed of picture motions.</p><p>To try on the simulator, then you must set the port link so that both Port0 and Port1 are linked to MXLED.exe by the message link with the WM_USER message, and lParam of Port0 is 2 and lParam of Port1 is 1. You also have to set the configuration of MXLED size as 8 x 32 landscape.</p><p>Happy trying and please do not hesitate to ask if there are less clear. Hopefully useful.</p> ]]></content:encoded> <wfw:commentRss>http://www.sulhansetiawan.com/menampilkan-gambar-pada-led-matriks-menggunakan-simulator/feed</wfw:commentRss> <slash:comments>102</slash:comments> </item> <item><title>3 Digits Counter</title><link>http://www.sulhansetiawan.com/counter-3-digit</link> <comments>http://www.sulhansetiawan.com/counter-3-digit#comments</comments> <pubDate>Mon, 22 Sep 2008 03:27:44 +0000</pubDate> <dc:creator>Sulhan</dc:creator> <category><![CDATA[Experiments]]></category> <category><![CDATA[Microcontroller]]></category> <category><![CDATA[All]]></category> <category><![CDATA[Microcontroller Learning]]></category> <category><![CDATA[Counter]]></category><guid isPermaLink="false">http://sulhansetiawan.com/?p=224</guid> <description><![CDATA[A friend asked me for help to create a program to perform calculations that can go up or down. The data displayed on a three-digit seven segment. Meanwhile, the buttons mounted on the port 3 used to raise or lower the count. Actually, he asked me to place the digits control using P0, and P2 [...]]]></description> <content:encoded><![CDATA[<p>A friend asked me for help to create a program to perform calculations that can go up or down. The data displayed on a three-digit seven segment. Meanwhile, the buttons mounted on the port 3 used to raise or lower the count.</p><p>Actually, he asked me to place the digits control using P0, and P2 for segment data. However, because previously I had made the program with P0 as the control of digits and P1 for segment data, so that I don&#8217;t need to reconfigure when I tried on the simulator, I keep using P0 as the control of digits and P1 for segment data. Therefore if you have already used P0 as the control of digits and P1 for segment data, then you need to change the PortDigit and PortData constants at the top of the program.</p><p>To realize the friend request, I use the way I usually do if I want to display data on the seven segment, i.e. put seven segment manager procedure on the timer interrupt. This ensures our programs to be able to display data on the seven segment with good brightness. There are several examples of programs that put the seven segment scanning process in the main program. But we know that the seven segment which installed in a multiplex must continuously scanned to be able to display the data. If the program are less keen in doing the scanning, then the display will be disturbed. Probably will not light up, and this is the worst, or at least the light intensity of the seven segment will be dimmed. And it is very unpleasant. By using a timer interrupt to do the scanning, we can relieve our attention from the scanning process, because it has been fully handled the interrupt handler. So this way is the best way (at least I think so, you may leave a comment if you do not agree).</p><p>Then, because the program is indeed a very simple program, then we can use all facilities owned by the microcontroller without much consideration. For easier handling in counter addition or subtraction, we can use the external interrupts, i.e. ext0 and ext1. So we just attach the button at P3.2 (ext0) and P3.3 (ext1). Of course we must use the button that really bounce-free (bounceless), so that if we press the button once, then we also get only one count. To raise the count, we use ext0. As for lowering the count, we use ext1. In the main program, we do not even do anything.</p><p>Using interrupts to handle button is very simple in terms of response. But the drawback is that the button used should be a bounceless type. In addition, only P3.2 and P3.3 can be used. Therefore, using debouncing technique as I have discussed in the <a title="Mudah dan Menyenangkan Belajar Mikrokontroler" href="http://www.sulhansetiawan.com/mudah-dan-menyenangkan-belajar-mikrokontroler"><strong>Easy and Fun Learning Microcontroller</strong></a> book will probably be a better solution in handling button. For that, I also will feature a program that handles the button not on the external interrupt, but placed on the timer interrupt. Thus, in addition to the timer interrupt is used to perform seven segment scanning is also used for button scanning.</p><p>In scanning through the timer interrupt, we can use any button, does not have to use the bounceless. We just need to adjust how quickly button bounce will be addressed. To try it, you can change the value MaxWait to 255 to slow down the response of the button bounce. If you use a simulator, and a computer that used is quite a fast computer, it may be the key response is still too fast. You simply change the TimeOutDown and TimeOutUp type to be <span style="color: #800000;">unsigned int</span>, and change the MaxWait value to higher rates. After that, try to press the button on Tombol.exe with high frequency. You will find that if the button is pressed too quickly, then presses the button too fast will be considered as a bounce. Thus, we can use the buttons that are not really bounce free. All you need to do is adjusting how sensitive your buttons, i.e. by setting the MaxWait value. And generally, you will not use numbers higher than 255. Therefore, the data type I use is <span style="color: #800000;">unsigned char</span>.</p><p>Remember, if you use Tombol.exe as simulated buttons, then you must set the used port (in this case is P3) on the simulator to be linked in <strong>Link Message</strong>. This is necessary because Tombol.exe send the keystrokes signals to the simulator through Window Message. As for the program that handles button via the external interrupts, then you can not use Tombol.exe, because Tombol.exe could not provide an interrupt signal to the simulator. You must use the existing buttons on the simulator. To display this button port window is from the <strong>View-Port</strong> menu. Then from the window, double-click on the desired port, which is the name of the port, not on its value, because if you double-click on the value, then it will appear the dialog to change the value of the port or the relevant registers.</p><p>Another friend asked me, &#8220;How do I create a program that constantly monitor keystrokes, but other operations continue to run without being interrupted by the oversight of the key&#8221;. Well, two examples of the above program, whether using an external interrupt and those that use the button scanning on the timer interrupt, has conducted monitoring of key presses continuously, while at the main program does not even do anything. Thus, the above example is also an answer to this question. You simply put the other operations in the main program, while the supervision of the button has been continuously monitored.</p><p><strong><a title="Counter3Digit.zip" href="http://resource.sulhansetiawan.com/microsource/Counter3Digit.zip">I wrote the program in c and M51 language only</a></strong>. So if you just have a Micro v5.4, which is the IDE that I include in the <strong><a title="Mudah dan Menyenangkan Belajar Mikrokontroler" href="http://www.sulhansetiawan.com/mudah-dan-menyenangkan-belajar-mikrokontroler">Easy and Fun Learning Microcontroller</a></strong> book, then you should first download the <strong><a title="Microcontroller Project" href="http://www.sulhansetiawan.com/microcontroller-project#download">latest version of the IDE that supports the C language.</a></strong></p><p>Happy trying, hopefully useful.</p><div id="download" class="wp-caption aligncenter" style="width: 97px"><a href="http://resource.sulhansetiawan.com/microsource/Counter3Digit.zip"><img class="  " title="Source" src="http://resource.sulhansetiawan.com/img/download.gif" alt="Source" width="87" height="30" /></a><p class="wp-caption-text">Source</p></div> ]]></content:encoded> <wfw:commentRss>http://www.sulhansetiawan.com/counter-3-digit/feed</wfw:commentRss> <slash:comments>14</slash:comments> </item> <item><title>Seven segment simulation for digital clock program with hours-minutes-seconds display</title><link>http://www.sulhansetiawan.com/simulasi-seven-segment-untuk-program-jam-digital-dengan-tampilan-jam-menit-detik</link> <comments>http://www.sulhansetiawan.com/simulasi-seven-segment-untuk-program-jam-digital-dengan-tampilan-jam-menit-detik#comments</comments> <pubDate>Mon, 22 Sep 2008 03:25:41 +0000</pubDate> <dc:creator>Sulhan</dc:creator> <category><![CDATA[Experiments]]></category> <category><![CDATA[All]]></category> <category><![CDATA[Microcontroller Learning]]></category> <category><![CDATA[Digital Clock]]></category> <category><![CDATA[Microcontroller]]></category> <category><![CDATA[Seven Segment]]></category> <category><![CDATA[Simulation]]></category><guid isPermaLink="false">http://sulhansetiawan.com/?p=222</guid> <description><![CDATA[Seven Segment is one of the most common components used primarily to display data in the form of numbers. For that, Microcontroller Project also provides a simulation for seven segment, namely SSLED.exe. Seven segment simulation provided by the SSLED.exe has eight-digit in multiplex manner. Multiplex technique is the most commonly used because of its compact [...]]]></description> <content:encoded><![CDATA[<p style="TEXT-ALIGN: center"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="339" height="159" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="menu" value="false" /><param name="quality" value="high" /><param name="scale" value="exactfit" /><param name="src" value="http://resource.sulhansetiawan.com/swf/SSLED.swf" /><embed type="application/x-shockwave-flash" width="339" height="159" src="http://resource.sulhansetiawan.com/swf/SSLED.swf" menu="false" scale="exactfit" quality="high"></embed></object></p><p>Seven Segment is one of the most common components used primarily to display data in the form of numbers. For that, <strong><a title="Micro Project Versi Terbaru" href="http://www.sulhansetiawan.com/microcontroller-project">Microcontroller Project</a></strong> also provides a simulation for seven segment, namely SSLED.exe.</p><p>Seven segment simulation provided by the SSLED.exe has eight-digit in multiplex manner. Multiplex technique is the most commonly used because of its compact wiring and requires only a few ports to control it. How to control the seven segment arranged in multiplex is by dividing two kinds of line, i.e. the data line and digits control line. Data line is used to determine which LED are lit, while the digits controller line is used to set which digits are lit.</p><p>Data line and digits control line of SSLED.exe received using window message as WM_USER. If lParam is 1, then the received signal will be considered as a signal for digits control line. Whereas if the lParam value is 2, then the received signal will be considered as a signal for the data line.</p><p>On the data line, bit 0 will be used for LED a, bit 1 to turn on the LED b, and so on until bit 6 to turn on the LED g. While the bit 7 is used to lit the decimal point LED. If a bit is 1, then the corresponding LED will lit. This would fit with the common cathode type. However, we can also reverse the data so that if the data sent value is FF, then the data would be considered 00. This capability is useful for adjustment with seven segment types to be used.</p><p>SSLED.exe provides two ways of controlling the digits, i.e. the parallel way and the counter way. In the parallel way, each digit can be individually activated depending on the bit of the line controller. Bit 0 in the line controller will control the rightmost digit and bit 7 will control the leftmost digit. If a bit is 1, then the corresponding digits will be active. And just as in the data line, the line controller digits can also be reversed.</p><p>In counter mode, only bit 0 and bit 1 in the line controller digit is used. Bit 0 is used to reset the counter, so the active digit will be the rightmost digit. While the bit 1 is used to shift the active digit to be the next left digit, or name it as raising the counter count. There are two kinds of how to raise the counter count, i.e. L to H transition or H to L transition. If we use the L to H transition, then the counter will be increased if bit 1 state changed from 0 to 1. Conversely, if the transition used are H to L, then counter would be raised if the bit condition changed from 1 to 0.</p><p>If the current digit is the leftmost digit and count raised, the active digit will return to the rightmost digit.</p><p>The picture above is an example of how simulation if operated for seven segment display digital clock program. Above program is actually a modification of the program on Interrupts chapter of the <a title="Mudah dan Menyenangkan Belajar Mikrokontroler" href="http://www.sulhansetiawan.com/buku/mudah-dan-menyenangkan-belajar-mikrokontroler/"><strong>Easy and Fun Learning Microcontroller</strong></a> book, ie on Timer.A51 program. But in the book we will try to program the actual seven segment, so we need to save money just by using four digits only. While in this simulation, we have simulated seven segment that provides eight digits. Therefore, we can show not only hours and minutes but also seconds. In fact we still have the remaining two digits. The remaining digits are used to separate hours to minutes and minutes to seconds, i.e. by displaying a (-) sign. Therefore, we need a little modification of the Timer.A51 program in order to display the seconds and the separation mark.</p><p><a title="Jam8Digit.zip" href="http://resource.sulhansetiawan.com/microsource/Jam8Digit.zip"><strong>The source code</strong></a> is written with the format of M51 and c where the data signal transmitted using P0, and the digit control signal using P1. Thus, we must set P0 to link by the Link Message with a WM_USER message, and lParam value is 2 and fill the Handle with the Handle of running SSLED.exe using Capture Handle button. Do this to P1 too. But in P1, lParam value is 1. And remember, remove the check mark on the <strong>Update Display</strong> menu on the simulator.</p><p>But keep in mind that the program is written to run on a microcontroller with a 11.592 MHz crystal. So the second change speed during the simulation may be is not correct. And its speed depends on the speed of the computer you use.</p><p>Well, interesting isn&#8217;t it? Happy trying <img src='http://www.sulhansetiawan.com/wp-includes/images/smilies/icon_exclaim.gif' alt=':!:' class='wp-smiley' /></p><div id="download" class="wp-caption aligncenter" style="width: 97px"><a href="http://resource.sulhansetiawan.com/microsource/Jam8Digit.zip"><img class="  " title="Source" src="http://resource.sulhansetiawan.com/img/download.gif" alt="Source" width="87" height="30" /></a><p class="wp-caption-text">Source</p></div> ]]></content:encoded> <wfw:commentRss>http://www.sulhansetiawan.com/simulasi-seven-segment-untuk-program-jam-digital-dengan-tampilan-jam-menit-detik/feed</wfw:commentRss> <slash:comments>98</slash:comments> </item> </channel> </rss>
