tag:blogger.com,1999:blog-2622253481346924492024-03-06T07:15:03.863+05:00Arthur's corner (embedded projects)My small embedded-related projects DeusExMachinahttp://www.blogger.com/profile/07663528269192019672noreply@blogger.comBlogger13125tag:blogger.com,1999:blog-262225348134692449.post-77417576666496736792015-11-14T18:52:00.001+05:002015-11-30T17:58:31.094+05:00Weather station: Chibios, stm32f051, bmp180, DHT11 sensor and 1.3 OLED sh1106 display <div dir="ltr" style="text-align: left;" trbidi="on">
Although I am an electronic engineer, periodically I want to spend my time constructing some fancy devices for home. Last weekend's project was a Meteorology station - I really need to know the temperature, pressure and humidity in my apartment!<br />
<br />
So, the first thing to do - decide what hardware platform fits well. I choose STM32F051 MCU (it's really cheap and powerful enough for my modest needs). The compiler should be arm-none-eabi-gcc, RTOS - Chibios, graphical engine - uGFX.<br />
The other thing to deal with - its sensors! Well, let's forget about analogue sensors. All we need are modern digital devices! I personally hate calibration, because it's too tedious to tune every sensor individually.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><img src="http://unihobbies.co.za/image/cache/data/BMP180_Pressure_Sensor_-500x500-1050x785.jpg" height="149" style="margin-left: auto; margin-right: auto;" width="200" /></td></tr>
<tr><td class="tr-caption" style="text-align: center;">BMP180 Sensor</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><img src="http://i00.i.aliimg.com/wsphoto/v0/522268110/5-PCS-LOT-Single-Bus-DHT11-Digital-Temperature-and-Humidity-Sensor-DHT11-Probe-090345.jpg" height="200" style="margin-left: auto; margin-right: auto;" width="200" /></td></tr>
<tr><td class="tr-caption" style="text-align: center;">DHT11 Sensor</td></tr>
</tbody></table>
So, I've selected Bosch Sensortec's bmp180 sensor for temperature and pressure. For the humidity I've selected a cheap Chinese DHT11 sensor. Maybe this was a mistake, because it was not easy to make it work properly.<br />
<br />
To show the information it has a 1.3' OLED <a href="http://www.aliexpress.com/item/1-3inch-OLED-Blue-Color-Display-Module-Chip-SH1106-128-64-Resolution-SPI-I2C-Interfaces-with/32294508948.html">display</a>. BMP180 is I2C sensor, and the display uses this bus as well. The DHT11 sensor uses it's self-brew protocol, quite tricky for implementation with any RTOS, because you have to use micro-secondary delays to get data.<br />
<br />
The schematics are quite simple:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjOtRmh0Ma7SrJkI5takbyL-Xn-xaErwcMghYMH6jleUzbd6TdQV5AyVzE1BpXtGVEfPeZGeZvhFiqrDkmWWjgIJ5q_00LiEtO_qfaHJDBsYiEiObpfWiBz6YY3whTywbr_GwfIcpldT_w/s1600/shc.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="505" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjOtRmh0Ma7SrJkI5takbyL-Xn-xaErwcMghYMH6jleUzbd6TdQV5AyVzE1BpXtGVEfPeZGeZvhFiqrDkmWWjgIJ5q_00LiEtO_qfaHJDBsYiEiObpfWiBz6YY3whTywbr_GwfIcpldT_w/s640/shc.png" width="640" /></a></div>
The PCB layout is simple too.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiDu2DQtRw9YiU5eoV-70dUI4pOA-0CPrho5TjaF42lUfHDHnCx_IkVs0VAFsfBeYBkgIxr_jv9quT8CK5ZNqB5C81NWy2jf4RS1-mSzXlAot7O0edapOITpYyihmS2PjmwvkO_gaZAwJk/s1600/brd.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiDu2DQtRw9YiU5eoV-70dUI4pOA-0CPrho5TjaF42lUfHDHnCx_IkVs0VAFsfBeYBkgIxr_jv9quT8CK5ZNqB5C81NWy2jf4RS1-mSzXlAot7O0edapOITpYyihmS2PjmwvkO_gaZAwJk/s640/brd.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg11T70Yr7OgzPYt8dgk48S1NBBDeaEj21HsfeCodrcKYzF_Z1bn-0k3596PjfiKZDrAf9Nm4spJ_POB3kLNV0oS3K_7Yauaxec203meM0uTmfUOUprN7X3tSUwV-08jhuCqc0puhZ7JI4/s1600/IMG_20151115_002703.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="174" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg11T70Yr7OgzPYt8dgk48S1NBBDeaEj21HsfeCodrcKYzF_Z1bn-0k3596PjfiKZDrAf9Nm4spJ_POB3kLNV0oS3K_7Yauaxec203meM0uTmfUOUprN7X3tSUwV-08jhuCqc0puhZ7JI4/s320/IMG_20151115_002703.jpg" width="320" /></a></div>
<br />
The only mess I had was that I routed the DHT11's data line to the PB2 pin of the MCU. This pin unable to perform a ICU (interval capture unit) feature :( So, I had to implement sensor reading using a conventional the GPIO port function. <a href="http://www.playembedded.org/">Here</a> there is an <a href="http://www.playembedded.org/index.php?lang=en&mod=art&sec=chi&id=006">example</a> of how to use this hardware feature with a DHT11, but due to already-produced PCBs I can't use this approach.<br />
So, I grabbed my logic analyzer and ran it with <a href="http://sigrok.org/wiki/Main_Page">Sigrok</a>. I was happy to find that the latest Sigrok has an embedded decoder for the DHT11 protocol!<br />
<img src="https://pbs.twimg.com/media/B6rhKCUIIAAIQzG.png" /><br />
<br />
Okay, the code has been uploaded to <a href="https://github.com/Nomados/Weather-Station">github</a>. Enjoy!<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxPDPCudhrOKZnRuu3M3aZpiXOwOcvOCYOnyIck8HyqcnPpa5goYn7x7pDjCC4JY1JVIv3HnxTLCFhPhgS73YAMDEk4CjGjMnnFxjpoP21e-3PPJyv4e9Uhc2UVtIXu7Z3EEqIVTlFqbM/s1600/IMG_20151115_002807.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="473" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxPDPCudhrOKZnRuu3M3aZpiXOwOcvOCYOnyIck8HyqcnPpa5goYn7x7pDjCC4JY1JVIv3HnxTLCFhPhgS73YAMDEk4CjGjMnnFxjpoP21e-3PPJyv4e9Uhc2UVtIXu7Z3EEqIVTlFqbM/s640/IMG_20151115_002807.jpg" width="640" /></a></div>
<br />
<br />
<br /></div>
DeusExMachinahttp://www.blogger.com/profile/07663528269192019672noreply@blogger.com0tag:blogger.com,1999:blog-262225348134692449.post-7684486572148785922015-02-18T17:20:00.003+05:002015-02-18T17:20:18.256+05:00Using Ethernet PHY with STM32F4DISCOVERY in Chibios<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
Ethernet with Chibios on STM32F4Discovery</h2>
<div style="text-align: left;">
<br /></div>
<div class="MsoNormal" style="text-align: left;">
<span lang="EN-US" style="line-height: 115%;"><a href="http://www.st.com/internet/evalboard/product/252419.jsp">STM32F4DISCOVERY</a> board is r</span>ather chip and can be easily purchased <span lang="EN-US">for the price near 25$. <o:p></o:p></span><span lang="EN-US" style="line-height: 115%;">It features powerful stm32F407 MCU, with
FPU, MAC, USB and 1Mb of flash. Moreover, it runs on 168 MHz frequency.</span>
So your tasks will run really fast! For my projects I use <a href="http://www.chibios.org/">Chibios</a>/RT, which
make developing applications just a piece of cake, b<span style="line-height: 115%;">ecause of many ready to use drivers and
many devboards support "out of the box".</span></div>
<div class="MsoNormal" style="text-align: left;">
<span style="line-height: 20px;">stm32F407 supports MAC, so we can go to eher/inter net to send/receive data. I used module with PHY from aliexpress.com, with DP8 from Texas Instruments.</span><br />
<span style="line-height: 20px;">You can find my code in <a href="https://github.com/Nomados/STM32F4Discovery-ethernet-PHY-DP83848-demo-ChibiOS">github</a></span></div>
<div class="MsoNormal">
<o:p></o:p></div>
<div class="MsoNormal">
<o:p></o:p></div>
</div>
DeusExMachinahttp://www.blogger.com/profile/07663528269192019672noreply@blogger.com0tag:blogger.com,1999:blog-262225348134692449.post-70949906803008101642015-02-18T17:16:00.001+05:002015-11-14T14:10:33.510+05:00OMG, quadcopter!<div dir="ltr" style="text-align: left;" trbidi="on">
Hello guys.<br />
It is time for me to switch on English.<br />
I started to construct my own quadcopter. As well as I am ChibiOS fan, I decided to use Taulabs flying controller, because they plan was to get rid of FreeRTOS and use Chibios there.<br />
For now I decided to use my STM32F3Discovery as a platform.<br />
<br />
<img src="http://www.rlocman.ru/i/Image/2012/09/28/stm32f3discovery.jpg" /><br />
<br />
This cheap board already has a magnetometer, accelerometer and gyroscope.<br />
I just needed an adapter and I ordered one on seedstudio. Gerbers can be found in Taulabs' software pack in the hardware folder. Not bad!<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_xr49wTNs7eKNSwFtVapIWL_S0msir6puq5bSDxvxg8HY2fvOq47wt4Qx831KAyM1wgeU-BqdbB7ef2PCdHoJ9B__F6Mv0AlxaY0ivauqeClXeAKfIH6XAreEwgUCr7GIAgsDKz5vsOY/s1600/F3shield.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="211" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_xr49wTNs7eKNSwFtVapIWL_S0msir6puq5bSDxvxg8HY2fvOq47wt4Qx831KAyM1wgeU-BqdbB7ef2PCdHoJ9B__F6Mv0AlxaY0ivauqeClXeAKfIH6XAreEwgUCr7GIAgsDKz5vsOY/s1600/F3shield.JPG" width="320" /></a></div>
<br />
Ok, but what about the frame, engines, ESCs, battery and numerous other stuff? I used recomendations from <a href="https://www.youtube.com/watch?v=eFqV6m45sqs">these videos</a>.<br />
I bought the recomended <a href="http://www.banggood.com/Wholesale-HJ450-4-Axis-RC-Remote-Control-Quapcopter-Repair-And-Replacement-Rack-p-56959.html?p=272200285223201309YD">frame</a>, <a href="http://www.banggood.com/Wholesale-XXD-HW30A-30A-Brushless-Motor-ESC-For-Airplane-Quadcopter-p-50621.html?p=272200285223201309YD">ESCs</a> and A2212 930KV motors.<br />
<div style="text-align: left;">
I also bought the <a href="http://www.banggood.com/Wholesale-FlySky-Upgrade-FS-TH9X-FS-TH9XB-2_4G-9CH-RC-Remote-Control-Transmitter-Mode-2-p-47904.html">FlySky TH9X</a> Radio.</div>
<div>
<br /></div>
Assembled copter:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2Utoaueqccry-YUQSwtcKpqDwQRRMvswFEmE98Hi3HRaJ2lJzYBRX8iKtutWSWgx2eY0Wf_5jyHk_FxTlxqtZvRGBj8AGxcS9u8RE2lms1J_oSmJKo0ZmEYRP525fI6_oxnNWKlT6UYk/s1600/IMGP7377.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="212" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2Utoaueqccry-YUQSwtcKpqDwQRRMvswFEmE98Hi3HRaJ2lJzYBRX8iKtutWSWgx2eY0Wf_5jyHk_FxTlxqtZvRGBj8AGxcS9u8RE2lms1J_oSmJKo0ZmEYRP525fI6_oxnNWKlT6UYk/s1600/IMGP7377.jpg" width="320" /></a></div>
<br />
So, it is almost time to fly!<br />
Here is a video on very first fly on YouTube:<br />
<a href="https://www.youtube.com/watch?v=JToOy15wG7o">https://www.youtube.com/watch?v=JToOy15wG7o</a><br />
<br />
<br /></div>
DeusExMachinahttp://www.blogger.com/profile/07663528269192019672noreply@blogger.com0tag:blogger.com,1999:blog-262225348134692449.post-77904746297447775432012-10-02T23:13:00.005+05:002012-10-02T23:13:52.967+05:00Операционная система реального времени Chibios/RT (Введение)<div dir="ltr" style="text-align: left;" trbidi="on">
Даю ссылку на свою <a href="http://we.easyelectronics.ru/os-rtos/operacionnaya-sistema-realnogo-vremeni-chibios-rt-vvedenie.html">статью</a> на easyelectronics.ru. Это вводная статья про интересную ОСРВ Chibios. На работе использую ее в прототипе платы ввода-вывода промышленного контроллера.<br />
Работает как часы, зараза :) </div>
DeusExMachinahttp://www.blogger.com/profile/07663528269192019672noreply@blogger.com0tag:blogger.com,1999:blog-262225348134692449.post-89386771293683929092012-03-26T08:21:00.000+05:002012-10-02T23:14:43.069+05:00Yet another msp430-based clock (YAMBC)<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-size: large;">Часы реального времени PCF8583 + MSP430G2553 (launchpad)</span><br />
Мы с женой любим путешествовать. Но наша игуана Вася это якорь, который не всегда дает нам возможность отлучиться надолго :) Утром ему нужно включить лампы и нагреватель, вечером выключить. Поэтому я решил автоматизировать этот процесс. Для определения времени нужна микросхема часов реального времени (с резервной батарейкой, если вдруг пропадет питание). Также в часах есть дополнительная RAM память, где можно хранить настройки, чтобы не портить flash микроконтроллера циклами записи/перезаписи.<br />
Итак, coming soon. Материал получился объемный, так что буду выкладывать частями.<br />
<br /></div>
DeusExMachinahttp://www.blogger.com/profile/07663528269192019672noreply@blogger.com0tag:blogger.com,1999:blog-262225348134692449.post-26631551940649499452011-08-21T18:08:00.002+05:002011-08-22T10:56:27.960+05:00Софтовый i2c и общение с датчиком DS1624<div dir="ltr" style="text-align: left;" trbidi="on">Возник на горизонте один проект, в котором было решено использовать новые контроллеры с продвинутым Сигма-дельта АЦП 24бит (!) MSP430AFE253. У контроллера встроенно три(!) независимых сигма-дельта АЦП, и это чудо в компеле стоит около 2$.<br />
Заказал у TI some Free samples и попросил заказчика купить небольшую партию для установочного производства... Срок поставки 3 недели. Решил пока поэксперементировать с недавно пришедшими по FedEx <strike>в наши *ня</strike> двумя новыми MSP430G2452, которые дружат с Launchpad после обновления прошивки. На них и отработаю soft i2c.<br />
Проблема у 253 следующая: там нет аппартного модуля i2c. Но этот кристалл также должен управлять цифровыми потенциометрами по этому протоколу. Сначала я пригорюнился, но потом храбро решил реализовать i2c программно. В режиме мастера это не так сложно.<br />
Digipot тоже ехал с эльфийского Запада неторопливо. Поэтому, порывшись по сусекам обнаружил завалявшийся DS1624 - продвинутый цифровой термометр, с точностью до 0.3С.<br />
Почему нет? попробую считать температуру, используя софтовый i2c.<br />
Нашел замечательную библиотеку у <a href="http://www.levap.ru/2010/03/rabotaem-s-shinoj-i2c-smbus/">levap</a>. Вся библиотека состоит из 2х файлов -<br />
Достаточно в i2c_soft.h прописать какие порты пины используются, и почти все заработает. Правда его библиотека под msp-gcc, а я проект делал в Code composer studio. Поэтому вызов функции nop() пришлось заменить на _nop().<br />
Для линий данных использовал GPIO пин 2.4 а для синхронизации 2.3.<br />
<br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">#define<span class="Apple-tab-span" style="white-space: pre;"> </span>I2COUT<span class="Apple-tab-span" style="white-space: pre;"> </span>P2OUT // Write to Port</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">#define<span class="Apple-tab-span" style="white-space: pre;"> </span>I2CIN<span class="Apple-tab-span" style="white-space: pre;"> </span>P2IN // Read from Port</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">#define<span class="Apple-tab-span" style="white-space: pre;"> </span>I2CDIR<span class="Apple-tab-span" style="white-space: pre;"> </span>P2DIR // Set Port Direction</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">#define<span class="Apple-tab-span" style="white-space: pre;"> </span>I2CSEL<span class="Apple-tab-span" style="white-space: pre;"> </span>P2SEL // Alternative Port Fuctions</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">#define SDA <span class="Apple-tab-span" style="white-space: pre;"> </span>BIT4 // Serial Data Line PIN</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">#define SCL <span class="Apple-tab-span" style="white-space: pre;"> </span>BIT3 // Serial Clock Line PIN</span><br />
<br />
Потом распаял на макетке датчик температуры, 2 подтягивающих резистора 4.7кОм на Vcc, заземлил выходы датчика A1-A3 (см. <a href="http://pdfserv.maxim-ic.com/en/ds/DS1624.pdf">даташит</a>).<br />
Вот что получилось:<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgyFMmy2Pmg38l1CCrI4L6Od4owBQSkGGSqwEbZEJTP6xUt9Ggy6zP88xEX-NeDFqQTzuNaNShmrbZ6pbI68CvOsjkjDldnGW1WkyFRq6Xgk5X71ob2bZ6vYXap3CxfdbwOax5xxd6A_5g/s1600/IMG0182A.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="306" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgyFMmy2Pmg38l1CCrI4L6Od4owBQSkGGSqwEbZEJTP6xUt9Ggy6zP88xEX-NeDFqQTzuNaNShmrbZ6pbI68CvOsjkjDldnGW1WkyFRq6Xgk5X71ob2bZ6vYXap3CxfdbwOax5xxd6A_5g/s320/IMG0182A.jpg" width="320" /></a></div><br />
Снимал телефоном, качество не очень. Но понять что к чему подключено можно. На датчик +5В брал с USB разъема.<br />
Для быстрой смены параметров кристалла использовал <a href="http://www.ti.com/gracewiki">Grace</a> - новую визуальную примочку к CCS от TI. Позволяет визуально задавать параметры кристалла (тактирование, пины, USI и т.д.). Неплохая вещь, хотя можно и без нее.<br />
Вот код общения с датчиком:<br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><br />
</span><br />
<br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">#define ACCESS_MEM 0x17</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">#define ACCESS_CONF 0xAC</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">#define READ_TEMP 0xAA</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">#define START_CONVERT 0xEE</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">#define STOP_CONVERT 0x22</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">#define READ 0x01</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">#define WRITE 0x00</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">unsigned int DS1624ReadTemperature(void)</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">{</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> volatile unsigned int temp, ack;</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> i2c_Init();</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> i2c_Start();</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> ack=i2c_Write(0x90); // W=0,R=1 b1001000W </span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> ack=i2c_Write(START_CONVERT); </span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> while(1)</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> {</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> <span class="Apple-tab-span" style="white-space: pre;"> </span>i2c_Start();</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> ack=i2c_Write(0x90);</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> ack=i2c_Write(ACCESS_CONF);</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> i2c_Start();</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> ack=i2c_Write(0x90);</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> if (i2c_Read(0) & 0x80)</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> break;</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> }</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> i2c_Start();</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> ack=i2c_Write(0x90);</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> ack=i2c_Write(READ_TEMP);</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> i2c_Start();</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> ack=i2c_Write(0x91);//read</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> temp = (unsigned int)i2c_Read(1);//1st byte</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> // temp <<= 8;</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> // temp |= (unsigned int)i2c_Read(1);//2nd byte. дает точность 0.3С после запятой. Ненадо</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> if (temp>125)//если t меньше 0</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> {</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> <span class="Apple-tab-span" style="white-space: pre;"> </span>temp = 255-temp;</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> }</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> i2c_Stop();</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> return temp;</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">}</span><br />
<div><br />
</div><br />
<br />
<br />
<br />
<br />
</div>DeusExMachinahttp://www.blogger.com/profile/07663528269192019672noreply@blogger.com2tag:blogger.com,1999:blog-262225348134692449.post-83405464890461029062011-02-09T10:22:00.033+05:002011-04-24T00:23:59.975+05:00Средства разработки MSP430 для Ubuntu Linux 10.04 -10.10<div dir="ltr" style="text-align: left;" trbidi="on"><div class="separator" style="clear: both; text-align: left;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgmtEZtPLOdEW_uK81TR6ngigdV1lGHcJMpmI8Ef-GjpHGuYTR9lO2ImtnslMSl9p0gjOw8iPjO9PJs3rObawQODVdnbqMB2FuSGqYdu1m-rnxZl1O5UaIMUwNIaX5O7MD2a9gAVykeJ6g/s1600/mspgcc-logo-small1.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgmtEZtPLOdEW_uK81TR6ngigdV1lGHcJMpmI8Ef-GjpHGuYTR9lO2ImtnslMSl9p0gjOw8iPjO9PJs3rObawQODVdnbqMB2FuSGqYdu1m-rnxZl1O5UaIMUwNIaX5O7MD2a9gAVykeJ6g/s1600/mspgcc-logo-small1.jpg" /></a></div><br />
Так исторически сложилось, что я очень не люблю операционную систему Windows. Во всех ее проявлениях. О причинах этого можно говорить долго и увлекательно, но не будем :)<br />
К сожалению два основных средства разработки для MSP430 - Code Composer studio и IAR Kickstart не поддерживают Linux :(<br />
Впрочем от CCS мы, наверное, этого и дождемся со временем - начиная с 4 версии он переехал на платформу Eclipse. Осталось портировать компилятор.<br />
Но есть и альтернатива - <a href="http://mspgcc4.sourceforge.net/">mspgcc</a>. Бесплатная... Delicious.<br />
Из разных источников [<a href="http://blog.wikifotos.org/2010/11/15/msp430-launchpad-in-ubuntu/">1</a>] [<a href="http://losinggeneration.homelinux.org/2010/07/02/msp430-launchpad-on-linux/">2</a>] [<a href="http://www.scribd.com/doc/219845/msp430-mspgcc-eclipse-ubuntu-tutorial">3</a>] я собрал рецепт сборки рабочей среды для Ubuntu.<br />
Итак, приступим<br />
Для начала установим необходимые библиотеки и компилятор gcc<br />
<span class="Apple-style-span" style="color: #555555; font-family: Arial, Helvetica, sans-serif; line-height: 19px;"><br />
</span><br />
<span class="Apple-style-span" style="color: #555555; line-height: 19px;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">sudo aptitude install git-core gcc-4.4 texinfo patch libncurses5-dev zlibc zlib1g-dev libx11-dev libusb-dev libreadline6-dev</span></span><br />
<span class="Apple-style-span" style="color: #555555; font-family: Arial, Helvetica, sans-serif; line-height: 19px;"><br />
</span><br />
<span class="Apple-style-span" style="line-height: 19px;"><span class="Apple-style-span" style="font-family: inherit;">Качаем порт mspgcc для gcc4 </span><a href="http://sourceforge.net/projects/mspgcc4/files/mspgcc4/"><span class="Apple-style-span" style="font-family: inherit;"><span class="Apple-style-span" style="color: black;">отсюда</span></span></a></span><br />
<span class="Apple-style-span" style="font-family: inherit;">или вводим команды, чтобы взять из репозитария git (на работе git не смог пробиться через прокси, а дома все ОК)</span><br />
<span class="Apple-style-span" style="font-family: inherit;"><br />
</span><br />
<span class="Apple-style-span" style="color: #555555;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">git clone git://mspgcc4.git.sourceforge.net/gitroot/mspgcc4/mspgcc4</span></span><br />
<span class="Apple-style-span" style="color: #555555; font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
Если скачали архив, то распаковываем его в домашнюю директорию. Переименуйте папку mspgcc4-20110130 в mspgcc4.<br />
<br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">cd mspgcc4 && perl buildgcc.pl</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, mono;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;">Запуститься скрипт сборки. На все вопросы можно жать Enter (по умолчанию) кроме вопроса о сборке - там нужно ввести "y" чтобы процесс сборки запустился. Также спрашивает ставить ли Insight - древний деббагер - можно сказать n, тем более что с ним бывают проблемы при сборке.</span><br />
<span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;">Можно попить кофе пока идет сборка.</span><br />
<span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;">После сборки в /opt появиться папочка msp-gcc-4.4.5. Неплохо бы сделать симлинк </span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, mono;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, mono;">sudo ln -s msp430-gcc-4.4.5/ mspgcc</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, mono;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">и добавить его в path. Теперь можно компилировать, например,</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">msp430-gcc -Os -mmcu=msp430x2231 -o led.elf led.c</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">led.c, например, такой:</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-style-span" style="font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px;"></span></span><br />
<div class="line alt1" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><code class="number" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; color: #5c5c5c; display: block; float: left; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0.3em; padding-top: 0px; position: static; right: auto; text-align: right; top: auto; vertical-align: baseline; width: 3em;">01.</code><span class="content" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: none; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-width: 3px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; color: black; display: block; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 3.3em; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0.5em; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;"><span class="block" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://blog.wikifotos.org/wp-content/plugins/syntaxhighlighter-plus/syntaxhighlighter/styles/wrapping.png); background-origin: initial; background-position: 0px 1.1em; background-repeat: no-repeat no-repeat; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; display: block; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 1.5em; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; text-indent: -1.5em; top: auto; vertical-align: baseline; width: auto;"><code class="comments" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; bottom: auto; color: #008200; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;">/* Пример моргания диодом */</code></span></span></span></div><div class="line alt2" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><code class="number" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; color: #5c5c5c; display: block; float: left; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0.3em; padding-top: 0px; position: static; right: auto; text-align: right; top: auto; vertical-align: baseline; width: 3em;">02.</code><span class="content" style="background-attachment: initial; background-clip: initial; background-color: #f8f8f8; background-image: none; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-width: 3px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; color: black; display: block; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 3.3em; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0.5em; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;"><span class="block" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://blog.wikifotos.org/wp-content/plugins/syntaxhighlighter-plus/syntaxhighlighter/styles/wrapping.png); background-origin: initial; background-position: 0px 1.1em; background-repeat: no-repeat no-repeat; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; display: block; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 1.5em; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; text-indent: -1.5em; top: auto; vertical-align: baseline; width: auto;"> </span></span></span></div><div class="line alt1" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><code class="number" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; color: #5c5c5c; display: block; float: left; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0.3em; padding-top: 0px; position: static; right: auto; text-align: right; top: auto; vertical-align: baseline; width: 3em;">03.</code><span class="content" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: none; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-width: 3px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; color: black; display: block; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 3.3em; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0.5em; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;"><span class="block" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://blog.wikifotos.org/wp-content/plugins/syntaxhighlighter-plus/syntaxhighlighter/styles/wrapping.png); background-origin: initial; background-position: 0px 1.1em; background-repeat: no-repeat no-repeat; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; display: block; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 1.5em; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; text-indent: -1.5em; top: auto; vertical-align: baseline; width: auto;"><code class="preprocessor" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; bottom: auto; color: grey; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;">#include <msp430g2231.h></code></span></span></span></div><div class="line alt2" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><code class="number" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; color: #5c5c5c; display: block; float: left; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0.3em; padding-top: 0px; position: static; right: auto; text-align: right; top: auto; vertical-align: baseline; width: 3em;">04.</code><span class="content" style="background-attachment: initial; background-clip: initial; background-color: #f8f8f8; background-image: none; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-width: 3px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; color: black; display: block; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 3.3em; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0.5em; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;"><span class="block" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://blog.wikifotos.org/wp-content/plugins/syntaxhighlighter-plus/syntaxhighlighter/styles/wrapping.png); background-origin: initial; background-position: 0px 1.1em; background-repeat: no-repeat no-repeat; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; display: block; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 1.5em; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; text-indent: -1.5em; top: auto; vertical-align: baseline; width: auto;"> </span></span></span></div><div class="line alt1" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><code class="number" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; color: #5c5c5c; display: block; float: left; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0.3em; padding-top: 0px; position: static; right: auto; text-align: right; top: auto; vertical-align: baseline; width: 3em;">05.</code><span class="content" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: none; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-width: 3px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; color: black; display: block; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 3.3em; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0.5em; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;"><span class="block" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://blog.wikifotos.org/wp-content/plugins/syntaxhighlighter-plus/syntaxhighlighter/styles/wrapping.png); background-origin: initial; background-position: 0px 1.1em; background-repeat: no-repeat no-repeat; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; display: block; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 1.5em; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; text-indent: -1.5em; top: auto; vertical-align: baseline; width: auto;"><code class="comments" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; bottom: auto; color: #008200; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;">/** Задержка. **/</code></span></span></span></div><div class="line alt2" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><code class="number" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; color: #5c5c5c; display: block; float: left; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0.3em; padding-top: 0px; position: static; right: auto; text-align: right; top: auto; vertical-align: baseline; width: 3em;">06.</code><span class="content" style="background-attachment: initial; background-clip: initial; background-color: #f8f8f8; background-image: none; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-width: 3px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; color: black; display: block; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 3.3em; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0.5em; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;"><span class="block" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://blog.wikifotos.org/wp-content/plugins/syntaxhighlighter-plus/syntaxhighlighter/styles/wrapping.png); background-origin: initial; background-position: 0px 1.1em; background-repeat: no-repeat no-repeat; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; display: block; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 1.5em; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; text-indent: -1.5em; top: auto; vertical-align: baseline; width: auto;"><code class="plain" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; bottom: auto; color: black; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;">delay(unsigned </code><code class="color1 bold" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; color: grey; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: bold; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;">int</code> <code class="plain" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; bottom: auto; color: black; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;">d) {</code></span></span></span></div><div class="line alt1" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><code class="number" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; color: #5c5c5c; display: block; float: left; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0.3em; padding-top: 0px; position: static; right: auto; text-align: right; top: auto; vertical-align: baseline; width: 3em;">07.</code><span class="content" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: none; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-width: 3px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; color: black; display: block; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 3.3em; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0.5em; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;"><span class="block" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://blog.wikifotos.org/wp-content/plugins/syntaxhighlighter-plus/syntaxhighlighter/styles/wrapping.png); background-origin: initial; background-position: 0px 1.1em; background-repeat: no-repeat no-repeat; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; display: block; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 14px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 1.5em; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; text-indent: -1.5em; top: auto; vertical-align: baseline; width: auto;"><code class="color1 bold" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; color: grey; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: bold; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;">int</code> <code class="plain" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; bottom: auto; color: black; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;">i;</code></span></span></span></div><div class="line alt2" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><code class="number" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; color: #5c5c5c; display: block; float: left; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0.3em; padding-top: 0px; position: static; right: auto; text-align: right; top: auto; vertical-align: baseline; width: 3em;">08.</code><span class="content" style="background-attachment: initial; background-clip: initial; background-color: #f8f8f8; background-image: none; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-width: 3px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; color: black; display: block; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 3.3em; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0.5em; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;"><span class="block" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://blog.wikifotos.org/wp-content/plugins/syntaxhighlighter-plus/syntaxhighlighter/styles/wrapping.png); background-origin: initial; background-position: 0px 1.1em; background-repeat: no-repeat no-repeat; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; display: block; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 14px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 1.5em; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; text-indent: -1.5em; top: auto; vertical-align: baseline; width: auto;"><code class="keyword bold" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; color: #006699; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: bold; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;">for</code> <code class="plain" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; bottom: auto; color: black; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;">(i = 0; i<d; i++) {</code></span></span></span></div><div class="line alt1" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><code class="number" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; color: #5c5c5c; display: block; float: left; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0.3em; padding-top: 0px; position: static; right: auto; text-align: right; top: auto; vertical-align: baseline; width: 3em;">09.</code><span class="content" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: none; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-width: 3px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; color: black; display: block; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 3.3em; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0.5em; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;"><span class="block" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://blog.wikifotos.org/wp-content/plugins/syntaxhighlighter-plus/syntaxhighlighter/styles/wrapping.png); background-origin: initial; background-position: 0px 1.1em; background-repeat: no-repeat no-repeat; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; display: block; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 28px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 1.5em; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; text-indent: -1.5em; top: auto; vertical-align: baseline; width: auto;"><code class="plain" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; bottom: auto; color: black; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;">nop();</code></span></span></span></div><div class="line alt2" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><code class="number" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; color: #5c5c5c; display: block; float: left; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0.3em; padding-top: 0px; position: static; right: auto; text-align: right; top: auto; vertical-align: baseline; width: 3em;">10.</code><span class="content" style="background-attachment: initial; background-clip: initial; background-color: #f8f8f8; background-image: none; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-width: 3px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; color: black; display: block; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 3.3em; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0.5em; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;"><span class="block" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://blog.wikifotos.org/wp-content/plugins/syntaxhighlighter-plus/syntaxhighlighter/styles/wrapping.png); background-origin: initial; background-position: 0px 1.1em; background-repeat: no-repeat no-repeat; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; display: block; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 14px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 1.5em; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; text-indent: -1.5em; top: auto; vertical-align: baseline; width: auto;"><code class="plain" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; bottom: auto; color: black; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;">}</code></span></span></span></div><div class="line alt1" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><code class="number" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; color: #5c5c5c; display: block; float: left; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0.3em; padding-top: 0px; position: static; right: auto; text-align: right; top: auto; vertical-align: baseline; width: 3em;">11.</code><span class="content" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: none; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-width: 3px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; color: black; display: block; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 3.3em; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0.5em; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;"><span class="block" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://blog.wikifotos.org/wp-content/plugins/syntaxhighlighter-plus/syntaxhighlighter/styles/wrapping.png); background-origin: initial; background-position: 0px 1.1em; background-repeat: no-repeat no-repeat; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; display: block; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 1.5em; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; text-indent: -1.5em; top: auto; vertical-align: baseline; width: auto;"><code class="plain" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; bottom: auto; color: black; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;">}</code></span></span></span></div><div class="line alt2" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><code class="number" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; color: #5c5c5c; display: block; float: left; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0.3em; padding-top: 0px; position: static; right: auto; text-align: right; top: auto; vertical-align: baseline; width: 3em;">12.</code><span class="content" style="background-attachment: initial; background-clip: initial; background-color: #f8f8f8; background-image: none; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-width: 3px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; color: black; display: block; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 3.3em; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0.5em; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;"><span class="block" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://blog.wikifotos.org/wp-content/plugins/syntaxhighlighter-plus/syntaxhighlighter/styles/wrapping.png); background-origin: initial; background-position: 0px 1.1em; background-repeat: no-repeat no-repeat; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; display: block; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 1.5em; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; text-indent: -1.5em; top: auto; vertical-align: baseline; width: auto;"> </span></span></span></div><div class="line alt1" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><code class="number" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; color: #5c5c5c; display: block; float: left; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0.3em; padding-top: 0px; position: static; right: auto; text-align: right; top: auto; vertical-align: baseline; width: 3em;">13.</code><span class="content" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: none; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-width: 3px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; color: black; display: block; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 3.3em; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0.5em; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;"><span class="block" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://blog.wikifotos.org/wp-content/plugins/syntaxhighlighter-plus/syntaxhighlighter/styles/wrapping.png); background-origin: initial; background-position: 0px 1.1em; background-repeat: no-repeat no-repeat; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; display: block; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 1.5em; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; text-indent: -1.5em; top: auto; vertical-align: baseline; width: auto;"><code class="color1 bold" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; color: grey; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: bold; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;">int</code> <code class="plain" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; bottom: auto; color: black; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;">main(</code><code class="keyword bold" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; color: #006699; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: bold; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;">void</code><code class="plain" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; bottom: auto; color: black; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;">) {</code></span></span></span></div><div class="line alt2" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><code class="number" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; color: #5c5c5c; display: block; float: left; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0.3em; padding-top: 0px; position: static; right: auto; text-align: right; top: auto; vertical-align: baseline; width: 3em;">14.</code><span class="content" style="background-attachment: initial; background-clip: initial; background-color: #f8f8f8; background-image: none; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-width: 3px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; color: black; display: block; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 3.3em; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0.5em; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;"><span class="block" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://blog.wikifotos.org/wp-content/plugins/syntaxhighlighter-plus/syntaxhighlighter/styles/wrapping.png); background-origin: initial; background-position: 0px 1.1em; background-repeat: no-repeat no-repeat; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; display: block; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 14px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 1.5em; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; text-indent: -1.5em; top: auto; vertical-align: baseline; width: auto;"><code class="plain" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; bottom: auto; color: black; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;">WDTCTL = WDTPW | WDTHOLD;// отключаем Watchdog таймер</code></span></span></span></div><div class="line alt1" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><code class="number" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; color: #5c5c5c; display: block; float: left; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0.3em; padding-top: 0px; position: static; right: auto; text-align: right; top: auto; vertical-align: baseline; width: 3em;">15.</code><span class="content" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: none; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-width: 3px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; color: black; display: block; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 3.3em; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0.5em; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;"><span class="block" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://blog.wikifotos.org/wp-content/plugins/syntaxhighlighter-plus/syntaxhighlighter/styles/wrapping.png); background-origin: initial; background-position: 0px 1.1em; background-repeat: no-repeat no-repeat; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; display: block; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 14px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 1.5em; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; text-indent: -1.5em; top: auto; vertical-align: baseline; width: auto;"><code class="plain" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; bottom: auto; color: black; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;">P1DIR = 0xFF;</code></span></span></span></div><div class="line alt2" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><code class="number" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; color: #5c5c5c; display: block; float: left; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0.3em; padding-top: 0px; position: static; right: auto; text-align: right; top: auto; vertical-align: baseline; width: 3em;">16.</code><span class="content" style="background-attachment: initial; background-clip: initial; background-color: #f8f8f8; background-image: none; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-width: 3px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; color: black; display: block; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 3.3em; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0.5em; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;"><span class="block" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://blog.wikifotos.org/wp-content/plugins/syntaxhighlighter-plus/syntaxhighlighter/styles/wrapping.png); background-origin: initial; background-position: 0px 1.1em; background-repeat: no-repeat no-repeat; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; display: block; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 14px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 1.5em; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; text-indent: -1.5em; top: auto; vertical-align: baseline; width: auto;"><code class="plain" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; bottom: auto; color: black; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;">P1OUT = 0x01;</code></span></span></span></div><div class="line alt1" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><code class="number" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; color: #5c5c5c; display: block; float: left; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0.3em; padding-top: 0px; position: static; right: auto; text-align: right; top: auto; vertical-align: baseline; width: 3em;">17.</code><span class="content" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: none; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-width: 3px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; color: black; display: block; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 3.3em; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0.5em; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;"><span class="block" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://blog.wikifotos.org/wp-content/plugins/syntaxhighlighter-plus/syntaxhighlighter/styles/wrapping.png); background-origin: initial; background-position: 0px 1.1em; background-repeat: no-repeat no-repeat; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; display: block; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 1.5em; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; text-indent: -1.5em; top: auto; vertical-align: baseline; width: auto;"> </span></span></span></div><div class="line alt2" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><code class="number" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; color: #5c5c5c; display: block; float: left; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0.3em; padding-top: 0px; position: static; right: auto; text-align: right; top: auto; vertical-align: baseline; width: 3em;">18.</code><span class="content" style="background-attachment: initial; background-clip: initial; background-color: #f8f8f8; background-image: none; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-width: 3px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; color: black; display: block; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 3.3em; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0.5em; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;"><span class="block" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://blog.wikifotos.org/wp-content/plugins/syntaxhighlighter-plus/syntaxhighlighter/styles/wrapping.png); background-origin: initial; background-position: 0px 1.1em; background-repeat: no-repeat no-repeat; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; display: block; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 14px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 1.5em; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; text-indent: -1.5em; top: auto; vertical-align: baseline; width: auto;"><code class="keyword bold" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; color: #006699; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: bold; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;">for</code> <code class="plain" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; bottom: auto; color: black; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;">(;;) {</code></span></span></span></div><div class="line alt1" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><code class="number" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; color: #5c5c5c; display: block; float: left; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0.3em; padding-top: 0px; position: static; right: auto; text-align: right; top: auto; vertical-align: baseline; width: 3em;">19.</code><span class="content" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: none; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-width: 3px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; color: black; display: block; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 3.3em; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0.5em; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;"><span class="block" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://blog.wikifotos.org/wp-content/plugins/syntaxhighlighter-plus/syntaxhighlighter/styles/wrapping.png); background-origin: initial; background-position: 0px 1.1em; background-repeat: no-repeat no-repeat; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; display: block; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 28px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 1.5em; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; text-indent: -1.5em; top: auto; vertical-align: baseline; width: auto;"><code class="plain" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; bottom: auto; color: black; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;">P1OUT = ~P1OUT;</code></span></span></span></div><div class="line alt2" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><code class="number" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; color: #5c5c5c; display: block; float: left; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0.3em; padding-top: 0px; position: static; right: auto; text-align: right; top: auto; vertical-align: baseline; width: 3em;">20.</code><span class="content" style="background-attachment: initial; background-clip: initial; background-color: #f8f8f8; background-image: none; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-width: 3px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; color: black; display: block; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 3.3em; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0.5em; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;"><span class="block" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://blog.wikifotos.org/wp-content/plugins/syntaxhighlighter-plus/syntaxhighlighter/styles/wrapping.png); background-origin: initial; background-position: 0px 1.1em; background-repeat: no-repeat no-repeat; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; display: block; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 28px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 1.5em; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; text-indent: -1.5em; top: auto; vertical-align: baseline; width: auto;"><code class="plain" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; bottom: auto; color: black; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;">delay(0x4fff);</code></span></span></span></div><div class="line alt1" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><code class="number" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; color: #5c5c5c; display: block; float: left; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0.3em; padding-top: 0px; position: static; right: auto; text-align: right; top: auto; vertical-align: baseline; width: 3em;">21.</code><span class="content" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: none; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-width: 3px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; color: black; display: block; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 3.3em; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0.5em; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;"><span class="block" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://blog.wikifotos.org/wp-content/plugins/syntaxhighlighter-plus/syntaxhighlighter/styles/wrapping.png); background-origin: initial; background-position: 0px 1.1em; background-repeat: no-repeat no-repeat; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; display: block; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 14px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 1.5em; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; text-indent: -1.5em; top: auto; vertical-align: baseline; width: auto;"><code class="plain" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; bottom: auto; color: black; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;">}</code></span></span></span></div><div class="line alt2" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><code class="number" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; color: #5c5c5c; display: block; float: left; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0.3em; padding-top: 0px; position: static; right: auto; text-align: right; top: auto; vertical-align: baseline; width: 3em;">22.</code><span class="content" style="background-attachment: initial; background-clip: initial; background-color: #f8f8f8; background-image: none; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-width: 3px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; color: black; display: block; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 3.3em; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0.5em; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;"><span class="block" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://blog.wikifotos.org/wp-content/plugins/syntaxhighlighter-plus/syntaxhighlighter/styles/wrapping.png); background-origin: initial; background-position: 0px 1.1em; background-repeat: no-repeat no-repeat; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-style: initial; border-top-width: 0px; bottom: auto; display: block; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 1.5em; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; text-indent: -1.5em; top: auto; vertical-align: baseline; width: auto;"><code class="plain" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; bottom: auto; color: black; float: none; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 12px; font-style: normal; font-weight: normal; height: auto; left: auto; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; position: static; right: auto; text-align: left; top: auto; vertical-align: baseline; width: auto;">}</code></span></span></span></div><br />
<br />
<div><br />
</div><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Если программа собрана без ошибок, то можно ее заливать в контроллер. Для этого нам пригодиться программа <a href="http://sourceforge.net/projects/mspdebug/files/">mspdebug</a>. </span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">tar -zxvf mspdebug.tar.gz</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">cd mspdebug</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">make</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">sudo make install</span><br />
<div style="font-family: Arial, Helvetica, sans-serif;"><br />
</div><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Чтобы можно было работать с LaunchPad не из под root, нужно задать udev правило.</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">sudo nano /etc/udev/rules.d/46-TI_launchpad.rules</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Вписываем туда :</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">ATTRS{idVendor}=="0451", ATTRS{idProduct}=="f432", MODE="0660", GROUP="plugdev"</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Перезапускаем udev:</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">sudo restart udev</span><br />
<br />
<div style="font-family: Arial, Helvetica, sans-serif;">Подключите Launchpad. </div><span class="Apple-style-span" style="font-family: 'Courier New', Courier, mono;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, mono;"></span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, mono;">mspdebug rf2500</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, mono;">prog led.elf</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, mono;"></span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, mono;">run</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, mono;"> </span><br />
<div><span class="Apple-style-span" style="font-family: 'Courier New', Courier, mono;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Программа прошьется в контроллер и плата заморгает красным глазком...</span></div><span class="Apple-style-span" style="font-family: 'Courier New', Courier, mono;"> </span></div>DeusExMachinahttp://www.blogger.com/profile/07663528269192019672noreply@blogger.com2tag:blogger.com,1999:blog-262225348134692449.post-63898321299800143122011-02-06T12:03:00.000+05:002011-02-06T12:06:33.405+05:00Мой помощник :)<div dir="ltr" style="text-align: left;" trbidi="on"><div class="separator" style="clear: both; text-align: left;">Наша игуана. Мужчина. Зовут Вася :)</div><div class="separator" style="clear: both; text-align: left;"><br />
</div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiUY_V-Hd4ljk45cZ7tdSpRRYjmyrGP790wWFz5dkWHueVCpvy9-XI8Y4NBE6DeMhhF3Y3mXzrzsqUnXR6BQodiIxMUUJPQP7w8-Ylokzv1Iz_X3WE0K1RKkVvxIG4LokPJKjOnq4lNewA/s1600/iguana.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiUY_V-Hd4ljk45cZ7tdSpRRYjmyrGP790wWFz5dkWHueVCpvy9-XI8Y4NBE6DeMhhF3Y3mXzrzsqUnXR6BQodiIxMUUJPQP7w8-Ylokzv1Iz_X3WE0K1RKkVvxIG4LokPJKjOnq4lNewA/s640/iguana.jpg" width="640" /></a></div><br />
</div>DeusExMachinahttp://www.blogger.com/profile/07663528269192019672noreply@blogger.com0tag:blogger.com,1999:blog-262225348134692449.post-88691487211413257362011-02-06T09:51:00.000+05:002011-02-07T14:26:00.671+05:00Пишем в дисплей по-русски!<div dir="ltr" style="text-align: left;" trbidi="on">В предыдущем <a href="http://mcudu.blogspot.com/2011/02/wh0802a.html">посте</a> мы таки подключили нашего маленького героя WH0802b. Теперь пора на него что-нибудь вывести.<br />
Как я уже говорил, ребята из Филадельфии <a href="http://groups.google.com/group/hive76-discussion/browse_thread/thread/e0f340ed29a2acad?pli=1">портировали</a> библиотеку Liquid Crystal от Arduino для MSP430. Я слегка модифицировал библиотеку, добавив функцию установки курсора дисплея и функцию для конвертации символов кириллицы.<br />
<a href="http://www.7e-nebo.ru/wh802.zip">Качаем</a>!<br />
Post scriptum - все работает в Code composer studio - среде от TI<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7oX8fNGgtrKFvW8nwssVaV7vd1moRU6-Naa4VuTOYHIdnUXiYMHgvIdz4AdqqBVShQjN5ZCqpmKENVoF-1PDgGz1MklELg4Gxeu0lsw3htMSVNBNgEw33TB_l_aXLWbLKqCGt_8grx74/s1600/P1040542.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="181" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7oX8fNGgtrKFvW8nwssVaV7vd1moRU6-Naa4VuTOYHIdnUXiYMHgvIdz4AdqqBVShQjN5ZCqpmKENVoF-1PDgGz1MklELg4Gxeu0lsw3htMSVNBNgEw33TB_l_aXLWbLKqCGt_8grx74/s320/P1040542.JPG" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">WH0802b</td></tr>
</tbody></table><br />
</div>DeusExMachinahttp://www.blogger.com/profile/07663528269192019672noreply@blogger.com2tag:blogger.com,1999:blog-262225348134692449.post-53209788837463701302011-02-05T01:23:00.000+05:002011-02-07T14:27:18.074+05:00Как я приручил WH0802a<div dir="ltr" style="text-align: left;" trbidi="on">Есть один контроллер... HD44780 от Hitachi. С его использованием создано огромное количество знакогенерирующих дисплеев. Например, просто вездесущий WH1602b.<br />
Сегодня мы будем приручать <a href="http://www.winstar.com.tw/products_detail_ov.php?lang=en&ProID=13">WH0802a</a>, так как он самый дешевый :) Стоит от 70 рублей.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjV09G4wk83uAcfQl92_oGPJW-QgwJd2sDl0TnyjjER4f4nTcAzcEY8Soe7AeTuudOg3qXTPmsgfzl2dn6DaD8xAdulUgx_h49rPuwx098g399xdVb-sTrW7WfqOy_Fo9aqmilQPwFiryA/s1600/WH0802A.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="179" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjV09G4wk83uAcfQl92_oGPJW-QgwJd2sDl0TnyjjER4f4nTcAzcEY8Soe7AeTuudOg3qXTPmsgfzl2dn6DaD8xAdulUgx_h49rPuwx098g399xdVb-sTrW7WfqOy_Fo9aqmilQPwFiryA/s320/WH0802A.png" width="320" /></a></div>Правда няшка?<br />
Теперь дисплей надо подключить к Launchpad. К счастью, команда хакеров <a href="http://www.hive76.org/">Hive76</a> из Филадельфии уже <a href="http://groups.google.com/group/hive76-discussion/browse_thread/thread/e0f340ed29a2acad?pli=1">озаботилась</a> подключением дисплея, правда 16x2 WH1602b, на том же контроллере HD44780. Сделали они это несколько безалаберно, поэтому попробую сделать все хорошо, да еще и научу дисплей писать по-русски.<br />
Вот назначение выводов дисплеев:<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDG4B2UwwYS0pGqNaVaZyjFQkilxfwA0NzkUNFbD1FPD7-R0sgte5fpc-i_SqMu9u1tTTm2q-dMWUEREmQxCz285Ko-atzl3CtmnjBntBJ8h4lFxzGfY7M5fZ4YrAtZa6W6jNXFy2V4hw/s1600/pins.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDG4B2UwwYS0pGqNaVaZyjFQkilxfwA0NzkUNFbD1FPD7-R0sgte5fpc-i_SqMu9u1tTTm2q-dMWUEREmQxCz285Ko-atzl3CtmnjBntBJ8h4lFxzGfY7M5fZ4YrAtZa6W6jNXFy2V4hw/s320/pins.gif" width="249" /></a></div>Вот схема как надо их подключать в случае 4х битной передачи (команды и символы байтов передаются по тетрадам).<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4zb5mftJYYKmpqgE0hiqK1z_qaheCvwdHVBBWRNlf0Ue_gZDeEpAyMSQXyykpfy3QhNA-vRS9SydjPshCbmKBnIS8n0MGOqeuUamSM6kCKX0kaDiTbJ2D3i29PW67Wl1fzxwGXsRofWU/s1600/Launchpad_HD44780.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="163" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4zb5mftJYYKmpqgE0hiqK1z_qaheCvwdHVBBWRNlf0Ue_gZDeEpAyMSQXyykpfy3QhNA-vRS9SydjPshCbmKBnIS8n0MGOqeuUamSM6kCKX0kaDiTbJ2D3i29PW67Wl1fzxwGXsRofWU/s320/Launchpad_HD44780.jpg" width="320" /></a></div><br />
Кроме этого, нужно подключить выход Vo через переменный резистор 22кОм к +5В для регулирования контраста. Это очень важно, так как выводимая информация может быть не видна без должной настройки контраста!!! Т.е. вроде бы все верно, все работает, а дисплей ничего не показывает. Подсветка обычно подводиться к выводам A (анод) и K (катод) с правой стороны дисплея. К аноду соотв. +5В, к катоду земля.<br />
WH0802a подключается точно также, только расположение его выводов немного другое:<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEizLOtL1TQzLnEwqhbRowfAfrwfn2xh1BcYawy9RHbad4fnkgjFE_cwRN0kxx-MXFboqvnz4CDzEZP4OFc6YmjTeyajSAHTQe0xYyW1gRAiNn1N8C7CYVIVxIA3faZCPuoUFdgFJaKshXQ/s1600/pins.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEizLOtL1TQzLnEwqhbRowfAfrwfn2xh1BcYawy9RHbad4fnkgjFE_cwRN0kxx-MXFboqvnz4CDzEZP4OFc6YmjTeyajSAHTQe0xYyW1gRAiNn1N8C7CYVIVxIA3faZCPuoUFdgFJaKshXQ/s320/pins.png" width="284" /></a></div>MSP430 трехвольтовые, но для питания дисплея и его логики нужно 5В. Это напряжение можно взять с площадки около USB разъема. Ближе к центру платы +5В, дальше от центра - земля.<br />
Собственно, вот что получилось:<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjTnlfFT8J8ErKxohifGj7M-GSnFD8M0kUJZoJLXKCyw3n9IL_tT1YN06lmafPnw7KACbXo1JVIpxKXIT_c-iZDFp0oJX3L8I5DVjhose_Ajaz4pdasb8eUYypE2JO5qPJCy5cq56cG6OM/s1600/P1040538.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjTnlfFT8J8ErKxohifGj7M-GSnFD8M0kUJZoJLXKCyw3n9IL_tT1YN06lmafPnw7KACbXo1JVIpxKXIT_c-iZDFp0oJX3L8I5DVjhose_Ajaz4pdasb8eUYypE2JO5qPJCy5cq56cG6OM/s320/P1040538.JPG" width="256" /></a></div>Про код, который заставил его работать в следующем <a href="http://mcudu.blogspot.com/2011/02/blog-post.html">посте </a>:)<br />
<br />
</div>DeusExMachinahttp://www.blogger.com/profile/07663528269192019672noreply@blogger.com1tag:blogger.com,1999:blog-262225348134692449.post-46169294642995806922011-02-04T22:11:00.000+05:002011-02-06T00:16:12.470+05:00MSP430 LaunchPad (MSP-EXP430G2) - обзор<div dir="ltr" style="text-align: left;" trbidi="on">У очень хорошей фирмы Texas Instruments, кстати совершенно незаслуженно непопулярной в России, появилась отладочная плата, ценой всего за 4.3$. На сайте TI можно заказать именно за эту сумму. Доставка пока бесплатно. Fedex довез платку до Уфы из Техаса за 5 дней.<br />
Полюбуйтесь:<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIgfjMbt7LtiEr1e5iFolRVPvnvCCqLN5aLBuvZBxcPwASrR3Qv2tRyXFxkps8JBW7D7Bm4ZX3wQW_AP__1z1HWoDo0HArMz0aiXIw3LmF9tN8frHjZXVL7c288gn9U9SJRh3QJ-uatXE/s1600/LaunchPad.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIgfjMbt7LtiEr1e5iFolRVPvnvCCqLN5aLBuvZBxcPwASrR3Qv2tRyXFxkps8JBW7D7Bm4ZX3wQW_AP__1z1HWoDo0HArMz0aiXIw3LmF9tN8frHjZXVL7c288gn9U9SJRh3QJ-uatXE/s320/LaunchPad.PNG" width="273" /></a></div><div class="separator" style="clear: both; text-align: left;">В комплекте есть: 2 контроллера MSP430 - MSP430G2231 и MSP430G2211. Каждый из них стоит меньше 0.5$ при покупке от 1килоюнита. Так то! Дрожи и обмирай, Tiny. Да еще и 16 бит, и до 2.5Мгц. </div><div class="separator" style="clear: both; text-align: left;">На плате разведены все выводы микроконтроллеров, есть 2 кнопки и 2 диода. Поддерживается отладка программы внутри системы. И это за 120 рублей. </div><div class="separator" style="clear: both; text-align: left;">В комплекте есть часовой кварц, который можно аккуратно впаять на соответствующее место на плате.</div><div class="separator" style="clear: both; text-align: left;">Есть и разьемы/штырьки для разведенных выходов микроконтроллера.</div><div class="separator" style="clear: both; text-align: left;">На чем кодить? Есть фирменная среда разработки - Code Composer Studio на базе Eclipse. Бесплатная, с ограничением размера программы в скомпилированном виде до 16кб. Есть такой же IAR. </div><div class="separator" style="clear: both; text-align: left;">В сверхдешевой серии MSP430G флеш-памяти всего 2Кб (анонсированы процессоры с памятью до 8Кб), так что <s>не</s>хватит с запасом.</div><div class="separator" style="clear: both; text-align: left;">Есть и другие платные разработки, даже какая то отечественная. </div><div class="separator" style="clear: both; text-align: left;">К сожалению, все под windows. Что делать?</div><div class="separator" style="clear: both; text-align: left;">Есть <a href="http://mspgcc4.sourceforge.net/">mspgcc4</a>. Есть <a href="http://mspdebug.sourceforge.net/">mspdebug</a>. Есть <a href="http://www.eclipse.org/">Eclipse</a> + <a href="http://www.eclipse.org/cdt/">CDT</a> + <a href="http://opensource.zylin.com/embeddedcdt.html">Zylin embedded CDT</a>. К сожалению, mspgcc4 сильно глючит (но его активно пилят). Позднее напишу отельную статью о настройке этого всего добра в Ubuntu.</div><div class="separator" style="clear: both; text-align: left;">Резюме: MUST HAVE! Дешевле средства для разработки встроенных систем просто не существует. </div><div class="separator" style="clear: both; text-align: left;"><br />
</div><br />
</div>DeusExMachinahttp://www.blogger.com/profile/07663528269192019672noreply@blogger.com3tag:blogger.com,1999:blog-262225348134692449.post-39680590408580042312010-04-03T11:40:00.000+05:002011-02-06T00:16:56.016+05:00Влажометр... То есть гигрометр на датчике влажности HIH-4000-001 и AVR atmega2560<div dir="ltr" style="text-align: left;" trbidi="on"><div><div style="text-align: left;">В этом году нашей кафедре выделили деньги на закупку оборудования для обучения и научных исследований. Я заказал стартовый набор от Atmel STK 600. Цена на набор, на мой взгляд, безобразно высока (около 12000 руб).</div><div>Вот сам отладочный набор:</div></div><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjc-10BxtnuAKRmHEVtUCTf5M0_XNEiCs-351Rz2PH2VqrGC7VsmsQJRRKKz7P5SUtEQOo_t-2YTWJMYZKka6Vh9V3vbgm7UryCwNhyphenhyphenqLvRMqwEUxf1q2OZP3Lz-0fIzO2MB9GzYGQW4Ns/s1600/P1020355.JPG" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"><img alt="" border="0" id="BLOGGER_PHOTO_ID_5455801415665400066" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjc-10BxtnuAKRmHEVtUCTf5M0_XNEiCs-351Rz2PH2VqrGC7VsmsQJRRKKz7P5SUtEQOo_t-2YTWJMYZKka6Vh9V3vbgm7UryCwNhyphenhyphenqLvRMqwEUxf1q2OZP3Lz-0fIzO2MB9GzYGQW4Ns/s320/P1020355.JPG" style="cursor: hand; cursor: pointer; display: block; height: 240px; margin: 0px auto 10px; text-align: center; width: 320px;" /></a> <br />
<div style="text-align: center;">stk600 с мезониной платой для 2560</div><div style="text-align: center;"><br />
</div><div style="text-align: left;">Как видите, на плате разведены все порты, есть диоды и кнопочки. Но в целом, это продвинутый программатор, не поддерживающий отладку по JTAG, что разочаровывает.</div>К нему я купил россыпь датчиков и LCD дисплей WH1602b. Для этого дисплея есть отличная библиотека WH<a href="http://mad-user.blogspot.com/2009/12/wh1602b.html">1602b</a>. Спасибо <a href="http://mad-user.blogspot.com/">anterior</a>! Моргать на плате диодами быстро надоело :) Захотелось создать прибор - гигрометр. Для отображения информации использовался WH1602b.<br />
<div>Для подключения дисплея к плате был сооружен вот такой шлейф:</div><br />
<div><div style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhrnp1qLPp_nZ9WL3KrBtg0BlIuUN98qTkFeBt54wNmQY4JJhQDF9xMLHheayqMfFAJFOMV5YcDAtAMQ-oTOdgz_2F6kdYBGIgVYALcnzT2uHe587Jhn4eQoBcX2yO6J9UpF7YUYokX6SU/s1600/P1020356.JPG" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"><img alt="" border="0" id="BLOGGER_PHOTO_ID_5455813357165763378" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhrnp1qLPp_nZ9WL3KrBtg0BlIuUN98qTkFeBt54wNmQY4JJhQDF9xMLHheayqMfFAJFOMV5YcDAtAMQ-oTOdgz_2F6kdYBGIgVYALcnzT2uHe587Jhn4eQoBcX2yO6J9UpF7YUYokX6SU/s320/P1020356.JPG" style="cursor: hand; cursor: pointer; height: 240px; width: 320px;" /></a></div><div style="text-align: center;">шлейф для дисплея</div><div style="text-align: center;"><br />
</div><div style="text-align: left;">Переменный резистор используется для регулировки контрастности. Питание подсветки индикатора (снизу) организованно по шине USB, так как питания с GND и VCC не хватает. При стандартном напряжении +5В индикатор дико грелся, поэтому пришлось поставить регулируемый резистор для уменьшения напряжения.</div><div style="text-align: left;">Распиновка понятна из кода настроек библиотеки дисплея wh1602b/conf.h:</div><div style="text-align: left;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><br />
</span> </div><div style="text-align: left;"><div style="text-align: left;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">#define F_CPU 1600000 /* частота мк, Гц */</span></div><div style="text-align: left;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">#define USE_PUTN /* включить поддержку wh1602b_putn() */</span></div><div style="text-align: left;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">#define USE_PUTH /* включить поддержку wh1602b_puth() */</span></div><div style="text-align: left;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">#define USE_GENC /* включить поддержку wh1602b_genc() */</span></div><div style="text-align: left;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><br />
</span> </div><div style="text-align: left;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">/* ножки к которым подключены выводы RS, RW, EN */</span></div><div style="text-align: left;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">#define NPIN_RS PE0</span></div><div style="text-align: left;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">#define NPIN_RW PE1</span></div><div style="text-align: left;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">#define NPIN_EN PE2</span></div><div style="text-align: left;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><br />
</span> </div><div style="text-align: left;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">/* порты к которым подключены выводы RS, RW, EN */</span></div><div style="text-align: left;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">#define PORT_RS _SFR_IO_ADDR(PORTE)</span></div><div style="text-align: left;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">#define PORT_RW _SFR_IO_ADDR(PORTE)</span></div><div style="text-align: left;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">#define PORT_EN _SFR_IO_ADDR(PORTE)</span></div><div style="text-align: left;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">#define DDR_RS _SFR_IO_ADDR(DDRE)</span></div><div style="text-align: left;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">#define DDR_RW _SFR_IO_ADDR(DDRE)</span></div><div style="text-align: left;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">#define DDR_EN _SFR_IO_ADDR(DDRE)</span></div><div style="text-align: left;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><br />
</span> </div><div style="text-align: left;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">/* ножки к которым подключены выводы DB4-DB7 */</span></div><div style="text-align: left;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">#define NPIN_DB7 PE7</span></div><div style="text-align: left;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">#define NPIN_DB6 PE6</span></div><div style="text-align: left;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">#define NPIN_DB5 PE5</span></div><div style="text-align: left;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">#define NPIN_DB4 PE4</span></div><div style="text-align: left;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><br />
</span> </div><div style="text-align: left;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">/* порты к которым подключены выводы DB4-DB7 */</span></div><div style="text-align: left;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">#define PORT_DB7 _SFR_IO_ADDR(PORTE)</span></div><div style="text-align: left;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">#define PORT_DB6 _SFR_IO_ADDR(PORTE)</span></div><div style="text-align: left;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">#define PORT_DB5 _SFR_IO_ADDR(PORTE)</span></div><div style="text-align: left;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">#define PORT_DB4 _SFR_IO_ADDR(PORTE)</span></div><div style="text-align: left;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">#define DDR_DB7 _SFR_IO_ADDR(DDRE)</span></div><div style="text-align: left;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">#define DDR_DB6 _SFR_IO_ADDR(DDRE)</span></div><div style="text-align: left;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">#define DDR_DB5 _SFR_IO_ADDR(DDRE)</span></div><div style="text-align: left;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">#define DDR_DB4 _SFR_IO_ADDR(DDRE)</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><br />
</span></div></div><div style="text-align: left;">В качестве датчика влажности используется HIH-4000-02. У него 3 ноги - питание, земля и выходной сигнал, пропорциональный влажности.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgvAkbCVSRH3_vlDzZxMSDFa-UPAl1eqi5FU8BXJ-kKrTZIGL4qW5HA74D5vn_RUWq6QjWWMVXLFQXl-X3cq3IeYWcbVkPCVcf9jf2setZz9VZVqiBrqP2Qim_voT2TdgK6B6X4JjRIPvs/s1600/dat.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="202" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgvAkbCVSRH3_vlDzZxMSDFa-UPAl1eqi5FU8BXJ-kKrTZIGL4qW5HA74D5vn_RUWq6QjWWMVXLFQXl-X3cq3IeYWcbVkPCVcf9jf2setZz9VZVqiBrqP2Qim_voT2TdgK6B6X4JjRIPvs/s320/dat.JPG" width="320" /></a></div><br />
</div></div><div style="text-align: left;">Вот код основной программы:<br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> #include <avr/io.h></span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> #include <stdio.h></span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> #include <util/delay.h></span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> #include "wh1602b/wh1602b.h"</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> #include <avr/pgmspace.h></span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> #include <avr/interrupt.h></span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> double humidity = 0;</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> const double n2 = 1024;</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> const double Vcc = 5;</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> const double v_ofset = 0.826;</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> void init_ADC(void)</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> {</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> ADMUX |= (1 << MUX2) | (1 << MUX1) | (1 << MUX0); // порт PF7</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> ADCSRA |=(1 << ADEN); // ВКЛЮЧИЛИ АЦП</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> ADCSRA |= (1 << ADPS2) | (1 << ADPS1) | (1 << ADPS0); // ЧАСТОТА ПРЕОБРАЗОВАНИЯ</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> ADMUX |= (1 << REFS0); // ИСПОЛЬЗУЕТСЯ ОПОРНОЕ НАПРЯЖЕНИЕ AVCC</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> }</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> unsigned int read_ADC(void)</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> {</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> ADCSRA |= (1 << ADSC); // НАЧАЛО ПРЕОБРАЗОВАНИЯ</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> _delay_ms(100);</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> if (ADIF)</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> {</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> return ADCW; // виртуальный регистр результатов</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> }</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> else</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> return 0;</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> }</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> int main(void)</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> {</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><br />
</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> wh1602b_init(); // инициализировать модуль, порты</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span><span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> // настроить параметры управления дисплеем</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> wh1602b_displayctl(DC_DISPLAY_ON); // дисплей включён</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span><span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> // задать число строк</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> wh1602b_funcset(FS_LINES_2); // 2 строки</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span><span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> // очистить область</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> wh1602b_clear();</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span><span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">// вернуться в начало (команда аналогичная move).</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span><span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">// этот вызов является обязательным после вызова genc()</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> wh1602b_home();</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> init_ADC();</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> wh1602b_puts("Please press SW0");</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><br />
</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> DDRB = 0xff; // все на вывод</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> DDRD = 0x00;</span><span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> // все на ввод</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><br />
</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> while ((PIND & (1<<PIND0))); // пока не нажата кнопка 0 ничего не делаем</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> wh1602b_clear();</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> wh1602b_puts("Ждите...");</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><br />
</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">while (1)</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">{</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><br />
</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">unsigned int h = 0;</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">h = read_ADC();</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">wh1602b_clear();</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">double u = h*Vcc/n2; // вычисляем напряжение из показаний АЦП, с разрядностью n = 2^10</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">humidity = (u - 0.826)/0.0315; // из даташита на датчик влажности</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">wh1602b_puts("Влажность ");</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">wh1602b_putn(humidity);</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">wh1602b_puts("%");</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><br />
</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">wh1602b_move(1,0);</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">wh1602b_puts("Uвых ");</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">wh1602b_putn(u*1000);</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">wh1602b_puts(" мВ");</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">_delay_ms(50);</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">}</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">return 0;</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> }</span><br />
<br />
</div></div>DeusExMachinahttp://www.blogger.com/profile/07663528269192019672noreply@blogger.com0tag:blogger.com,1999:blog-262225348134692449.post-33402135820808649002010-03-17T10:07:00.000+05:002011-02-06T09:27:48.826+05:00Средства разработки AVR для Linux<div dir="ltr" style="text-align: left;" trbidi="on">В принципе все можно делать из командной строки. Но IDE приятней :)<br />
<div>Перепробовав много чего, советую Eclipse (правда памяти жрет, уууу)</div><div>Рецепт такой: </div><div>ставим avr-gcc и все зависимости, которые он за собой потянет. </div><div>Ставим программатор avrdude</div><div>Ставим eclipse</div><div>ставим среду разработки Eclipse для C и CPP (по умолчанию только java)</div><div>Для этого идем в Help->Install New Software... там кнопочку Add и адрес среды</div><div>http://download.eclipse.org/tools/cdt/releases/galileo</div><div>Там же добавляем адрес плагина для avr</div><div>http://avr-eclipse.sourceforge.net/updatesite/</div><div>устанавливаем оба плагина - теперь можно создавать проекты для AVR </div><div>File-New Project - C Project - AVR Cross Target Application</div><div>Вот и все :) Компилируем Ctrl+B, заливаем прошивку в устройство - Ctrl+Alt+U</div><div><br />
</div><div><br />
</div></div>DeusExMachinahttp://www.blogger.com/profile/07663528269192019672noreply@blogger.com0