<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-5250193391449144895</id><updated>2025-05-03T02:44:20.864+02:00</updated><title type='text'>RobotyPic</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://robotypic.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5250193391449144895/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://robotypic.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/5250193391449144895/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Robotypic</name><uri>http://www.blogger.com/profile/16455462312458405515</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>41</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5250193391449144895.post-8034955417095060992</id><published>2032-04-15T16:52:00.010+02:00</published><updated>2025-05-02T19:55:34.470+02:00</updated><title type='text'>  </title><content type='html'>&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXR2Ti9xb0-IkNgkRy6MZuUI3FExEArPEY1YgItAvIgpsNfHvlhmoHuzhW5gJmYE1BYBXIGUTjdxXw8fY34AuskUArgI46muGHQs_56XhgbgCeGP1O-E8RCy2K_AOa811IHRnJBmejXJE/s1600/RobotyPic+Brazo+Robot+Presentaci%C3%B3n.jpg&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;490&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXR2Ti9xb0-IkNgkRy6MZuUI3FExEArPEY1YgItAvIgpsNfHvlhmoHuzhW5gJmYE1BYBXIGUTjdxXw8fY34AuskUArgI46muGHQs_56XhgbgCeGP1O-E8RCy2K_AOa811IHRnJBmejXJE/s640/RobotyPic+Brazo+Robot+Presentaci%C3%B3n.jpg&quot; width=&quot;600&quot; /&gt;&lt;/a&gt;

&lt;br /&gt;
&lt;hr align=&quot;center&quot; color=&quot;#E0F8EC&quot; size=&quot;5&quot; width=&quot;100%&quot; /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #2198a6; font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;b&gt;COMUNICACIONES ENTRE PC y PIC&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;float: left; padding: 10px; text-align: justify; width: 40%;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgbNgjEFoUKsODhtnB5jVZ3peYwNFCagJlml_MR6TtznqonIObjgxVAQZeIXbC8ajthD_zENhqitPPHtYwPtsoRNUj-1KwfIjoFSeAJdEW7GzrGvcxoontWgVh6XyrRylupyNTZ30QL-lo/s1600/PIC+-+PC+_+RobotyPic.JPG&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;217&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgbNgjEFoUKsODhtnB5jVZ3peYwNFCagJlml_MR6TtznqonIObjgxVAQZeIXbC8ajthD_zENhqitPPHtYwPtsoRNUj-1KwfIjoFSeAJdEW7GzrGvcxoontWgVh6XyrRylupyNTZ30QL-lo/s320/PIC+-+PC+_+RobotyPic.JPG&quot; width=&quot;290&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;float: right; padding: 10px; text-align: justify; width: 48%;&quot;&gt;
&lt;span face=&quot;&amp;quot;verdana&amp;quot; , sans-serif&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span face=&quot;&amp;quot;verdana&amp;quot; , sans-serif&quot;&gt;Serie de ejemplos dedicados a la comunicación y control de los PIC desde el PC por diversos medios. Puertos serie y USB además de internet como medio de transmisión. Software desarrollado bajo VB6 para podernos comunicar con el PIC desde el PC.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b style=&quot;color: #2198a6; font-family: Nobile;&quot;&gt;&lt;br /&gt;&lt;/b&gt;
&lt;b style=&quot;color: #2198a6; font-family: Nobile;&quot;&gt;&lt;br /&gt;&lt;/b&gt;
&lt;b style=&quot;color: #2198a6; font-family: Nobile;&quot;&gt;&lt;br /&gt;&lt;/b&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=5250193391449144895#&quot; onclick=&quot;Effect.toggle(&amp;quot;expandir1&amp;quot;,&amp;quot;slide&amp;quot;); return false&quot;&gt;[+/-] Ver / Ocultar publicaciones&lt;/a&gt;&lt;br /&gt;
&lt;div id=&quot;expandir1&quot; style=&quot;display: none;&quot;&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #2198a6; font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;b&gt;&lt;a href=&quot;http://robotypic.blogspot.com.es/2010/09/control-de-un-pic-desde-el-pc-por-el.html&quot; target=&quot;_blank&quot;&gt;Control de un PIC por el puerto serie con el hyperterminal&lt;/a&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;Comunicación entre un PIC y el PC por el &lt;b&gt;puerto serie&lt;/b&gt; utilizando el hyperterminal de windows como visor de puerto serie como interface con el usuario.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b style=&quot;color: #2198a6; font-family: Nobile;&quot;&gt;&lt;a href=&quot;http://robotypic.blogspot.com.es/2010/09/control-de-un-pic-desde-el-pc-por-el_18.html&quot; target=&quot;_blank&quot;&gt;Control de un PIC por el puerto serie con aplicación Visual Basic&lt;/a&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;Comunicación entre un PIC y el PC por el &lt;b&gt;puerto serie&lt;/b&gt; utilizando una aplicación desarrollada bajo Visual Basic 6 como interface con el usuario.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b style=&quot;color: #2198a6; font-family: Nobile;&quot;&gt;&lt;a href=&quot;http://robotypic.blogspot.com.es/2013/02/comunicacion-pc-pic-por-usb.html&quot; target=&quot;_blank&quot;&gt;Control de un PIC por USB con el hyperterminal&lt;/a&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;Comunicación entre un PIC y el PC por el &lt;b&gt;puerto USB &lt;/b&gt;en modo CDC emulando un puerto serie utilizando el hyperterminal de windows como visor de puerto serie como interface con el usuario.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b style=&quot;color: #2198a6; font-family: Nobile;&quot;&gt;&lt;a href=&quot;http://robotypic.blogspot.com.es/2013/02/comunicacion-pc-pic-por-usb.html&quot; target=&quot;_blank&quot;&gt;Control de un PIC por USB con aplicación Visual Basic&lt;/a&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;Comunicación entre un PIC y el PC&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;por el &lt;b&gt;puerto USB&lt;/b&gt; en modo CDC emulando un puerto serie&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&amp;nbsp;utilizando una aplicación desarrollada bajo Visual Basic 6 como interface con el usuario.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;


&lt;b style=&quot;color: #2198a6; font-family: Nobile;&quot;&gt;&lt;a href=&quot;http://robotypic.blogspot.com.es/2010/09/control-de-un-microcontrolador-pic-por.html&quot; target=&quot;_blank&quot;&gt;Control de un PIC por Internet&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;Control de un PIC por &lt;b&gt;internet &lt;/b&gt;utilizando aplicaciones cliente y servidor desarrolladas mediante Visual Basic 6.&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;b style=&quot;color: #2198a6; font-family: Nobile;&quot;&gt;&lt;a href=&quot;http://robotypic.blogspot.com/2015/07/ServidorWeb-PIC18f4550-enc28j60.html&quot; target=&quot;_blank&quot;&gt;Servidor Web PIC18F4550 y enc28j60&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;Servidor Web con PIC18F4550 y ENC28j60.&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;b style=&quot;color: #2198a6; font-family: Nobile;&quot;&gt;&lt;a href=&quot;http://robotypic.blogspot.com/2015/07/ServidorWeb-PIC18f4620-enc28j60.html&quot; target=&quot;_blank&quot;&gt;Servidor Web PIC18F4620 y enc28j60&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;Servidor Web con PIC18F4620 y ENC28j60 utilizando el wizard del compilador ccs pic c compiler.&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;hr align=&quot;center&quot; color=&quot;#E0F8EC&quot; size=&quot;5&quot; width=&quot;100%&quot; /&gt;
&lt;br /&gt;
&lt;b style=&quot;color: #2198a6; font-family: Nobile;&quot;&gt;COMUNICACIONES ENTRE PICs&lt;/b&gt;&lt;br /&gt;
&lt;div style=&quot;float: left; padding: 10px; text-align: justify; width: 40%;&quot;&gt;
&lt;div style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgLlpyYAaOE48-yVAoRk5ggJ5fn9lGI7RnArbf_qe3uJhTqiASSUfxZe6bcvj0rfzCHURCwDe91uh6V13FO1GFGuUfM-qSY23NPFQyNcqekM7wH2LGkTco70iDrn8HMy_ul-J2M8fMTjOE/s1600/PIC+-+PIC+_+RobotyPic.JPG&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;171&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgLlpyYAaOE48-yVAoRk5ggJ5fn9lGI7RnArbf_qe3uJhTqiASSUfxZe6bcvj0rfzCHURCwDe91uh6V13FO1GFGuUfM-qSY23NPFQyNcqekM7wH2LGkTco70iDrn8HMy_ul-J2M8fMTjOE/s320/PIC+-+PIC+_+RobotyPic.JPG&quot; width=&quot;290&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;float: right; padding: 10px; text-align: justify; width: 48%;&quot;&gt;
&lt;span face=&quot;&amp;quot;verdana&amp;quot; , sans-serif&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span face=&quot;&amp;quot;verdana&amp;quot; , sans-serif&quot;&gt;Existen diferentes formas de comunicar PIC entre sí; bus I2C, bus serie, infrarrojos, entre otros. Sección&amp;nbsp;&lt;/span&gt;&lt;span face=&quot;&amp;quot;verdana&amp;quot; , sans-serif&quot;&gt;dedicada a la comunicación de los PIC entre sí por diversos buses y métodos.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #2198a6; font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;color: #2198a6; font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;color: #2198a6; font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;color: #2198a6; font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;color: #2198a6; font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;color: #2198a6; font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #2198a6; font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;color: #2198a6; font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;color: #2198a6; font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=5250193391449144895#&quot; onclick=&quot;Effect.toggle(&amp;quot;expandir1&amp;quot;,&amp;quot;slide&amp;quot;); return false&quot;&gt;&lt;br /&gt;&lt;/a&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=5250193391449144895#&quot; onclick=&quot;Effect.toggle(&amp;quot;expandir1&amp;quot;,&amp;quot;slide&amp;quot;); return false&quot;&gt;&lt;br /&gt;&lt;/a&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=5250193391449144895#&quot; onclick=&quot;Effect.toggle(&amp;quot;expandir2&amp;quot;,&amp;quot;slide&amp;quot;); return false&quot;&gt;[+/-] Ver / Ocultar publicaciones&lt;/a&gt;&lt;br /&gt;
&lt;div id=&quot;expandir2&quot; style=&quot;display: none;&quot;&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #2198a6; font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;b&gt;&lt;a href=&quot;http://robotypic.blogspot.com.es/2010/10/comunicacion-via-i2c-entre-dos-pic.html&quot; target=&quot;_blank&quot;&gt;Comunicación I2C entre 2 PIC.&lt;/a&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;Comunicación por bus I2C entre 2 PIC maestro-esclavo con la función I2C_poll( ).&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b style=&quot;color: #2198a6; font-family: Nobile;&quot;&gt;&lt;a href=&quot;http://robotypic.blogspot.com.es/2012/03/comunicacion-i2c-entre-tres-pics.html&quot; target=&quot;_blank&quot;&gt;Comunicación I2C entre 3 PIC.&lt;/a&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;Comunicación por bus I2C entre 3 PIC maestro-esclavos haciendo uso de la interrupción #INT_SSP.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b style=&quot;color: #2198a6; font-family: Nobile;&quot;&gt;&lt;a href=&quot;http://robotypic.blogspot.com.es/2011/03/comunicacion-rs232-entre-dos-pic.html&quot; target=&quot;_blank&quot;&gt;Comunicación por RS232 entre 2 PIC&lt;/a&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;Comunicación por bus serie entre 2 PIC actuando ambos como maestro-esclavo&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b style=&quot;color: #2198a6; font-family: Nobile;&quot;&gt;&lt;a href=&quot;http://robotypic.blogspot.com.es/2017/06/comunicacion-no-estandar-entre-dos-pic.html&quot; target=&quot;_blank&quot;&gt;Comunicación no estándar entre 2 PIC&lt;/a&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;Desarrollo de un sistema de comunicación entre 2 PIC por un bus de 4 lineas.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b style=&quot;color: #2198a6; font-family: Nobile;&quot;&gt;&lt;a href=&quot;http://robotypic.blogspot.com.es/2012/08/transmision-variable-tipo-float-por.html&quot; target=&quot;_blank&quot;&gt;Envío variable &quot;float&quot; por RS232&lt;/a&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;Envio por RS232 de una variable con signo y decimal.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b style=&quot;color: #2198a6; font-family: Nobile;&quot;&gt;&lt;a href=&quot;http://robotypic.blogspot.com.es/2010/11/emisor-receptor-de-infrarojos-con-pic.html&quot; target=&quot;_blank&quot;&gt;Emisor-receptor por infrarrojos&lt;/a&gt;&lt;/b&gt;

&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;Comunicación entre dos PIC por infrarrojos&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;hr align=&quot;center&quot; color=&quot;#E0F8EC&quot; size=&quot;5&quot; width=&quot;100%&quot; /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #2198a6; font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;b&gt;SENSORES CON PIC&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;float: left; padding: 10px; text-align: justify; width: 40%;&quot;&gt;
&lt;div style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmzAG0SXogs2Dk8_EGu8MOmp3Qg53q_TOlklWkBup6HNApm9GGUwH5m00IvJCDqKKYpwYtc01kCjnEMZsPsI5WZG3WjE1yyXuJhKvDdIwb7p1z-eDbeZVyQVbYwWjZ3fXP9GJT-goXZxY/s1600/PIC+-+sensor+_+RobotyPic.jpg&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;162&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmzAG0SXogs2Dk8_EGu8MOmp3Qg53q_TOlklWkBup6HNApm9GGUwH5m00IvJCDqKKYpwYtc01kCjnEMZsPsI5WZG3WjE1yyXuJhKvDdIwb7p1z-eDbeZVyQVbYwWjZ3fXP9GJT-goXZxY/s320/PIC+-+sensor+_+RobotyPic.jpg&quot; width=&quot;290&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;float: right; padding: 10px; text-align: justify; width: 48%;&quot;&gt;
&lt;span face=&quot;&amp;quot;verdana&amp;quot; , sans-serif&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span face=&quot;&amp;quot;verdana&amp;quot; , sans-serif&quot;&gt;Los sensores permiten a los sistemas electrónicos y robots recibir información del entorno en el que se encuentran para gestionarla y tomar decisiones consecuentes. En esta sección se muestra el control con PIC de algunos de los más utilizados en la robótica didáctica.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #2198a6; font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;color: #2198a6; font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;color: #2198a6; font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;color: #2198a6; font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;color: #2198a6; font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;color: #2198a6; font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;color: #2198a6; font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #2198a6; font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;color: #2198a6; font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;

&lt;br /&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=5250193391449144895#&quot; onclick=&quot;Effect.toggle(&amp;quot;expandir3&amp;quot;,&amp;quot;slide&amp;quot;); return false&quot;&gt;&lt;br /&gt;&lt;/a&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=5250193391449144895#&quot; onclick=&quot;Effect.toggle(&amp;quot;expandir3&amp;quot;,&amp;quot;slide&amp;quot;); return false&quot;&gt;&lt;br /&gt;&lt;/a&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=5250193391449144895#&quot; onclick=&quot;Effect.toggle(&amp;quot;expandir3&amp;quot;,&amp;quot;slide&amp;quot;); return false&quot;&gt;[+/-] Ver / Ocultar publicaciones&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=5250193391449144895#&quot; onclick=&quot;Effect.toggle(&amp;quot;expandir3&amp;quot;,&amp;quot;slide&amp;quot;); return false&quot;&gt;&lt;br /&gt;&lt;/a&gt;
&lt;br /&gt;
&lt;div id=&quot;expandir3&quot; style=&quot;display: none;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #2198a6; font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;b&gt;&lt;a href=&quot;http://robotypic.blogspot.com.es/2010/09/circuito-simulador-srf04-para-proteus.html&quot; target=&quot;_blank&quot;&gt;SRF04 y SRF05 para proteus.&lt;/a&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;Emulación de los sensores &lt;b&gt;SRF04 &lt;/b&gt;y &lt;b&gt;SRF05&lt;/b&gt; con un PIC para simulación de circuitos en proteus.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b style=&quot;color: #2198a6; font-family: Nobile;&quot;&gt;&lt;a href=&quot;http://robotypic.blogspot.com.es/2010/10/medida-de-distancias-con-srf04.html&quot; target=&quot;_blank&quot;&gt;Medida de distancias con SRF04&lt;/a&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;Medida de distancias por ultrasonidos con un &lt;b&gt;SRF04 &lt;/b&gt;y un PIC haciendo uso de la interrupción por detección de flanco de subida y bajada.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b style=&quot;color: #2198a6; font-family: Nobile;&quot;&gt;&lt;a href=&quot;http://robotypic.blogspot.com.es/2011/06/medida-de-distancias-con-srf05.html&quot; target=&quot;_blank&quot;&gt;Medida de distancias con SRF05&lt;/a&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;Medida de distancias por ultrasonidos con un &lt;/span&gt;&lt;b style=&quot;font-family: Nobile;&quot;&gt;SRF05 &lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;y un PIC haciendo uso de la interrupción por detección de flanco de subida y bajada.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b style=&quot;color: #2198a6; font-family: Nobile;&quot;&gt;&lt;a href=&quot;http://robotypic.blogspot.com.es/2012/12/sensor-srf08-con-pic.html&quot; target=&quot;_blank&quot;&gt;Sensor SRF08 con PIC&lt;/a&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;Control de un sensor &lt;b&gt;SRF08 &lt;/b&gt;con PIC. Envío de comandos y lectura de la versión, luminosidad ambiental y distancia al objeto más cercano.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;b style=&quot;color: #2198a6; font-family: Nobile;&quot;&gt;&lt;a href=&quot;http://robotypic.blogspot.com.es/2010/09/control-del-sensor-termico-tpa81.html&quot; target=&quot;_blank&quot;&gt;Sensor TPA81 con PIC&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;Control de un sensor térmico &lt;b&gt;TPA81 &lt;/b&gt;con PIC. Lectura de la versión, temperatura ambiental y de todos sus píxeles. Control de las posiciones del servo asociado.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;b style=&quot;color: #2198a6; font-family: Nobile;&quot;&gt;&lt;a href=&quot;http://robotypic.blogspot.com.es/2010/12/cambio-de-la-direccion-i2c-de-un-tpa81.html&quot; target=&quot;_blank&quot;&gt;Cambio de la dirección I2C de un sensor TPA81&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;Proceso de cambio de la dirección con la que se identifica el sensor &lt;b&gt;TPA81 &lt;/b&gt;en un bus I2C.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;b style=&quot;color: #2198a6; font-family: Nobile;&quot;&gt;&lt;a href=&quot;http://robotypic.blogspot.com.es/2013/09/SHT11conPIC.html&quot; target=&quot;_blank&quot;&gt;Sensor de temperatura y humedad SHT11 con PIC&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;Lectura de la temperatura y humedad ambientales con un sensor &lt;b&gt;SHT11 &lt;/b&gt;controlado por un PIC por comunicación serie.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;b style=&quot;color: #2198a6; font-family: Nobile;&quot;&gt;&lt;a href=&quot;http://robotypic.blogspot.com.es/2013/09/Libreria-C-para-SHT11.html&quot; target=&quot;_blank&quot;&gt;Librería C para el control de un sensor SHT11&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;Explicación y uso de la librería C para el uso de un sensor &lt;b&gt;SHT11 &lt;/b&gt;con PIC.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;b style=&quot;color: #2198a6; font-family: Nobile;&quot;&gt;&lt;a href=&quot;http://robotypic.blogspot.com.es/2013/03/configuracion-del-easyvr.html&quot; target=&quot;_blank&quot;&gt;Configuración del módulo EasyVr&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;Configuración y control de un módulo de reconocimiento de voz &lt;b&gt;EasyVr&lt;/b&gt; desde un PC. Creación de voces y tablas de sonidos.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;b style=&quot;color: #2198a6; font-family: Nobile;&quot;&gt;&lt;a href=&quot;http://robotypic.blogspot.com.es/2013/03/control-PIC-por-voz.html&quot; target=&quot;_blank&quot;&gt;Control de un PIC por voz.&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;Control de un PIC mediante voz utilizando el módulo &lt;b&gt;EasyVr&lt;/b&gt;. Reproducción de frases y sonidos.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;b style=&quot;color: #2198a6; font-family: Nobile;&quot;&gt;&lt;a href=&quot;http://robotypic.blogspot.com.es/2013/10/CMUcam4-desde-PC.html&quot; target=&quot;_blank&quot;&gt;CMUcam4 controlada desde un PC.&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;Control de una cámara &lt;b&gt;CMUcam4 &lt;/b&gt;desde un PC mediante el software gráfico CMUcam4GUI y mediante comandos con visor de puerto serie. Rastreo de un color mediante los servos asociados.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;b style=&quot;color: #2198a6; font-family: Nobile;&quot;&gt;&lt;a href=&quot;http://robotypic.blogspot.com.es/2013/10/CMUcam4-con-PIC.html&quot; target=&quot;_blank&quot;&gt;CMUcam4 controlada con PIC&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;Control de una cámara &lt;b&gt;CMUcam4 &lt;/b&gt;con un PC mediante comandos. Rastreo de un color mediante los servos asociados&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;hr align=&quot;center&quot; color=&quot;#E0F8EC&quot; size=&quot;5&quot; width=&quot;100%&quot; /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #2198a6; font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;b&gt;COMPONENTES &amp;nbsp;CON PIC&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;float: left; padding: 10px; text-align: justify; width: 40%;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOfurk7Y7gOYsUGN4Ms04LA1cRjrd7_XGhVh-S750QHeTp4tTW6Zmj0KJ1db4l4jGudMkePv8ZFiNZfgdbUD3JZ-v92b7Vyer2whkI_56N9ugTEETmQjFlg3JYnRcAs39AE4Sv8Qp2dUw/s1600/PIC+-+componentes+_+RobotyPic.JPG&quot; style=&quot;clear: left; display: inline; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;178&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOfurk7Y7gOYsUGN4Ms04LA1cRjrd7_XGhVh-S750QHeTp4tTW6Zmj0KJ1db4l4jGudMkePv8ZFiNZfgdbUD3JZ-v92b7Vyer2whkI_56N9ugTEETmQjFlg3JYnRcAs39AE4Sv8Qp2dUw/s320/PIC+-+componentes+_+RobotyPic.JPG&quot; width=&quot;290&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;float: right; padding: 10px; text-align: justify; width: 48%;&quot;&gt;
&lt;span face=&quot;&amp;quot;verdana&amp;quot; , sans-serif&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span face=&quot;&amp;quot;verdana&amp;quot; , sans-serif&quot;&gt;Cuando el PIC, y por extensión los Robots tienen que comunicarse con nosotros, necesitaremos del uso de componentes que nos ofrezcan dicha información de una forma legible, sea en LCD, por voz, etc.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=5250193391449144895#&quot; onclick=&quot;Effect.toggle(&amp;quot;expandir4&amp;quot;,&amp;quot;slide&amp;quot;); return false&quot;&gt;&lt;br /&gt;&lt;/a&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=5250193391449144895#&quot; onclick=&quot;Effect.toggle(&amp;quot;expandir4&amp;quot;,&amp;quot;slide&amp;quot;); return false&quot;&gt;&lt;br /&gt;&lt;/a&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=5250193391449144895#&quot; onclick=&quot;Effect.toggle(&amp;quot;expandir4&amp;quot;,&amp;quot;slide&amp;quot;); return false&quot;&gt;&lt;br /&gt;&lt;/a&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=5250193391449144895#&quot; onclick=&quot;Effect.toggle(&amp;quot;expandir4&amp;quot;,&amp;quot;slide&amp;quot;); return false&quot;&gt;[+/-] Ver / Ocultar publicaciones&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=5250193391449144895#&quot; onclick=&quot;Effect.toggle(&amp;quot;expandir4&amp;quot;,&amp;quot;slide&amp;quot;); return false&quot;&gt;&lt;br /&gt;&lt;/a&gt;
&lt;br /&gt;
&lt;div id=&quot;expandir4&quot; style=&quot;display: none;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #2198a6; font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;b&gt;&lt;a href=&quot;http://robotypic.blogspot.com.es/2011/04/control-de-un-lcd03-por-bus-i2c.html&quot; target=&quot;_blank&quot;&gt;Control de un LCD03 por bus I2C.&lt;/a&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;Uso de un LCD03 controlado por un PIC por bus I2C. Envío de comandos para encendido-apagado de la iluminación, borrado de la pantalla, escritura de texto, ocultación del cursor, desplazamiento del cursor y borrado de caracteres.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b style=&quot;color: #2198a6; font-family: Nobile;&quot;&gt;&lt;a href=&quot;http://robotypic.blogspot.com.es/2011/04/control-de-un-sintetizador-de-voz-sp03.html&quot; target=&quot;_blank&quot;&gt;Control de un sintetizador de voz SP03.&lt;/a&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;Reproducción de textos y voces mediante un sintetizador de voz SP03 por bus I2C.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b style=&quot;color: #2198a6; font-family: Nobile;&quot;&gt;&lt;a href=&quot;http://robotypic.blogspot.com.es/2010/11/lectura-escritura-eeprom-con-pic-por.html&quot; target=&quot;_blank&quot;&gt;Lectura-escritura de una eeprom por bus I2C&lt;/a&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;Lectura y escritura en una memoria eeprom con PIC por bus I2C.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;hr align=&quot;center&quot; color=&quot;#E0F8EC&quot; size=&quot;5&quot; width=&quot;100%&quot; /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #2198a6; font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;b&gt;ACTUADORES CON PIC&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;float: left; padding: 10px; text-align: justify; width: 40%;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhQnuF3nMQTWDzEHaaKZX5WjlS7_E0Gnh9Dc35O_ayYgPmYcGuZUSuw1BCbIq70weBiqAnHoJqTzta5XfL5_TRXzjj7pa0h7nkQkQA1cLTyHShBqlDv5ofAD7bcSXSEGyhyphenhypheniECpiTRfpzc/s1600/Actuadores+con+PIC_RobotyPic.JPG&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;194&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhQnuF3nMQTWDzEHaaKZX5WjlS7_E0Gnh9Dc35O_ayYgPmYcGuZUSuw1BCbIq70weBiqAnHoJqTzta5XfL5_TRXzjj7pa0h7nkQkQA1cLTyHShBqlDv5ofAD7bcSXSEGyhyphenhypheniECpiTRfpzc/s320/Actuadores+con+PIC_RobotyPic.JPG&quot; width=&quot;290&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;float: right; padding: 10px; text-align: justify; width: 48%;&quot;&gt;
&lt;span face=&quot;&amp;quot;verdana&amp;quot; , sans-serif&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span face=&quot;&amp;quot;verdana&amp;quot; , sans-serif&quot;&gt;Para reaccionar ante ciertas circunstancias del entorno necesitaremos saber controlar diversos mecanismos como servos, motores, etc. &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=5250193391449144895#&quot; onclick=&quot;Effect.toggle(&amp;quot;expandir5&amp;quot;,&amp;quot;slide&amp;quot;); return false&quot;&gt;[+/-] Ver / Ocultar publicaciones&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=5250193391449144895#&quot; onclick=&quot;Effect.toggle(&amp;quot;expandir5&amp;quot;,&amp;quot;slide&amp;quot;); return false&quot;&gt;&lt;br /&gt;&lt;/a&gt;
&lt;br /&gt;
&lt;div id=&quot;expandir5&quot; style=&quot;display: none;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #2198a6; font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;b&gt;&lt;a href=&quot;http://robotypic.blogspot.com.es/2010/11/control-de-8-servos-con-pic-16f876a_13.html&quot; target=&quot;_blank&quot;&gt;Control de 8 servos con PIC&lt;/a&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;Control simultáneo de 8 servos mediante código en un PIC.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;b style=&quot;color: #2198a6; font-family: Nobile;&quot;&gt;&lt;a href=&quot;http://robotypic.blogspot.com.es/2013/05/pic-controlador-de-servos.html&quot; target=&quot;_blank&quot;&gt;PIC controlador de servos por bus I2C&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;Control simultáneo de 20 servos mediante código en un PIC esclavo. Control de las posiciones de los servos desde un PIC maestro por bus I2C.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;b style=&quot;color: #2198a6; font-family: Nobile;&quot;&gt;&lt;a href=&quot;http://robotypic.blogspot.com.es/2012/12/controladora-de-servos-sd21-con-pic.html&quot; target=&quot;_blank&quot;&gt;Controladora de servos SD21&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;Gestión de servos mediante el módulo SD21 controlado por bus I2C con un PIC.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;b style=&quot;color: #2198a6; font-family: Nobile;&quot;&gt;&lt;a href=&quot;http://robotypic.blogspot.com.es/2012/11/control-de-velocidad-de-un-motor-dc-con.html&quot; target=&quot;_blank&quot;&gt;Control de velocidad de un motor DC&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;Control de un motor DC mediante la generación de una señal PWM variable con un PIC.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;hr align=&quot;center&quot; color=&quot;#E0F8EC&quot; size=&quot;5&quot; width=&quot;100%&quot; /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #2198a6; font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;b&gt;PROCESOS CON PIC&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;float: left; padding: 10px; text-align: justify; width: 40%;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjuAqzPH3aMJfcIsHvezfLL5R4Imp-igB0j5qbe2Yw8y9538qbZQ7S-oBaiMbPmWa2vNbJ6dyip3jzJbx4KQE5QC9By_GZ4mx6_IfvgfrVQ9A_Fl_mPJaVMk1aQbFQUF0RpgSw-WmVsXhg/s1600/Procesos+con+PIC+_+RobotyPic.JPG&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;174&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjuAqzPH3aMJfcIsHvezfLL5R4Imp-igB0j5qbe2Yw8y9538qbZQ7S-oBaiMbPmWa2vNbJ6dyip3jzJbx4KQE5QC9By_GZ4mx6_IfvgfrVQ9A_Fl_mPJaVMk1aQbFQUF0RpgSw-WmVsXhg/s320/Procesos+con+PIC+_+RobotyPic.JPG&quot; width=&quot;290&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;float: right; padding: 10px; text-align: justify; width: 48%;&quot;&gt;
&lt;span face=&quot;&amp;quot;verdana&amp;quot; , sans-serif&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span face=&quot;&amp;quot;verdana&amp;quot; , sans-serif&quot;&gt;Control de diferentes procesos o funciones usando algunas de las características de los PIC.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #2198a6; font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #2198a6; font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;color: #2198a6; font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;color: #2198a6; font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;color: #2198a6; font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;color: #2198a6; font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;color: #2198a6; font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;color: #2198a6; font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;color: #2198a6; font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;color: #2198a6; font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=5250193391449144895#&quot; onclick=&quot;Effect.toggle(&amp;quot;expandir6&amp;quot;,&amp;quot;slide&amp;quot;); return false&quot;&gt;[+/-] Ver / Ocultar publicaciones&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=5250193391449144895#&quot; onclick=&quot;Effect.toggle(&amp;quot;expandir6&amp;quot;,&amp;quot;slide&amp;quot;); return false&quot;&gt;&lt;br /&gt;&lt;/a&gt;
&lt;br /&gt;
&lt;div id=&quot;expandir6&quot; style=&quot;display: none;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #2198a6; font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;b&gt;&lt;a href=&quot;http://robotypic.blogspot.com.es/2011/02/lectura-de-luminosidad-con-el-conversor.html&quot; target=&quot;_blank&quot;&gt;Lectura de luminosidad con PIC&lt;/a&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;Lectura de la diferencia de luminosidad entre 2 LDR mediante el conversor A/D del PIC.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;b style=&quot;color: #2198a6; font-family: Nobile;&quot;&gt;&lt;a href=&quot;http://robotypic.blogspot.com.es/2011/05/generacion-de-numeros-aleatorios-con.html&quot; target=&quot;_blank&quot;&gt;Generación de números aleatorios&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;Generación de números aleatorios con un PIC con las funciones rand( ) y srand( ).&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;hr align=&quot;center&quot; color=&quot;#E0F8EC&quot; size=&quot;5&quot; width=&quot;100%&quot; /&gt;
&lt;br /&gt;
&lt;b style=&quot;color: #2198a6; font-family: Nobile;&quot;&gt;ROBOTS CON PIC&lt;/b&gt;&lt;br /&gt;
&lt;div style=&quot;float: left; padding: 10px; text-align: justify; width: 40%;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEid40uPs9IiLXIqSJ3rQ0u0SE5ykn4A1nA1xojhBLdmdLxmvUtS1lFuP2SZaV2olX-QYGD5NAGImtDEDlECviSQZqlbDanzh6hY7vpvScrAxkBiHqkk9pEoLkOZ_gedrA1ob0Roc89qp64/s1600/Robot+-+PIC+_+RobotyPic.JPG&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;262&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEid40uPs9IiLXIqSJ3rQ0u0SE5ykn4A1nA1xojhBLdmdLxmvUtS1lFuP2SZaV2olX-QYGD5NAGImtDEDlECviSQZqlbDanzh6hY7vpvScrAxkBiHqkk9pEoLkOZ_gedrA1ob0Roc89qp64/s320/Robot+-+PIC+_+RobotyPic.JPG&quot; width=&quot;290&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEid40uPs9IiLXIqSJ3rQ0u0SE5ykn4A1nA1xojhBLdmdLxmvUtS1lFuP2SZaV2olX-QYGD5NAGImtDEDlECviSQZqlbDanzh6hY7vpvScrAxkBiHqkk9pEoLkOZ_gedrA1ob0Roc89qp64/s1600/Robot+-+PIC+_+RobotyPic.JPG&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;br /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;float: right; padding: 10px; text-align: justify; width: 48%;&quot;&gt;
&lt;span face=&quot;&amp;quot;verdana&amp;quot; , sans-serif&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span face=&quot;&amp;quot;verdana&amp;quot; , sans-serif&quot;&gt;No podríamos entender el mundo en pleno siglo XXI sin los robots. En esta sección, los artículos desarrollados muestran algunos modelos didácticos. Por supuesto controlados con PIC.&lt;/span&gt;&lt;br /&gt;
&lt;span face=&quot;&amp;quot;verdana&amp;quot; , sans-serif&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span face=&quot;&amp;quot;verdana&amp;quot; , sans-serif&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;span face=&quot;&amp;quot;verdana&amp;quot; , sans-serif&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span face=&quot;&amp;quot;verdana&amp;quot; , sans-serif&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span face=&quot;&amp;quot;verdana&amp;quot; , sans-serif&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span face=&quot;&amp;quot;verdana&amp;quot; , sans-serif&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span face=&quot;&amp;quot;verdana&amp;quot; , sans-serif&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span face=&quot;&amp;quot;verdana&amp;quot; , sans-serif&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b style=&quot;color: #2198a6; font-family: Nobile; font-size: 12pt; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b style=&quot;color: #2198a6; font-family: Nobile; font-size: 12pt; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b style=&quot;color: #2198a6; font-family: Nobile; font-size: 12pt; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b style=&quot;color: #2198a6; font-family: Nobile; font-size: 12pt; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b style=&quot;color: #2198a6; font-family: Nobile; font-size: 12pt; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=5250193391449144895#&quot; onclick=&quot;Effect.toggle(&amp;quot;expandir7&amp;quot;,&amp;quot;slide&amp;quot;); return false&quot;&gt;[+/-] Ver / Ocultar publicaciones&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div id=&quot;expandir7&quot; style=&quot;display: none;&quot;&gt;
&lt;b style=&quot;color: #2198a6; font-family: Nobile; text-align: justify;&quot;&gt;&lt;a href=&quot;http://robotypic.blogspot.com.es/2010/09/proyecto-de-robot-que-evita-obstaculos.html&quot; target=&quot;_blank&quot;&gt;Robot que evita obstáculos.&lt;/a&gt;&lt;/b&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;Robot explorador controlado con PIC que avanza sorteando obstáculos.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b style=&quot;color: #2198a6; font-family: Nobile;&quot;&gt;&lt;a href=&quot;http://robotypic.blogspot.com.es/2010/10/robot-con-sensor-termico-tpa81.html&quot; target=&quot;_blank&quot;&gt;Robot con TPA81.&lt;/a&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;Robot controlado con PIC que detecta y sigue el calor corporal.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b style=&quot;color: #2198a6; font-family: Nobile;&quot;&gt;&lt;a href=&quot;http://robotypic.blogspot.com.es/2011/03/robot-con-srf04-y-tpa81.html&quot; target=&quot;_blank&quot;&gt;Robot con SRF04 y TPA81.&lt;/a&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;Robot explorador controlado con PIC. Evita obstáculos en su camino y detecta a las personas por su calor corporal.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b style=&quot;color: #2198a6; font-family: Nobile;&quot;&gt;&lt;a href=&quot;http://robotypic.blogspot.com.es/2011/11/control-de-un-brazo-robotico.html&quot; target=&quot;_blank&quot;&gt;Brazo robot de 4 ejes.&lt;/a&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;Control de un brazo robot de 4 ejes. Control de los 4 servos mediante código en el PIC.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;b style=&quot;color: #2198a6; font-family: Nobile;&quot;&gt;&lt;a href=&quot;http://robotypic.blogspot.com.es/2013/04/brazo-de-6-ejes-con-PIC.html&quot; target=&quot;_blank&quot;&gt;Brazo robot de 6 ejes.&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;Control de un brazo robot de 6 ejes&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;. Gestión de los 6 servos mediante módulo SD21 controlado con un PIC.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;b style=&quot;color: #2198a6; font-family: Nobile;&quot;&gt;&lt;a href=&quot;http://robotypic.blogspot.com.es/2011/10/diseno-de-la-plataforma-movil-para-el.html&quot; target=&quot;_blank&quot;&gt;Plataforma para robot.&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;nobile&amp;quot;;&quot;&gt;Proceso de fabricación paso a paso de una plataforma para un robot con 2 ruedas motrices-directrices.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;hr align=&quot;center&quot; color=&quot;#E0F8EC&quot; size=&quot;5&quot; width=&quot;100%&quot; /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;center&gt;&lt;/center&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhD7wQ-FR5dVNdcb0Dpz_pgoK2NF1MSFg4HSpNxxzQOddL_8KGHzWx47NsQTzOxr-f-byH7VpSYB3kjcPyAskFfKErotbvBs8H_P59L0jbhNAU9grOMaQgQ3AEkl1J5hyphenhyphen3rr5t1uqypZrc/s1600/Condensadores+_+RobotyPic.jpg&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhD7wQ-FR5dVNdcb0Dpz_pgoK2NF1MSFg4HSpNxxzQOddL_8KGHzWx47NsQTzOxr-f-byH7VpSYB3kjcPyAskFfKErotbvBs8H_P59L0jbhNAU9grOMaQgQ3AEkl1J5hyphenhyphen3rr5t1uqypZrc/s640/Condensadores+_+RobotyPic.jpg&quot; width=&quot;427&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;hr align=&quot;center&quot; color=&quot;#E0F8EC&quot; size=&quot;5&quot; width=&quot;100%&quot; /&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://robotypic.blogspot.com/feeds/8034955417095060992/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5250193391449144895/8034955417095060992?isPopup=true' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5250193391449144895/posts/default/8034955417095060992'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5250193391449144895/posts/default/8034955417095060992'/><link rel='alternate' type='text/html' href='http://robotypic.blogspot.com/2012/04/robotypic.html' title='  '/><author><name>Robotypic</name><uri>http://www.blogger.com/profile/16455462312458405515</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXR2Ti9xb0-IkNgkRy6MZuUI3FExEArPEY1YgItAvIgpsNfHvlhmoHuzhW5gJmYE1BYBXIGUTjdxXw8fY34AuskUArgI46muGHQs_56XhgbgCeGP1O-E8RCy2K_AOa811IHRnJBmejXJE/s72-c/RobotyPic+Brazo+Robot+Presentaci%C3%B3n.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5250193391449144895.post-7914052579441500470</id><published>2017-06-04T01:22:00.002+02:00</published><updated>2017-06-04T21:07:45.150+02:00</updated><title type='text'>Comunicación no estándar entre dos PIC.</title><content type='html'>&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhy9_FtSQBCJtZQx-9oqLfqIDTISr_y3Sw5z4cToMWV5gzO_CVIjm6Ys0Wp2fiBVuecXU3kfa8yJmigWyY3-2Z8vDVGaW26uFQCPP0FytRfZ9HtskOxXWyspp98MCgE3BHlFaOlCJrpl4U/s1600/RyP_COM.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;304&quot; data-original-width=&quot;719&quot; height=&quot;270&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhy9_FtSQBCJtZQx-9oqLfqIDTISr_y3Sw5z4cToMWV5gzO_CVIjm6Ys0Wp2fiBVuecXU3kfa8yJmigWyY3-2Z8vDVGaW26uFQCPP0FytRfZ9HtskOxXWyspp98MCgE3BHlFaOlCJrpl4U/s640/RyP_COM.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Sabemos que existen diversos sistemas de
comunicación para transmitir datos entre PICs (comunicación serie, SPI, I2C,
etc.). Aquí vamos a desarrollar un sistema de comunicación propio para la
transmisión de bytes de datos de un PIC maestro a uno esclavo y viceversa. No
se trata de competir con los sistemas estándar de comunicación existentes sino
de disponer de un recurso cuando tenemos que transferir datos de un PIC a otro
sin demasiadas exigencias. La única condición en el código desarrollado es que ambos PICs, maestro y esclavo, trabajen con la misma frecuencia de reloj.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;El proceso se ha pensado para un bus de 4 líneas:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;- &lt;i&gt;&lt;b&gt;Mx_pin&lt;/b&gt;&lt;/i&gt; es unidireccional y transfiere
información del PIC Maestro al PIC Esclavo. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;- &lt;i&gt;&lt;b&gt;Ex_pin&lt;/b&gt;&lt;/i&gt; hace la misma función que el anterior
pero la transferencia es del PIC Esclavo al Maestro.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;- &lt;i&gt;&lt;b&gt;Inicio_pin&lt;/b&gt;&lt;/i&gt; también es unidireccional y se emplea para avisar al PIC
Esclavo desde el Maestro de que se va a producir una transferencia de
información.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;- &lt;b&gt;&lt;i&gt;Sincro_pin&lt;/i&gt;&lt;/b&gt; es bidireccional y su misión es sincronizar
el envío de información de uno de los PIC con su recepción por el
otro PIC.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiAnSGuhUa2N4bPgytx3gKj53u7vWiTtUPHMzIkMIuBcKPY7ql_bxia50BTqhaT3YTqK-UYwkjYQy9Mx49p8GuIhtmtq1kbutQzJXH36YfmX3qX28YFTaiIIY_NF6DNluK9Dw8tm9NiL6c/s1600/Esquema+Comunicaci%25C3%25B3n+RyP_COM.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;595&quot; data-original-width=&quot;742&quot; height=&quot;512&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiAnSGuhUa2N4bPgytx3gKj53u7vWiTtUPHMzIkMIuBcKPY7ql_bxia50BTqhaT3YTqK-UYwkjYQy9Mx49p8GuIhtmtq1kbutQzJXH36YfmX3qX28YFTaiIIY_NF6DNluK9Dw8tm9NiL6c/s640/Esquema+Comunicaci%25C3%25B3n+RyP_COM.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; text-align: justify;&quot;&gt;Para enviar un byte al Esclavo, el PIC
maestro comienza el proceso poniendo a &#39;1&#39; &lt;i&gt;&lt;b&gt;Inicio_pin&lt;/b&gt;&lt;/i&gt;. Este pulso alerta al PIC
esclavo para atender la petición del maestro. Previamente, el maestro ha
asegurado el &lt;b&gt;&lt;i&gt;Mx_pin&lt;/i&gt;&lt;/b&gt; a &#39;&lt;/span&gt;&lt;st1:metricconverter productid=&quot;0”&quot; style=&quot;font-family: verdana, sans-serif;&quot; w:st=&quot;on&quot;&gt;0&#39;&lt;/st1:metricconverter&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; text-align: justify;&quot;&gt;.
Cuando el Esclavo atiende a la solicitud, lee el estado del &lt;i&gt;&lt;b&gt;Mx_pin&lt;/b&gt;&lt;/i&gt;. Un &#39;&lt;/span&gt;&lt;st1:metricconverter productid=&quot;0”&quot; style=&quot;font-family: verdana, sans-serif;&quot; w:st=&quot;on&quot;&gt;0&#39;&lt;/st1:metricconverter&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; text-align: justify;&quot;&gt;&amp;nbsp;significa que el maestro le
va a enviar un byte de datos. Un &#39;&lt;/span&gt;&lt;st1:metricconverter productid=&quot;1”&quot; style=&quot;font-family: verdana, sans-serif;&quot; w:st=&quot;on&quot;&gt;1&#39;&lt;/st1:metricconverter&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; text-align: justify;&quot;&gt;&amp;nbsp;significa que el maestro le va a solicitar leer un byte de datos.&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Cuando el esclavo ya ha accedido a la solicitud del maestro y leído el estado del
&lt;i&gt;&lt;b&gt;Mx_pin&lt;/b&gt;&lt;/i&gt;, da un pulso en el &lt;i&gt;&lt;b&gt;Sincro_pin&lt;/b&gt;&lt;/i&gt; para avisar al maestro de que puede mandarle el primer bit del byte a transmitir, comenzando por el
bit más significativo b7. El PIC esclavo espera unos 5 uS para asegurar que el
maestro pase al &lt;i&gt;&lt;b&gt;Mx_pin&lt;/b&gt;&lt;/i&gt; el siguiente bit. Cuando el esclavo lee el valor vuelve
a dar un pulso en &lt;i&gt;&lt;b&gt;Sincro_pin&lt;/b&gt;&lt;/i&gt; para avisar al maestro. El proceso se repite para
los 8 bits del byte transmitido. Después de leer el último bit, el esclavo da
un pulso&amp;nbsp; de unos 10uS en el pin &lt;i&gt;&lt;b&gt;Ex_pin&lt;/b&gt;&lt;/i&gt;
como confirmación de recepción del byte completo.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;


&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZEqWKNdzhBuLclf6JHQULnGo59I3ebgJlFQR4DPIIZSb_U9Havg6uF_IFH4fT9zXaObjsiuOUMqva44m3wVxxvXzA8L_C26ZtxwBsWkbOUdqDTss-oEPdu80AFQGkbC_PG05AqzvjhqA/s1600/Envio+Comunicaci%25C3%25B3n+RyP_COM+%2528RobotyPic%2529.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;1364&quot; data-original-width=&quot;1600&quot; height=&quot;544&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZEqWKNdzhBuLclf6JHQULnGo59I3ebgJlFQR4DPIIZSb_U9Havg6uF_IFH4fT9zXaObjsiuOUMqva44m3wVxxvXzA8L_C26ZtxwBsWkbOUdqDTss-oEPdu80AFQGkbC_PG05AqzvjhqA/s640/Envio+Comunicaci%25C3%25B3n+RyP_COM+%2528RobotyPic%2529.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Para solicitar un byte al Esclavo, el PIC
maestro comienza el proceso asegurando el pin &lt;i&gt;&lt;b&gt;Mx_pin&lt;/b&gt;&lt;/i&gt; a &#39;&lt;/span&gt;&lt;st1:metricconverter productid=&quot;1”&quot; style=&quot;font-family: verdana, sans-serif;&quot; w:st=&quot;on&quot;&gt;1&#39;&lt;/st1:metricconverter&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;. A continuación da un pulso de
comienzo de comunicación en el pin &lt;i&gt;&lt;b&gt;Inicio_pin&lt;/b&gt;&lt;/i&gt;. Este pulso alerta al esclavo
para que atienda el requerimiento del maestro. El esclavo lee el estado del pin
&lt;i&gt;&lt;b&gt;Mx_pin&lt;/b&gt;&lt;/i&gt;. El valor &#39;&lt;/span&gt;&lt;st1:metricconverter productid=&quot;1”&quot; style=&quot;font-family: verdana, sans-serif;&quot; w:st=&quot;on&quot;&gt;1&#39;&lt;/st1:metricconverter&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&amp;nbsp;le avisa de que el maestro le solicita un byte para leer. El esclavo confirma
su lectura mediante un pulso en &lt;i&gt;&lt;b&gt;Sincro_pin&lt;/b&gt;&lt;/i&gt;. &amp;nbsp;En ese momento el control del pin &lt;i&gt;&lt;b&gt;Sincro_pin&lt;/b&gt;&lt;/i&gt;
pasa al maestro (pasa a ser salida en el maestro y entrada en el esclavo).&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Ahora es el esclavo quien trasmite el byte de
datos bit a bit por &lt;b&gt;&lt;i&gt;Ex_pin&lt;/i&gt;&lt;/b&gt; y el maestro quien advierte al esclavo de que ya ha
leído el bit en curso mediante un pulso en la linea &lt;i&gt;&lt;b&gt;Sincro_pin&lt;/b&gt;&lt;/i&gt;.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Finalizada la recepción del byte completo por
el maestro este lo indica con un pulso de 10uS en &lt;i&gt;&lt;b&gt;Mx_pin&lt;/b&gt;&lt;/i&gt;.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_qCFGXGE3xMATwKWynADKvNhic1fEO5OCmWeFBjITl16B2eisyCtqvc3CeTAtjxzDyp7VdwmU17ZyyARIVvPiD7txznG6x7I1S3Adc9O-2vGtjheNM0M3KG-pnM6lFrG4S0W1IdL9jDk/s1600/Recepci%25C3%25B3n+Comunicaci%25C3%25B3n+RyP_COM+%2528RobotyPic%2529.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;1408&quot; data-original-width=&quot;1600&quot; height=&quot;562&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_qCFGXGE3xMATwKWynADKvNhic1fEO5OCmWeFBjITl16B2eisyCtqvc3CeTAtjxzDyp7VdwmU17ZyyARIVvPiD7txznG6x7I1S3Adc9O-2vGtjheNM0M3KG-pnM6lFrG4S0W1IdL9jDk/s640/Recepci%25C3%25B3n+Comunicaci%25C3%25B3n+RyP_COM+%2528RobotyPic%2529.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Tanto en el maestro como en el esclavo, la estrategia empleada, a nivel de código para
enviar un byte (8 bits) bit a bit por una única línea, consiste en emplear una variable
de valor inicial 0x80 (0b10000000)&amp;nbsp; con
la que haremos una comparación AND con el byte a enviar. Si el byte a enviar
tiene ese mismo bit a &#39;&lt;st1:metricconverter productid=&quot;1”&quot; w:st=&quot;on&quot;&gt;1&#39;&lt;/st1:metricconverter&gt;,
el resultado de la función AND será 1 y si es 0 será 0. Y ese será el valor que
enviaremos del bit. Rotaremos el bit de la variable una posición (0b01000000=&amp;gt;
mascara = 0x40) para comparar el siguiente bit del byte (b6) y así
sucesivamente para los 8 bits. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;border: 5px solid rgb(224, 248, 236); padding: 5px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjIY3Mmhu6ssbUxUF6chwb_XMPehfj_UW95fKoWMZfgUVHP_a0_dxIWm4gdZAAuKhdGl-QXnEltAnh3fvoLh0x4aCdnqbOjZ1fwfxI7VKw8K0_OYw4qBDREGMH1zcjN9oZrgNxHAo1Hz8w/s1600/Proceso+de+envio+RyP_COM.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;764&quot; data-original-width=&quot;1600&quot; height=&quot;245&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjIY3Mmhu6ssbUxUF6chwb_XMPehfj_UW95fKoWMZfgUVHP_a0_dxIWm4gdZAAuKhdGl-QXnEltAnh3fvoLh0x4aCdnqbOjZ1fwfxI7VKw8K0_OYw4qBDREGMH1zcjN9oZrgNxHAo1Hz8w/s640/Proceso+de+envio+RyP_COM.jpg&quot; width=&quot;500&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid rgb(224, 248, 236); padding: 5px;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #4a442a;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: #4a442a;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: #4a442a;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #444444;&quot;&gt;mascara =&lt;/span&gt;&lt;span style=&quot;color: #4a442a;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;0x80&lt;/span&gt;&lt;span style=&quot;color: #4a442a;&quot;&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #4a442a;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: #4a442a;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #4a442a;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp;&amp;nbsp; /**
Envío del byte de datos **/&lt;/span&gt;&lt;span style=&quot;color: #4a442a;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #4a442a;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: #4a442a;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;color: #4a442a;&quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #444444;&quot;&gt;(bit=&lt;/span&gt;&lt;span style=&quot;color: #274e13;&quot;&gt;8&lt;/span&gt;&lt;span style=&quot;color: #444444;&quot;&gt;; bit&amp;gt;=&lt;/span&gt;&lt;span style=&quot;color: #274e13;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #444444;&quot;&gt;; bit--){&lt;/span&gt;&lt;span style=&quot;color: #4a442a;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Para los 8 bits&lt;/span&gt;&lt;span style=&quot;color: #4a442a;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #4a442a;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: #4a442a;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;if
&lt;/span&gt;&lt;span style=&quot;color: #444444;&quot;&gt;((dato &amp;amp; mascara)&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #274e13;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #444444;&quot;&gt;) output_high(Mx_pin);&lt;/span&gt;&lt;span style=&quot;color: #4a442a;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Si bit en curso es 1&lt;/span&gt;&lt;span style=&quot;color: #4a442a;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #4a442a;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: #4a442a;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;else&lt;/span&gt;&lt;span style=&quot;color: #4a442a;&quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #444444;&quot;&gt;output_low (Mx_pin);&lt;/span&gt;&lt;span style=&quot;color: #4a442a;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Si
bit en curso es 0&lt;/span&gt;&lt;span style=&quot;color: #4a442a;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #4a442a;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: #4a442a;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;span style=&quot;color: #444444;&quot;&gt;mascara = mascara &amp;gt;&amp;gt; &lt;/span&gt;&lt;span style=&quot;color: #274e13;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #444444;&quot;&gt;;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #4a442a;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Preparación proximo bit&lt;/span&gt;&lt;span style=&quot;color: #4a442a;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #444444; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Al otro lado está el PIC que recibe el byte bit a bit. &amp;nbsp;Cuando el bit recibido es 0
realiza una función OR entre la variable &lt;i&gt;temporal &lt;/i&gt;(que inicialmente tiene valor 0)
y la constante &lt;i&gt;mascara0 &lt;/i&gt;(con valor 0b00000000). Cuando el bit recibido es 1
realiza la función OR entre la variable &lt;i&gt;temporal &lt;/i&gt;y la constante &lt;i&gt;mascara1&lt;/i&gt;. Rota una
posición los bits de la variable &lt;i&gt;temporal &lt;/i&gt;y vuelve a recibir el siguiente bit. Así hasta los 8 bits.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;border: 5px solid rgb(224, 248, 236); padding: 5px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjrb5GWb6ar1PkRhPoELjH1t1rinLufaSUg5-DzWkH3Egx_EWuD5A4ZRWH-6OS8wskEesTIQsqR2-6zDdL5zV2cdRmjGSBH5k2W4IVoTafCUzrL5X1W15cPj2k4a9xMOXjuQNqsmPgeT0w/s1600/Proceso+de+recepci%25C3%25B3n+RyP_COM.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;719&quot; data-original-width=&quot;1600&quot; height=&quot;286&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjrb5GWb6ar1PkRhPoELjH1t1rinLufaSUg5-DzWkH3Egx_EWuD5A4ZRWH-6OS8wskEesTIQsqR2-6zDdL5zV2cdRmjGSBH5k2W4IVoTafCUzrL5X1W15cPj2k4a9xMOXjuQNqsmPgeT0w/s640/Proceso+de+recepci%25C3%25B3n+RyP_COM.jpg&quot; width=&quot;600&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid rgb(224, 248, 236); padding: 5px;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #595959;&quot;&gt;&lt;span style=&quot;color: #444444; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;int &lt;/span&gt;&lt;span style=&quot;color: #444444; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;mascara0 = &lt;/span&gt;&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #444444; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #595959;&quot;&gt;&lt;span style=&quot;color: #444444; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;int &lt;/span&gt;&lt;span style=&quot;color: #444444; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;mascara1 = &lt;/span&gt;&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;0x01&lt;/span&gt;&lt;span style=&quot;color: #444444; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #595959;&quot;&gt;&lt;span style=&quot;color: #444444; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;int &lt;/span&gt;&lt;span style=&quot;color: #444444; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;temporal = &lt;/span&gt;&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #444444; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #595959;&quot;&gt;&lt;span style=&quot;color: #444444; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #444444; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #595959;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp;&amp;nbsp;
/** Lectura de los 8 bits del byte enviado **/&lt;/span&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #595959;&quot;&gt;&lt;span style=&quot;color: #444444; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;for &lt;/span&gt;&lt;span style=&quot;color: #444444; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;(bit=&lt;/span&gt;&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;8&lt;/span&gt;&lt;span style=&quot;color: #444444; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;; bit&amp;gt;=&lt;/span&gt;&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #444444; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;; bit--){&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #595959;&quot;&gt;&lt;span style=&quot;color: #444444; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
delay_us (&lt;/span&gt;&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: #444444; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #595959;&quot;&gt;&lt;span style=&quot;color: #444444; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #444444; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt; (input_state (Ex_pin))
temporal|=mascara1;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Si bit
recibido es 1&lt;/span&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #595959;&quot;&gt;&lt;span style=&quot;color: #444444; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;else&lt;/span&gt;&lt;span style=&quot;color: #444444; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt; temporal|=mascara0;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Si bit recibido es
0&lt;/span&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #595959;&quot;&gt;&lt;span style=&quot;color: #444444; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
DatoE_RyP_COM=temporal;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Guarda recepción&lt;/span&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #595959;&quot;&gt;&lt;span style=&quot;color: #444444; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
temporal = temporal &amp;lt;&amp;lt; &lt;/span&gt;&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;1&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #444444; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #444444; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Preparación para recibir siguiente bit&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #595959;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; }&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Todas las funciones necesarias para realizar la comunicacion entre los dos PICs se ha incluido en una librería &amp;lt;RyP_COM.c&amp;gt; que es la que deberemos llamar en el código principal.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;



&lt;br /&gt;
&lt;div style=&quot;border: 5px solid rgb(224, 248, 236); padding: 5px;&quot;&gt;
&lt;span style=&quot;color: red; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;#include&lt;/span&gt;&lt;span style=&quot;color: #444444; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt; &amp;lt;RyP_COM.c&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Previamente deberemos definir si el PIC lo vamos a utilizar como Maestro...&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;



&lt;br /&gt;
&lt;div style=&quot;border: 5px solid rgb(224, 248, 236); padding: 5px;&quot;&gt;
&lt;span style=&quot;color: red; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;#define&lt;/span&gt;&lt;span style=&quot;color: #444444; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt; MASTER &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #444444; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;//PIC como Maestro&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;O como esclavo...&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;


&lt;br /&gt;
&lt;div style=&quot;border: 5px solid rgb(224, 248, 236); padding: 5px;&quot;&gt;
&lt;span style=&quot;color: red; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;#define&lt;/span&gt;&lt;span style=&quot;color: #444444; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;SLAVE &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #444444; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;//PIC como Esclavo&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;También deberemos definir, antes de cargar la librería, los pines del bus a emplear. Se pueden elegir los que se deseen pero, sino se especifica ninguno, la librería cargará los que tiene por defecto.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;





&lt;br /&gt;
&lt;div style=&quot;border: 5px solid rgb(224, 248, 236); padding: 5px;&quot;&gt;
&lt;span style=&quot;color: red; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;#define&lt;/span&gt;&lt;span style=&quot;color: #444444; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt; Mx_pin &amp;nbsp; &amp;nbsp; &amp;nbsp; PIN_B1&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: red; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;#define&lt;/span&gt;&lt;span style=&quot;color: #444444; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt; Ex_pin &amp;nbsp; &amp;nbsp; &amp;nbsp; PIN_B2&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: red; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;#define&lt;/span&gt;&lt;span style=&quot;color: #444444; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt; Inicio_pin &amp;nbsp; PIN_B3&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: red; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;#define&lt;/span&gt;&lt;span style=&quot;color: #444444; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt; Sincro_pin &amp;nbsp; PIN_B4&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;En el código del PIC maestro, para enviar un byte al esclavo, llamaremos a la función...&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;


&lt;br /&gt;
&lt;div style=&quot;border: 5px solid rgb(224, 248, 236); padding: 5px;&quot;&gt;
&lt;span style=&quot;color: #444444; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;Tx_RyP_COM (Dato_Maestro); &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;//Envío de un dato al esclavo&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Donde &quot;Dato_Maestro&quot; será la variable que contiene el byte a enviar.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Cuando lo que se quiere es leer un byte del esclavo, la función es...&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;


&lt;br /&gt;
&lt;div style=&quot;border: 5px solid rgb(224, 248, 236); padding: 5px;&quot;&gt;
&lt;span style=&quot;color: #444444; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;Rx_RyP_COM (Dato_Esclavo); &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;//Solicitud de dato al esclavo&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;El byte recibido se almacena en la variable &quot;Dato_Esclavo&quot;.&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Los nombres de las variables se pueden elegir a voluntad.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;En el esclavo, la función a invocar es...&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;



&lt;br /&gt;
&lt;div style=&quot;border: 5px solid rgb(224, 248, 236); padding: 5px;&quot;&gt;
&lt;span style=&quot;color: #444444; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;Test_RyP_COM (Dato_Esclavo, Dato_Maestro);&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Se encarga de testear las posibles solicitudes del PIC maestro. En la variable &quot;Dato_Maestro&quot; se almacena el byte recibido y se envía el byte contenido en &quot;Dato_Esclavo&quot;. También para esta función los nombres de las variables se pueden elegir a voluntad, siempre y cuando sean previamente declaradas.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;El código de ejemplo aquí mostrado es una muestra de su uso. El PIC Maestro lee el valor de su conversor A/D y lo envía al Esclavo. De la misma forma solicita el valor de la lectura del conversor A/D del Esclavo. Ambas lecturas se muestran en los displays de los respectivos PICs.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;En esta animación vemos su funcionamiento y las señales generadas.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;center&gt;
&lt;/center&gt;
&lt;center&gt;
&lt;iframe allowfullscreen=&quot;&quot; frameborder=&quot;0&quot; height=&quot;315&quot; src=&quot;https://www.youtube.com/embed/2orGtt5KZKg&quot; width=&quot;560&quot;&gt;&lt;/iframe&gt;&lt;/center&gt;
&lt;center&gt;
&lt;/center&gt;
&lt;center style=&quot;text-align: justify;&quot;&gt;
&lt;/center&gt;
&lt;center style=&quot;text-align: justify;&quot;&gt;
&lt;/center&gt;
&lt;center style=&quot;text-align: justify;&quot;&gt;
&lt;/center&gt;
&lt;a href=&quot;https://www.blogger.com/blogger.g?blogID=5250193391449144895#&quot; onclick=&quot;Effect.toggle(&amp;quot;expandir3&amp;quot;,&amp;quot;slide&amp;quot;); return false&quot;&gt;&lt;br /&gt;&lt;/a&gt;
&lt;a href=&quot;https://www.blogger.com/blogger.g?blogID=5250193391449144895#&quot; onclick=&quot;Effect.toggle(&amp;quot;expandir3&amp;quot;,&amp;quot;slide&amp;quot;); return false&quot;&gt;&lt;br /&gt;&lt;/a&gt;
&lt;a href=&quot;https://www.blogger.com/blogger.g?blogID=5250193391449144895#&quot; onclick=&quot;Effect.toggle(&amp;quot;expandir3&amp;quot;,&amp;quot;slide&amp;quot;); return false&quot;&gt;[+/-] Ver / Ocultar código PIC Maestro&lt;/a&gt;&lt;br /&gt;
&lt;div id=&quot;expandir3&quot; style=&quot;display: none;&quot;&gt;
&lt;center style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: justify;&quot;&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/*****************************************************************************/&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; */&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;COMUNICACIÓN ENTRE PICS POR BUS DE 4 LINEAS &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; CON PIC16F876A &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; */&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MAESTRO &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; */&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Robotypic (c) 2017 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; */&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/*****************************************************************************/&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* Consiste en un sistema de comunicación entre PICs utilizando 4 pines: &amp;nbsp; &amp;nbsp; */&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* Mx_pin &amp;nbsp; &amp;nbsp; &amp;nbsp;trasmite datos del Maestro al Esclavo &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; */&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* EX_pin &amp;nbsp; &amp;nbsp; &amp;nbsp;trasmite datos del Esclavo al Maestro &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; */&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* Inicio_pin &amp;nbsp;señal de inicio de la comunicación &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* Sincro_pin &amp;nbsp;señal de sincronización en la trasmisión de datos &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; */&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/*****************************************************************************/&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#include &amp;lt;16F876A.h&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Driver del PIC a emplear&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#fuses HS,NOWDT,NOPROTECT,NOLVP,NODEBUG &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#device adc=8&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#use delay(clock=20000000) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Uso de un cristal de cuarzo 20MHz&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define MASTER &amp;nbsp; &amp;nbsp;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//PIC como Maestro&amp;nbsp;&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* Configuración del control del LCD */&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define use_portc_lcd TRUE &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Puerto c para uso del lcd&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#include &amp;lt;LCDportc.c&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Librería lcd para puerto c&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#include &amp;lt;RyP_COM.c&amp;gt;&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/*************************** FUNCIÓN PRINCIPAL *******************************/&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;void main() {&amp;nbsp;&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;/* Variables locales **/&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;byte Dato_Esclavo; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Dato a recibir del Esclavo&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;byte Dato_Maestro; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Dato a enviar al esclavo&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;/** Inicialización LCD **/&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;lcd_init(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;/** Configuración de entradas y salidas **/&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;set_tris_c (0x00); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;//Configuración entradas y salidas puerto c&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;/** Configuración conversor AD **/&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;setup_adc_ports(AN0);&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;setup_adc(ADC_CLOCK_INTERNAL );&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;/** Mensaje en LCD **/&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;lcd_gotoxy(1,1);&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;printf(lcd_putc,&quot;Maestro&quot;);&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;while (true){&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; /** Lecura canal analógico 0 **/&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; set_adc_channel(0);&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; delay_us(20);&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Dato_Maestro = read_adc();&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; /** Comunicación con el Esclavo **/&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Tx_RyP_COM (Dato_Maestro); &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Envío de un dato al esclavo&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; delay_ms (100);&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Rx_RyP_COM (Dato_Esclavo); &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Solicitud de dato al esclavo&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; delay_ms (100);&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; /** Visualización en LCD de las lecturas **/&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; lcd_gotoxy(1,2);&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; printf(lcd_putc, &quot;M:%2x E:%2x&quot;,Dato_Maestro, Dato_Esclavo);&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: justify;&quot;&gt;
&lt;/center&gt;
&lt;/center&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;a href=&quot;https://www.blogger.com/blogger.g?blogID=5250193391449144895#&quot; onclick=&quot;Effect.toggle(&amp;quot;expandir2&amp;quot;,&amp;quot;slide&amp;quot;); return false&quot;&gt;[+/-] Ver / Ocultar código PIC Esclavo&lt;/a&gt;&lt;br /&gt;
&lt;div id=&quot;expandir2&quot; style=&quot;display: none;&quot;&gt;
&lt;div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/*****************************************************************************/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; */&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;COMUNICACIÓN ENTRE PICS POR BUS DE 4 LINEAS &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; CON PIC16F876A &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; */&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ESCLAVO &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; */&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; © Robotypic 2017 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; */&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/*****************************************************************************/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* Consiste en un sistema de comunicación entre PICs utilizando 4 pines: &amp;nbsp; &amp;nbsp; */&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* Mx_pin &amp;nbsp; &amp;nbsp; &amp;nbsp;trasmite datos del Maestro al Esclavo &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; */&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* EX_pin &amp;nbsp; &amp;nbsp; &amp;nbsp;trasmite datos del Esclavo al Maestro &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; */&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* Inicio_pin &amp;nbsp;señal de inicio de la comunicación &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* Sincro_pin &amp;nbsp;señal de sincronización en la trasmisión de datos &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; */&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/*****************************************************************************/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#include &amp;lt;16F876A.h&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Driver del PIC a emplear&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#fuses HS,NOWDT,PUT,NOPROTECT,NOLVP &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#device adc=8&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#use delay(clock=20000000) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Uso de un cristal de cuarzo 20MHz&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define SLAVE &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//PIC como esclavo&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define use_portc_lcd TRUE &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Puerto c para uso del lcd&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#include &amp;lt;LCDportc.c&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#include &amp;lt;RyP_COM.c&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Llamada a la librería de comunicación&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/*************************** FUNCIÓN PRINCIPAL *******************************/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;void main() {&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/** Variables locales **/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;byte Dato_Esclavo; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;//Variable para dato solicitado por el Maestro&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;byte Dato_Maestro; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Variable para dato recibido del Maestro&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;/** Inicialización LCD **/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;lcd_init(); &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Inicialización de LCD&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;/** Configuración de entradas y salidas **/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;set_tris_c(0x00);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/** Configuración conversor AD **/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;setup_adc_ports(AN0);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;setup_adc(ADC_CLOCK_INTERNAL );&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/** Mensaje en LCD **/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;lcd_gotoxy(1,1);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;printf(lcd_putc,&quot;Esclavo&quot;);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;while (true){&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/** Lecura canal analógico 0 **/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; set_adc_channel(0);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; delay_us(20);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Dato_Esclavo = read_adc();&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/** Visualización en LCD de las lecturas **/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; lcd_gotoxy(1,2);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; printf(lcd_putc,&quot;M:%2x E:%2x &quot;,Dato_Maestro,Dato_Esclavo );&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; delay_ms (10);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/** Comprobación si el Maestro solicita comunicación **/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Test_RyP_COM (Dato_Esclavo, Dato_Maestro);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;a href=&quot;https://www.blogger.com/blogger.g?blogID=5250193391449144895#&quot; onclick=&quot;Effect.toggle(&amp;quot;expandir1&amp;quot;,&amp;quot;slide&amp;quot;); return false&quot;&gt;[+/-] Ver / Ocultar código librería &lt;ryp_com .c=&quot;&quot;&gt;&lt;/ryp_com&gt;&lt;/a&gt;&lt;br /&gt;
&lt;div id=&quot;expandir1&quot; style=&quot;display: none;&quot;&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/*****************************************************************************/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; */&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;LIBRERÍA PARA COMUNICACIÓN ENTRE PICS POR BUS DE 4 LINEAS &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;RyP_COM.c&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; */&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; */&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; © Robotypic &amp;nbsp;2017 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; */&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; */&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/*****************************************************************************/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* Consiste en un sistema de comunicación entre PICs utilizando 4 pines: &amp;nbsp; &amp;nbsp; */&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* Mx_pin &amp;nbsp; &amp;nbsp; &amp;nbsp;trasmite datos del Maestro al Esclavo &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; */&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* EX_pin &amp;nbsp; &amp;nbsp; &amp;nbsp;trasmite datos del Esclavo al Maestro &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; */&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* Inicio_pin &amp;nbsp;señal de inicio de la comunicación &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* Sincro_pin &amp;nbsp;señal de sincronización en la trasmisión de datos &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; */&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; */&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* Condición:PIC Maestro y PIC Esclavo deben funcionar a la misma frecuencia */&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* de reloj. &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; */&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; */&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* Se deben definir los pines deseados en el código principal. Si no se &amp;nbsp; &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* definen, por defecto quedan: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* #define Mx_pin &amp;nbsp; &amp;nbsp; &amp;nbsp; PIN_B1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; */&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* #define Ex_pin &amp;nbsp; &amp;nbsp; &amp;nbsp; PIN_B2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; */&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* #define Inicio_pin &amp;nbsp; PIN_B3 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; */&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* #define Sincro_pin &amp;nbsp; PIN_B4 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; */&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; */&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* Se debe definir si se trata del Maestro o Esclavo: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* #define MASTER &amp;nbsp; &amp;nbsp;1 &amp;nbsp; &amp;nbsp; //Para el Maestro &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; */&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* #define SLAVE &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; //Para el Esclavo &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; */&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; */&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* Se debe cargar la librería: &amp;nbsp; &amp;lt;RyP_COM.c&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; */&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; */&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* Para enviar un dato al esclavo, el maestro debe invocar la función: &amp;nbsp; &amp;nbsp; &amp;nbsp; */&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* Tx_RyP_COM (Dato); &amp;nbsp; //Dato es la variable que contiene valor a enviar &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* Para solicitar un dato al esclavo, el maestro debe invocar la función: &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* Rx_RyP_COM (Dato); //Dato es la variable que contiene valor recibido &amp;nbsp; &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; */&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* Para que Esclavo atienda a las solicitudes del Maestro se debe invocar &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* periodicamente a &amp;nbsp;a función: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* Test_RyP_COM (Dato1,Dato2); //Dato1 es dato enviado,Dato2 es dato recibido*/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/*****************************************************************************/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/** Variables globales **/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;byte DatoM_RyP_COM;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/********************* CÓDIGO PARA MASTER &amp;nbsp;***********************************/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/*****************************************************************************/ &lt;/span&gt;&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#if (defined (MASTER)) &amp;amp;&amp;amp; (MASTER == 1)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/** Definición de pines del bus por defecto **/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;#ifndef Mx_pin&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; #define Mx_pin &amp;nbsp; &amp;nbsp; &amp;nbsp; PIN_B1&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;#endif&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;#ifndef Ex_pin&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; #define Ex_pin &amp;nbsp; &amp;nbsp; &amp;nbsp; PIN_B2&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;#endif&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;#ifndef Inicio_pin&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; #define Inicio_pin &amp;nbsp; PIN_B3&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;#endif&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;#ifndef Sincro_pin&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; #define Sincro_pin &amp;nbsp; PIN_B4&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;#endif&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/**************************** FUNCIÓN ENVIO DATO *****************************/ &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/*****************************************************************************/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Función para el envío de un byte al esclavo &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; */&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* Señal con Mx_pin. Bajo =&amp;gt; Envío a esclavo. Alto =&amp;gt; lectura del esclavo &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* Pulso con Inicio_pin para aviso de comunicación al esclavo &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* Espera de confirmación por Sincro_pin de aviso recibido por el esclavo &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* Envío del byte bit a bit &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/*****************************************************************************/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;void Tx_RyP_COM (int Dato){&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt; &amp;nbsp;/* Variables locales */&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;int mascara = 0x80;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;int bit;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;/** Indicación de envio (Bajo=&amp;gt;Envío,Alto=&amp;gt;Recepción) a esclavo **/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;output_low (Mx_pin);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;/** Señal de inicio **/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;output_low (Inicio_pin);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;output_high (Inicio_pin);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;/** Confirmación del esclavo **/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;while (!input_state(sincro_pin)){}; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Espera respuesta del esclavo&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;output_low (Inicio_pin); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;//Se deja Inicio_pin en bajo&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;/** Envío del byte de datos **/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;for (bit=8; bit&amp;gt;=1; bit--){ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Para los 8 bits&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; if ((dato &amp;amp; mascara)&amp;gt;0) output_high(Mx_pin); &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Si bit en curso es 1&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; else output_low (Mx_pin); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Si bit en curso es 0&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; mascara = mascara &amp;gt;&amp;gt; 1; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Preparación proximo bit&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; while(!input_state(Sincro_pin)){} &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Espera a que esclavo lea el bit&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;output_low (Mx_pin); &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Finalizado envío deja Mx_pin en bajo.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/************************** FUNCIÓN LECTURA DATO *****************************/ &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/*****************************************************************************/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Función para la lectura de un byte del esclavo &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* Señal con Mx_pin. Bajo =&amp;gt; Envío a esclavo. Alto =&amp;gt; lectura del esclavo &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* Pulso con Inicio_pin para aviso de comunicación al esclavo &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* Espera de confirmación por Sincro_pin de aviso recibido por el esclavo &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* Envío del byte bit a bit &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/*****************************************************************************/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;void Rx_RyP_COM (int &amp;amp;DatoE_RyP_COM){&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;/* Variables locales */&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;int mascara = 0x80;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;int mascara0 = 0;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;int mascara1 &amp;nbsp;= 0x01;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;int temporal = 0;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;int bit;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;/** Indicación de lectura (Bajo=&amp;gt;Envío,Alto=&amp;gt;Recepción) del esclavo **/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;output_high (Mx_pin);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;/** Señal de inicio **/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;output_low (Inicio_pin);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;output_high (Inicio_pin);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;/** Confirmación del esclavo **/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;while (!input_state(sincro_pin)){}; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Espera respuesta del esclavo&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;output_low (Inicio_pin); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Se deja Inicio_pin en bajo&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;/** Fin de indicación de lectura al esclavo **/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;output_low (Mx_pin); &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Puesta en bajo bus Mx_pin&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;/** Control del Sincro_pin por el Maestro **/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;output_low (Sincro_pin); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Asegura Sincro_pin a bajo&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;/** Lectura de los 8 bits del byte enviado por el Esclavo **/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;for (bit=8; bit&amp;gt;=1; bit--){&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; delay_us (5); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Da tiempo a Master que ejecuteinstrucciones para mandar bit&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; if (input_state (Ex_pin)) temporal|=mascara1; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Si bit recibido es 1&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; else temporal|=mascara0; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Si bit recibido es &lt;/span&gt;&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;0&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; DatoE_RyP_COM=temporal; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Guarda recepción&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; temporal = temporal &amp;lt;&amp;lt; 1; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Preparación para recibir siguiente bit&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; /** Maestro avisa a Esclavo de que ya ha leído el bit en curso**/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; output_high (Sincro_pin);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; output_low (Sincro_pin);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;/** Maestro manda confirmación de byte completo leído **/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;output_high (Mx_pin);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;delay_us(10);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;output_low (Mx_pin);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;output_low (Mx_pin); //Asegura el estado bajo de Mx_pin al finalizar trasmisión&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;/* Sincro_pin control &amp;nbsp;por esclavo **/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;output_float (Sincro_pin);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/********************* CÓDIGO PARA ESCLAVO &amp;nbsp;**********************************/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/*****************************************************************************/ &lt;/span&gt;&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#elif (defined (SLAVE)) &amp;amp;&amp;amp; (SLAVE == 1)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/** Definición de pines del bus por defecto **/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;#ifndef Mx_pin&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; #define Mx_pin &amp;nbsp; &amp;nbsp; &amp;nbsp; PIN_B1&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;#endif&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;#ifndef Ex_pin&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; #define Ex_pin &amp;nbsp; &amp;nbsp; &amp;nbsp; PIN_B2&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;#endif&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;#ifndef Inicio_pin&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; #define Inicio_pin &amp;nbsp; PIN_B3&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;#endif&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;#ifndef Sincro_pin&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; #define Sincro_pin &amp;nbsp; PIN_B4&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;#endif&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/***************** FUNCIÓN ATENCIÓN A LA COMUNICACIÓN ************************/ &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/*****************************************************************************/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* &amp;nbsp; &amp;nbsp; Función de atención a la comunicación solicitada por el Maestro &amp;nbsp; &amp;nbsp; &amp;nbsp; */&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* Señal Inicio_pin en alto =&amp;gt; Solicitud de comunicación por el Maestro &amp;nbsp; &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* Señal en Mx_pin. Bajo =&amp;gt; Maestro va a enviar. Alto =&amp;gt; Maestro va a leer &amp;nbsp; */&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* Espera de confirmación por Sincro_pin de aviso recibido por el esclavo &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* Envío del byte bit a bit &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/*****************************************************************************/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;void TxR_Dato (int DatoE_RyP_COM, int &amp;amp;DatoM_RyP_COM ){&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;int mascara = 0x80;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;int mascara0 = 0x00;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;int mascara1 = 0x01;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;int bit;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;int temporal;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;delay_us (5); &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Espera a que termine master de ejecutar las instrucciones&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;/** Si Master ha puesto Mx_pin a 0 =&amp;gt; Master va a enviar dato **/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;if (!input_state (Mx_pin)){&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; /** Señal para aviso a master de que ya se ha leido estado de Mx_pin **/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; output_high (Sincro_pin);&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; output_low (Sincro_pin);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; /** Lectura de los 8 bits del byte enviado por el Master **/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; for (bit=8; bit&amp;gt;=1; bit--){&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;delay_us (5); &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Da tiempo a Master que ejecute instrucciones para mandar bit&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (input_state (Mx_pin)) temporal|=mascara1; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;else temporal|=mascara0;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;DatoM_RyP_COM=temporal; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;temporal = temporal &amp;lt;&amp;lt; 1;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;/** Esclavo avisa a Master de que ya ha leído el bit **/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;output_high (Sincro_pin);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;output_low (Sincro_pin);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; /** Esclavo manda confirmación de byte completo leído **/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; output_high (Ex_pin);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; delay_us(10);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; output_low (Ex_pin);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;/** Si Master ha puesto Mx_pin a 1 =&amp;gt; Master va a leer dato **/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;else {&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; /** Señal para aviso a master de que ya se ha leido estado de Mx_pin **/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; output_high (Sincro_pin);&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; output_low (Sincro_pin);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; output_float (Sincro_pin); &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Sincro_pin control por el maestro&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; /** Envío del byte de datos **/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; for (bit=8; bit&amp;gt;=1; bit--){&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if ((DatoE_RyP_COM &amp;amp; mascara)&amp;gt;0) output_high(Ex_pin);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;else output_low (Ex_pin);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;mascara = mascara &amp;gt;&amp;gt; 1;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;while(!input_state(Sincro_pin)){} &amp;nbsp; //Espera a que esclavo lea el bit&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; output_low (Ex_pin); &amp;nbsp; &amp;nbsp; //Asegura el estado bajo de Ex_pin al finalizar&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/***************** FUNCIÓN AVISO A ESCLAVO DE COMUNICACIÓN *******************/ &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/*****************************************************************************/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* &amp;nbsp; &amp;nbsp; Función de aviso a esclavo de solicitud de comunicación del Master &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* Si Maestro pone Inicio_pin en alto, esclavo responde a la solicitud de &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* comunicación &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/*****************************************************************************/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; void Test_RyP_COM (int Dato_Esclavo,int &amp;amp;DatoM_RyP_COM){&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; if (input_state (Inicio_pin)){TxR_Dato(Dato_Esclavo, DatoM_RyP_COM);}&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; }&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/******************************************************************************/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #274e13; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#endif&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;center style=&quot;text-align: justify;&quot;&gt;
&lt;/center&gt;
&lt;center style=&quot;text-align: justify;&quot;&gt;
&lt;/center&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Los archivos del proyecto se pueden descargar en este enlace:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;a href=&quot;https://www.dropbox.com/s/82af9i3g4s058qp/Comunicaci%C3%B3n%20no%20estandar%202%20pic.rar?dl=0&quot; target=&quot;_blank&quot;&gt;Descargar archivos &quot;Comunicación no estandar entre 2 pic&quot;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: x-small;&quot;&gt;El proyecto contenido en el artículo ha sido diseñado y probado con éxito utilizando las siguientes versiones de software:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: x-small;&quot;&gt;- Windows 10 (64 bits)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: x-small;&quot;&gt;- Proteus V7.7 SP2&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: x-small;&quot;&gt;- CCS PIC C COMPILER v5.015&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://robotypic.blogspot.com/feeds/7914052579441500470/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5250193391449144895/7914052579441500470?isPopup=true' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5250193391449144895/posts/default/7914052579441500470'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5250193391449144895/posts/default/7914052579441500470'/><link rel='alternate' type='text/html' href='http://robotypic.blogspot.com/2017/06/comunicacion-no-estandar-entre-dos-pic.html' title='Comunicación no estándar entre dos PIC.'/><author><name>Robotypic</name><uri>http://www.blogger.com/profile/16455462312458405515</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhy9_FtSQBCJtZQx-9oqLfqIDTISr_y3Sw5z4cToMWV5gzO_CVIjm6Ys0Wp2fiBVuecXU3kfa8yJmigWyY3-2Z8vDVGaW26uFQCPP0FytRfZ9HtskOxXWyspp98MCgE3BHlFaOlCJrpl4U/s72-c/RyP_COM.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5250193391449144895.post-4351158065064728047</id><published>2015-07-13T21:35:00.000+02:00</published><updated>2017-06-04T01:48:39.766+02:00</updated><title type='text'>Servidor Web con PIC18F4550 y ENC28j60</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgPan64ZytPa1dL0PA96zBOo2YTcQFNxUjt7WYD6ctSIRa1eeL1khfAxpHA8qyhmgVF9UcK_jUp_BOZUr7rUu-0RYwHlhgn__2PuPQLeXjKewnXMVTVYYlcSOEWVJc18W-SnfZYeCFxs1I/s1600/ENC28j60_RyP.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;235&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgPan64ZytPa1dL0PA96zBOo2YTcQFNxUjt7WYD6ctSIRa1eeL1khfAxpHA8qyhmgVF9UcK_jUp_BOZUr7rUu-0RYwHlhgn__2PuPQLeXjKewnXMVTVYYlcSOEWVJc18W-SnfZYeCFxs1I/s320/ENC28j60_RyP.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;En este proyecto se va a tratar un
ejemplo básico de conexión de un PIC 18F4550 a una red ethernet por mediación del enc28j60. El control del PIC se realiza accediendo mediante una dirección IP que mostrará una página web, alojada en la propia memoria del PIC, y accesibl&lt;/span&gt;&lt;a href=&quot;https://www.blogger.com/null&quot; name=&quot;_GoBack&quot; style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;/a&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;e con el explorador de internet desde cualquier dispositivo conectado a dicha
red.&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;La web nos mostrará una página principal (\index). Desde ella podremos activar 3 salidas del PIC mediante sendos botones. También podremos enviar textos que veremos representados en un display lcd. Una página secundaria, accesible desde la principal, nos monitorizará las lecturas realizadas por el PIC (el canal analógico AN0 y el estado del bit 0 del puerto E).&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Se va a mostrar el ejemplo
simulándolo bajo proteus. Para ello, será necesario instalar&amp;nbsp;&lt;a href=&quot;https://www.winpcap.org/install/bin/WinPcap_4_1_3.exe&quot; target=&quot;_blank&quot;&gt;&lt;span style=&quot;color: windowtext;&quot;&gt;WinPcap&lt;/span&gt;&lt;/a&gt;.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigi2Q53UTB-wf3uB9E-FQysPIkBRqucLarDPnqKrmq5mnCPXuoVy_zHzUgZdZkUbThcrhphb-uEEdeMTmMr71SWp1BYJKxPBApu4k1aquahTgiQefHs6y9u1E-v1nnUJxHd-9imh4tAqc/s1600/18f4550%252Benc28j60_RyP.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;455&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigi2Q53UTB-wf3uB9E-FQysPIkBRqucLarDPnqKrmq5mnCPXuoVy_zHzUgZdZkUbThcrhphb-uEEdeMTmMr71SWp1BYJKxPBApu4k1aquahTgiQefHs6y9u1E-v1nnUJxHd-9imh4tAqc/s640/18f4550%252Benc28j60_RyP.jpg&quot; width=&quot;620&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;A la hora de crear el
programa del PIC lo primero es especificar los criterios de configuración
elegidos que se van a tener en cuenta a la hora de cargar el stack tcpip y que
van a determinar que opciones van a ser utilizadas.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;#define&lt;/span&gt;&lt;span class=&quot;apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;STACK_USE_ICMP&lt;span class=&quot;apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&amp;nbsp;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #38761d;&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;apple-converted-space&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Módulo de
respuesta ICMP (ping)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;#define&lt;/span&gt;&lt;span class=&quot;apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;STACK_USE_ARP &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #38761d;&quot;&gt;1&lt;span class=&quot;apple-converted-space&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Para
solucionar direccionamiento MAC de las IP&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;#define&lt;span class=&quot;apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;STACK_USE_TCP
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #38761d;&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;apple-converted-space&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Para enviar paquetes TCP&lt;/span&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;#define&lt;/span&gt;&lt;span class=&quot;apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;STACK_USE_HTTP &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #38761d;&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;apple-converted-space&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Uso de las funciones http del stack.&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: red;&quot;&gt;#define&lt;span class=&quot;apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;STACK_USE_CCS_PICENS &lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #38761d;&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;apple-converted-space&quot;&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #999999;&quot;&gt;//CCS PICENS 18F4620 +
ENC28J60&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;#define&lt;/span&gt;&lt;span class=&quot;apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;STACK_USE_MCPENC &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #38761d;&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;apple-converted-space&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Uso del enc28j60 por el stack (stacktsk.c)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;#define&lt;/span&gt;&lt;span class=&quot;apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;STACK_USE_MAC &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #38761d;&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;apple-converted-space&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Uso de la tarjeta de red&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 13.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;También hay que
incluir el número de puerto, necesario cuando accedamos a través de internet.&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;span style=&quot;color: red;&quot;&gt;#define&lt;/span&gt;
&lt;span class=&quot;apple-converted-space&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;
HTTP_SOCKET&lt;span class=&quot;apple-converted-space&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;80&lt;/span&gt;&lt;span class=&quot;apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;//Nº de puerto
asociado al socket.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;El PIC se comunica con el enc28j60 mediante el bus SPI. Para definir los pines del PIC que van a ser utilizados para este propósito existen 3 posibilidades:&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Opción 1.&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;No definir nada, en cuyo caso se
implementará una comunicación SPI por software y se tomará la definición de
patillas establecida dentro del archivo &lt;i&gt;enc28j60.c&lt;/i&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 13.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt; text-align: left;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: red;&quot;&gt;#define&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;
PIN_ENC_MAC_SO&amp;nbsp; PIN_D7&amp;nbsp;&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt; text-align: left;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;#define&lt;/span&gt; PIN_ENC_MAC_SI&amp;nbsp; PIN_D6&amp;nbsp;&amp;nbsp;
&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt; text-align: left;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: red;&quot;&gt;#define&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt; PIN_ENC_MAC_CLK
PIN_D5&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt; text-align: left;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: red;&quot;&gt;#define&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;
PIN_ENC_MAC_CS&amp;nbsp; PIN_D4&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt; text-align: left;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: red;&quot;&gt;#define&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt; PIN_ENC_MAC_RST
PIN_D3&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt; text-align: left;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: red;&quot;&gt;#define&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt; PIN_ENC_MAC_INT
PIN_D2&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: red;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;#define&lt;/span&gt;&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt; PIN_ENC_MAC_WOL
PIN_D1&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Opción 2.&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; text-align: justify;&quot;&gt;Definir todas las patillas para la
comunicación SPI, con lo que se implementará una comunicación SPI por
software con la definición de patillas elegida.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; text-align: justify;&quot;&gt;La definición existente dentro del archivo &lt;i&gt;enc28j60.c&lt;/i&gt; será en este caso ignorada. Por ejemplo...&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;#define&lt;/span&gt; PIN_ENC_MAC_SO&amp;nbsp; PIN_C4 &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;#define&lt;/span&gt; PIN_ENC_MAC_SI&amp;nbsp; PIN_C5&amp;nbsp;&amp;nbsp;
&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: red;&quot;&gt;#define&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt; PIN_ENC_MAC_CLK PIN_B4&amp;nbsp;&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: red;&quot;&gt;#define&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt; PIN_ENC_MAC_CS&amp;nbsp;
PIN_B5&amp;nbsp;&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: red;&quot;&gt;#define&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt; PIN_ENC_MAC_RST PIN_B6&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: red;&quot;&gt;#define&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt; PIN_ENC_MAC_INT PIN_B7&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;font-family: &amp;quot;courier new&amp;quot;; font-size: 13.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;b&gt;Opción 3.&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Habilitar
el uso de SPI por hardware del PIC y definir las patillas ajenas al hardware
del módulo SPI (CS, INT y RST). En este caso es imprescindible definir también
la patilla SO para que el stack (dentro del archivo &lt;i&gt;enc28j60.c&lt;/i&gt;) no habilite el SPI por
software. Da igual que patilla SO se defina, la que se deberá cablear será &lt;st1:personname productid=&quot;la SO&quot; w:st=&quot;on&quot;&gt;la SO&lt;/st1:personname&gt; real, así como SI y CLK.&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;#define&lt;/span&gt; ENC_MAC_USE_SPI 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #7f7f7f;&quot;&gt;//Uso del SPI por hardware&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;#define&lt;/span&gt; PIN_ENC_MAC_SO&amp;nbsp; PIN_B0&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #7f7f7f;&quot;&gt;//Entrada serie de datos&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;color: #7f7f7f;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;//#define PIN_ENC_MAC_SI&amp;nbsp; PIN_C7 &amp;nbsp; //Salida serie de datos(no necesario definir)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;color: #7f7f7f;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;//#define PIN_ENC_MAC_CLK PIN_B1&amp;nbsp;&amp;nbsp; //Señal de reloj&amp;nbsp; (no necesario definir)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: red;&quot;&gt;#define&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt; PIN_ENC_MAC_CS&amp;nbsp;
PIN_B2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #7f7f7f;&quot;&gt;//Chip select&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: red;&quot;&gt;#define&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt; PIN_ENC_MAC_RST PIN_B3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #7f7f7f;&quot;&gt;//Reset&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: red; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;#define&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt; PIN_ENC_MAC_INT PIN_B4&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f7f7f; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;//Interrupción&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Una observación. Aunque estamos definiendo también las patillas RST e INT, en este ejemplo, no van a ser cableadas.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Con todas las
opciones definidas se puede cargar el stack tcpip.&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 13.5pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: red;&quot;&gt;#include&lt;/span&gt;&lt;span class=&quot;apple-converted-space&quot;&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #999999;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: purple;&quot;&gt;&quot;tcpip/stacktsk.c&quot;&lt;/span&gt;&lt;span class=&quot;apple-converted-space&quot;&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #999999;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #999999;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;//Carga el stack TCP/IP de
Microchip&lt;/span&gt;&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;font-family: &amp;quot;courier new&amp;quot;; font-size: 13.5pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;font-size: 13.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;La dirección MAC identificará el dispositivo
hardware dentro de la red. No puede haber, por tanto, dos dispositivos con la
misma dirección MAC conectados a una misma red.&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;


&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;span lang=&quot;EN-GB&quot;&gt;MY_MAC_BYTE1=&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #38761d;&quot;&gt;0&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;;&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&amp;nbsp;
&amp;nbsp;MY_MAC_BYTE2=&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #38761d;&quot;&gt;2&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;;&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&amp;nbsp;
&amp;nbsp;MY_MAC_BYTE3=&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #38761d;&quot;&gt;3&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;;&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&amp;nbsp;
&amp;nbsp;MY_MAC_BYTE4=&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #38761d;&quot;&gt;4&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;;&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&amp;nbsp;
&amp;nbsp;MY_MAC_BYTE5=&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #38761d;&quot;&gt;5&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;;&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;MY_MAC_BYTE6=&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;6&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Esta asignación se ha definido dentro de la función &lt;i&gt;MACAddrInit()&lt;/i&gt; a la que accederemos desde la función
principal &lt;i&gt;main(),&lt;/i&gt; antes de ejecutar las tareas del stack tcpip.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Lo mismo para la función&amp;nbsp;&lt;i style=&quot;font-family: Verdana, sans-serif; text-align: start;&quot;&gt;IPAddrInit(). Dentro de la cual se ha especificado cual va a ser la dirección IP de nuestro servidor web, la dirección IP de la puerta de enlace y la máscara de subred.&amp;nbsp;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;&lt;span class=&quot;apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp;//Elección
de la dirección IP.&lt;/span&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;span lang=&quot;EN-GB&quot;&gt;MY_IP_BYTE1=&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #38761d;&quot;&gt;192&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;;&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&amp;nbsp;
&amp;nbsp;MY_IP_BYTE2=&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #38761d;&quot;&gt;168&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;;&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&amp;nbsp;
&amp;nbsp;MY_IP_BYTE3=&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #38761d;&quot;&gt;1&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;;&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&amp;nbsp;
&amp;nbsp;MY_IP_BYTE4=&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #387613;&quot;&gt;15&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;;&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;//Elección de la dirección de puerta de enlace.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;span lang=&quot;EN-GB&quot;&gt;MY_GATE_BYTE1=&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #38761d;&quot;&gt;192&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;;&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&amp;nbsp;
&amp;nbsp;MY_GATE_BYTE2=&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #38761d;&quot;&gt;168&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;;&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&amp;nbsp;
&amp;nbsp;MY_GATE_BYTE3=&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #38761d;&quot;&gt;1&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;;&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&amp;nbsp;
&amp;nbsp;MY_GATE_BYTE4=&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #38761d;&quot;&gt;1&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;;&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;//Elección de la máscara de subred.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;span lang=&quot;EN-GB&quot;&gt;MY_MASK_BYTE1=&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #38761d;&quot;&gt;255&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;;&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&amp;nbsp;
&amp;nbsp;MY_MASK_BYTE2=&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #38761d;&quot;&gt;255&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;;&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&amp;nbsp;
&amp;nbsp;MY_MASK_BYTE3=&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #38761d;&quot;&gt;255&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;;&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&amp;nbsp;
&amp;nbsp;MY_MASK_BYTE4=&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #38761d;&quot;&gt;0&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;font-size: 13.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Antes ejecutar las tareas del stack tcpip hay que inicializarlo:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;StackInit(); &amp;nbsp;&lt;span class=&quot;apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Inicializa
el stack&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 13.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 13.5pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Y posteriormente mantenerlo funcionando mediante un bucle
infinito:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;while&lt;/span&gt;(TRUE) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;StackTask();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;span style=&quot;font-size: 13.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Con el stack funcionando, cuando
apliquemos la ip del servidor web en la barra de direcciones del explorador de internet de otro
dispositivo conectado a la misma red, deberá aparecer la página que se encuentra contenida dentro del código del pic. De ello se encarga la función:&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 13.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;int32&lt;/span&gt;&lt;span class=&quot;apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;http_get_page(&lt;span style=&quot;color: blue;&quot;&gt;char&lt;span class=&quot;apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;*file_str){}&lt;/span&gt;&lt;span style=&quot;font-size: 13.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Definida por el stack, localiza la
posición de memoria dentro del PIC donde se encuentra el código correspondiente
a la página solicitada. Previamente habremos diseñado la página web con código
html y lo habremos introducido dentro del código del PIC como una constante. Tanto la página principal:&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: blue;&quot;&gt;const char&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;HTML_INDEX_PAGE[]=&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: purple; font-family: &amp;quot;Courier New&amp;quot; mso-ansi-language: EN-GB;&quot;&gt;&quot; &amp;nbsp;&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Como la página secundaria:&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;span style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;/span&gt;
&lt;br /&gt;
&lt;div style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;
&lt;span style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;const char&lt;/span&gt;&lt;span class=&quot;apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;HTML_LECTURAS_PAGE[]=&lt;span style=&quot;color: purple;&quot;&gt;&quot;
&amp;nbsp;&quot;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;
Con la página cargada, la aplicación web ya puede interactuar con la aplicación
del PIC. Aunque en realidad, recordemos que ambas conviven como parte del código en el propio PIC.&amp;nbsp;Para
ello se emplean otras dos funciones igualmente definidas por el stack.&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;La función:&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;void&lt;span class=&quot;apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;http_exec_cgi(&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;int32&lt;span class=&quot;apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;file,&lt;/span&gt;&lt;span class=&quot;apple-converted-space&quot; style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;char&lt;span class=&quot;apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;*key,&lt;/span&gt;&lt;span class=&quot;apple-converted-space&quot; style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;char&lt;span class=&quot;apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;*val) {}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;;&quot;&gt;Recibe los cambios producidos en la aplicación web y los refleja en el
código del PIC. Dentro de ella, programaremos &amp;nbsp;las actuaciones que deben ejecutarse &amp;nbsp;en función de los cambios producidos en la página web. En nuestro caso, activar 3 salidas o recibir un texto para mostrar sobre el lcd.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;;&quot;&gt;Por ejemplo, la parte del código html que crea uno de los botones es:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: purple; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;lt;FORM METHOD=GET&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: purple; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;lt;input type=\&quot;submit\&quot; name=\&quot;boton1\&quot; value=\&quot;Botón 1\&quot;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: purple; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; text-align: left;&quot;&gt;&amp;lt;/FORM&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;;&quot;&gt;Cuando en la aplicación web se pulsa dicho botón, se envía la información &quot;&lt;i&gt;boton1&lt;/i&gt;&quot; por mediación de la variable &lt;i&gt;key&lt;/i&gt;. En el código del PIC se detecta el cambio cuando dentro de la función se compara dicha información con ciertas variables preestablecidas. Si la información es coincidente con alguna de ellas, se ejecutará la actuación correspondiente.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;static char&lt;/span&gt; boton1_key[]=&lt;span style=&quot;color: purple;&quot;&gt;&quot;boton1&quot;&lt;/span&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;static char&lt;/span&gt; boton2_key[]=&lt;span style=&quot;color: purple;&quot;&gt;&quot;boton2&quot;&lt;/span&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; text-align: left;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; text-align: left;&quot;&gt;static char &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; text-align: left;&quot;&gt;boton3_key[]=&lt;/span&gt;&lt;span style=&quot;color: purple; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; text-align: left;&quot;&gt;&quot;boton3&quot;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; text-align: left;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt; (stricmp(key,boton1_key)==&lt;span style=&quot;color: #38761d;&quot;&gt;0&lt;/span&gt;) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; output_toggle(PIN_C0);&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; text-align: left;&quot;&gt;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;;&quot;&gt;
La otra función:&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;int8&lt;span class=&quot;apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;http_format_char(&lt;span style=&quot;background: white; color: blue;&quot;&gt;int32&lt;span class=&quot;apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;file,&lt;span class=&quot;apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;char&lt;span class=&quot;apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;id,&lt;span class=&quot;apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;char&lt;span class=&quot;apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;*str,&lt;span class=&quot;apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;int8&lt;span class=&quot;apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;max_ret) {}&lt;/span&gt;&lt;span style=&quot;font-size: 13.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Informa a la
aplicación web del estado de las variables medidas por el PIC. Dicha función ofrece los valores que han de representarse en la página web cuando ésta se carga. Por ejemplo, la parte del código referente a la representación del valor de la lectura del canal analógico:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: purple; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;lt;P&amp;gt;&amp;lt;B&amp;gt;AN: &amp;lt;/B&amp;gt;%0 &amp;lt;/P&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Mostrará, por mediación de la función anterior, el valor de la variable virtual &lt;i&gt;%0&lt;/i&gt; que corresponderá con la lectura física del canal analógico del PIC.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;case &lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;&#39;0&#39;&lt;/span&gt;:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;set_adc_channel(&lt;span style=&quot;color: #38761d;&quot;&gt;0&lt;/span&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;delay_us(&lt;span style=&quot;color: #38761d;&quot;&gt;100&lt;/span&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;AD0=read_adc();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;sprintf(new_str,&lt;span style=&quot;color: purple;&quot;&gt;&quot;0x%X&quot;&lt;/span&gt;,AD0);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;len=strlen(new_str);&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;break&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=5250193391449144895#&quot; onclick=&quot;Effect.toggle(&amp;quot;expandir1&amp;quot;,&amp;quot;slide&amp;quot;); return false&quot;&gt;[+/-] Ver / Ocultar código C PIC (Código principal)&lt;/a&gt;&lt;br /&gt;
&lt;div id=&quot;expandir1&quot; style=&quot;display: none;&quot;&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;////////////////////////////////////////////////////////////////////////////////&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;SERVIDOR WEB CON PIC 18F4550 Y ENC28J60 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ccs PIC C compiler v4.104 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (c) RobotyPic 2015 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;////////////////////////////////////////////////////////////////////////////////&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;// Conmuta encendido-apagado de 3 leds controlados desde la aplicación web &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;// Muestra variables leídas por el PIC: Canal analógico An0 y estado bit RE0 &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;// Representa en lcd el texto introducido desde la aplicación web &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;////////////////////////////////////////////////////////////////////////////////&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#include &amp;lt;18F4550.h&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#device ADC=8&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#use delay(clock=20000000)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#fuses HS,NOWDT,NOPROTECT,NOLVP,NODEBUG,USBDIV,VREGEN,NOPBADEN,WRTB&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#byte porte = 0xF84&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/** Configuración para el uso del stack tcip **/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define STACK_USE_ICMP &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1 &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Módulo de respuesta ICMP (ping)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define STACK_USE_ARP &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Para solucionar direccionamiento MAC de las IP&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define STACK_USE_TCP &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Para enviar paquetes TCP&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define STACK_USE_HTTP &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1 &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Uso de las funciones http del stack.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define STACK_USE_CCS_PICENS &amp;nbsp;1 &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//CCS PICENS (Embedded Ethernet) 18F4620 + ENC28J60&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define STACK_USE_MCPENC &amp;nbsp; &amp;nbsp; &amp;nbsp;1 &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Uso del enc28j60 por el stack (stacktsk.c)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define STACK_USE_MAC &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Uso de la tarjeta de red&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define HTTP_SOCKET 80 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Nº de puerto asociado al socket.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/********** Definición del patillaje de conexión al enc28j60 ******************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* Existen varias posibilidades:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;Opción 1. No definir nada, en cuyo caso se implementará una comunicación SPI por&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;software y se tomarán la definición de patillas establecida en enc28j60.c&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;SO &amp;nbsp;PIN_D7 ---- ENC &amp;gt;&amp;gt;&amp;gt;&amp;gt; PIC&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;SI &amp;nbsp;PIN_D6 ---- PIC &amp;gt;&amp;gt;&amp;gt;&amp;gt; ENC&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;CLK PIN_D5&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;CS &amp;nbsp;PIN_D4&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;RST PIN_D3&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;INT PIN_D2&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;WOL PIN_D1&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;Opción 2. Definir todas las patillas de la comunicación SPI, en cuyo caso se&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;implementará una comunicación SPI por software con la definición de patillas&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;elegida. Por ejemplo...&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define PIN_ENC_MAC_SO &amp;nbsp;PIN_C4 &amp;nbsp; //Entrada serie de datos&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define PIN_ENC_MAC_SI &amp;nbsp;PIN_C5 &amp;nbsp; //Salida serie de datos&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define PIN_ENC_MAC_CLK PIN_B4 &amp;nbsp; //Señal de reloj&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define PIN_ENC_MAC_CS &amp;nbsp;PIN_B5 &amp;nbsp; //Chip select&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define PIN_ENC_MAC_RST PIN_B6 &amp;nbsp; //Reset&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define PIN_ENC_MAC_INT PIN_B7 &amp;nbsp; //Interrupción&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;Opción 3. El que aquí se ha utilizado, que consiste en habilitar el uso de SPI&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;por hardware del PIC y definir las patillas ajenas al hardware del módulo SPI&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;(CS, INT y RST). En este caso es imprescindible definir también la patilla SO&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;para que el stack (dentro de enc28j60.c) no habilite SPI por software. Da igual&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;que patilla SO se defina, la que se deberá cablear será la SO real del PIC &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define ENC_MAC_USE_SPI 1&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //Uso del SPI por hardware&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define PIN_ENC_MAC_SO &amp;nbsp;PIN_B0&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Entrada serie de datos&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//#define PIN_ENC_MAC_SI &amp;nbsp;PIN_C7 &amp;nbsp; &amp;nbsp;//Salida serie de datos (no necesario definir)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//#define PIN_ENC_MAC_CLK PIN_B1 &amp;nbsp; &amp;nbsp;//Señal de reloj &amp;nbsp;(no necesario definir)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define PIN_ENC_MAC_CS &amp;nbsp;PIN_B2&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Chip select&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define PIN_ENC_MAC_RST PIN_B3&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Reset&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define PIN_ENC_MAC_INT PIN_B4&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Interrupción&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/******************************************************************************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define use_portd_lcd TRUE &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Uso del puerto d para control del lcd&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#include &amp;lt;LCD420PIC18F_RyP.c&amp;gt; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Carga librería del lcd de 4x20 para familia 18F&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#include &quot;tcpip/stacktsk.c&quot; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Carga el stack TCP/IP de Microchip&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/********************* &amp;nbsp;PAGINA WEB A MOSTRAR **********************************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* Página principal INDEX (/) */&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;const char &amp;nbsp;HTML_INDEX_PAGE[]=&quot;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;lt;HTML&amp;gt;&amp;lt;BODY BGCOLOR=#FFFFFF TEXT=#000000&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;lt;IMG SRC=\&quot;http://www.robotypic.com/ryp.png\&quot;&amp;gt;&amp;lt;P&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;lt;center&amp;gt;&amp;lt;H1&amp;gt;Servidor WEB con PIC 18f4550 &amp;lt;/H1&amp;gt;&amp;lt;/center&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;lt;BR&amp;gt;&amp;lt;center&amp;gt;&amp;lt;H2&amp;gt;ROBOTYPIC&amp;lt;/H2&amp;gt;&amp;lt;/CENTER&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;lt;FORM METHOD=GET&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;lt;P&amp;gt;LCD: &amp;lt;INPUT TYPE=\&quot;text\&quot; NAME=\&quot;lcd\&quot; size=20 maxlength=16&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;lt;input type=\&quot;submit\&quot; value=\&quot;Enviar texto\&quot;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;lt;/FORM&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;lt;FORM METHOD=GET&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;lt;input type=\&quot;submit\&quot; name=\&quot;boton1\&quot; value=\&quot;Botón 1\&quot;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;lt;/FORM&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;lt;FORM METHOD=GET&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;lt;input type=\&quot;submit\&quot; name=\&quot;boton2\&quot; value=\&quot;Botón 2\&quot;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;lt;/FORM&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;lt;FORM METHOD=GET&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;lt;input type=\&quot;submit\&quot; name=\&quot;boton3\&quot; value=\&quot;Botón 3\&quot;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;lt;/FORM&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;lt;P&amp;gt;&amp;lt;A HREF=\&quot;/lecturas\&quot;&amp;gt;Lecturas del PIC&amp;lt;/A&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;lt;/BODY&amp;gt;&amp;lt;/HTML&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&quot;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* Página secundaria (\lecturas). Accesible desde la página principal */&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;const char &amp;nbsp;HTML_LECTURAS_PAGE[]=&quot;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;lt;meta http-equiv=\&quot;refresh\&quot;content=\&quot;3;url=lecturas\&quot;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;lt;HTML&amp;gt;&amp;lt;BODY BGCOLOR=#FFFFFF TEXT=#000000&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;lt;IMG SRC=\&quot;http://www.robotypic.com/ryp.png\&quot;&amp;gt;&amp;lt;P&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;lt;center&amp;gt;&amp;lt;H1&amp;gt;Servidor WEB con PIC 18f4550 &amp;lt;/H1&amp;gt;&amp;lt;/center&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;lt;BR&amp;gt;&amp;lt;center&amp;gt;&amp;lt;H2&amp;gt;ROBOTYPIC&amp;lt;/H2&amp;gt;&amp;lt;/CENTER&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;lt;br&amp;gt;&amp;lt;center&amp;gt;LECTURAS&amp;lt;/center&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;lt;P&amp;gt;&amp;lt;B&amp;gt;AN: &amp;lt;/B&amp;gt;%0 &amp;lt;/P&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;lt;BR/&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;lt;P&amp;gt;&amp;lt;B&amp;gt;RE0: &amp;lt;/B&amp;gt;%1 &amp;lt;/P&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;lt;BR/&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;lt;P&amp;gt;&amp;lt;A HREF=\&quot;/\&quot;&amp;gt;LCD/LEDs&amp;lt;/A&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;lt;/BODY&amp;gt;&amp;lt;/HTML&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&quot;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* Elección de MAC. No puede haber 2 dispositivos con misma MAC en una misma red&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;Microchip Vendor ID &amp;nbsp;MAC: 00.04.A3.xx.xx.xx. &amp;nbsp;*/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;void MACAddrInit(void) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;MY_MAC_BYTE1=0;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;MY_MAC_BYTE2=0x04;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;MY_MAC_BYTE3=0xA3;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;MY_MAC_BYTE4=0x06;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;MY_MAC_BYTE5=0x07;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;MY_MAC_BYTE6=0x08;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;void IPAddrInit(void) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Elección de la dirección IP.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;MY_IP_BYTE1=192;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;MY_IP_BYTE2=168;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;MY_IP_BYTE3=1;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;MY_IP_BYTE4=15;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Elección de la dirección de puerta de enlace.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;MY_GATE_BYTE1=192;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;MY_GATE_BYTE2=168;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;MY_GATE_BYTE3=1;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;MY_GATE_BYTE4=1;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Elección de la máscara de red.Si no se indica nada se tomará 255.255.255.0&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;MY_MASK_BYTE1=255;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;MY_MASK_BYTE2=255;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;MY_MASK_BYTE3=255;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;MY_MASK_BYTE4=0;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/*************************** &amp;nbsp;FUNCIÓN GET PAGE &amp;nbsp; ******************************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* Esta función devuelve la posición de memoria donde se encuentra la página web&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;a mostrar. En este caso se trata de una web con 2 páginas. Una principal index(/)&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;y una secundaria(/lecturas) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; */&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;int32 http_get_page(char *file_str) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;int32 file_loc=0;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;static char index[]=&quot;/&quot;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;static char lecturas[]=&quot;/lecturas&quot;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;printf(lcd_putc,&quot;\fRequest %s &quot;,file_str); &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Muestra en lcd solicitud&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;/* Busca la posición de memoria donde se encuentra la página solicitada */&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;if (stricmp(file_str,index)==0) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Si es la principal...&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; file_loc=label_address(HTML_INDEX_PAGE); &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//...toma su posición en la memoria&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;else if (stricmp(file_str,lecturas)==0) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//O si es la secundaria...&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; file_loc=label_address(HTML_LECTURAS_PAGE); &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//...toma su posición en la memoria&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* Muestra en lcd la página solicitada */&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;if (file_loc){ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Si existe...&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; printf(lcd_putc,&quot;\n(FILE=%LU)&quot;,file_loc); &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//...muestra en lcd pos. de memoria&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;else{ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Si no existe...&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; printf(lcd_putc,&quot;\n(File Not Found)&quot;); &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//...muestra en lcd mensaje&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* Devuelve la posición en la memoria donde se encuentra la página a mostrar */&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;return(file_loc); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/************************** &amp;nbsp;FUNCIÓN FORMAT CHAR &amp;nbsp;*****************************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* Con &amp;nbsp;la función http_format_char &amp;nbsp;interconectamos las variables virtuales de&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;la página web con las variables del programa del PIC. Se encarga de enviar los&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;cambios producidos en la aplicación del PIC y reflejarlos en la aplicación web.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;Muestra,por tanto, las lectura obtenidas por el PIC y las representa en la&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;aplicación de la página web &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;%0 es la variable virtual para representar el valor de la lectura del canal&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;analógico&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;%1 es la variable virtual para representar el valor de la lectura del bit 0 del&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;puerto E.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;*/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;int8 http_format_char(int32 file, char id, char *str, int8 max_ret) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;char new_str[20];&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;int8 len=0;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;int8 AD0;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;int8 RE0;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;*str=0;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;switch(id) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; case &#39;0&#39;:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;set_adc_channel(0);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;delay_us(100);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AD0=read_adc();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;sprintf(new_str,&quot;0x%X&quot;,AD0);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;len=strlen(new_str);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; break;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; case &#39;1&#39;:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;RE0=bit_test(porte,0);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;sprintf(new_str,&quot;%d&quot;,RE0);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;len=strlen(new_str);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; break; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; default:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; len=0;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;if (len)strncpy(str, new_str, max_ret);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;else &amp;nbsp;*str=0;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;return(len);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/*************************** &amp;nbsp;FUNCIÓN EXEC CGI &amp;nbsp; ******************************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/* Con la función http_exec_cgi interconectamos las variables virtuales de la&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;página web con las variables del programa del PIC. Se encarga de recibir&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;los cambios producidos en la aplicación web y reflejarlos en el hardware del PIC.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;Ejecuta, por tanto, la acción elegida según el valor de la variable virtual recibida&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;de la página web&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;key es la variable virtual que viene de la pagina web&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;val es el valor de una variable virtual de la página web&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;file es la dirección de la página web devuelta por http_get_page ()&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;*/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;void http_exec_cgi(int32 file, char *key, char *val) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;static char boton1_key[]=&quot;boton1&quot;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;static char boton2_key[]=&quot;boton2&quot;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;static char boton3_key[]=&quot;boton3&quot;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;static char lcd_key[]=&quot;lcd&quot;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;printf(lcd_putc,&quot;\fCGI FILE=%LD&quot;, file);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;printf(lcd_putc,&quot;\nKEY=%S&quot;, key);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;printf(lcd_putc,&quot;\nVAL=%S&quot;, val);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;/* Se ejecutará al pulsar el botón &quot;Botón 1&quot; en la aplicación web */&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;if (stricmp(key,boton1_key)==0) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; output_toggle(PIN_C0);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;/* Se ejecutará al pulsar el botón &quot;Botón 2&quot; en la aplicación web */&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;if (stricmp(key,boton2_key)==0) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; output_toggle(PIN_C1);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;/* Se ejecutará al pulsar el botón &quot;Botón 3&quot; en la aplicación web */&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;if (stricmp(key,boton3_key)==0) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; output_toggle(PIN_C2);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;/* Se ejecutará al pulsar el botón &quot;Enviar texto&quot; en la aplicación web */&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;if (stricmp(key,lcd_key)==0) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; printf(lcd_putc,&quot;\f%s&quot;,val); &amp;nbsp;//Muestra en el lcd el texto recibido&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/************************** FUNCIÓN PRINCIPAL *********************************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;void main(void) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;/* Habilitación y configuración del canal analógico 0 */&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;setup_adc(ADC_CLOCK_INTERNAL);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;setup_adc_ports(AN0);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;set_adc_channel(0);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;delay_ms(1);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;/*Reset de las salidas */&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;output_low(PIN_C0);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;output_low(PIN_C1);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;output_low(PIN_C2);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;/* Inicialización del lcd */&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;lcd_init();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;printf(lcd_putc,&quot;\fROBOTYPIC WEB SERVER&quot;); &amp;nbsp; //Mensaje de inicio en lcd&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;delay_ms(1000);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;/* Inicialización del Stack */&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;MACAddrInit(); //Se asigna la dirección MAC elegida&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;IPAddrInit(); &amp;nbsp;//Se asigna IP, mascara de red y puerta de enlace elegidos&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;StackInit(); &amp;nbsp; //Inicializa el stack&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;/* Muestra la IP elegida en lcd */&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;printf(lcd_putc,&quot;\n\n IP: %u.%u.%u.%u&quot;, MY_IP_BYTE1, MY_IP_BYTE2, MY_IP_BYTE3, MY_IP_BYTE4);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;printf(lcd_putc,&quot;\n %u&quot;, HTTP_SOCKET);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;delay_ms(10);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;while(TRUE) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; StackTask();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Para hacerlo funcionar, conectamos el PIC a la red ethernet del router. Desde otro dispositivo conectado a la misma red (al router), en la barra de direcciones del explorador, tecleamos la dirección IP que hemos asignado a nuestro servidor web (162.168.1.15). Si todo va bien nos aparecerá la página que hemos cargado en el PIC y desde la que podremos interactuar.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;iframe allowfullscreen=&quot;&quot; frameborder=&quot;0&quot; height=&quot;315&quot; src=&quot;https://www.youtube.com/embed/KZEPlXsuTnQ&quot; width=&quot;560&quot;&gt;&lt;/iframe&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;En esta simulación se ha visto como acceder al PIC desde un dispositivo conectado a la red ethernet interna. Si lo que queremos es acceder desde el exterior por internet, en la barra de direcciones del explorador deberemos escribir la dirección IP con la que se identifica nuestro router en internet y el número de puerto (puerto 80).&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; text-align: left;&quot;&gt;Por ejemplo&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;font-family: Verdana, sans-serif; font-style: italic; text-align: left;&quot;&gt;87.64.15.102:80&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Previamente, deberemos haber configurado el router de forma que redirija&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;el trafico que le llega desde el exterior hasta el servidor web. En dicha configuración, tendremos que abrir el puerto 80 TCP para la dirección IP del servidor web (192.168.1.15).&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Para saber la dirección IP de nuestro router en internet, podemos ayudarnos de muchas páginas que nos la pueden proporcionar. Una de ellas es&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;a href=&quot;http://www.cualesmiip.com/&quot; target=&quot;_blank&quot;&gt;http://www.cualesmiip.com/&lt;/a&gt;.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Esquema completo para el montaje real:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;img border=&quot;0&quot; height=&quot;452&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEirmDPcuehPZ9ueaUL9HOY9OWy2h8kRKv9Ma5FE1gYxV0ksGj_7k14NFYX9scjxk2qwPZ2JYEL99nzYe8opEio2JuztVNGlADn2Zf0luKHlzO6K4sP1vCuhyphenhyphenql5qaAPbTdJXr098c4E5KE/s640/Esquema+18f4550%252Benc28j60_RyP.jpg&quot; width=&quot;640&quot; /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Descarga de los archivos del proyecto:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;a href=&quot;http://dfiles.eu/files/t73bgwvpv&quot; target=&quot;_blank&quot;&gt;Webserver PIC18F4550+ENC28j60&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: x-small;&quot;&gt;El proyecto contenido en el artículo ha sido diseñado y probado utilizando las siguientes versiones de software:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: x-small;&quot;&gt;- Windows xp, windows 7 (32 bits) y windows 8 (64 bits)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: x-small;&quot;&gt;- Proteus V7.7 SP2&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: x-small;&quot;&gt;- CCS PIC C COMPILER v4.104&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: 13.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: large;&quot;&gt;Artículo relacionado&amp;gt;&amp;gt;&amp;nbsp;&lt;a href=&quot;http://robotypic.blogspot.com.es/2015/07/ServidorWeb-PIC18f4620-enc28j60.html&quot; target=&quot;_blank&quot;&gt;Servidor Web PIC18f4620+enc28j60&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://robotypic.blogspot.com/feeds/4351158065064728047/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5250193391449144895/4351158065064728047?isPopup=true' title='67 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5250193391449144895/posts/default/4351158065064728047'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5250193391449144895/posts/default/4351158065064728047'/><link rel='alternate' type='text/html' href='http://robotypic.blogspot.com/2015/07/ServidorWeb-PIC18f4550-enc28j60.html' title='Servidor Web con PIC18F4550 y ENC28j60'/><author><name>Robotypic</name><uri>http://www.blogger.com/profile/16455462312458405515</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgPan64ZytPa1dL0PA96zBOo2YTcQFNxUjt7WYD6ctSIRa1eeL1khfAxpHA8qyhmgVF9UcK_jUp_BOZUr7rUu-0RYwHlhgn__2PuPQLeXjKewnXMVTVYYlcSOEWVJc18W-SnfZYeCFxs1I/s72-c/ENC28j60_RyP.jpg" height="72" width="72"/><thr:total>67</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5250193391449144895.post-6581637559175827549</id><published>2015-07-13T21:34:00.003+02:00</published><updated>2019-01-21T22:37:19.960+01:00</updated><title type='text'>Servidor Web con PIC18F4620 y ENC28J60 con wizard de CCS</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;nbsp;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWKoY_VXXqqHHWbSAysfqPS8_h3KMvjtmGiWq6qx2TSaL3nnlLcwKtbTMx4Vk1RACgSCN5skMRJi3Lqtrs0877pyTgv3JrWt2oHoZiRWXRpUr90APW10_KfgtCX5OCXmRSihu5lcaOYJ4/s1600/ENC28j60+_RyP.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;183&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWKoY_VXXqqHHWbSAysfqPS8_h3KMvjtmGiWq6qx2TSaL3nnlLcwKtbTMx4Vk1RACgSCN5skMRJi3Lqtrs0877pyTgv3JrWt2oHoZiRWXRpUr90APW10_KfgtCX5OCXmRSihu5lcaOYJ4/s320/ENC28j60+_RyP.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;En este proyecto se va a mostrar la creación de un Servidor Web, similar al del artículo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&quot;&lt;i&gt;&lt;a href=&quot;http://robotypic.blogspot.com.es/2015/07/ServidorWeb-PIC18f4550-enc28j60.html&quot; target=&quot;_blank&quot;&gt;Servidor Web con PIC18F4550 Y ENC28j60&lt;/a&gt;&lt;/i&gt;&quot;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;aunque en este caso mediante el uso del wizard del ccs PIC c compiler de la versión v5.15.&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&amp;nbsp;El control del PIC se realiza igualmente por medio de una página web, alojada en la propia memoria del PIC, y accesible desde cualquier dispositivo, conectado a la red.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;La página que se va a crear para permitir el acceso al control del PIC consistirá en 2 botones que nos permitirán activar dos salidas en el PIC, conmutando entre el encendido y apagado de unos leds. Por otro lado&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;monitorizará la lectura del canal analógico AN0.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;El wizard nos va a
crear el código del PIC y la propia página web. Lo único que deberemos programar es lo que queramos que ocurra cuando pulsemos
los botones en la web (conmutar las salidas en el PIC) o lo que queramos que aparezca en la misma proporcionado
por los eventos ocurridos en el PIC (mostrar el valor de la lectura de una entrada
analógica). En los comentarios del código del PIC generado por
el wizard, identificaremos rápidamente dónde debemos colocar nuestro propio
código.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;En este ejemplo emplearemos la versión v5.015 del ccs pic c compiler. La opción del servidor web en el wizard no está disponible en las primeras versiones del ccs v5, y por tanto tampoco en ninguna de las del ccs v4.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Se va a mostrar el ejemplo
simulado bajo proteus, para ello habrá que instalar&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.winpcap.org/install/bin/WinPcap_4_1_3.exe&quot; style=&quot;font-family: Verdana, sans-serif;&quot; target=&quot;_blank&quot;&gt;&lt;span style=&quot;color: windowtext;&quot;&gt;WinPcap&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;. Software que se puede descargar
gratuitamente.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjuTzIYiqpKddIMUHHkBiFhcGRsGR9OjDDgqgx7SCyU2IujW3z8hTb4P-kxbIg84QCBUlNpRamL3rzg7TdaOyp1FHkYll-_u89nbWprkkgqpuwJHD9A7WMQhgT631V1bqMAmBrRv_y_Yio/s1600/18f4620%252Benc28j60_RyP.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;418&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjuTzIYiqpKddIMUHHkBiFhcGRsGR9OjDDgqgx7SCyU2IujW3z8hTb4P-kxbIg84QCBUlNpRamL3rzg7TdaOyp1FHkYll-_u89nbWprkkgqpuwJHD9A7WMQhgT631V1bqMAmBrRv_y_Yio/s640/18f4620%252Benc28j60_RyP.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;En la siguiente
animación se muestra todo el proceso de configuración con el wizard para la
creación del código del PIC y la página web asociada.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;center&gt;
&lt;iframe allowfullscreen=&quot;&quot; frameborder=&quot;0&quot; height=&quot;315&quot; src=&quot;https://www.youtube.com/embed/bCyCvZAf--k&quot; width=&quot;560&quot;&gt;&lt;/iframe&gt;
&lt;/center&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;No obstante, se expone a
continuación paso a paso todo el proceso:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; text-indent: -18pt;&quot;&gt;Ejecutar CCS PIC C
compiler.&lt;/span&gt;&lt;/li&gt;
&lt;br /&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; text-indent: -18pt;&quot;&gt;En el menú seleccionar
&lt;/span&gt;&lt;i style=&quot;font-family: Verdana, sans-serif; text-indent: -18pt;&quot;&gt;&lt;b&gt;&amp;lt;File&amp;gt; &amp;lt;new&amp;gt; &amp;lt;Project Wizard&amp;gt;&lt;/b&gt;&lt;/i&gt;&lt;/li&gt;
&lt;br /&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; text-indent: -18pt;&quot;&gt;Indicar el nombre y
ruta donde guardar el proyecto con los archivos que se van a generar.&lt;/span&gt;&lt;/li&gt;
&lt;br /&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; text-indent: -18pt;&quot;&gt;Se abre la pantalla
del Wizard. En la opción &lt;/span&gt;&lt;b style=&quot;font-family: Verdana, sans-serif; text-indent: -18pt;&quot;&gt;&lt;i&gt;“Device”&lt;/i&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; text-indent: -18pt;&quot;&gt; elegiremos el PIC deseado. En este caso hemos
optado por el PIC18F4620. Este es uno de los permitidos por el Wizard. No todos son admitidos a la hora de compilar.&lt;/span&gt;&lt;/li&gt;
&lt;br /&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; text-indent: -18pt;&quot;&gt;En la opción &lt;/span&gt;&lt;b style=&quot;font-family: Verdana, sans-serif; text-indent: -18pt;&quot;&gt;&lt;i&gt;“Analog”
&lt;/i&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; text-indent: -18pt;&quot;&gt;elegimos la entrada analógica que vamos a emplear (AN0) y el número de bits
(8bits =&amp;gt; 0-255)&lt;/span&gt;&lt;/li&gt;
&lt;br /&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; text-indent: -18pt;&quot;&gt;En la opción &lt;/span&gt;&lt;i style=&quot;font-family: Verdana, sans-serif; text-indent: -18pt;&quot;&gt;&lt;b&gt;“TCP/IP”
&lt;/b&gt;&lt;/i&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; text-indent: -18pt;&quot;&gt;marcamos &lt;/span&gt;&lt;i style=&quot;font-family: Verdana, sans-serif; text-indent: -18pt;&quot;&gt;&lt;b&gt;“use TCP/IP”&lt;/b&gt;&lt;/i&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; text-indent: -18pt;&quot;&gt;. Al hacerlo nos permitirá elegir el uso del ENC28J60,
elegir la dirección MAC y seleccionar los pines del PIC para el bus SPI. EN concreto
para el reset (B3 en este ejemplo) y para el Chip select (B2). El resto de los
pines del bus SPI no se pueden cambiar puesto que al usar el módulo hardware se
emplearán los pines físicos propios del bus.&lt;/span&gt;&lt;/li&gt;
&lt;br /&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; text-indent: -18pt;&quot;&gt;Continuando dentro de
&lt;/span&gt;&lt;i style=&quot;font-family: Verdana, sans-serif; text-indent: -18pt;&quot;&gt;&lt;b&gt;“TCP/IP”&lt;/b&gt;&lt;/i&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; text-indent: -18pt;&quot;&gt;, en la pestaña &lt;/span&gt;&lt;i style=&quot;font-family: Verdana, sans-serif; text-indent: -18pt;&quot;&gt;&lt;b&gt;“IP”&lt;/b&gt;&lt;/i&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; text-indent: -18pt;&quot;&gt; desmarcamos &lt;/span&gt;&lt;i style=&quot;font-family: Verdana, sans-serif; text-indent: -18pt;&quot;&gt;&lt;b&gt;“use DHCP” &lt;/b&gt;&lt;/i&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; text-indent: -18pt;&quot;&gt;que nos permitirá elegir
las direcciones IP (192.168.1.15), puerta de enlace (192.168.1.1) y máscara de
subred (255.255.255.0)&lt;/span&gt;&lt;/li&gt;
&lt;br /&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; text-indent: -18pt;&quot;&gt;Sin salir de &lt;/span&gt;&lt;i style=&quot;font-family: Verdana, sans-serif; text-indent: -18pt;&quot;&gt;&lt;b&gt;“TCP/IP”&lt;/b&gt;&lt;/i&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; text-indent: -18pt;&quot;&gt;,
en la pestaña &lt;/span&gt;&lt;b style=&quot;font-family: Verdana, sans-serif; text-indent: -18pt;&quot;&gt;&lt;i&gt;“Webserver”&lt;/i&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; text-indent: -18pt;&quot;&gt;, seleccionando &lt;/span&gt;&lt;i style=&quot;font-family: Verdana, sans-serif; text-indent: -18pt;&quot;&gt;&lt;b&gt;“use http Server”&lt;/b&gt;&lt;/i&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; text-indent: -18pt;&quot;&gt;, podremos indicar
cuantos campos de lectura del PIC &amp;nbsp;y los botones a
mostrar en la web.&lt;/span&gt;&lt;/li&gt;
&lt;br /&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; text-indent: -18pt;&quot;&gt;Elegidas todas estas
opciones podemos pulsar ya el botón &lt;/span&gt;&lt;i style=&quot;font-family: Verdana, sans-serif; text-indent: -18pt;&quot;&gt;&lt;b&gt;&amp;lt;Create Project&amp;gt;&lt;/b&gt;&lt;/i&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; text-indent: -18pt;&quot;&gt;. Aparecerá el código
del archivo fuente principal creado. Sobre este código deberemos programar los
efectos que queramos que ocurran al pulsar los botones en la web por ejemplo.&lt;/span&gt;&lt;/li&gt;
&lt;br /&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; text-indent: -18pt;&quot;&gt;La información procedente del PIC que queramos que aparezca en la
web la programaremos dentro de la función &lt;i&gt;&lt;b&gt;http_format_char()&lt;/b&gt;&lt;/i&gt;. A continuación
muestro el código resultante de dicha función. En rojo, el código &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; text-indent: -18pt;&quot;&gt;que hemos creado para leer el
canal analógico y enviarlo a la web. El resto de
código es el propio creado por el wizard.&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: blue;&quot;&gt;unsigned int8&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;
http_format_char(&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: blue;&quot;&gt;char&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;* file, &lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: blue;&quot;&gt;char&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt; id, &lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: blue;&quot;&gt;char&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt; *str, unsigned &lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: blue;&quot;&gt;int8&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt; max_ret)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: red; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; text-indent: -18pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; text-indent: -18pt;&quot;&gt;char new_str[20];&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: red;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;
int8 len=0;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: red;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;
int8 AD0;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; text-indent: -18pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;
/* TODO: This is a callback function to the HTTP stack.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #7f7f7f;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;
&#39;id&#39; is the char for the dynamic element to be updated.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #7f7f7f;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;
For each dynamic element you create, you need to parse&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #7f7f7f;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;
and save a result to &#39;str&#39;. *str is where the callback&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #7f7f7f;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;
function must save the formatting result, and it should&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #7f7f7f;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;
not store more than max_ret characters to this pointer&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #7f7f7f;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;
(buffer-overrun protection).&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #7f7f7f;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;
Example:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #7f7f7f;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;
switch(id) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #7f7f7f;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
case 0x00:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #7f7f7f;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
set_adc_channel(0);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #7f7f7f;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
delay_us(100);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #7f7f7f;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
i=read_adc();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #7f7f7f;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
sprintf(new_str,&quot;0x%X&quot;, i);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #7f7f7f;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;
.....&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #7f7f7f;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;
strncpy(str, new_str, max_ret);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #7f7f7f;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;
*/&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #1f497d;&quot;&gt;if&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt; (id == &lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: green;&quot;&gt;0&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: grey;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
//TODO: Handle dyn0 field and save result to str&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: red;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
set_adc_channel(0);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: red;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
delay_us(100);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: red;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
AD0=read_adc();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: red;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
sprintf(new_str,&quot;0x%X&quot;,AD0);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: red;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
len=strlen(new_str);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: red;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
strncpy(str, new_str, max_ret);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; text-indent: -18pt;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 115%; text-indent: -18pt;&quot;&gt;Dentro de la función&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;line-height: 115%; text-indent: -18pt;&quot;&gt;&lt;i&gt;http_exec_cgi()&lt;/i&gt;&lt;/b&gt;&lt;span style=&quot;line-height: 115%; text-indent: -18pt;&quot;&gt;&amp;nbsp;escribiremos
el código de lo que queramos que ocurra cuando se pulsan los botones en la web.
Cambiaremos el estado de dos de los pines del PIC para encender y apagar unos
leds. Como en el caso anterior, en rojo se ha representado el código introducido
manualmente. Una vez más, los&amp;nbsp;comentarios generados por el wizard nos
ayudan a saber dónde se debe colocar.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 115%; text-indent: -18pt;&quot;&gt;
&lt;/span&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: blue;&quot;&gt;void&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt; http_exec_cgi(&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: blue;&quot;&gt;char&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;* file, &lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: blue;&quot;&gt;char&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt; *key, &lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: blue;&quot;&gt;char&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt; *val)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: grey;&quot;&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; /*
TODO: This is a callback function to the HTTP stack.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: grey;&quot;&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;
This function is called with each key/value pair read in&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: grey;&quot;&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;
the GET/POST request before any web data is sent to the&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: grey;&quot;&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;
web browser. &#39;key&#39; matches the name of the field and&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: grey;&quot;&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; &#39;val&#39;
is the value it was changed to.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: grey;&quot;&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;
Example:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: grey;&quot;&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;
int8 v = atoi(val);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: grey;&quot;&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; if
(stricmp(key,led1_key)==0)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: grey;&quot;&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
LedSet(0, v);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: grey;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp;&amp;nbsp; */&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #1f497d;&quot;&gt;if&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt; (strcmp(key,
&quot;&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #660066;&quot;&gt;button00&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&quot;) == &lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: green;&quot;&gt;0&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #999999;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
//TODO: Handle button00&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: red;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; output_toggle(PIN_C0);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #1f497d;&quot;&gt;if&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt; (strcmp(key,
&quot;&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #660066;&quot;&gt;button01&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&quot;) == &lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: green;&quot;&gt;0&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #999999;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
//TODO: Handle button01&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: red;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;output_toggle(PIN_C1);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt 18pt;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt; text-align: justify; text-indent: 0px;&quot;&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Con esto ya
funcionaría nuestro ejemplo. No hemos intervenido para nada en
la programación de la página web. Todo el código html lo ha creado el
wizard.&amp;nbsp;Ahora bien, quizá deseemos modificar el código creado para
personalizar el diseño a nuestro gusto o adaptarlo a nuestra necesidad. Detallo a
continuación el procedimiento para hacerlo. No se trata de mostrar como
programar una aplicación web, sino del proceso a seguir para compilar de nuevo
el ejemplo una vez modificada la página web creada.&lt;/span&gt;&lt;/div&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; text-indent: -18pt;&quot;&gt;Deberemos localizar el archivo &lt;i&gt;&lt;b&gt;“index.html”&lt;/b&gt;&lt;/i&gt; que se ha creado
dentro de la carpeta &lt;b&gt;&lt;i&gt;“pages”&lt;/i&gt;&lt;/b&gt; en el directorio donde se nos ha compilado el
proyecto. Este archivo es la página web que el wizard ha creado.&lt;/span&gt;&lt;/li&gt;
&lt;br /&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; text-indent: -18pt;&quot;&gt;Para modificarlo, debemos abrirlo con cualquier editor HTML como
&lt;/span&gt;&lt;a href=&quot;http://formbreeze.net/pgbreeze.exe&quot; style=&quot;font-family: Verdana, sans-serif; text-indent: -18pt;&quot; target=&quot;_blank&quot;&gt;PageBreeze&lt;/a&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; text-indent: -18pt;&quot;&gt;, Microsoft Office FrontPage, etc. Una vez modificado guardar los
cambios.&lt;/span&gt;&lt;/li&gt;
&lt;br /&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; text-indent: -18pt;&quot;&gt;Ahora se debe cargar el nuevo diseño web en el código del PIC. Para
ello ejecutamos el archivo &lt;/span&gt;&lt;i style=&quot;font-family: Verdana, sans-serif; text-indent: -18pt;&quot;&gt;&lt;b&gt;“make mpfsimg”&lt;/b&gt;&lt;/i&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; text-indent: -18pt;&quot;&gt; también creado en el mismo directorio
del proyecto.&lt;/span&gt;&lt;/li&gt;
&lt;br /&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; text-indent: -18pt;&quot;&gt;Compilamos una vez más el archivo fuente con el ccs pic c compiler.&lt;/span&gt;&lt;/li&gt;
&lt;br /&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; text-indent: -18pt;&quot;&gt;Al ejecutar de nuevo el proyecto deberemos ver los cambios producidos
en la web.&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Para hacerlo funcionar, ya sea con la web personalizada o la creada originalmente, en la barra de direcciones del explorador web de cualquier dispositivo conectado a la misma red ethernet, tecleamos la dirección IP que hemos asignado a nuestro servidor (162.168.1.15). Aparecerá la página que hemos cargado en el PIC.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;center&gt;
&lt;iframe allowfullscreen=&quot;&quot; frameborder=&quot;0&quot; height=&quot;315&quot; src=&quot;https://www.youtube.com/embed/Zk3FBpyZzdE&quot; width=&quot;560&quot;&gt;&lt;/iframe&gt;
&lt;/center&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Cuando queramos acceder desde el exterior por internet, en la barra de direcciones del explorador deberemos escribir la dirección IP con la que se identifica nuestro router en internet y el número de puerto (puerto 80).&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; text-align: left;&quot;&gt;Por ejemplo&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;font-family: Verdana, sans-serif; font-style: italic; text-align: left;&quot;&gt;87.64.15.102:80&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Es necesario haber configurado el router de forma que redirija&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;el trafico que le llega desde el exterior hasta el servidor web. Deberemos abrir el puerto 80 TCP para la dirección IP del servidor web (192.168.1.15).&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;La dirección IP de nuestro router en internet, la podremos obtener por mediación de alguna de las muchas páginas que nos la pueden proporcionar. Una de ellas es&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;a href=&quot;http://www.cualesmiip.com/&quot; target=&quot;_blank&quot;&gt;http://www.cualesmiip.com/&lt;/a&gt;.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;El esquema completo para un montaje real:&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiJSMxaHWjFe4oa9WdyLzhgw7vJfU_NoIyuNLsf1tu-89feT8lsh6vLKYBVYhjG0kGSl_DZ5wTHciYn8wlSmsW2fWzOiF4hRWXZ-iXojUXMzEd0Gu7fWyZhycyDODOzy_7JZ5nFnx28cUo/s1600/Esquema+18F4620%252BENC28j60_RyP.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;452&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiJSMxaHWjFe4oa9WdyLzhgw7vJfU_NoIyuNLsf1tu-89feT8lsh6vLKYBVYhjG0kGSl_DZ5wTHciYn8wlSmsW2fWzOiF4hRWXZ-iXojUXMzEd0Gu7fWyZhycyDODOzy_7JZ5nFnx28cUo/s640/Esquema+18F4620%252BENC28j60_RyP.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Descarga de los archivos del proyecto:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;a href=&quot;https://www.dropbox.com/s/p12jf513eza71s2/Servidor%20Web%20PIC18F4620%2BENC28j60.rar?dl=0&quot; target=&quot;_blank&quot;&gt;Servidor Web PIC18f4620+ENC28j60&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;text-indent: -18pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;text-indent: -18pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; text-indent: -18pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;El proyecto contenido en el artículo ha sido diseñado y probado utilizando las siguientes versiones de software:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;- Windows xp, windows 7 (32 bits) y windows 8 (64 bits)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;- Proteus V7.7 SP2&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;- CCS PIC C COMPILER v5.015&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: 13.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: large;&quot;&gt;Artículo relacionado&amp;gt;&amp;gt;&amp;nbsp;&lt;a href=&quot;http://robotypic.blogspot.com/2015/07/ServidorWeb-PIC18f4550-enc28j60.html&quot; target=&quot;_blank&quot;&gt;Servidor Web PIC18F4550+enc28j60&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://robotypic.blogspot.com/feeds/6581637559175827549/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5250193391449144895/6581637559175827549?isPopup=true' title='18 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5250193391449144895/posts/default/6581637559175827549'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5250193391449144895/posts/default/6581637559175827549'/><link rel='alternate' type='text/html' href='http://robotypic.blogspot.com/2015/07/ServidorWeb-PIC18f4620-enc28j60.html' title='Servidor Web con PIC18F4620 y ENC28J60 con wizard de CCS'/><author><name>Robotypic</name><uri>http://www.blogger.com/profile/16455462312458405515</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWKoY_VXXqqHHWbSAysfqPS8_h3KMvjtmGiWq6qx2TSaL3nnlLcwKtbTMx4Vk1RACgSCN5skMRJi3Lqtrs0877pyTgv3JrWt2oHoZiRWXRpUr90APW10_KfgtCX5OCXmRSihu5lcaOYJ4/s72-c/ENC28j60+_RyP.jpg" height="72" width="72"/><thr:total>18</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5250193391449144895.post-270387952247616409</id><published>2013-10-27T18:37:00.000+01:00</published><updated>2013-11-01T23:00:54.633+01:00</updated><title type='text'>CMUcam4 con PIC</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;En el artículo &lt;i&gt;&lt;a href=&quot;http://robotypic.blogspot.com.es/2013/10/CMUcam4-desde-PC.html&quot; target=&quot;_blank&quot;&gt;&quot;CMUcam4 controlado por un PC&quot;&lt;/a&gt;&lt;/i&gt; se ha mostrado como contactar con una CMUcam4 desde un PC con la intención de tener un primer contacto y familiarizarnos con ella. Aquí, las actuaciones que en ese artículo se han mostrado desde el PC las vamos a realizar controlando la cámara con un PIC. Es decir, vamos a rastrear un objeto de un color concreto con la cámara soportada por los servos PAN y TILT. Los comandos enviados así como la respuesta recibida de la cámara lo mostraremos en un LCD.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Para la conexión eléctrica del PIC con la CMUcam hay que tener en cuenta un detalle muy importante. En la comunicación serie, los datos son transmitidos por el PIC a 5V. Sin embargo, los datos recibidos los envía la CMUcam a niveles en torno a los 3,3V, por lo que aunque la tarjeta de la cámara entiende los comandos del PIC, éste no es capaz de descifrar la información que recibe de la CMUcam y en el LCD aparecen caracteres ilegibles. Por tanto va a ser necesario pasar esos niveles de 3,3V a niveles de 5V detectables por el PIC bien por comparadores, puertas AND, etc., o como aquí se ha hecho, con el MAX232 conectado como se ve en el esquema.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhLZANhNpWlmfp-XflmQAvTdTppCCMIDiEoBGeJYlwz_JvV_e7jIommfcawkk19_Cle4D407WJ7QrW65bABqePL2i9kmIPYx5_2zZxA5mECvVJpfBvcvBZmSosBVkZY7oENlcwU18umI_0/s1600/Esquema+CMUcam+con+PIC+con+servos_RobotyPic.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;430&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhLZANhNpWlmfp-XflmQAvTdTppCCMIDiEoBGeJYlwz_JvV_e7jIommfcawkk19_Cle4D407WJ7QrW65bABqePL2i9kmIPYx5_2zZxA5mECvVJpfBvcvBZmSosBVkZY7oENlcwU18umI_0/s640/Esquema+CMUcam+con+PIC+con+servos_RobotyPic.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Se han empleado algunos comandos. La totalidad de ellos con su descripción y forma de usarlo se puede consultar en la &lt;a href=&quot;http://www.cmucam.org/attachments/download/636/CMUcam4-Command-List-102.pdf&quot; target=&quot;_blank&quot;&gt;&lt;i&gt;documentación técnica&lt;/i&gt;&lt;/a&gt; del componente.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Para programar el PIC, por tanto, habrá que configurar la conexión serie con las características que por defecto lleva la CMUcam.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid rgb(224, 248, 236); padding: 5px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;b&gt;#use rs232(baud=19200,xmit=pin_c6,rcv=pin_c7,bits=8,stop=1,parity=n, errors)&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Hay que considerar que la CMUcam tarda más tiempo en reiniciarse que el PIC. Le daremos un tiempo antes de enviar el primer comando para evitar que se bloquee. Aquí, mientras espera, muestra un mensaje en el LCD.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid rgb(224, 248, 236); padding: 5px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;/** Espera hasta que CMUcam se reinicie **/&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp;printf(lcd_putc, &quot;\f &amp;nbsp;Iniciando... &amp;nbsp;&quot;);&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d; font-weight: bold;&quot;&gt;&amp;nbsp; &amp;nbsp;delay_ms (6000); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Tiempo para inicio de la CMUcam&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;En esta demostración se envían varios comandos antes de rastrear el objeto como muestra de cual es la respuesta de la cámara. Solicitamos obtener la versión.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid rgb(224, 248, 236); padding: 5px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;b&gt;/&lt;/b&gt;** Valor del la versión de la CMUcam **/&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d; font-weight: bold;&quot;&gt;&amp;nbsp; &amp;nbsp;strcpy (CMUcam_comando, &quot;GV&quot;); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//En CMUcam_comando se guarda comando&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d; font-weight: bold;&quot;&gt;&amp;nbsp; &amp;nbsp;puts(CMUcam_comando); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Envío del comando a la CMUcam&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;i&gt;&lt;b&gt;strcpy &lt;/b&gt;&lt;/i&gt;guarda la cadena &lt;i&gt;&lt;b&gt;GV &lt;/b&gt;&lt;/i&gt;en la variable &lt;i&gt;&lt;b&gt;CMUcam_comando&lt;/b&gt;&lt;/i&gt;. Y luego se envía por el puerto serie a la cámara con &lt;i&gt;&lt;b&gt;puts&lt;/b&gt;&lt;/i&gt;.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Estas dos instrucciones C pueden sustituirse por una sola:&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid rgb(224, 248, 236); padding: 5px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; text-align: left;&quot;&gt;&lt;span style=&quot;color: #38761d; font-weight: bold;&quot;&gt;&amp;nbsp; &amp;nbsp;puts(&quot;GV&quot;); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Envío del comando a la CMUcam&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Pero el comando que enviamos a la cámara lo guardamos en una variable para mostrarlo también en el LCD.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid rgb(224, 248, 236); padding: 5px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;/** Muestra los primeros 16 caracteres del comando en la primera línea **/&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;b style=&quot;color: #38761d; font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;for(i=0;i&amp;lt;strlen(CMUcam_comando);i++)&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; printf(lcd_putc,&quot;%c&quot;,CMUcam_comando[i]);&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;/** Muestra los caracteres posteriores al 16 recibidos en la segunda línea **/&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp;if (strlen(CMUcam_comando)&amp;gt;16){&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d; font-weight: bold;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; lcd_gotoxy(1,2); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//En 2ª linea y 1ª columna del LCD...&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp;for(i=16;i&amp;lt;strlen(CMUcam_comando);i++)&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; printf(lcd_putc,&quot;%c&quot;,CMUcam_comando[i]);&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp;}&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;i&gt;strlen&lt;/i&gt;&lt;/b&gt; nos dice cuantos caracteres tiene la cadena contenida en &lt;i&gt;&lt;b&gt;CMUcam_comando &lt;/b&gt;&lt;/i&gt;para imprimir en el LCD los 16 primeros en la primera linea y el resto en la segunda.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;El siguiente comando solicita la lectura de los valores umbral del color a rastrear. Por defecto la cámara ajusta todo el rango de 0 a 255 de cada uno de los 3 colores primarios.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid rgb(224, 248, 236); padding: 5px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;/** Valores actuales umbral rastreo de color **/&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d; font-weight: bold;&quot;&gt;&amp;nbsp; &amp;nbsp;strcpy (CMUcam_comando, &quot;GT&quot;); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//En CMUcam_comando se guarda comando&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d; font-weight: bold;&quot;&gt;&amp;nbsp; &amp;nbsp;puts(CMUcam_comando); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Envío del comando a la CMUcam&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;A continuación se envía a la cámara los valores umbral deseados correspondientes al color del objeto que vamos a rastrear. Hasta ahora los comandos ejecutados no eran imprescindibles, se trataba tan solo de una demostración, pero este comando si es necesario. Estos valores umbral se han obtenido con el software CMUcam4GUI tal como se muestra en el artículo &lt;i&gt;&lt;a href=&quot;http://robotypic.blogspot.com.es/2013/10/CMUcam4-desde-PC.html&quot; target=&quot;_blank&quot;&gt;&quot;CMUcam4 controlada desde un PC&quot;&lt;/a&gt;&lt;/i&gt;.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid rgb(224, 248, 236); padding: 5px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;/** Fija nuevos valores umbral rastreo de color **/&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;strcpy (CMUcam_comando, &quot;ST 58 107 152 188 46 97&quot;);&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;/&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d; font-weight: bold;&quot;&gt;&amp;nbsp; &amp;nbsp;puts(CMUcam_comando); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Envío del comando a la CMUcam&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Ahora, en el programa ejemplo, hacemos de nuevo una lectura de los valores umbral como se ha hecho antes para verificar que han sido adquiridos por la cámara. Normalmente suelen variar algo con respecto a los enviados.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;El siguiente paso es poner los servos PAN y TILT en modo automático.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid rgb(224, 248, 236); padding: 5px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;/** Control automático del servo PAN para rastreo de color **/&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d; font-weight: bold;&quot;&gt;&amp;nbsp; &amp;nbsp;strcpy (CMUcam_comando, &quot;AP 1 1&quot;); &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//En CMUcam_comando se guarda comando&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d; font-weight: bold;&quot;&gt;&amp;nbsp; &amp;nbsp;puts(CMUcam_comando); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Envío del comando a la CMUcam&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;/** Control automático del servo TILT para rastreo de color **/&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d; font-weight: bold;&quot;&gt;&amp;nbsp; &amp;nbsp;strcpy (CMUcam_comando, &quot;AT 1 1&quot;); &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//En CMUcam_comando se guarda comando&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d; font-weight: bold;&quot;&gt;&amp;nbsp; &amp;nbsp;puts(CMUcam_comando); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Envío del comando a la CMUcam&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Se ha empleado el modo inverso puesto que los servos empleados así lo requerían. Cuando el servo en cuestión se desplaza en sentido contrario al movimiento del objeto hay que cambiarle el modo de funcionamiento de directo a inverso.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Ahora mismo la cámara está lista para detectar el objeto cuyo color hemos definido. En un bucle &lt;b&gt;&lt;i&gt;while()&lt;/i&gt;&lt;/b&gt; además vamos a leer y mostrar en un LCD las posiciones de los servos a tiempo real. Primero la del servo TILT...&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid rgb(224, 248, 236); padding: 5px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;/** Lectura del valor del pulso de control servo TILT en mseg.**/&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d; font-weight: bold;&quot;&gt;&amp;nbsp; &amp;nbsp;puts(&quot;GS 0&quot;); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Envío del comando a la CMUcam&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;//Si el 4º caracter recibido no es un número lo borra del buffer recepción&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;b&gt;&amp;nbsp; if((CMUcam_recepcion[3]&amp;lt;48)||(CMUcam_recepcion[3]&amp;gt;57))CMUcam_recepcion[3]=&#39; &#39;;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d; font-weight: bold;&quot;&gt;&amp;nbsp; &amp;nbsp;lcd_gotoxy(1,1); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//En primera linea y primer caracter del LCD...&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//...muestra valor obtenido&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp;printf(lcd_putc,&quot;Servo TILT: %c%c%c%c&quot;, CMUcam_recepcion[0], CMUcam_recepcion[1], CMUcam_recepcion[2], CMUcam_recepcion[3]);&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;...y a continuación en la segunda línea del LCD la del servo PAN.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid rgb(224, 248, 236); padding: 5px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;/** Lectura del valor del pulso de control servo PAN en mseg.**/&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d; font-weight: bold;&quot;&gt;&amp;nbsp; &amp;nbsp;puts(&quot;GS 1&quot;); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Envío del comando a la CMUcam&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;//Si el 4º caracter recibido no es un número lo borra del buffer recepción&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;b&gt;&amp;nbsp; if((CMUcam_recepcion[3]&amp;lt;48)||(CMUcam_recepcion[3]&amp;gt;57))CMUcam_recepcion[3]=&#39; &#39;;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d; font-weight: bold;&quot;&gt;&amp;nbsp; &amp;nbsp;lcd_gotoxy(1,2); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//En segunda linea y primer caracter del LCD...&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;//...muestra valor obtenido&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp;printf(lcd_putc,&quot;Servo PAN: &amp;nbsp;%c%c%c%c&quot;, CMUcam_recepcion[0], CMUcam_recepcion[1], CMUcam_recepcion[2], CMUcam_recepcion[3]);&lt;/b&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Solo se mostrarán los caracteres numéricos, es decir, se evitará mostrar el carácter &lt;b&gt;&lt;i&gt;&quot;:&quot;&lt;/i&gt;&lt;/b&gt; con el que finaliza el envío la CMUcam.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Para la recepción de datos de la CMUcam se ha habilitado la interrupción por recepción serie.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid rgb(224, 248, 236); padding: 5px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d; font-weight: bold;&quot;&gt;&amp;nbsp; &amp;nbsp;enable_interrupts(int_rda); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;// Habilita Interrupción RDA&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Cuando el PIC detecta que ha recibido algo, salta a la función de la interrupción. Allí obtiene el último carácter recibido y lo añade al buffer de recepción donde se guarda la cadena de texto completa de respuesta de la CMUcam.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid rgb(224, 248, 236); padding: 5px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d; font-weight: bold;&quot;&gt;&amp;nbsp; &amp;nbsp;siguiente_caracter=getc(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;// se descarga y ...&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;//...se añade el caracter recibido al Buffer de recepción&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp;CMUcam_recepcion[indice_buffer]=siguiente_caracter; &amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Después de recibir un carácter, se incrementa su indice en 1 para dejarlo preparado para la recepción del siguiente de la cadena de texto completa.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid rgb(224, 248, 236); padding: 5px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;/** Indice del buffer para el próximo caracter a recibir **/&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; indice_buffer++;&lt;/b&gt; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Dentro de la cadena de texto recibida, se encuentra el ACK o NCK. Estos 3 caracteres son extraídos y guardados en un buffer aparte para ser tratados de la forma que más convenga.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid rgb(224, 248, 236); padding: 5px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;/** Si recibe ACK o NCK lo guarda en un buffer aparte **/ &lt;b&gt;&amp;nbsp;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp;if (CMUcam_recepcion[indice_buffer]==&#39;K&#39;){&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; if (CMUcam_recepcion[indice_buffer-1]==&#39;C&#39;){&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (CMUcam_recepcion[indice_buffer-2]==&#39;A&#39;){&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d; font-weight: bold;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; strcpy (CMUcam_ACK, &quot;ACK&quot;); &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//En CMU_ACK se guarda texto &#39;ACK&#39;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for (i=indice_buffer-2;i&amp;lt;=indice_buffer;i++)CMUcam_recepcion[i]=&#39; &#39;;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d; font-weight: bold;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; indice_buffer=255; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Reinicio del indice del buffer&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;else if (CMUcam_recepcion[indice_buffer-2]==&#39;N&#39;){&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d; font-weight: bold;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; strcpy (CMUcam_ACK, &quot;NCK&quot;); &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//En CMU_ACK se guarda texto &#39;NCK&#39;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for (i=indice_buffer-2;i&amp;lt;=indice_buffer;i++)CMUcam_recepcion[i]=&#39; &#39;;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d; font-weight: bold;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; indice_buffer=255; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Reinicio del indice del buffer&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp;}&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;En este ejemplo, este ACK o NCK tan solo se muestra en las últimas posiciones del LCD separados del resto de la cadena recibida.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid rgb(224, 248, 236); padding: 5px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;/** Muestra ACK o NCK en los 3 últimos dígitos del LCD **/&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d; font-weight: bold;&quot;&gt;&amp;nbsp; &amp;nbsp;lcd_gotoxy(14,2); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//En 2ª linea y columna 14 del LCD...&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp;printf(lcd_putc,&quot;%s&quot;,CMUcam_ACK);&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=5250193391449144895#&quot; onclick=&quot;Effect.toggle(&amp;quot;expandir1&amp;quot;,&amp;quot;slide&amp;quot;); return false&quot;&gt;[+/-] Ver / Ocultar programa completo en C&lt;/a&gt;&lt;br /&gt;
&lt;div id=&quot;expandir1&quot; style=&quot;display: none;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;////////////////////////////////////////////////////////////////////////////////&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;// &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;// &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp;CMUcam4 con PIC &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;// &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;//
&amp;nbsp;Ejemplo de comunicación entre CMUcam y el PIC. Rastreo de un color cuyos
&amp;nbsp;//&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;//
&amp;nbsp;parámetros son cargados desde el PIC. Habilitación de los servos PAN y
&amp;nbsp; &amp;nbsp;//&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;// &amp;nbsp;TILT
para el seguimiento del objeto. Los datos enviados por la CMUcam son //&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;//
&amp;nbsp;represntados en un LCD &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;// &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;// &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp;(c) RobotyPic 2013 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;// &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;////////////////////////////////////////////////////////////////////////////////&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;/** Carga del
driver del PIC empleado **/&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;#include
&amp;lt;16F876a.h&amp;gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;/**
Configuración de fuses **/&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #38761d;&quot;&gt;#fuses HS, NOWDT &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//HS:
cristal 20MHz, NOWDT: no reset por watchdog&lt;/span&gt;&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;/** Frecuencia
de reloj **/&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;#use
delay(clock=20000000)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;/**
Configuración de la comunicación serie **/&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #38761d;&quot;&gt;#use rs232(baud=19200, xmit=pin_c6, rcv=pin_c7, bits=8, stop=1,
parity=n, errors)&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;/**
Configuración de los puertos **/&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;#use
standard_io(c) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Modo de uso del puerto C&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;#define
use_portb_lcd TRUE &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Puerto B para uso del LCD&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;/** Carga de
librerías **/&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;#include
&amp;lt;lcd.c&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Librería para
uso del LCD&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;#include
&amp;lt;string.h&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Librería para tratamiento
de cadenas&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;/**************************
Variables globales ********************************/&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;int
&amp;nbsp;indice_buffer=0x00; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Indice del buffer de recepción
de datos&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;char
CMUcam_recepcion[40]; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Buffer de recepción datos de la CMUCAM&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;char
CMUcam_comando[40]; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Contenedor del comando a enviar a
CMUcam&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;char
CMUcam_ACK[3]; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Guarda ACK o NCK recibido&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;char
siguiente_caracter=&#39; &#39;; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Último caracter recibido en el buffer&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;int i; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Indice genérico para bucles repetitivos&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;/******************************************************************************/&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;/********************
FUNCIÓN RECEPCIÓN DATOS CMUCAM **************************/&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;/** &amp;nbsp;Cada
vez que la CMAcam responde, la información es guardada en el buffer&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp;CMUcam[],
se eliminan los caracteres correspondientes al retorno de carro, se&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp;lee el
ACK o NCK y se guarda en CMUcam_ACK[] &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;**/&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;#int_rda&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;void
serial_isr() { &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;// Interrupción recepción serie&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;
&amp;nbsp;while(kbhit()){ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;// Si hay algo pendiente de recibir ...&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;
&amp;nbsp; siguiente_caracter=getc(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;// se
descarga y ...&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp; &amp;nbsp;
&amp;nbsp; //...se añade el caracter recibido al Buffer de recepción&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;
&amp;nbsp; CMUcam_recepcion[indice_buffer]=siguiente_caracter; &amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;
&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;
&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;/** Si recibe ACK o NCK lo guarda en un buffer aparte **/ &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;
&amp;nbsp; &lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #38761d;&quot;&gt;if
(CMUcam_recepcion[indice_buffer]==&#39;K&#39;){&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if
(CMUcam_recepcion[indice_buffer-1]==&#39;C&#39;){&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if
(CMUcam_recepcion[indice_buffer-2]==&#39;A&#39;){&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;strcpy
(CMUcam_ACK, &quot;ACK&quot;); &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//En CMU_ACK se guarda texto &#39;ACK&#39;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #38761d;&quot;&gt;for
(i=indice_buffer-2;i&amp;lt;=indice_buffer;i++)CMUcam_recepcion[i]=&#39; &#39;;&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;indice_buffer=255;
&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Reinicio del indice del buffer&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #38761d;&quot;&gt;}&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else if
(CMUcam_recepcion[indice_buffer-2]==&#39;N&#39;){&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;strcpy (CMUcam_ACK,
&quot;NCK&quot;); &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//En CMU_ACK se guarda texto &#39;NCK&#39;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #38761d;&quot;&gt;for
(i=indice_buffer-2;i&amp;lt;=indice_buffer;i++)CMUcam_recepcion[i]=&#39; &#39;;&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;indice_buffer=255;
&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Reinicio del indice del buffer&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;
&amp;nbsp; }&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;
&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;/** Si recibe retorno de carro se ignora el caracter recibido**/&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt; &amp;nbsp;
&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;
&amp;nbsp; if (siguiente_caracter==13) indice_buffer--;&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;
&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;
&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;/** Indice del buffer para el próximo caracter a recibir **/ &amp;nbsp;
&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;
&amp;nbsp; indice_buffer++; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;}&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;/******************************************************************************/&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;/********************
FUNCIÓN BORRADO BUFFER DE RECEPCIÓN *********************/&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #38761d;&quot;&gt;void Borrado_buffer () { &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;for (i=0;i&amp;lt;=40;i++) CMUcam_recepcion[i] = &#39; &#39;;&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;}&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;/******************************************************************************/&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;/******************
FUNCIÓN REPRESENTACIÓN INFORMACIÓN RECIBIDA ***************/&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;/**
&amp;nbsp;Visualiza en el LCD la respuesta recibida de la CMUcam y el ACK o NCK
&amp;nbsp; **/&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;void
LCD_recepcion () {&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;
&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;
&amp;nbsp;printf(lcd_putc,&quot;\f&quot;); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Borrado del LCD&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;
&amp;nbsp;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp;
&amp;nbsp;/** Muestra los primeros 16 caracteres recibidos en la primera línea **/&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #38761d;&quot;&gt;for(i=0; i&amp;lt;strlen(CMUcam_recepcion); i++)
printf(lcd_putc,&quot;%c&quot;,CMUcam_recepcion[i]);&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;/** Muestra los caracteres posteriores al 16 recibidos en la
segunda línea **/&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;
&amp;nbsp;if (strlen(CMUcam_recepcion)&amp;gt;16){&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;
&amp;nbsp; lcd_gotoxy(1,2); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//En 2ª linea y 1ª columna del LCD...&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;
&amp;nbsp; &lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #38761d;&quot;&gt;for(i=16;i&amp;lt;strlen(CMUcam_recepcion);
i++) printf(lcd_putc,&quot;%c&quot;,CMUcam_recepcion[i]);&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;}&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;
&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;/** Muestra ACK o NCK en los 3 últimos dígitos del LCD **/&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;
&amp;nbsp;lcd_gotoxy(14,2); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//En 2ª linea y columna 14 del LCD...&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #38761d;&quot;&gt;printf(lcd_putc,&quot;%s&quot;,CMUcam_ACK);&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;/** Reinicio del buffer de recepción para próxima lectura **/&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;
&amp;nbsp;indice_buffer=0x00; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Indice del buffer al primer caracter&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;
&amp;nbsp;Borrado_buffer(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Borrado de la información recibida&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;}&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;/******************************************************************************/&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;/*******************
FUNCIÓN REPRESENTACIÓN INFORMACIÓN ENVIADA ***************/&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;/** &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Visualiza en el LCD el comando enviado
a la CMUcam &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;**/&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;void LCD_envio
() { &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;
&amp;nbsp;printf(lcd_putc,&quot;\f&quot;); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Borrado del LCD&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;
&amp;nbsp;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp;
&amp;nbsp;/** Muestra los primeros 16 caracteres del comando en la primera línea
**/&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #38761d;&quot;&gt;for(i=0; i&amp;lt;strlen(CMUcam_comando); i++)
printf(lcd_putc,&quot;%c&quot;,CMUcam_comando[i]);&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;/** Muestra los caracteres posteriores al 16 recibidos en la
segunda línea **/&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;
&amp;nbsp;if (strlen(CMUcam_comando)&amp;gt;16){&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;
&amp;nbsp; lcd_gotoxy(1,2); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//En 2ª
linea y 1ª columna del LCD...&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;
&amp;nbsp; &lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #38761d;&quot;&gt;for(i=16; i&amp;lt;strlen(CMUcam_comando);
i++) printf(lcd_putc,&quot;%c&quot;,CMUcam_comando[i]);&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;}&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;}&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;/******************************************************************************/&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;/**************************
FUNCIÓN PRINCIPAL *********************************/&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;void main() {&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;
&amp;nbsp;lcd_init(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Inicialización del LCD&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;
&amp;nbsp;Borrado_buffer(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Función de borrado del buffer&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;
&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;
&amp;nbsp;enable_interrupts(int_rda); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;// Habilita Interrupción RDA&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;
&amp;nbsp;enable_interrupts(global); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;// Habilita interrupciones&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;
&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp;
&amp;nbsp;/** Espera hasta que CMUcam se reinicie **/&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;
&amp;nbsp;printf(lcd_putc, &quot;\f &amp;nbsp;Iniciando... &amp;nbsp;&quot;);&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;
&amp;nbsp;delay_ms (6000); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Tiempo para inicio de la CMUcam&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp;
&amp;nbsp;/** Valor del la versión de la CMUcam **/&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;
&amp;nbsp;strcpy (CMUcam_comando, &quot;GV&quot;); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//En CMUcam_comando se guarda comando&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;
&amp;nbsp;puts(CMUcam_comando); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Envío del comando a la CMUcam&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;
&amp;nbsp;LCD_envio(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Representación en LCD&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;
&amp;nbsp;delay_ms(2000); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Tiempo de visualización en LCD&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;
&amp;nbsp;LCD_recepcion(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Representación en LCD&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;
&amp;nbsp;delay_ms(2000); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Tiempo de visualización en LCD&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp;
&amp;nbsp;/** Valores actuales umbral rastreo de color **/&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;
&amp;nbsp;strcpy (CMUcam_comando, &quot;GT&quot;); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//En CMUcam_comando se guarda comando&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;puts(CMUcam_comando);
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Envío
del comando a la CMUcam&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;
&amp;nbsp;LCD_envio(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Representación en LCD&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;
&amp;nbsp;delay_ms(2000); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Tiempo de visualización en LCD&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;
&amp;nbsp;LCD_recepcion(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Representación en LCD&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;
&amp;nbsp;delay_ms(2000); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Tiempo de visualización en LCD&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp;
&amp;nbsp;/** Fija nuevos valores umbral rastreo de color **/&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;
&amp;nbsp;strcpy (CMUcam_comando, &quot;ST 58 107 152 188 46 97&quot;);&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//En
CMUcam_comando se guarda comando&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;
&amp;nbsp;puts(CMUcam_comando); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Envío del comando a la CMUcam&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;
&amp;nbsp;LCD_envio(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Representación en LCD&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;
&amp;nbsp;delay_ms(2000); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Tiempo de visualización en LCD&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;
&amp;nbsp;LCD_recepcion(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Representación en LCD&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;
&amp;nbsp;delay_ms(2000); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Tiempo de visualización en LCD&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;
&amp;nbsp;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp;
&amp;nbsp;/** Valores umbral rastreo de color **/&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;
&amp;nbsp;strcpy (CMUcam_comando, &quot;GT&quot;); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//En CMUcam_comando se guarda comando&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;puts(CMUcam_comando);
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Envío
del comando a la CMUcam&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;
&amp;nbsp;LCD_envio(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Representación en LCD&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;
&amp;nbsp;delay_ms(2000); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Tiempo de visualización en LCD&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;
&amp;nbsp;LCD_recepcion(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Representación en LCD&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;
&amp;nbsp;delay_ms(2000); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Tiempo de visualización en LCD&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;
&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp;
&amp;nbsp;/** Control automático del servo PAN para rastreo de color **/&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;
&amp;nbsp;strcpy (CMUcam_comando, &quot;AP 1 1&quot;); &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//En CMUcam_comando se guarda comando&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;
&amp;nbsp;puts(CMUcam_comando); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Envío del comando a la CMUcam&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;
&amp;nbsp;LCD_envio(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Representación en LCD&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;
&amp;nbsp;delay_ms(500); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Tiempo de visualización en LCD&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;
&amp;nbsp;LCD_recepcion(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Representación en LCD&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;
&amp;nbsp;delay_ms(500); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Tiempo de visualización en LCD&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;
&amp;nbsp;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp;
&amp;nbsp;/** Control automático del servo TILT para rastreo de color **/&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;
&amp;nbsp;strcpy (CMUcam_comando, &quot;AT 1 1&quot;); &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//En CMUcam_comando se guarda comando&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;
&amp;nbsp;puts(CMUcam_comando); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Envío del comando a la CMUcam&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;
&amp;nbsp;LCD_envio(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Representación en LCD&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;
&amp;nbsp;delay_ms(500); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Tiempo de visualización en LCD&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;
&amp;nbsp;LCD_recepcion(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Representación en LCD&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;
&amp;nbsp;delay_ms(500); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Tiempo de visualización en LCD&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp;
&amp;nbsp;/** Bucle de lectura y visualización en LCD de las posiciones de los
servos **/&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;
&amp;nbsp;while (true) {&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;
&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;/** Lectura del valor del pulso de control servo TILT en mseg.**/&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;
&amp;nbsp; puts(&quot;GS 0&quot;); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Envío del comando a la CMUcam&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp; &amp;nbsp;
&amp;nbsp; //Si el 4º caracter recibido no es un número lo borra del buffer
recepción&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;
&amp;nbsp; if ((CMUcam_recepcion[3]&amp;lt; 48)||(CMUcam_recepcion[3]&amp;gt; 57))
CMUcam_recepcion[3]= &#39; &#39;;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;
&amp;nbsp; lcd_gotoxy(1,1); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//En primera linea y
primer caracter del LCD...&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp; &amp;nbsp;
&amp;nbsp; //...muestra valor obtenido&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;
&amp;nbsp; printf(lcd_putc,&quot;Servo TILT: %c%c%c%c&quot;, CMUcam_recepcion[0],
CMUcam_recepcion[1], CMUcam_recepcion[2], CMUcam_recepcion[3]);&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;
&amp;nbsp; delay_ms (200);&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;
&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;
&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;/** Lectura del valor del pulso de control servo PAN en mseg.**/&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;
&amp;nbsp; puts(&quot;GS 1&quot;); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Envío del comando a la CMUcam&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp; &amp;nbsp;
&amp;nbsp; //Si el 4º caracter recibido no es un número lo borra del buffer
recepción&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;
&amp;nbsp; if ((CMUcam_recepcion[3]&amp;lt; 48)||(CMUcam_recepcion[3]&amp;gt; 57))
CMUcam_recepcion[3]= &#39; &#39;;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;
&amp;nbsp; lcd_gotoxy(1,2); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//En segunda linea y
primer caracter del LCD...&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp; &amp;nbsp;
&amp;nbsp; //...muestra valor obtenido&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;
&amp;nbsp; printf(lcd_putc,&quot;Servo PAN: &amp;nbsp;%c%c%c%c&quot;,
CMUcam_recepcion[0], CMUcam_recepcion[1],
CMUcam_recepcion[2],CMUcam_recepcion[3]);&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;
&amp;nbsp; delay_ms (200);&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 13.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;En este vídeo se muestra el resultado de todo lo hasta aquí argumentado.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;center&gt;
&lt;iframe allowfullscreen=&quot;&quot; frameborder=&quot;0&quot; height=&quot;360&quot; src=&quot;//www.youtube.com/embed/mqbgQI7A6e8?feature=player_detailpage&quot; width=&quot;640&quot;&gt;&lt;/iframe&gt;&lt;/center&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Y en este enlace de descarga disponibles todos los archivos y documentación.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;a href=&quot;http://dfiles.eu/files/o6sdlpjji&quot; target=&quot;_blank&quot;&gt;Descargar CMUcam4 con PIC&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: large;&quot;&gt;Artículo relacionado&amp;gt;&amp;gt;&amp;nbsp;&lt;a href=&quot;http://robotypic.blogspot.com.es/2013/10/CMUcam4-desde-PC.html&quot; target=&quot;_blank&quot;&gt;Control CMUcam4 desde un PC&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;border: 5px solid rgb(224, 248, 236); padding: 5px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;El proyecto contenido en el artículo ha sido diseñado y probado &amp;nbsp;utilizando estas versiones de software:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;- Windows 7&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;- CCS PIC C COMPILER v4.084&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://robotypic.blogspot.com/feeds/270387952247616409/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5250193391449144895/270387952247616409?isPopup=true' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5250193391449144895/posts/default/270387952247616409'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5250193391449144895/posts/default/270387952247616409'/><link rel='alternate' type='text/html' href='http://robotypic.blogspot.com/2013/10/CMUcam4-con-PIC.html' title='CMUcam4 con PIC'/><author><name>Robotypic</name><uri>http://www.blogger.com/profile/16455462312458405515</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhLZANhNpWlmfp-XflmQAvTdTppCCMIDiEoBGeJYlwz_JvV_e7jIommfcawkk19_Cle4D407WJ7QrW65bABqePL2i9kmIPYx5_2zZxA5mECvVJpfBvcvBZmSosBVkZY7oENlcwU18umI_0/s72-c/Esquema+CMUcam+con+PIC+con+servos_RobotyPic.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5250193391449144895.post-7620150557851963150</id><published>2013-10-27T18:13:00.000+01:00</published><updated>2013-10-27T18:46:02.085+01:00</updated><title type='text'>CMUcam4 controlada desde un PC</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgRlxFlM3p2jX_5tFKaiv8esQp9s3bmuHF23YlcIoEg02nHos6VrMqvGGM2agMuoobrxk9-iDIxwgKeSBLKXKoowHmav6ncH5_eTT_7bJw-q0qX6AKMRTRaLmQbEk-EF_WYG4Ab2ch9puE/s1600/CMUcam4+-+RobotyPic.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;333&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgRlxFlM3p2jX_5tFKaiv8esQp9s3bmuHF23YlcIoEg02nHos6VrMqvGGM2agMuoobrxk9-iDIxwgKeSBLKXKoowHmav6ncH5_eTT_7bJw-q0qX6AKMRTRaLmQbEk-EF_WYG4Ab2ch9puE/s400/CMUcam4+-+RobotyPic.jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Aunque la intención es controlar la CMUcam4 con PIC, en este artículo se va a tratar de conectar la cámara a un PC. En primer lugar mediante el software &lt;i&gt;&lt;a href=&quot;http://www.cmucam.org/attachments/download/796/CMUcam4GUI_windows_100.zip&quot; target=&quot;_blank&quot;&gt;CMUcam4GUI&lt;/a&gt;&lt;/i&gt; proporcionado por el fabricante.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Con este software, además de comprobar el funcionamiento de la cámara de una forma sencilla, nos va a permitir familiarizarnos con el componente, ya que prácticamente todos los controles de los que el software dispone de una manera gráfica, son los que podemos emplear con el PIC en forma de comandos.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;La conexión de comunicación al PC se realiza por el puerto serie. Para ello, y como viene siendo habitual en las comunicaciones serie con el PC, será necesario adaptar los niveles de tensión del bus mediante un circuito externo como puede ser un MAX232.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-LIy5yTgWqXICbVoJOe-fc5UO-MCFFRrsaCwbXrmx1ck4Vcdy_U_FyVkp699k1z3taCDhMi9PMCicgAwXvibZgeMrXcgIKWzJZzj_mOhnHPuotHwM4o80sbXYApMFL5qfO3xdQ_X0J8A/s591/Conexi%C3%B3n+CMUcam4+-+RobotyPic.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-LIy5yTgWqXICbVoJOe-fc5UO-MCFFRrsaCwbXrmx1ck4Vcdy_U_FyVkp699k1z3taCDhMi9PMCicgAwXvibZgeMrXcgIKWzJZzj_mOhnHPuotHwM4o80sbXYApMFL5qfO3xdQ_X0J8A/s640/Conexi%C3%B3n+CMUcam4+-+RobotyPic.jpg&quot; width=&quot;622&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Energizamos ahora todo el conjunto. Se encenderá el led verde de la tarjeta de la CMUcam como testigo de que está alimentada. Transcurridos unos segundos se encenderá el led rojo, indicando que la CMUcam está ya operativa.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Ejecutamos el software de testeo de la CMUcam4 en el PC. Pulsamos el botón verde del menú superior &lt;i&gt;&lt;b&gt;&quot;Begin&quot;&lt;/b&gt;&lt;/i&gt; para realizar la conexión a la cámara. En el desplegable que aparece hay que elegir el puerto COM al que está conectada en el PC y aceptamos. Inmediatamente a continuación pulsamos el botón &lt;b&gt;&lt;i&gt;&quot;Reset&quot;&lt;/i&gt;&lt;/b&gt; de la CMUcam4 para que se reinicie y se conecte. Puede ser necesario pulsar varias veces hasta conseguirlo. Detectaremos que queda comunicada con el PC cuando el botón &lt;b&gt;&lt;i&gt;&quot;End&quot;&lt;/i&gt;&lt;/b&gt; del menú pasa de un estado inactivo de color gris a un estado activo y de color rojo.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Con PC y cámara en comunicación se puede ya ejecutar su control. En el vídeo que se muestra a continuación se representa el proceso de configuración para detectar un objeto por su color.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;center&gt;
&lt;iframe allowfullscreen=&quot;&quot; frameborder=&quot;0&quot; height=&quot;360&quot; src=&quot;//www.youtube.com/embed/0b6Glpfg7YU?feature=player_detailpage&quot; width=&quot;640&quot;&gt;&lt;/iframe&gt;&lt;/center&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Dentro del software de control, en la sección &lt;i&gt;&lt;b&gt;&quot;tracking Parameters&quot;&lt;/b&gt;&lt;/i&gt; de la pestaña &lt;i&gt;&lt;b&gt;&quot;options&quot;&lt;/b&gt;&lt;/i&gt;, podemos ver los valores umbral de los colores del objeto capturado. Estos valores nos servirán para introducirlos como argumento de comando con el PIC o mediante Terminal serie mostrado más adelante de este artículo.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Si ademas queremos usar los servos &lt;b&gt;&lt;i&gt;PAN &amp;amp; TILT,&lt;/i&gt;&lt;/b&gt; la CMUcam4 dispone de los conectores para que la propia tarjeta realice la función de seguimiento con dichos servos. La tarjeta tiene, junto a los conectores de los servos, los pines para aplicarles la tensión de alimentación que les corresponda según el tipo de servo empleado. La alimentación de estos servos por estos pines no alimenta al resto de componentes de la tarjeta. Es una alimentación independiente.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;En este otro vídeo se muestra el proceso de configuración para realizar el rastreo con estos servos. &lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Como se muestra al final del vídeo, se pueden controlar también de una forma manual.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;center&gt;
&lt;iframe allowfullscreen=&quot;&quot; frameborder=&quot;0&quot; height=&quot;360&quot; src=&quot;//www.youtube.com/embed/mpHNdQ96ewQ?feature=player_detailpage&quot; width=&quot;640&quot;&gt;&lt;/iframe&gt;&lt;/center&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Existen otras muchas opciones pero aquí lo que se pretende es tener un primer contacto con la cámara o verificar su funcionamiento antes de pasar a controlarla con un PIC.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Siguiendo con esta intención, mostramos ahora como controlarla&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&amp;nbsp;mediante comandos utilizando un visor de puerto serie como puede ser el hyperterminal u otro similar. Aquí vamos a utilizar el &lt;i&gt;&lt;a href=&quot;http://www.parallax.com/sites/default/files/downloads/P8-Parallax-Serial-Terminal.zip&quot; target=&quot;_blank&quot;&gt;&quot;&lt;/a&gt;&lt;/i&gt;&lt;/span&gt;&lt;i style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;a href=&quot;http://www.parallax.com/sites/default/files/downloads/P8-Parallax-Serial-Terminal.zip&quot; target=&quot;_blank&quot;&gt;Parallax Serial Terminal (PST)&quot;&lt;/a&gt;&lt;/i&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&amp;nbsp;que es el que recomienda el fabricante en la documentación y que además es de uso libre. Esta es la forma más parecida al control con un PIC.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Ejecutamos el programa para comunicación por el puerto serie. Se selecciona el puerto COM al que está conectada la cámara y se elige una velocidad de 19200 baudios.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Habilitamos la comunicación y pulsamos el botón &lt;i&gt;&lt;b&gt;Reset&lt;/b&gt; &lt;/i&gt;de la tarjeta de la CMUcam. Se debería establecer la comunicación entre PC y CMUcam. Lo confirmaremos cuando en el escritorio del programa visor aparezca la versión del componente.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;A partir de este momento ya podemos enviar comandos a la tarjeta de la cámara. Estos comandos consistirán en dos caracteres ASCII seguidos de su argumento cuando lo necesiten y la confirmación con un &quot;&lt;i&gt;&lt;b&gt;ENTER&lt;/b&gt;&lt;/i&gt;&quot; (Retorno de carro). Si la cámara entiende el comando, responderá con un &lt;i&gt;ACK &lt;/i&gt;&amp;nbsp;y la información solicitada a continuación, si es el caso. Si no entiende el comando responderá con un &lt;i&gt;NCK&lt;/i&gt; o con &lt;i&gt;ERR&lt;/i&gt; seguido de la descripción del error producido.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;La &lt;a href=&quot;http://www.cmucam.org/attachments/download/636/CMUcam4-Command-List-102.pdf&quot; target=&quot;_blank&quot;&gt;&lt;i&gt;lista de todos los comandos&lt;/i&gt;&lt;/a&gt; y de su uso junto a sus argumentos se pueden ver en la documentación del fabricante. Aquí se van a probar algunos de ellos. En concreto, lo que se va a hacer es configurar la CMUcam para seguimiento del color con los servos, tal como se ha hecho con el software gráfico, pero en este caso por comandos.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;El proceso puede verse en este vídeo.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;center&gt;
&lt;iframe allowfullscreen=&quot;&quot; frameborder=&quot;0&quot; height=&quot;360&quot; src=&quot;//www.youtube.com/embed/OtKATOMmals?feature=player_detailpage&quot; width=&quot;640&quot;&gt;&lt;/iframe&gt;&lt;/center&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Se puede ver que con el comando &lt;b&gt;&lt;i&gt;&quot;ST&quot;&lt;/i&gt;&lt;/b&gt; se introducen unos valores numéricos. Estos valores corresponden a los valores que obtenemos con el software CMUcam4GUI en la captura del color que queremos rastrear.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhsZwB-B7putbWqUTi_Sd-KcANP693HjvhXrvTB3YhAAxes7B8h-RXGAbJq8VUj_8p3i_28koY5QbEqGaDgtZ3CEaaNRPvAFQDbceIb1KN__YRP7o739U3HbKXRzSGszCD-S3NH79LSqNk/s1600/Opciones+CMUcam4+-+RobotyPic.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;516&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhsZwB-B7putbWqUTi_Sd-KcANP693HjvhXrvTB3YhAAxes7B8h-RXGAbJq8VUj_8p3i_28koY5QbEqGaDgtZ3CEaaNRPvAFQDbceIb1KN__YRP7o739U3HbKXRzSGszCD-S3NH79LSqNk/s640/Opciones+CMUcam4+-+RobotyPic.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: large;&quot;&gt;Artículo relacionado&amp;gt;&amp;gt;&amp;nbsp;&lt;a href=&quot;http://robotypic.blogspot.com.es/2013/10/CMUcam4-con-PIC.html&quot; target=&quot;_blank&quot;&gt;CMUcam4 con PIC&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://robotypic.blogspot.com/feeds/7620150557851963150/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5250193391449144895/7620150557851963150?isPopup=true' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5250193391449144895/posts/default/7620150557851963150'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5250193391449144895/posts/default/7620150557851963150'/><link rel='alternate' type='text/html' href='http://robotypic.blogspot.com/2013/10/CMUcam4-desde-PC.html' title='CMUcam4 controlada desde un PC'/><author><name>Robotypic</name><uri>http://www.blogger.com/profile/16455462312458405515</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgRlxFlM3p2jX_5tFKaiv8esQp9s3bmuHF23YlcIoEg02nHos6VrMqvGGM2agMuoobrxk9-iDIxwgKeSBLKXKoowHmav6ncH5_eTT_7bJw-q0qX6AKMRTRaLmQbEk-EF_WYG4Ab2ch9puE/s72-c/CMUcam4+-+RobotyPic.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5250193391449144895.post-718089195361809802</id><published>2013-09-14T23:20:00.000+02:00</published><updated>2013-09-15T20:56:47.709+02:00</updated><title type='text'>Librería C para sensor SHT11 con PIC</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;
&lt;img 0=&quot;&quot; alt=&quot;SHT11 con PIC” border=&quot; height=&quot;200&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghN3wm5O-5rh8CIfpSj2mw63RGc1unVQWPZpuIqjcmOxFOhhzuVBu15M3FmIHDpNZ4q9biTQlVgAhmz13VPdDdj2TPfROXiweX0kI-PAIp4S2ulUsNPjXtiJOS_9hmQxOFbM8IK2vwkzA/s200/sht11_RobotyPic.jpg&quot; style=&quot;float: left; margin: 0px; text-align: right;&quot; width=&quot;174&quot; /&gt;&lt;/div&gt;
&lt;div style=&quot;float: right; padding: 10px; text-align: justify; width: 60%;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Se trata de una librería C, &amp;nbsp;&lt;/span&gt;&lt;b style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;i&gt;SHTxx_RyP.c,&lt;/i&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&amp;nbsp;para el control del sensor SHT11 con un PIC. Un ejemplo de su aplicación se puede ver en el artículo: &quot;Sensor de temperatura y humedad SHT11 con PIC&quot;.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Es válida para toda la gama de sensores SHT10, SHT11, SHT15, SHT71 y SHT75.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Cuando se emplee la versión v3 o v4 del sensor SHT71 o SHT75, la librería alternativa es &lt;b&gt;&lt;i&gt;SHT7xv3_RyP.c&lt;/i&gt;&lt;/b&gt; que contiene los coeficientes de cálculo adecuados correspondientes a dichas versiones.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Dentro de la librería C encontraremos el código estructurado en diferentes secuencias y funciones.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana;&quot;&gt;La&lt;/span&gt;&lt;b style=&quot;font-family: Verdana;&quot;&gt; &lt;span style=&quot;font-size: x-small;&quot;&gt;SECUENCIA DE INICIO DE TRANSMISIÓN&lt;/span&gt;&amp;nbsp; &lt;/b&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;consistente en:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 5.0pt; margin-left: 36.0pt; margin-right: 0cm; margin-top: 0cm; mso-list: l0 level1 lfo1; tab-stops: list 36.0pt; text-align: justify; text-indent: -18.0pt;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;-&lt;span style=&quot;font-family: &#39;Times New Roman&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;Poner a “&lt;st1:metricconverter productid=&quot;0”&quot; w:st=&quot;on&quot;&gt;0”&lt;/st1:metricconverter&gt;
la línea DATA mientras SCK está a “&lt;st1:metricconverter productid=&quot;1”&quot; w:st=&quot;on&quot;&gt;1”&lt;/st1:metricconverter&gt;.
&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 5.0pt; margin-left: 36.0pt; margin-right: 0cm; margin-top: 0cm; mso-list: l0 level1 lfo1; tab-stops: list 36.0pt; text-align: justify; text-indent: -18.0pt;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;-&lt;span style=&quot;font-family: &#39;Times New Roman&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;Poner a “&lt;st1:metricconverter productid=&quot;0”&quot; w:st=&quot;on&quot;&gt;0”&lt;/st1:metricconverter&gt;
SCK mientras DATA continua a “&lt;st1:metricconverter productid=&quot;0”&quot; w:st=&quot;on&quot;&gt;0”&lt;/st1:metricconverter&gt;.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 5.0pt; margin-left: 36.0pt; margin-right: 0cm; margin-top: 0cm; mso-list: l0 level1 lfo1; tab-stops: list 36.0pt; text-align: justify; text-indent: -18.0pt;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;-&lt;span style=&quot;font-family: &#39;Times New Roman&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;Volver a poner a “&lt;st1:metricconverter productid=&quot;1”&quot; w:st=&quot;on&quot;&gt;1”&lt;/st1:metricconverter&gt; SCK sin cambiar el estado de
DATA&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 5.0pt; margin-left: 36.0pt; margin-right: 0cm; margin-top: 0cm; mso-list: l0 level1 lfo1; tab-stops: list 36.0pt; text-align: justify; text-indent: -18.0pt;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;-&lt;span style=&quot;font-family: &#39;Times New Roman&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;Finalmente pasar DATA a “&lt;st1:metricconverter productid=&quot;1”&quot; w:st=&quot;on&quot;&gt;1”&lt;/st1:metricconverter&gt; mientras SCK está a “&lt;st1:metricconverter productid=&quot;1”&quot; w:st=&quot;on&quot;&gt;1”&lt;/st1:metricconverter&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiW9PZnBQi_UdKreQcXIjCjB06TV5oRVd3z4o70YH0dqEbg-3yQJU_MEh3tlalkTrWSknBhDlF6wkqo5VMVOJAJUWhVrlKoTyk1AbLg68yKBpzsOWrTIxGPZvJIRJunRoM16w_ZjpKFtlE/s1600/Inicio+Transmisi%C3%B3n+sht11.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;135&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiW9PZnBQi_UdKreQcXIjCjB06TV5oRVd3z4o70YH0dqEbg-3yQJU_MEh3tlalkTrWSknBhDlF6wkqo5VMVOJAJUWhVrlKoTyk1AbLg68yKBpzsOWrTIxGPZvJIRJunRoM16w_ZjpKFtlE/s400/Inicio+Transmisi%C3%B3n+sht11.jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;/**
secuencia de inicio de transmisión **/&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;void
SHTxx_InicioTrans (void) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;//DATA a &quot;0&quot; con SCK a
&quot;1&quot;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;
output_float(sht_data_pin);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;//línea DATA a &quot;1&quot;&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;
output_low(sht_sck_pin);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;//línea SCK a &quot;0&quot;&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;
delay_us(1); &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;
output_high(sht_sck_pin);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;//línea SCK a &quot;1&quot;&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;
delay_us(1); &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;
output_low(sht_data_pin);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;//línea DATA a &quot;0&quot;&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;
delay_us(1); &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;
//SCK a &quot;0&quot; sin cambiar DATA &quot;0&quot;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;
output_low(sht_sck_pin);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;//línea SCK a &quot;0&quot;&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;
delay_us(2); &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;
//SCK a &quot;1&quot; sin cambiar DATA &quot;0&quot;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;
output_high(sht_sck_pin);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;//línea SCK a &quot;1&quot;&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;
delay_us(1); &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;
//DATA a &quot;1&quot; con SCK a &quot;1&quot;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;
output_float(sht_data_pin);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;//línea DATA a &quot;1&quot;&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;
delay_us(1); &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;
output_low(sht_sck_pin);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;//línea SCK a &quot;0&quot;&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;}&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-ansi-language: EN-GB;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: Arial;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Verdana; font-size: 10pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana;&quot;&gt;La&lt;b&gt; &lt;span style=&quot;font-size: x-small;&quot;&gt;SECUENCIA DE RESET&lt;/span&gt; &lt;/b&gt;resetea solo la
interface, los registros de estado mantienen sus valores. Consiste en: &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 5.0pt; margin-left: 36.0pt; margin-right: 0cm; margin-top: 0cm; mso-list: l0 level1 lfo1; tab-stops: list 36.0pt; text-align: justify; text-indent: -18.0pt;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;-&lt;span style=&quot;font-family: &#39;Times New Roman&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;Con la línea DATA puesta a “&lt;st1:metricconverter productid=&quot;1”&quot; w:st=&quot;on&quot;&gt;&lt;st1:metricconverter productid=&quot;1”&quot; w:st=&quot;on&quot;&gt;1”&lt;/st1:metricconverter&gt;,
 c&lt;/st1:metricconverter&gt;onmutar 9 o más veces la línea SCK entre “&lt;st1:metricconverter productid=&quot;0”&quot; w:st=&quot;on&quot;&gt;0”&lt;/st1:metricconverter&gt; y “&lt;st1:metricconverter productid=&quot;1”&quot; w:st=&quot;on&quot;&gt;1”&lt;/st1:metricconverter&gt;.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 5.0pt; margin-left: 36.0pt; margin-right: 0cm; margin-top: 0cm; mso-list: l0 level1 lfo1; tab-stops: list 36.0pt; text-align: justify; text-indent: -18.0pt;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;-&lt;span style=&quot;font-family: &#39;Times New Roman&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;Debe seguirle una&amp;nbsp;
secuencia de Inicio.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgLWvAieUzYqAGtF36V7JpkbX4ofOwntR49mH47TZpKwhQzuwSaZ54at3jqQ9usewQtRdDJun1IfOag5R34F9TzkNDGGDGJDueVmoEm_nLL81mUZrRE1lpIbsNvMLg-YcCPvi5ZUAe-PN8/s1600/Secuencia+Reset+sht11.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;127&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgLWvAieUzYqAGtF36V7JpkbX4ofOwntR49mH47TZpKwhQzuwSaZ54at3jqQ9usewQtRdDJun1IfOag5R34F9TzkNDGGDGJDueVmoEm_nLL81mUZrRE1lpIbsNvMLg-YcCPvi5ZUAe-PN8/s400/Secuencia+Reset+sht11.jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt; text-align: left;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;/** secuencia de reset **/&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt; text-align: left;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;void SHTxx_Reset (void) { &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt; text-align: left;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;b style=&quot;text-indent: 35.4pt;&quot;&gt;&lt;span style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;int i;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt; text-align: left;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;//inicio
de secuencia con SCK a “&lt;st1:metricconverter productid=&quot;0”&quot; w:st=&quot;on&quot;&gt;0”&lt;/st1:metricconverter&gt;
y DATA a “&lt;st1:metricconverter productid=&quot;1”&quot; w:st=&quot;on&quot;&gt;1”&lt;/st1:metricconverter&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt; text-align: left;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;output_float(sht_data_pin);&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;//línea DATA a
“&lt;st1:metricconverter productid=&quot;1”&quot; w:st=&quot;on&quot;&gt;1”&lt;/st1:metricconverter&gt;&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt; text-align: left;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;output_low(sht_sck_pin);&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;//línea SCK a
“&lt;st1:metricconverter productid=&quot;0”&quot; w:st=&quot;on&quot;&gt;0”&lt;/st1:metricconverter&gt;&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt; text-align: left;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;delay_us(2); &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt; text-align: left;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;//conmuta
SCK 9 veces con DATA a “&lt;st1:metricconverter productid=&quot;1”&quot; w:st=&quot;on&quot;&gt;1”&lt;/st1:metricconverter&gt;&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt; text-align: left; text-indent: 35.4pt;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;for(i=0; i&amp;lt;9;
i++) { &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt; text-align: left;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output_high(sht_sck_pin);&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt; text-align: left;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; delay_us(2);
&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt; text-align: left;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output_low(sht_sck_pin);
&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt; text-align: left;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;delay_us(2); &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt; text-align: left;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;} &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt; text-align: left;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;/** secuencia de inicio de transmisión **/&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt; text-align: left;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;SHTxx_InicioTrans ();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt; text-align: left;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;}&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana;&quot;&gt;Con la&lt;/span&gt;&lt;b style=&quot;font-family: Verdana;&quot;&gt; &lt;span style=&quot;font-size: x-small;&quot;&gt;SECUENCIA DE ENVIO DE COMANDO&lt;/span&gt; &amp;nbsp;&lt;/b&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;se
le indica al sensor la actuación que debe realizar. Son comandos de 5 bits pero
se debe enviar un byte completo (8 bits), 3 bits de dirección A0 a A2 y los 5
bits del comando C0 a C4. Los bits de dirección solo permiten valor “&lt;/span&gt;&lt;st1:metricconverter productid=&quot;0”&quot; style=&quot;font-family: Verdana;&quot; w:st=&quot;on&quot;&gt;0”&lt;/st1:metricconverter&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;
&lt;div align=&quot;center&quot;&gt;
&lt;table border=&quot;1&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;MsoTableGrid&quot; style=&quot;border-collapse: collapse; border: none; margin-left: 5.4pt; mso-border-alt: solid windowtext 1.5pt; mso-border-insideh: 1.5pt solid windowtext; mso-border-insidev: 1.5pt solid windowtext; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt; mso-yfti-tbllook: 480; width: 492px;&quot;&gt;
 &lt;tbody&gt;
&lt;tr style=&quot;height: 19.85pt; mso-yfti-firstrow: yes; mso-yfti-irow: 0;&quot;&gt;
  &lt;td style=&quot;background: #E0F8EC; border: solid windowtext 1.5pt; height: 19.85pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 171.0pt;&quot; width=&quot;228&quot;&gt;&lt;div style=&quot;margin-top: 0cm;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: Arial;&quot;&gt;COMANDO&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;background: #E0F8EC; border-left: none; border: solid windowtext 1.5pt; height: 19.85pt; mso-border-left-alt: solid windowtext 1.5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 117.0pt;&quot; width=&quot;156&quot;&gt;&lt;div style=&quot;margin-top: 0cm;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: Arial;&quot;&gt;Código
  en binario&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;background: #E0F8EC; border-left: none; border: solid windowtext 1.5pt; height: 19.85pt; mso-border-left-alt: solid windowtext 1.5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 81.0pt;&quot; width=&quot;108&quot;&gt;&lt;div style=&quot;margin-top: 0cm;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: Arial;&quot;&gt;Código
  hex.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr style=&quot;height: 19.85pt; mso-yfti-irow: 1;&quot;&gt;
  &lt;td style=&quot;border-top: none; border: solid windowtext 1.5pt; height: 19.85pt; mso-border-top-alt: solid windowtext 1.5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 171.0pt;&quot; width=&quot;228&quot;&gt;&lt;div style=&quot;margin-top: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: Arial;&quot;&gt;Reservado&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.5pt; border-left: none; border-right: solid windowtext 1.5pt; border-top: none; height: 19.85pt; mso-border-left-alt: solid windowtext 1.5pt; mso-border-top-alt: solid windowtext 1.5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 117.0pt;&quot; width=&quot;156&quot;&gt;&lt;div style=&quot;margin-top: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: Arial;&quot;&gt;0000x&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.5pt; border-left: none; border-right: solid windowtext 1.5pt; border-top: none; height: 19.85pt; mso-border-left-alt: solid windowtext 1.5pt; mso-border-top-alt: solid windowtext 1.5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 81.0pt;&quot; width=&quot;108&quot;&gt;&lt;div align=&quot;center&quot; style=&quot;margin-top: 0cm; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: Arial;&quot;&gt;--&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr style=&quot;height: 19.85pt; mso-yfti-irow: 2;&quot;&gt;
  &lt;td style=&quot;border-top: none; border: solid windowtext 1.5pt; height: 19.85pt; mso-border-top-alt: solid windowtext 1.5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 171.0pt;&quot; width=&quot;228&quot;&gt;&lt;div style=&quot;margin-top: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: Arial;&quot;&gt;Medida de Temperatura&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.5pt; border-left: none; border-right: solid windowtext 1.5pt; border-top: none; height: 19.85pt; mso-border-left-alt: solid windowtext 1.5pt; mso-border-top-alt: solid windowtext 1.5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 117.0pt;&quot; width=&quot;156&quot;&gt;&lt;div style=&quot;margin-top: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: Arial;&quot;&gt;00011&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.5pt; border-left: none; border-right: solid windowtext 1.5pt; border-top: none; height: 19.85pt; mso-border-left-alt: solid windowtext 1.5pt; mso-border-top-alt: solid windowtext 1.5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 81.0pt;&quot; width=&quot;108&quot;&gt;&lt;div style=&quot;margin-top: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: Arial;&quot;&gt;0x03&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr style=&quot;height: 19.85pt; mso-yfti-irow: 3;&quot;&gt;
  &lt;td style=&quot;border-top: none; border: solid windowtext 1.5pt; height: 19.85pt; mso-border-top-alt: solid windowtext 1.5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 171.0pt;&quot; width=&quot;228&quot;&gt;&lt;div style=&quot;margin-top: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: Arial;&quot;&gt;Medida de Humedad Relativa&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.5pt; border-left: none; border-right: solid windowtext 1.5pt; border-top: none; height: 19.85pt; mso-border-left-alt: solid windowtext 1.5pt; mso-border-top-alt: solid windowtext 1.5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 117.0pt;&quot; width=&quot;156&quot;&gt;&lt;div style=&quot;margin-top: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: Arial;&quot;&gt;00101&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.5pt; border-left: none; border-right: solid windowtext 1.5pt; border-top: none; height: 19.85pt; mso-border-left-alt: solid windowtext 1.5pt; mso-border-top-alt: solid windowtext 1.5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 81.0pt;&quot; width=&quot;108&quot;&gt;&lt;div style=&quot;margin-top: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: Arial;&quot;&gt;0x05&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr style=&quot;height: 19.85pt; mso-yfti-irow: 4;&quot;&gt;
  &lt;td style=&quot;border-top: none; border: solid windowtext 1.5pt; height: 19.85pt; mso-border-top-alt: solid windowtext 1.5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 171.0pt;&quot; width=&quot;228&quot;&gt;&lt;div style=&quot;margin-top: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: Arial;&quot;&gt;Lectura del Registro de Estado&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.5pt; border-left: none; border-right: solid windowtext 1.5pt; border-top: none; height: 19.85pt; mso-border-left-alt: solid windowtext 1.5pt; mso-border-top-alt: solid windowtext 1.5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 117.0pt;&quot; width=&quot;156&quot;&gt;&lt;div style=&quot;margin-top: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: Arial;&quot;&gt;00111&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.5pt; border-left: none; border-right: solid windowtext 1.5pt; border-top: none; height: 19.85pt; mso-border-left-alt: solid windowtext 1.5pt; mso-border-top-alt: solid windowtext 1.5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 81.0pt;&quot; width=&quot;108&quot;&gt;&lt;div style=&quot;margin-top: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: Arial;&quot;&gt;0x07&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr style=&quot;height: 19.85pt; mso-yfti-irow: 5;&quot;&gt;
  &lt;td style=&quot;border-top: none; border: solid windowtext 1.5pt; height: 19.85pt; mso-border-top-alt: solid windowtext 1.5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 171.0pt;&quot; width=&quot;228&quot;&gt;&lt;div style=&quot;margin-top: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: Arial;&quot;&gt;Escritura en registro de Estado&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.5pt; border-left: none; border-right: solid windowtext 1.5pt; border-top: none; height: 19.85pt; mso-border-left-alt: solid windowtext 1.5pt; mso-border-top-alt: solid windowtext 1.5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 117.0pt;&quot; width=&quot;156&quot;&gt;&lt;div style=&quot;margin-top: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: Arial;&quot;&gt;00110&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.5pt; border-left: none; border-right: solid windowtext 1.5pt; border-top: none; height: 19.85pt; mso-border-left-alt: solid windowtext 1.5pt; mso-border-top-alt: solid windowtext 1.5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 81.0pt;&quot; width=&quot;108&quot;&gt;&lt;div style=&quot;margin-top: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: Arial;&quot;&gt;0x06&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr style=&quot;height: 19.85pt; mso-yfti-irow: 6;&quot;&gt;
  &lt;td style=&quot;border-top: none; border: solid windowtext 1.5pt; height: 19.85pt; mso-border-top-alt: solid windowtext 1.5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 171.0pt;&quot; width=&quot;228&quot;&gt;&lt;div style=&quot;margin-top: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: Arial;&quot;&gt;Reservado&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.5pt; border-left: none; border-right: solid windowtext 1.5pt; border-top: none; height: 19.85pt; mso-border-left-alt: solid windowtext 1.5pt; mso-border-top-alt: solid windowtext 1.5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 117.0pt;&quot; width=&quot;156&quot;&gt;&lt;div style=&quot;margin-top: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: Arial;&quot;&gt;0101x-1110x&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.5pt; border-left: none; border-right: solid windowtext 1.5pt; border-top: none; height: 19.85pt; mso-border-left-alt: solid windowtext 1.5pt; mso-border-top-alt: solid windowtext 1.5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 81.0pt;&quot; width=&quot;108&quot;&gt;&lt;div align=&quot;center&quot; style=&quot;margin-top: 0cm; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: Arial;&quot;&gt;--&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr style=&quot;height: 19.85pt; mso-yfti-irow: 7; mso-yfti-lastrow: yes;&quot;&gt;
  &lt;td style=&quot;border-top: none; border: solid windowtext 1.5pt; height: 19.85pt; mso-border-top-alt: solid windowtext 1.5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 171.0pt;&quot; width=&quot;228&quot;&gt;&lt;div style=&quot;margin-top: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: Arial;&quot;&gt;Reset del Sofá, resetea la interface, limpia el
  registro a los valores por defecto. SE debe esperar un mínimo de 11msg antes
  del siguiente comando.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.5pt; border-left: none; border-right: solid windowtext 1.5pt; border-top: none; height: 19.85pt; mso-border-left-alt: solid windowtext 1.5pt; mso-border-top-alt: solid windowtext 1.5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 117.0pt;&quot; width=&quot;156&quot;&gt;&lt;div style=&quot;margin-top: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: Arial;&quot;&gt;11110&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.5pt; border-left: none; border-right: solid windowtext 1.5pt; border-top: none; height: 19.85pt; mso-border-left-alt: solid windowtext 1.5pt; mso-border-top-alt: solid windowtext 1.5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 81.0pt;&quot; width=&quot;108&quot;&gt;&lt;div style=&quot;margin-top: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: Arial;&quot;&gt;0x1D&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-top: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin-top: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana;&quot;&gt;Consiste en:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 5.0pt; margin-left: 36.0pt; margin-right: 0cm; margin-top: 0cm; mso-list: l0 level1 lfo1; tab-stops: list 36.0pt; text-align: justify; text-indent: -18.0pt;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;-&lt;span style=&quot;font-family: &#39;Times New Roman&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;Tras una secuencia completa de Inicio de
transmisión.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 5.0pt; margin-left: 36.0pt; margin-right: 0cm; margin-top: 0cm; mso-list: l0 level1 lfo1; tab-stops: list 36.0pt; text-align: justify; text-indent: -18.0pt;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;-&lt;span style=&quot;font-family: &#39;Times New Roman&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;Envío del comando bit a bit&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 5.0pt; margin-left: 36.0pt; margin-right: 0cm; margin-top: 0cm; mso-list: l0 level1 lfo1; tab-stops: list 36.0pt; text-align: justify; text-indent: -18.0pt;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;-&lt;span style=&quot;font-family: &#39;Times New Roman&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;Lectura del ack&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibimsavPIWQFPKN240FltsAj27hhPJ2jMBhLpFyNMNq9ACTb-PRBQPDDHOcvCmPAxI-dUL1W99lojALTkAvw_GGfGI-UbUKkGh6cI0yvxpFQ8lSKYBR1qYptDD-t-Z3FXSl6WmW8iCG9U/s1600/secuencia+comando+sht11.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;160&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibimsavPIWQFPKN240FltsAj27hhPJ2jMBhLpFyNMNq9ACTb-PRBQPDDHOcvCmPAxI-dUL1W99lojALTkAvw_GGfGI-UbUKkGh6cI0yvxpFQ8lSKYBR1qYptDD-t-Z3FXSl6WmW8iCG9U/s640/secuencia+comando+sht11.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div align=&quot;right&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: right;&quot;&gt;
&lt;b&gt;&lt;i&gt;&lt;span style=&quot;font-family: &amp;quot;Arial Narrow&amp;quot;; font-size: 8.0pt; mso-bidi-font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;Línea
fina indica su control por el PIC, línea gruesa control por el sensor.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;/** secuencia de envío de comando **/&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;int1 SHTxx_Comando (int8 sht_comando) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;
int8 bit;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp; int8 mascara = 0x80; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;
int1 ack; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;
delay_us(4); &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;
//Salida &lt;st1:place w:st=&quot;on&quot;&gt;&lt;st1:state w:st=&quot;on&quot;&gt;del&lt;/st1:state&gt;&lt;/st1:place&gt;
comando bit a bit&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;
for(bit=8; bit&amp;gt;=1; bit--) { &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
output_low(sht_sck_pin);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;//línea SCK a &quot;0&quot;&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Línea DATA a &quot;1&quot; si MSB es
&quot;1&quot;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;if((sht_comando &amp;amp; mascara) &amp;gt; 0)
output_float(sht_data_pin);&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Línea DATA a &quot;0&quot; si MSB es
&quot;0&quot;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;else output_low(sht_data_pin);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
delay_us(1); &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
output_high(sht_sck_pin);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;//línea SCK a
&quot;1&quot;&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;delay_us(1); &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mascara = mascara &amp;gt;&amp;gt; 1;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;//siguiente
bit pasa a ser MSB &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;} &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;
/** lectura &lt;st1:place w:st=&quot;on&quot;&gt;&lt;st1:state w:st=&quot;on&quot;&gt;del&lt;/st1:state&gt;&lt;/st1:place&gt;
ack **/&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;
output_low(sht_sck_pin);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;//línea SCK a &quot;0&quot;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;
delay_us(1); &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;
ack = input(sht_data_pin);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;//lectura &lt;st1:place w:st=&quot;on&quot;&gt;&lt;st1:state w:st=&quot;on&quot;&gt;del&lt;/st1:state&gt;&lt;/st1:place&gt;
ack&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;
output_high(sht_sck_pin);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;//línea SCK a &quot;1&quot;&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;
delay_us(1); &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;
output_low(sht_sck_pin);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;//línea SCK a &quot;0&quot;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;
return(ack); &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;}&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-GB; mso-bidi-font-family: Arial;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Verdana; font-size: 10pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-top: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana;&quot;&gt;La &lt;b&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;SECUENCIA DE ESPERA DE MEDICIÓN TERMINADA&lt;/span&gt;&amp;nbsp; &lt;/b&gt;espera, una vez enviado el comando de medida
de la temperatura o humedad, a que el sensor avise de la finalización del
proceso de medida pasando la línea DATA de “&lt;st1:metricconverter productid=&quot;1”&quot; w:st=&quot;on&quot;&gt;1”&lt;/st1:metricconverter&gt; a “&lt;st1:metricconverter productid=&quot;0”&quot; w:st=&quot;on&quot;&gt;0”&lt;/st1:metricconverter&gt;. &lt;/span&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;Puede durar un máximo de 20/80/320msg. para una medida de
8/12/14 bits.&lt;/span&gt;&lt;span style=&quot;font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-top: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiWfTU9cRPIJiowq_TAQZgm-TlGbAEkIIKPCi76GTSH99soVhd644zV6tnjwQoYqr2dashPDRiO8f-BehcEgo4x24-w02npLtw-SgMKouxrolBaCl487lTp8ulgKezh5qvzkFHiLKobqqM/s1600/secuencia+espera+medida+sht11.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;148&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiWfTU9cRPIJiowq_TAQZgm-TlGbAEkIIKPCi76GTSH99soVhd644zV6tnjwQoYqr2dashPDRiO8f-BehcEgo4x24-w02npLtw-SgMKouxrolBaCl487lTp8ulgKezh5qvzkFHiLKobqqM/s640/secuencia+espera+medida+sht11.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;!--[if gte vml 1]&gt;&lt;v:oval id=&quot;_x0000_s1026&quot;
 style=&#39;position:absolute;margin-left:270pt;margin-top:0;width:162pt;height:93.85pt;
 z-index:1&#39; filled=&quot;f&quot; strokecolor=&quot;#396&quot;/&gt;&lt;![endif]--&gt;&lt;!--[if !vml]--&gt;&lt;span style=&quot;mso-ignore: vglayout; position: relative; z-index: 1;&quot;&gt;&lt;span style=&quot;height: 127px; left: 359px; position: absolute; top: -1px; width: 218px;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #999999; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-ansi-language: EN-GB;&quot;&gt;&lt;!--[if gte vml 1]&gt;&lt;v:shape id=&quot;_x0000_i1029&quot;
 type=&quot;#_x0000_t75&quot; style=&#39;width:424.5pt;height:84pt&#39;&gt;
 &lt;v:imagedata src=&quot;file:///C:\Users\Javier\AppData\Local\Temp\msohtml1\01\clip_image007.jpg&quot;
  o:title=&quot;espera lectura&quot;/&gt;
&lt;/v:shape&gt;&lt;![endif]--&gt;&lt;!--[if !vml]--&gt;&lt;!--[endif]--&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt; text-align: right;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #999999; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-ansi-language: EN-GB;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;b style=&quot;text-align: right;&quot;&gt;&lt;i&gt;&lt;span style=&quot;font-family: &amp;quot;Arial Narrow&amp;quot;; font-size: 8.0pt; mso-bidi-font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;Línea
fina indica su control por el PIC, línea gruesa control por el sensor.&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;/**
Secuencia de espera de medida terminada **/&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;void SHTxx_Espera (void) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
int16 sht_delay; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
output_float(sht_data_pin);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;//línea DATA a
&quot;1&quot;&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
output_low(sht_sck_pin);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;//línea SCK a
&quot;0&quot;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;delay_us(1); &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp; //Espera a que linea DATA pase a
&quot;0&quot; máximo 300msg.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;for(sht_delay=0; sht_delay&amp;lt;30000;
sht_delay++) { &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;//si linea
DATA pasa a &quot;0&quot; =&amp;gt; fin de la medición &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;if (!input(sht_data_pin)) break;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;delay_us(10); &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp; } &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;}&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana;&quot;&gt;Con la&lt;b&gt; &lt;span style=&quot;font-size: x-small;&quot;&gt;SECUENCIA DE LECTURA DEL DATO DE UNA
MEDIDA&lt;/span&gt;, &lt;/b&gt;y tras que el SHTxx haya indicado el fin de una medición, el
microcontrolador reinicia el bus SCK para obtener el dato de la medida. &lt;/span&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;El dato de la medida es almacenado
por lo que el procesador puede hacer otras tareas hasta su lectura.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-top: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin-top: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana;&quot;&gt;La secuencia consiste en:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 5.0pt; margin-left: 36.0pt; margin-right: 0cm; margin-top: 0cm; mso-list: l0 level1 lfo1; tab-stops: list 36.0pt; text-align: justify; text-indent: -18.0pt;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;-&lt;span style=&quot;font-family: &#39;Times New Roman&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;Lectura del byte alto del dato de la medida. Si es
un dato de 8 bits este byte se ignora.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 5.0pt; margin-left: 36.0pt; margin-right: 0cm; margin-top: 0cm; mso-list: l0 level1 lfo1; tab-stops: list 36.0pt; text-align: justify; text-indent: -18.0pt;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;-&lt;span style=&quot;font-family: &#39;Times New Roman&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;El microcontrolador pone la linea DATA a “&lt;st1:metricconverter productid=&quot;0”&quot; w:st=&quot;on&quot;&gt;0”&lt;/st1:metricconverter&gt; como reconocimiento ack.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 5.0pt; margin-left: 36.0pt; margin-right: 0cm; margin-top: 0cm; mso-list: l0 level1 lfo1; tab-stops: list 36.0pt; text-align: justify; text-indent: -18.0pt;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;-&lt;span style=&quot;font-family: &#39;Times New Roman&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;Lectura del byte bajo del dato de la medida. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 5.0pt; margin-left: 36.0pt; margin-right: 0cm; margin-top: 0cm; mso-list: l0 level1 lfo1; tab-stops: list 36.0pt; text-align: justify; text-indent: -18.0pt;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;-&lt;span style=&quot;font-family: &#39;Times New Roman&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;El microcontrolador pone la linea DATA a “&lt;st1:metricconverter productid=&quot;0”&quot; w:st=&quot;on&quot;&gt;0”&lt;/st1:metricconverter&gt; como reconocimiento ack si va
a leer el byte CRC checksum o a “&lt;st1:metricconverter productid=&quot;1”&quot; w:st=&quot;on&quot;&gt;1”&lt;/st1:metricconverter&gt;
para terminar sin lectura de CRC checksum.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 5.0pt; margin-left: 36.0pt; margin-right: 0cm; margin-top: 0cm; mso-list: l0 level1 lfo1; tab-stops: list 36.0pt; text-align: justify; text-indent: -18.0pt;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;-&lt;span style=&quot;font-family: &#39;Times New Roman&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;Lectura del byte del CRC checksum (opcional). &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 5.0pt; margin-left: 36.0pt; margin-right: 0cm; margin-top: 0cm; mso-list: l0 level1 lfo1; tab-stops: list 36.0pt; text-align: justify; text-indent: -18.0pt;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;-&lt;span style=&quot;font-family: &#39;Times New Roman&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;El microcontrolador pone la línea DATA a “&lt;st1:metricconverter productid=&quot;0”&quot; w:st=&quot;on&quot;&gt;0”&lt;/st1:metricconverter&gt; como reconocimiento ack.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-top: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNu9m2aI_eOLNboCY0-PZhh43hk7dBS58hi-8GphsJXPfZL2PyRBnUh-VSH72yDG0utCpYzJsFqQ4xhlxatDe-7aniJ_2psbZHXN0yk79TcwRJKo7knbGCg0FBYgvPSs52c7DYH3N942I/s1600/lectura+dato+sht11.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;90&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNu9m2aI_eOLNboCY0-PZhh43hk7dBS58hi-8GphsJXPfZL2PyRBnUh-VSH72yDG0utCpYzJsFqQ4xhlxatDe-7aniJ_2psbZHXN0yk79TcwRJKo7knbGCg0FBYgvPSs52c7DYH3N942I/s640/lectura+dato+sht11.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;margin-top: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div align=&quot;right&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: right;&quot;&gt;
&lt;b&gt;&lt;i&gt;&lt;span style=&quot;font-family: &amp;quot;Arial Narrow&amp;quot;; font-size: 8.0pt; mso-bidi-font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;Línea
fina indica su control por el PIC, línea gruesa control por el sensor.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-top: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;/**
Secuencia de lectura del dato de la medida **/ &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;int16 SHTxx_Lectura (void) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;
int8 bit; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;
int16 sht_dato = 0; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;
const int16 mascara0 = 0x0000; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;const int16 mascara1 = 0x0001; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp; //guarda byte alto del dato leído en byte
alto de sht_dato bit a bit &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp; for(bit=8;
bit&amp;gt;=1; bit--) { &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;sht_dato =
sht_dato &amp;lt;&amp;lt; 1; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;//siguiente bit pasa a ser MSB&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;output_high(sht_sck_pin);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;//línea SCK a &quot;1&quot;&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
delay_us(1); &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;//si línea DATA es &quot;1&quot;
pone bit corresp&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;ondiente en
sht_dato a &quot;1&quot;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
if (input(sht_data_pin)) sht_dato |= mascara1;&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;//si línea
DATA es &quot;0&quot; pone bit correspondiente en sht_dato a &quot;0&quot;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;else sht_dato |= mascara0; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
output_low(sht_sck_pin);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;//línea SCK a &quot;0&quot;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
delay_us(1); &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp; } &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp; &amp;nbsp;//Envío ack poniendo linea DATA a &quot;0&quot;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;
output_low(sht_data_pin);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;//línea DATA a &quot;0&quot;&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;
delay_us(1); &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;
output_high(sht_sck_pin);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;//línea SCK a &quot;1&quot;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;
delay_us(2); &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;
output_low(sht_sck_pin);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;//línea SCK a &quot;0&quot;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;
delay_us(1); &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;
output_float(sht_data_pin);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;//línea DATA a &quot;1&quot;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp; &amp;nbsp;//guarda byte bajo del dato leído en byte
bajo de sht_dato bit a bit &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp; for(bit=8;
bit&amp;gt;=1; bit--) { &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;sht_dato =
sht_dato &amp;lt;&amp;lt; 1; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;//siguiente
bit pasa a ser MSB&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;output_high(sht_sck_pin);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;//línea SCK a &quot;1&quot;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;delay_us(1); &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //si línea DATA es &quot;1&quot; pone bit
correspondiente en sht_dato a &quot;1&quot;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
if (input(sht_data_pin)) sht_dato |= mascara1;&amp;nbsp; //shift in data bit &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;//si línea
DATA es &quot;0&quot; pone bit correspondiente en sht_dato a &quot;0&quot;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;else sht_dato |= mascara0; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
output_low(sht_sck_pin);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;//línea SCK a &quot;0&quot;&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
delay_us(1); &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp; } &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;
//Envío ack poniendo linea DATA a &quot;1&quot; =&amp;gt; no lectura CRC
checksum&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;output_float(sht_data_pin);&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //línea DATA a &quot;1&quot;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;
delay_us(1); &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;
output_high(sht_sck_pin);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;//línea SCK a &quot;1&quot;&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;
delay_us(2); &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;
output_low(sht_sck_pin);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;//línea SCK a &quot;0&quot;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;
return(sht_dato); &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;}&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: Arial;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana;&quot;&gt;La &lt;b&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;FUNCIÓN DE MEDIDA DE LA VARIABLE&lt;/span&gt;&lt;/b&gt;
ejecuta todas las secuencias necesarias y en el orden correcto para obtener el
valor digital de la humedad o temperatura leídas por el sensor. El proceso
será:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 36.0pt; margin-right: 0cm; margin-top: 0cm; mso-list: l0 level1 lfo1; tab-stops: list 36.0pt; text-align: justify; text-indent: -18.0pt;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;-&lt;span style=&quot;font-family: &#39;Times New Roman&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;Secuencia de inicio de transmisión&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 36.0pt; margin-right: 0cm; margin-top: 0cm; mso-list: l0 level1 lfo1; tab-stops: list 36.0pt; text-align: justify; text-indent: -18.0pt;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;-&lt;span style=&quot;font-family: &#39;Times New Roman&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;Secuencia de envío de comando&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 36.0pt; margin-right: 0cm; margin-top: 0cm; mso-list: l0 level1 lfo1; tab-stops: list 36.0pt; text-align: justify; text-indent: -18.0pt;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;-&lt;span style=&quot;font-family: &#39;Times New Roman&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;Secuencia de espera hasta medición completada&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 36.0pt; margin-right: 0cm; margin-top: 0cm; mso-list: l0 level1 lfo1; tab-stops: list 36.0pt; text-align: justify; text-indent: -18.0pt;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;-&lt;span style=&quot;font-family: &#39;Times New Roman&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;Secuencia de lectura del dato de la medición&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;//** Función
de medida de variable **/ &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;int16 SHTxx_Medida (sht_comando) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;
int1 ack; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;int16 sht_dato; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp; /** secuencia de inicio de transmission **/&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp; SHTxx_InicioTrans ();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp; //envío del commando y lectura del ack &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp; ack = SHTxx_Comando (sht_comando);&amp;nbsp;&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp; if(ack == 1) return;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//si hay error sale de la medida&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp; //espera a que sht termine el cálculo de la
medida &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp; SHTxx_Espera ();&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp; //finalizada la medida, obtiene el valor
digital&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;sht_dato = SHTxx_Lectura ();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;
return(sht_dato); &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;}&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana;&quot;&gt;La &lt;b&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;FUNCIÓN DEL CÁLCULO DE LAS VARIABLES&lt;/span&gt;&lt;/b&gt; obtiene
los valores reales analógicos partiendo de los datos digitales leídos por el
sensor. Para el cálculo se emplean unos coeficientes proporcionados por el
fabricante y que dependen de la resolución (nº de bits) de las medidas
obtenidas.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;SHTxx_calculo (int16 sht_DatoTemperatura,
float &amp;amp;sht_temperatura, int16 sht_DatoHumedad, float &amp;amp;sht_humedad) { &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp; &amp;nbsp;float sht_HumedadLineal;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp; //Cálculo de temperatura en función de la
medida digital del sensor&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp; sht_temperatura = ((float)
sht_DatoTemperatura * d2) + d1; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp; //Cálculo valor lineal humedad&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp; sht_HumedadLineal = (sht_DatoHumedad * c2) +
(sht_DatoHumedad * sht_DatoHumedad * c3) + c1; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp; //Cálculo de la humedad compensada por
temperatura&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;sht_humedad = ((sht_temperatura - 25.0) *
(t1 + (t2 * sht_DatoHumedad))) + sht_HumedadLineal; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;}&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana;&quot;&gt;La &lt;b&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;FUNCIÓN DE
LECTURA DEL REGISTRO DE ESTADO&lt;/span&gt;&lt;/b&gt; obtiene el valor de configuración de dicho
registro. Consistirá en:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-left: 36.0pt; mso-list: l0 level1 lfo1; tab-stops: list 36.0pt; text-align: justify; text-indent: -18.0pt;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;-&lt;span style=&quot;font-family: &#39;Times New Roman&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;Secuencia de inicio de transmisión&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-left: 36.0pt; mso-list: l0 level1 lfo1; tab-stops: list 36.0pt; text-align: justify; text-indent: -18.0pt;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;-&lt;span style=&quot;font-family: &#39;Times New Roman&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;Secuencia de envío de comando&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-left: 36.0pt; mso-list: l0 level1 lfo1; tab-stops: list 36.0pt; text-align: justify; text-indent: -18.0pt;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;-&lt;span style=&quot;font-family: &#39;Times New Roman&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;Secuencia de lectura del registro de estado y
cheksum&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-left: 36.0pt; mso-list: l0 level1 lfo1; tab-stops: list 36.0pt; text-align: justify; text-indent: -18.0pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: Arial;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&lt;b&gt;SHTxx_LECTURA_REGISTRO_ESTADO ()&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;int16 sht_dato; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;//Byte alto = registro estado, byte bajo = ckecksum&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;
int8 sht_checksum;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;//Guardará el
valor del checksum&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;
/** secuencia de inicio de transmission **/&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;
SHTxx_InicioTrans ();&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;
/** Secuencia de envío de comando **/&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp; SHTxx_Comando
(SHTxx_REG_ESTADO_R); &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;//Comando de lectura registro de estado&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;
/** Lectura del registro de estado y checksum **/&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;
sht_dato = SHTxx_Lectura ();&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;
sht_registro = make8(sht_dato,1);&amp;nbsp;
&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;//Byte alto = valor registro de estado&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp; sht_checksum = make8(sht_dato,0);&amp;nbsp; &lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;//Byte
bajo = valor &lt;st1:place w:st=&quot;on&quot;&gt;&lt;st1:state w:st=&quot;on&quot;&gt;del&lt;/st1:state&gt;&lt;/st1:place&gt;
checksum&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp; return
(sht_registro);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;//Devuelve
valor del registro de estado&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&lt;b&gt;}&lt;/b&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: Arial;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana;&quot;&gt;Con la &lt;b&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;FUNCIÓN
DE ESCRITURA DEL REGISTRO DE ESTADO&lt;/span&gt;&lt;/b&gt; se carga el valor de configuración del
sensor. Consistirá en:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-left: 36.0pt; mso-list: l0 level1 lfo1; tab-stops: list 36.0pt; text-align: justify; text-indent: -18.0pt;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;-&lt;span style=&quot;font-family: &#39;Times New Roman&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;Secuencia de inicio de transmisión&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-left: 36.0pt; mso-list: l0 level1 lfo1; tab-stops: list 36.0pt; text-align: justify; text-indent: -18.0pt;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;-&lt;span style=&quot;font-family: &#39;Times New Roman&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;Secuencia de envío de comando&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-left: 36.0pt; mso-list: l0 level1 lfo1; tab-stops: list 36.0pt; text-align: justify; text-indent: -18.0pt;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;-&lt;span style=&quot;font-family: &#39;Times New Roman&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;Secuencia de escritura del valor del registro de
estado &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-left: 36.0pt; mso-list: l0 level1 lfo1; tab-stops: list 36.0pt; text-align: justify; text-indent: -18.0pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: Arial;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;SHTxx_ESCRITURA_REGISTRO_ESTADO
(sht_registro)&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;/** secuencia de inicio de transmisión **/&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp; SHTxx_InicioTrans ();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp; /** Secuencia de envío de comando **/&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp; SHTxx_Comando (SHTxx_REG_ESTADO_W); &lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;//Comando de esritura registro de estado&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp; SHTxx_Comando (sht_registro);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;//Argumento
a cargar en el registro de estado&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;}&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana;&quot;&gt;Con la &lt;b&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;FUNCIÓN DE RESET DE SOFT&lt;/span&gt;&lt;/b&gt; se envía el comando que inicializa el
valor del registro a sus valores por defecto (0x00).&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;void SHTxx_Reset_Soft (void) { &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;SHTxx_Reset();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;//Reset comunicación &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp; SHTxx_Comando(SHTxx_SOFT_RESET); &lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;//Comando reset=&amp;gt;Reg.Estado ,valores defecto &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp; delay_ms(15);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=&quot;color: #999999; font-family: &#39;Courier New&#39;;&quot;&gt;//Espera 15 mseg.&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;b&gt;&lt;span style=&quot;color: teal; font-family: &#39;Courier New&#39;;&quot;&gt;}&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=5250193391449144895#&quot; onclick=&quot;Effect.toggle(&amp;quot;expandir1&amp;quot;,&amp;quot;slide&amp;quot;); return false&quot;&gt;[+/-] Ver / Ocultar librería C completa&lt;/a&gt;&lt;br /&gt;
&lt;div id=&quot;expandir1&quot; style=&quot;display: none;&quot;&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;////////////////////////////////////////////////////////////////////////////////&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;// &amp;nbsp; &amp;nbsp;Librería C para el control de sensores de Temperatura y Humedad: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; SHT10, SHT11, SHT15, SHT71, SHT75 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;// Debe cargarse este archivo desde la cabecera del programa principal con: &amp;nbsp; // &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; #include &amp;lt;SHTxx.RyP.c&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;// * Inicialización del sensor mediante la función: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; SHTxx_init (); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;// * Obtención de la medida de humedad y temperatura mediante la función: &amp;nbsp; &amp;nbsp; //&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; SHTxx (sht_temperatura, sht_humedad); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;// &amp;nbsp; En las variables sht_temperatura y sht_humedad se obtienen los valores &amp;nbsp; //&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;// &amp;nbsp; reales de temperatura y humedad medidos. &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;// * Escritura del valor del registro de estado mediante la función: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; SHTxx_ESCRITURA_REGISTRO_ESTADO (sht_registro); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;// &amp;nbsp;sht_registro deberá contener el valor a cargar en el registro (defecto 0) //&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;// &amp;nbsp; &amp;nbsp;bit0 = 0 =&amp;gt; Resolución 14bits Temperatura y 12 bits Humedad &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;// &amp;nbsp; &amp;nbsp;bit0 = 1 =&amp;gt; Resolución 12bits Temperatura y &amp;nbsp;8 bits Humedad &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;// &amp;nbsp; &amp;nbsp;bit1 = 0 =&amp;gt; Dato de calibración no se carga antes de cada medida &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;// &amp;nbsp; &amp;nbsp;bit1 = 1 =&amp;gt; Dato de calibración se carga antes de cada medida &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;// &amp;nbsp; &amp;nbsp;bit2 = 0 =&amp;gt; Calefactor interno OFF &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;// &amp;nbsp; &amp;nbsp;bit2 = 1 =&amp;gt; Calefactor interno ON &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;// &amp;nbsp; &amp;nbsp;bit6 = 0 =&amp;gt; Detección baja tensión Vcc &amp;gt; 2.47V (bit de solo lectura) &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;// &amp;nbsp; &amp;nbsp;bit6 = 1 =&amp;gt; Detección baja tensión Vcc &amp;lt; 2.47V (bit de solo lectura) &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;// * Obtención del valor del registro de estado mediante la función: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; SHTxx_LECTURA_REGISTRO_ESTADO (sht_registro); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;// &amp;nbsp; sht_registro devolverá el valor del registro de estado &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;// * Reset del soft del sensor mediante la función: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; SHTxx_Reset_Soft (); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;// &amp;nbsp; &amp;nbsp; (Registro de estado a sus valores por defecto) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; http://robotypic.blogspot.com/ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;////////////////////////////////////////////////////////////////////////////////&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;/**************** &amp;nbsp;Definición de pines del bus serie **************************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;#define sht_data_pin &amp;nbsp; PIN_A4&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;#define sht_sck_pin &amp;nbsp; &amp;nbsp;PIN_A3&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;/** Comandos del SHTxx &amp;nbsp;**/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;#define SHTxx_REG_ESTADO_W &amp;nbsp; &amp;nbsp;0x06 &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Comando escritura en registro de estado&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;#define SHTxx_REG_ESTADO_R &amp;nbsp; &amp;nbsp;0x07 &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Comando lectura de registro de estado&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;#define SHTxx_COMANDO_TEMP &amp;nbsp; &amp;nbsp;0x03 &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Comando medida de temperatura&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;#define SHTxx_COMANDO_HUM &amp;nbsp; &amp;nbsp; 0x05 &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Comando medida de humedad&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;#define SHTxx_SOFT_RESET &amp;nbsp; &amp;nbsp; &amp;nbsp;0x1E &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Comando reset de soft&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;/***** Variables globales para lectura del valor de temperatura y humedad *****/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;float sht_temperatura; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Guardará el valor real de temperatura medida&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;float sht_humedad; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Guardará el valor real de humedad medida&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;int8 sht_registro; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Guardará el valor del registro de estado&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;/******************************************************************************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;/**************** SECUENCIA DE INICIO DE TRANSMISIÓN **************************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; _____ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ________&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;// DATA: &amp;nbsp; &amp;nbsp; &amp;nbsp;|_______|&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ___ &amp;nbsp; &amp;nbsp; ___&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;// SCK : ___| &amp;nbsp; |___| &amp;nbsp; |______&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;void SHTxx_InicioTrans (void) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//DATA a &quot;0&quot; con SCK a &quot;1&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;output_float(sht_data_pin); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//línea DATA a &quot;1&quot;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;output_low(sht_sck_pin); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//línea SCK a &quot;0&quot;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;delay_us(1);&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;output_high(sht_sck_pin); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//línea SCK a &quot;1&quot;&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;delay_us(1);&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;output_low(sht_data_pin); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//línea DATA a &quot;0&quot;&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;delay_us(1);&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//SCK a &quot;0&quot; sin cambiar DATA &quot;0&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;output_low(sht_sck_pin); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//línea SCK a &quot;0&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;delay_us(2);&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//SCK a &quot;1&quot; sin cambiar DATA &quot;0&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;output_high(sht_sck_pin); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//línea SCK a &quot;1&quot;&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;delay_us(1);&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//DATA a &quot;1&quot; con SCK a &quot;1&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;output_float(sht_data_pin); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//línea DATA a &quot;1&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;delay_us(1);&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;output_low(sht_sck_pin); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//línea SCK a &quot;0&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;/******************************************************************************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;/*********************** SECUENCIA DE RESET ***********************************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; _____________________________________________________ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ________&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;// DATA: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|_______|&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;_ &amp;nbsp; &amp;nbsp;_ &amp;nbsp; &amp;nbsp;_ &amp;nbsp; &amp;nbsp;_ &amp;nbsp; &amp;nbsp;_ &amp;nbsp; &amp;nbsp;_ &amp;nbsp; &amp;nbsp;_ &amp;nbsp; &amp;nbsp;_ &amp;nbsp; &amp;nbsp;_ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;___ &amp;nbsp; &amp;nbsp; ___&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;// SCK : __| |__| |__| |__| |__| |__| |__| |__| |__| |______| &amp;nbsp; |___| &amp;nbsp; |______&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;void SHTxx_Reset (void) {&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;int i;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//inicio de secuencia con SCK a &quot;0&quot; y DATA a &quot;1&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;output_float(sht_data_pin); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//línea DATA a &quot;1&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;output_low(sht_sck_pin); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//línea SCK a &quot;0&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;delay_us(2);&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//conmuta SCK 9 veces con DATA a &quot;1&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;for(i=0; i&amp;lt;9; i++) {&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; output_high(sht_sck_pin); &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; delay_us(2);&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; output_low(sht_sck_pin);&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; delay_us(2);&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;}&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;// secuencia de inicio de transmisión&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;SHTxx_InicioTrans ();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;/******************************************************************************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;/******************* SECUENCIA DE ENVIO DE COMANDO ****************************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; __ &amp;nbsp; __ &amp;nbsp; __ &amp;nbsp; __ &amp;nbsp; __ &amp;nbsp; __ &amp;nbsp; __ &amp;nbsp; __ &amp;nbsp; ___&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;// DATA: ___|A2|_|A1|_|A0|_|C4|_|C3|_|C2|_|C1|_|C0|_|ack|_&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; __ &amp;nbsp; __ &amp;nbsp; __ &amp;nbsp; __ &amp;nbsp; __ &amp;nbsp; __ &amp;nbsp; __ &amp;nbsp; __ &amp;nbsp; ___ &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;// SCK : ___| &amp;nbsp;|_| &amp;nbsp;|_| &amp;nbsp;|_| &amp;nbsp;|_| &amp;nbsp;|_| &amp;nbsp;|_| &amp;nbsp;|_| &amp;nbsp;|_| &amp;nbsp; |_&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;int1 SHTxx_Comando (int8 sht_comando) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;int8 bit;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;int8 mascara = 0x80;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;int1 ack;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;delay_us(4);&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Salida del comando bit a bit&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;for(bit=8; bit&amp;gt;=1; bit--) {&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; output_low(sht_sck_pin); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//línea SCK a &quot;0&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; //Línea DATA a &quot;1&quot; si MSB es &quot;1&quot;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; if((sht_comando &amp;amp; mascara) &amp;gt; 0) output_float(sht_data_pin); &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Línea DATA a &quot;0&quot; si MSB es &quot;0&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; else output_low(sht_data_pin); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; delay_us(1);&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; output_high(sht_sck_pin); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//línea SCK a &quot;1&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; delay_us(1);&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; mascara = mascara &amp;gt;&amp;gt; 1; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//siguiente bit pasa a ser MSB&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;}&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;/** lectura del ack **/&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;output_low(sht_sck_pin); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//línea SCK a &quot;0&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;delay_us(1);&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;ack = input(sht_data_pin); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//lectura del ack&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;output_high(sht_sck_pin); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//línea SCK a &quot;1&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;delay_us(1);&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;output_low(sht_sck_pin); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//línea SCK a &quot;0&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;return(ack);&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;/******************************************************************************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;/**************** SECUENCIA DE ESPERA DE MEDIDA TERMINADA *********************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;void SHTxx_Espera (void) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; int16 sht_delay;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp; output_float(sht_data_pin); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt; //línea DATA a &quot;1&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp; output_low(sht_sck_pin); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//línea SCK a &quot;0&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; delay_us(1);&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Espera a que linea DATA pase a &quot;0&quot; máximo 300msg.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;for(sht_delay=0; sht_delay&amp;lt;30000; sht_delay++) {&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//si linea DATA pasa a &quot;0&quot; =&amp;gt; fin de la medición&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; if (!input(sht_data_pin)) break; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; delay_us(10);&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;}&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;/******************************************************************************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;/*************** SECUENCIA DE LECTURA DEL DATO DE LA MEDIDA *******************/&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; _ &amp;nbsp; _ &amp;nbsp; _ &amp;nbsp; _ &amp;nbsp; _ &amp;nbsp; _ &amp;nbsp; _ &amp;nbsp; _ &amp;nbsp; ___ &amp;nbsp; _ &amp;nbsp; _ &amp;nbsp; _ &amp;nbsp; _ &amp;nbsp; _ &amp;nbsp; _ &amp;nbsp; _ &amp;nbsp; _ &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;//SCK:__| |_| |_| |_| |_| |_| |_| |_| |_|ack|_| |_| |_| |_| |_| |_| |_| |_| |__&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;// &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; |&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;// &amp;nbsp; &amp;nbsp; |-- idle bits &amp;nbsp;-|Msb --------- &amp;nbsp;12 bit Humidity Data ------------ &amp;nbsp;Lsb|&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;// &amp;nbsp; &amp;nbsp; | _ &amp;nbsp; _ &amp;nbsp; _ &amp;nbsp; _ | _ &amp;nbsp; _ &amp;nbsp; _ &amp;nbsp; _ &amp;nbsp; ___ &amp;nbsp; _ &amp;nbsp; _ &amp;nbsp; _ &amp;nbsp; _ &amp;nbsp; _ &amp;nbsp; _ &amp;nbsp; _ &amp;nbsp; _ |&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;//DATA:_|F|_|E|_|D|_|C|_|B|_|A|_|9|_|8|_|ack|_|7|_|6|_|5|_|4|_|3|_|2|_|1|_|0|__&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;int16 SHTxx_Lectura (void) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;int8 bit;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;int16 sht_dato = 0;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;const int16 mascara0 = 0x0000;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;const int16 mascara1 = 0x0001;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//guarda byte alto del dato leído en byte alto de sht_dato bit a bit&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;for(bit=8; bit&amp;gt;=1; bit--) {&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sht_dato = sht_dato &amp;lt;&amp;lt; 1; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//siguiente bit pasa a ser MSB&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; output_high(sht_sck_pin); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//línea SCK a &quot;1&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; delay_us(1);&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//si línea DATA es &quot;1&quot; pone bit correspondiente en sht_dato a &quot;1&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; if (input(sht_data_pin)) sht_dato |= mascara1; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//si línea DATA es &quot;0&quot; pone bit correspondiente en sht_dato a &quot;0&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; else sht_dato |= mascara0;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; output_low(sht_sck_pin); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//línea SCK a &quot;0&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; delay_us(1);&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;}&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Envío ack poniendo linea DATA a &quot;0&quot;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;output_low(sht_data_pin); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//línea DATA a &quot;0&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;delay_us(1);&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;output_high(sht_sck_pin); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//línea SCK a &quot;1&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;delay_us(2);&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;output_low(sht_sck_pin); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//línea SCK a &quot;0&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;delay_us(1);&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;output_float(sht_data_pin); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//línea DATA a &quot;1&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;//guarda byte bajo del dato leído en byte bajo de sht_dato bit a bit&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;for(bit=8; bit&amp;gt;=1; bit--) {&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sht_dato = sht_dato &amp;lt;&amp;lt; 1; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//siguiente bit pasa a ser MSB&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; output_high(sht_sck_pin); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//línea SCK a &quot;1&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; delay_us(1);&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//si línea DATA es &quot;1&quot; pone bit correspondiente en sht_dato a &quot;1&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; if (input(sht_data_pin)) sht_dato |= mascara1; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//si línea DATA es &quot;0&quot; pone bit correspondiente en sht_dato a &quot;0&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; else sht_dato |= mascara0;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; output_low(sht_sck_pin); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//línea SCK a &quot;0&quot;&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt; &amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; delay_us(1);&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;}&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Envío ack poniendo linea DATA a &quot;1&quot; =&amp;gt; no lectura CRC checksum&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;output_float(sht_data_pin); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//línea DATA a &quot;1&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;delay_us(1);&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;output_high(sht_sck_pin); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//línea SCK a &quot;1&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;delay_us(2);&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;output_low(sht_sck_pin); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//línea SCK a &quot;0&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;return(sht_dato);&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;/******************************************************************************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;/******************* FUNCIÓN DE MEDIDA DE VARIABLE ****************************/&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;int16 SHTxx_Medida (sht_comando) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;int1 ack;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;int16 sht_dato;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;/** secuencia de inicio de transmisión **/&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;SHTxx_InicioTrans ();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//envío del commando y lectura del ack&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;ack = SHTxx_Comando (sht_comando); &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;if(ack == 1) return; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//si hay error sale de la medida&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp; &amp;nbsp;//espera a que sht termine el cálculo de la medida&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;SHTxx_Espera (); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//finalizada la medida, obtiene el valor digital&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;sht_dato = SHTxx_Lectura (); &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;return(sht_dato);&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;/******************************************************************************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;/***************** FUNCIÓN DE RESET DE LA INTERFACE ***************************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;void SHTxx_Reset_Soft (void) {&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;SHTxx_Reset(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Reset comunicación&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;SHTxx_Comando(SHTxx_SOFT_RESET); &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Comando reset=&amp;gt;Reg.Estado ,valores defecto&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;delay_ms(15); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Espera 15 mseg.&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt; &amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;}&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;/******************************************************************************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;/********* FUNCIÓN PARA CÁLCULO DE TEMPERATURA Y HUMEDAD REALES ***************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;SHTxx_calculo (int16 sht_DatoTemperatura, float &amp;amp;sht_temperatura, int16 sht_DatoHumedad, float &amp;amp;sht_humedad) {&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;float sht_HumedadLineal;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;/** Coeficientes para cálculo de la Temperatura para 14 bits y Vcc=5V **/&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;float d1 = -40.1;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;float d2 = 0.01;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;/** Coeficientes de conversión para cálculo de la Humedad para 12 bits **/&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;float c1 = -2.0468;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;float c2 = 0.0367;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;float c3 = -0.0000015955;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;/**Coeficientes para compensación de Temperatura de la Humedad para 12 bits**/&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;float t1 = 0.01;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;float t2 = 0.00008;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//En el caso de emplear resolución Temperatura 12 bits y humedad 8 bits...&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;if (sht_registro &amp;amp; 0b00000001){&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;/** Coeficientes para cálculo de la Temperatura para 12 bits y Vcc=5V **/&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; d1 = -40.1;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; d2 = 0.04;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;/** Coeficientes de conversión para cálculo de la Humedad para 8 bits **/&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; c1 = -2.0468;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; c2 = 0.5872;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; c3 = -0.00040845;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;/**Coeficientes para compensación de Temperatura de la Humedad para 8 bits**/&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; t1 = 0.01;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; t2 = 0.00128;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Cálculo de temperatura en función de la medida digital del sensor&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt; &amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;sht_temperatura = ((float) sht_DatoTemperatura * d2) + d1;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Cálculo valor lineal humedad&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;sht_HumedadLineal = (sht_DatoHumedad * c2) + (sht_DatoHumedad * sht_DatoHumedad * c3) + c1;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Cálculo de la humedad compensada por temperatura&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;sht_humedad = ((sht_temperatura - 25.0) * (t1 + (t2 * sht_DatoHumedad))) + sht_HumedadLineal;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Evita mostrar valores fuera de rango&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;if (sht_humedad &amp;gt;= 100) sht_humedad = 100;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;if(sht_humedad&amp;lt;0.1)sht_humedad=0.1;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;}&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;/******************************************************************************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;/********** FUNCIÓN PARA MEDIDA Y CÁLCULO DE TEMPERATURA Y HUMEDAD ************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;void SHTxx (float &amp;amp;sht_temperatura, float &amp;amp;sht_humedad) {&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;int16 sht_DatoTemperatura; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Dato de Temperatura obtenido por el SHTxx&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;int16 sht_DatoHumedad; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Dato de Humedad obtenido por el SHTxx&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;sht_DatoTemperatura = SHTxx_Medida(SHTxx_COMANDO_TEMP); &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Medida de la temperatura&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;sht_DatoHumedad = SHTxx_Medida(SHTxx_COMANDO_HUM); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Medida de la humedad&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;SHTxx_calculo (sht_DatoTemperatura, &amp;nbsp;sht_temperatura, sht_DatoHumedad, sht_humedad); &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//calculate temp &amp;amp; RH&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;}&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;/******************************************************************************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;/**************** FUNCIÓN PARA LECTURA DEL REGISTRO DE ESTADO *****************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;SHTxx_LECTURA_REGISTRO_ESTADO () &amp;nbsp;{&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;int16 sht_dato; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Byte alto = registro estado, byte bajo = ckecksum&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;int8 sht_checksum; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Guardará el valor del checksum&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;/** secuencia de inicio de transmission **/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;SHTxx_InicioTrans ();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;/** Secuencia de envío de comando **/&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;SHTxx_Comando (SHTxx_REG_ESTADO_R); &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Comando de lectura registro de estado&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;/** Lectura del registro de estado y checksum **/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;sht_dato = SHTxx_Lectura ();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;sht_registro = make8(sht_dato,1); &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Byte alto = valor registro de estado&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;sht_checksum = make8(sht_dato,0); &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Byte bajo = valor del checksum&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;return (sht_registro); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Devuelve valor del registro de estado&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;/******************************************************************************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;/*************** FUNCIÓN PARA ESCRITURA DEL REGISTRO DE ESTADO ****************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;SHTxx_ESCRITURA_REGISTRO_ESTADO (sht_registro) &amp;nbsp;{&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;/** secuencia de inicio de transmisión **/&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;SHTxx_InicioTrans ();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;/** Secuencia de envío de comando **/&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;SHTxx_Comando (SHTxx_REG_ESTADO_W); &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Comando de esritura registro de estado&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;SHTxx_Comando (sht_registro); &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Argumento a cargar en el registro de estado&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;/******************************************************************************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;/******************** FUNCIÓN DE INICIALIZACIÓN DEL SHTxx *********************/&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;void SHTxx_init (void){&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;SHTxx_Reset(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//reset SHT&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;delay_ms(20); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;/******************************************************************************/&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: large;&quot;&gt;Artículo relacionado&amp;gt;&amp;gt;&amp;nbsp;&lt;a href=&quot;http://robotypic.blogspot.com.es/2013/09/SHT11conPIC.html&quot; target=&quot;_blank&quot;&gt;Sensor SHT11 con PIC&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;a href=&quot;http://dfiles.eu/files/6e9pizraw&quot; target=&quot;_blank&quot;&gt;Descargar archivos &quot;SHT11 con PIC + Librerías&quot;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://robotypic.blogspot.com/feeds/718089195361809802/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5250193391449144895/718089195361809802?isPopup=true' title='3 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5250193391449144895/posts/default/718089195361809802'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5250193391449144895/posts/default/718089195361809802'/><link rel='alternate' type='text/html' href='http://robotypic.blogspot.com/2013/09/Libreria-C-para-SHT11.html' title='Librería C para sensor SHT11 con PIC'/><author><name>Robotypic</name><uri>http://www.blogger.com/profile/16455462312458405515</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghN3wm5O-5rh8CIfpSj2mw63RGc1unVQWPZpuIqjcmOxFOhhzuVBu15M3FmIHDpNZ4q9biTQlVgAhmz13VPdDdj2TPfROXiweX0kI-PAIp4S2ulUsNPjXtiJOS_9hmQxOFbM8IK2vwkzA/s72-c/sht11_RobotyPic.jpg" height="72" width="72"/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5250193391449144895.post-6031503781508955732</id><published>2013-09-14T23:13:00.000+02:00</published><updated>2018-08-14T11:59:58.597+02:00</updated><title type='text'>Sensor de Temperatura y Humedad SHT11 con PIC</title><content type='html'>&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEixIlvnkL8zD0Pk_WQ3l0eIO3_x0_ABb_HhCR0G6PjAvib2ZNgtjBd30AaDTkEfMACgA5cQwzhcpyPtueAc6XunENrJGxrE7lVYMjy1OFuz2ZVNjKWh8cLeQWs1kYqnLkpprRjn3m9r5Sk/s1600/sht11_RobotyPic.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;200&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEixIlvnkL8zD0Pk_WQ3l0eIO3_x0_ABb_HhCR0G6PjAvib2ZNgtjBd30AaDTkEfMACgA5cQwzhcpyPtueAc6XunENrJGxrE7lVYMjy1OFuz2ZVNjKWh8cLeQWs1kYqnLkpprRjn3m9r5Sk/s200/sht11_RobotyPic.jpg&quot; width=&quot;173&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;;&quot;&gt;En realidad, lo aquí documentado es válido para toda
la gama de sensores con comunicación serie: SHT10, SHT11, SHT15, SHT71 y SHT75.&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div align=&quot;center&quot;&gt;
&lt;table border=&quot;1&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;MsoTableGrid&quot; style=&quot;border-collapse: collapse; border: none; mso-border-alt: solid windowtext 1.0pt; mso-border-insideh: 1.0pt solid windowtext; mso-border-insidev: 1.0pt solid windowtext; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt; mso-yfti-tbllook: 480;&quot;&gt;
 &lt;tbody&gt;
&lt;tr style=&quot;height: 19.85pt; mso-yfti-firstrow: yes; mso-yfti-irow: 0;&quot;&gt;
  &lt;td style=&quot;background: #E0F8EC; border: solid windowtext 1.0pt; height: 19.85pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 31.0pt;&quot; width=&quot;41&quot;&gt;&lt;div align=&quot;center&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: center;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 10.0pt;&quot;&gt;Pin&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;background: #E0F8EC; border-left: none; border: solid windowtext 1.0pt; height: 19.85pt; mso-border-left-alt: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 90.85pt;&quot; width=&quot;121&quot;&gt;&lt;div align=&quot;center&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: center;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 10.0pt;&quot;&gt;Denominación&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;background: #E0F8EC; border-left: none; border: solid windowtext 1.0pt; height: 19.85pt; mso-border-left-alt: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 134.6pt;&quot; width=&quot;179&quot;&gt;&lt;div align=&quot;center&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: center;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 10.0pt;&quot;&gt;Comentarios&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td rowspan=&quot;6&quot; style=&quot;border-left: none; border: solid windowtext 1.0pt; height: 19.85pt; mso-border-left-alt: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 117.0pt;&quot; valign=&quot;top&quot; width=&quot;156&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi7J5EtwH3Vo6w41wquwvhe6HPr1vtybHiqRfo1RRRQzUZaF4bR4nTg9Peq2K41F64rpJQiwqVnbjc4-cTbpDgGFeX-tXpgJyqSIuUe0RTEuZq5la0saxAW-OqoHeFin2LZhg8k1NDwY98/s1600/sht11+patillas.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;150&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi7J5EtwH3Vo6w41wquwvhe6HPr1vtybHiqRfo1RRRQzUZaF4bR4nTg9Peq2K41F64rpJQiwqVnbjc4-cTbpDgGFeX-tXpgJyqSIuUe0RTEuZq5la0saxAW-OqoHeFin2LZhg8k1NDwY98/s200/sht11+patillas.jpg&quot; width=&quot;140&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr style=&quot;height: 19.85pt; mso-yfti-irow: 1;&quot;&gt;
  &lt;td style=&quot;border-top: none; border: solid windowtext 1.0pt; height: 19.85pt; mso-border-top-alt: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 31.0pt;&quot; width=&quot;41&quot;&gt;&lt;div align=&quot;center&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 10.0pt;&quot;&gt;1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 19.85pt; mso-border-left-alt: solid windowtext 1.0pt; mso-border-top-alt: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 90.85pt;&quot; width=&quot;121&quot;&gt;&lt;div align=&quot;center&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 10.0pt;&quot;&gt;GND&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 19.85pt; mso-border-left-alt: solid windowtext 1.0pt; mso-border-top-alt: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 134.6pt;&quot; width=&quot;179&quot;&gt;&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 10.0pt;&quot;&gt;Masa&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr style=&quot;height: 19.85pt; mso-yfti-irow: 2;&quot;&gt;
  &lt;td style=&quot;border-top: none; border: solid windowtext 1.0pt; height: 19.85pt; mso-border-top-alt: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 31.0pt;&quot; width=&quot;41&quot;&gt;&lt;div align=&quot;center&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 10.0pt;&quot;&gt;2&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 19.85pt; mso-border-left-alt: solid windowtext 1.0pt; mso-border-top-alt: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 90.85pt;&quot; width=&quot;121&quot;&gt;&lt;div align=&quot;center&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 10.0pt;&quot;&gt;DATA&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 19.85pt; mso-border-left-alt: solid windowtext 1.0pt; mso-border-top-alt: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 134.6pt;&quot; width=&quot;179&quot;&gt;&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 10.0pt;&quot;&gt;Entrada-Salida de datos&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr style=&quot;height: 19.85pt; mso-yfti-irow: 3;&quot;&gt;
  &lt;td style=&quot;border-top: none; border: solid windowtext 1.0pt; height: 19.85pt; mso-border-top-alt: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 31.0pt;&quot; width=&quot;41&quot;&gt;&lt;div align=&quot;center&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 10.0pt;&quot;&gt;3&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 19.85pt; mso-border-left-alt: solid windowtext 1.0pt; mso-border-top-alt: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 90.85pt;&quot; width=&quot;121&quot;&gt;&lt;div align=&quot;center&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 10.0pt;&quot;&gt;SCK&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 19.85pt; mso-border-left-alt: solid windowtext 1.0pt; mso-border-top-alt: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 134.6pt;&quot; width=&quot;179&quot;&gt;&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 10.0pt;&quot;&gt;Entrada señal de reloj&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr style=&quot;height: 19.85pt; mso-yfti-irow: 4;&quot;&gt;
  &lt;td style=&quot;border-top: none; border: solid windowtext 1.0pt; height: 19.85pt; mso-border-top-alt: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 31.0pt;&quot; width=&quot;41&quot;&gt;&lt;div align=&quot;center&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 10.0pt;&quot;&gt;4&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 19.85pt; mso-border-left-alt: solid windowtext 1.0pt; mso-border-top-alt: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 90.85pt;&quot; width=&quot;121&quot;&gt;&lt;div align=&quot;center&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 10.0pt;&quot;&gt;Vcc&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 19.85pt; mso-border-left-alt: solid windowtext 1.0pt; mso-border-top-alt: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 134.6pt;&quot; width=&quot;179&quot;&gt;&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 10.0pt;&quot;&gt;Alimentación (5V)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr style=&quot;height: 19.85pt; mso-yfti-irow: 5; mso-yfti-lastrow: yes;&quot;&gt;
  &lt;td style=&quot;border-top: none; border: solid windowtext 1.0pt; height: 19.85pt; mso-border-top-alt: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 31.0pt;&quot; width=&quot;41&quot;&gt;&lt;div align=&quot;center&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 10.0pt;&quot;&gt;NC&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 19.85pt; mso-border-left-alt: solid windowtext 1.0pt; mso-border-top-alt: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 90.85pt;&quot; width=&quot;121&quot;&gt;&lt;div align=&quot;center&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 10.0pt;&quot;&gt;NC&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 19.85pt; mso-border-left-alt: solid windowtext 1.0pt; mso-border-top-alt: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 134.6pt;&quot; width=&quot;179&quot;&gt;&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 10.0pt;&quot;&gt;No conectado&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;;&quot;&gt;Se ha desarrollado una librería para el control de este tipo de sensores&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;font-family: Verdana;&quot;&gt;&lt;i&gt;&amp;lt;SHTxx_RyP.c&amp;gt;.&lt;/i&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;;&quot;&gt;&amp;nbsp;Su documentación en detalle puede verse en el artículo &quot;&lt;i&gt;Librería C para sensor SHT11&lt;/i&gt;&quot;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;;&quot;&gt;.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;;&quot;&gt;Aunque el sensor se puede alimentar con un rango de tensiones de 2.4v a 5.5v, la exactitud del valor de la medida de los valores ambientales dependerán de dicho valor. La librería c está desarrollada para una tensión de alimentación de 5v. Otros valores diferentes a éste pueden provocar errores en la exactitud de la medida de las variables ambientales.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;;&quot;&gt;Se debe colocar un condensador de desacoplo de 100nF entre los pines de alimentación y colocado lo mas cercano posible a estos en el sensor. La línea DATA también requiere de una resistencia pull up de 10k.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSjvD-f50vrO4bS01QolXZnuZEwau7U-tpWlwyOm4uKaKzOK0FG6Gbc3-1wGzO29jhOmjPfKVj9qdoWMgLybnNXB-lFIbhjRJGUGU8GWw7MRjpxeTR8eV4_ISg81GkzSvbp9QLaZ6qGoE/s1600/Esquema+SHT11+con+PIC.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;490&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSjvD-f50vrO4bS01QolXZnuZEwau7U-tpWlwyOm4uKaKzOK0FG6Gbc3-1wGzO29jhOmjPfKVj9qdoWMgLybnNXB-lFIbhjRJGUGU8GWw7MRjpxeTR8eV4_ISg81GkzSvbp9QLaZ6qGoE/s640/Esquema+SHT11+con+PIC.jpg&quot; width=&quot;590&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;;&quot;&gt;En la cabecera del programa habrá que llamarla
mediante la directiva:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt; text-align: left;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: teal; font-family: &amp;quot;courier new&amp;quot;;&quot;&gt;#include
&amp;lt;SHTxx_RyP.c&amp;gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;En el caso del empleo de la versión v3 o v4 del sensor
SHT71 o SHT75, la librería C a emplear será &lt;b&gt;&lt;i&gt;&amp;lt;SHT7xv3_RyP.c&amp;gt;&lt;/i&gt;&lt;/b&gt; que contiene
los coeficientes de cálculo adecuados para esas versiones.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;La comunicación entre el PIC y el sensor es mediante
un protocolo serie (no es válido un protocolo I2C). Los pines del PIC configurados para dicha comunicación son
el RA4 para la línea DATA (Datos) y el RA3 para la línea SCK (Reloj), pero
pueden ser sustituidos por los deseados modificando su definición en la
cabecera de la librería C.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt; text-align: left;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot;;&quot;&gt;/*************&amp;nbsp; Definición de pines del bus serie
**************/&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt; text-align: left;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &amp;quot;courier new&amp;quot;;&quot;&gt;#define sht_data_pin&amp;nbsp;&amp;nbsp; PIN_A4&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt; text-align: left;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: teal; font-family: &amp;quot;courier new&amp;quot;;&quot;&gt;#define sht_sck_pin&amp;nbsp;&amp;nbsp;&amp;nbsp; PIN_A3&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Cargada la librería C para el sensor, y antes de
cualquier otra llamada al mismo, habrá que inicializarlo:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt; text-align: left;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: teal; font-family: &amp;quot;courier new&amp;quot;;&quot;&gt;SHTxx_init();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot;;&quot;&gt;//Inicialización
del SHT11&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=&quot;color: teal; font-family: &amp;quot;courier new&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;;&quot;&gt;Para leer los valores de las medidas ambientales de Temperatura y Humedad, se llama a la función:&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0cm;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid rgb(224, 248, 236); padding: 5px;&quot;&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt; text-align: left;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot;;&quot;&gt;/** Llamada a la función de lectura de Temperatura y Humedad **/&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: teal; font-family: &amp;quot;courier new&amp;quot;;&quot;&gt;SHTxx (sht_temperatura, sht_humedad);&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin: 0cm;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;;&quot;&gt;Nos devolverá en las variables&amp;nbsp;&lt;b&gt;&lt;i&gt;sht_temperatura&lt;/i&gt;&lt;/b&gt;&amp;nbsp;y&amp;nbsp;&lt;b&gt;&lt;i&gt;sht_humedad&lt;/i&gt;&lt;/b&gt;&amp;nbsp;los valores de temperatura y humedad respectivamente.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;;&quot;&gt;Por defecto, el Registro de Estado se carga con la
configuración 0x00. Es decir, emplea una resolución de 14 bits para la lectura
digital de la Temperatura, 12 bits de resolución para la lectura digital de la
humedad y se deja apagado el calefactor interno del sensor. Si se desea cambiar
esta configuración, se deberá llamar a la función:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt; text-align: left;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: teal; font-family: &amp;quot;courier new&amp;quot;;&quot;&gt;SHTxx_ESCRITURA_REGISTRO_ESTADO
(sht_registro);&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;;&quot;&gt;Donde&amp;nbsp; &lt;/span&gt;&lt;b style=&quot;font-family: Verdana;&quot;&gt;&lt;i&gt;sht_registro&lt;/i&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;;&quot;&gt; deberá contener el
valor a cargar en el Registro de Estado en base a los bits que se desee
activar:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div align=&quot;center&quot;&gt;
&lt;table border=&quot;1&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;MsoTableGrid&quot; style=&quot;border-collapse: collapse; border: none; mso-border-alt: solid windowtext 1.0pt; mso-border-insideh: 1.0pt solid windowtext; mso-border-insidev: 1.0pt solid windowtext; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt; mso-yfti-tbllook: 480;&quot;&gt;
 &lt;tbody&gt;
&lt;tr&gt;
  &lt;td style=&quot;background: #E0F8EC; border: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 26.4pt;&quot; width=&quot;35&quot;&gt;&lt;div align=&quot;center&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: center;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 10.0pt;&quot;&gt;Bit&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;background: #E0F8EC; border-left: none; border: solid windowtext 1.0pt; mso-border-left-alt: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 34.9pt;&quot; width=&quot;47&quot;&gt;&lt;div align=&quot;center&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: center;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 10.0pt;&quot;&gt;Tipo&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;background: #E0F8EC; border-left: none; border: solid windowtext 1.0pt; mso-border-left-alt: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 208.3pt;&quot; width=&quot;278&quot;&gt;&lt;div align=&quot;center&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: center;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 10.0pt;&quot;&gt;Descripción&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;background: #E0F8EC; border-left: none; border: solid windowtext 1.0pt; mso-border-left-alt: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 46.75pt;&quot; width=&quot;62&quot;&gt;&lt;div align=&quot;center&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: center;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 10.0pt;&quot;&gt;Por
  defecto&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr&gt;
  &lt;td style=&quot;border-top: none; border: solid windowtext 1.0pt; mso-border-top-alt: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 26.4pt;&quot; valign=&quot;top&quot; width=&quot;35&quot;&gt;&lt;div align=&quot;center&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 10.0pt;&quot;&gt;7&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-left-alt: solid windowtext 1.0pt; mso-border-top-alt: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 34.9pt;&quot; valign=&quot;top&quot; width=&quot;47&quot;&gt;&lt;div align=&quot;center&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 10.0pt;&quot;&gt;---&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-left-alt: solid windowtext 1.0pt; mso-border-top-alt: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 208.3pt;&quot; valign=&quot;top&quot; width=&quot;278&quot;&gt;&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 10.0pt;&quot;&gt;Reservado&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-left-alt: solid windowtext 1.0pt; mso-border-top-alt: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 46.75pt;&quot; width=&quot;62&quot;&gt;&lt;div align=&quot;center&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 10.0pt;&quot;&gt;0&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr&gt;
  &lt;td style=&quot;border-top: none; border: solid windowtext 1.0pt; mso-border-top-alt: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 26.4pt;&quot; valign=&quot;top&quot; width=&quot;35&quot;&gt;&lt;div align=&quot;center&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 10.0pt;&quot;&gt;6&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-left-alt: solid windowtext 1.0pt; mso-border-top-alt: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 34.9pt;&quot; valign=&quot;top&quot; width=&quot;47&quot;&gt;&lt;div align=&quot;center&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 10.0pt;&quot;&gt;R&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-left-alt: solid windowtext 1.0pt; mso-border-top-alt: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 208.3pt;&quot; valign=&quot;top&quot; width=&quot;278&quot;&gt;&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 10.0pt;&quot;&gt;Detección de bajo voltaje:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 10.0pt;&quot;&gt;‘0’ =&amp;gt; Vcc &amp;gt; 2.47 V&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 10.0pt;&quot;&gt;‘1’ =&amp;gt; Vcc &amp;lt; 2.47 V&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-left-alt: solid windowtext 1.0pt; mso-border-top-alt: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 46.75pt;&quot; width=&quot;62&quot;&gt;&lt;div align=&quot;center&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 10.0pt;&quot;&gt;Sólo lectura&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr&gt;
  &lt;td style=&quot;border-top: none; border: solid windowtext 1.0pt; mso-border-top-alt: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 26.4pt;&quot; valign=&quot;top&quot; width=&quot;35&quot;&gt;&lt;div align=&quot;center&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 10.0pt;&quot;&gt;5&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-left-alt: solid windowtext 1.0pt; mso-border-top-alt: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 34.9pt;&quot; valign=&quot;top&quot; width=&quot;47&quot;&gt;&lt;div align=&quot;center&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 10.0pt;&quot;&gt;---&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-left-alt: solid windowtext 1.0pt; mso-border-top-alt: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 208.3pt;&quot; valign=&quot;top&quot; width=&quot;278&quot;&gt;&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 10.0pt;&quot;&gt;Reservado&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-left-alt: solid windowtext 1.0pt; mso-border-top-alt: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 46.75pt;&quot; width=&quot;62&quot;&gt;&lt;div align=&quot;center&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 10.0pt;&quot;&gt;0&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr&gt;
  &lt;td style=&quot;border-top: none; border: solid windowtext 1.0pt; mso-border-top-alt: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 26.4pt;&quot; valign=&quot;top&quot; width=&quot;35&quot;&gt;&lt;div align=&quot;center&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 10.0pt;&quot;&gt;4&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-left-alt: solid windowtext 1.0pt; mso-border-top-alt: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 34.9pt;&quot; valign=&quot;top&quot; width=&quot;47&quot;&gt;&lt;div align=&quot;center&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 10.0pt;&quot;&gt;---&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-left-alt: solid windowtext 1.0pt; mso-border-top-alt: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 208.3pt;&quot; valign=&quot;top&quot; width=&quot;278&quot;&gt;&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 10.0pt;&quot;&gt;Reservado&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-left-alt: solid windowtext 1.0pt; mso-border-top-alt: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 46.75pt;&quot; width=&quot;62&quot;&gt;&lt;div align=&quot;center&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 10.0pt;&quot;&gt;0&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr&gt;
  &lt;td style=&quot;border-top: none; border: solid windowtext 1.0pt; mso-border-top-alt: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 26.4pt;&quot; valign=&quot;top&quot; width=&quot;35&quot;&gt;&lt;div align=&quot;center&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 10.0pt;&quot;&gt;3&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-left-alt: solid windowtext 1.0pt; mso-border-top-alt: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 34.9pt;&quot; valign=&quot;top&quot; width=&quot;47&quot;&gt;&lt;div align=&quot;center&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 10.0pt;&quot;&gt;---&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-left-alt: solid windowtext 1.0pt; mso-border-top-alt: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 208.3pt;&quot; valign=&quot;top&quot; width=&quot;278&quot;&gt;&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 10.0pt;&quot;&gt;No usar&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-left-alt: solid windowtext 1.0pt; mso-border-top-alt: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 46.75pt;&quot; width=&quot;62&quot;&gt;&lt;div align=&quot;center&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 10.0pt;&quot;&gt;0&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr&gt;
  &lt;td style=&quot;border-top: none; border: solid windowtext 1.0pt; mso-border-top-alt: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 26.4pt;&quot; valign=&quot;top&quot; width=&quot;35&quot;&gt;&lt;div align=&quot;center&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 10.0pt;&quot;&gt;2&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-left-alt: solid windowtext 1.0pt; mso-border-top-alt: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 34.9pt;&quot; valign=&quot;top&quot; width=&quot;47&quot;&gt;&lt;div align=&quot;center&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 10.0pt;&quot;&gt;R/W&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-left-alt: solid windowtext 1.0pt; mso-border-top-alt: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 208.3pt;&quot; valign=&quot;top&quot; width=&quot;278&quot;&gt;&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 10.0pt;&quot;&gt;Calefactor interno&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 10.0pt;&quot;&gt;‘0’ =&amp;gt; off&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 10.0pt;&quot;&gt;‘1’ =&amp;gt; on&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-left-alt: solid windowtext 1.0pt; mso-border-top-alt: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 46.75pt;&quot; width=&quot;62&quot;&gt;&lt;div align=&quot;center&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 10.0pt;&quot;&gt;0&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr&gt;
  &lt;td style=&quot;border-top: none; border: solid windowtext 1.0pt; mso-border-top-alt: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 26.4pt;&quot; valign=&quot;top&quot; width=&quot;35&quot;&gt;&lt;div align=&quot;center&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 10.0pt;&quot;&gt;1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-left-alt: solid windowtext 1.0pt; mso-border-top-alt: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 34.9pt;&quot; valign=&quot;top&quot; width=&quot;47&quot;&gt;&lt;div align=&quot;center&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 10.0pt;&quot;&gt;R/W&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-left-alt: solid windowtext 1.0pt; mso-border-top-alt: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 208.3pt;&quot; valign=&quot;top&quot; width=&quot;278&quot;&gt;&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 10.0pt;&quot;&gt;Sin Recarga de OTP&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-left-alt: solid windowtext 1.0pt; mso-border-top-alt: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 46.75pt;&quot; width=&quot;62&quot;&gt;&lt;div align=&quot;center&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 10.0pt;&quot;&gt;0&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr&gt;
  &lt;td style=&quot;border-top: none; border: solid windowtext 1.0pt; mso-border-top-alt: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 26.4pt;&quot; valign=&quot;top&quot; width=&quot;35&quot;&gt;&lt;div align=&quot;center&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 10.0pt;&quot;&gt;0&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-left-alt: solid windowtext 1.0pt; mso-border-top-alt: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 34.9pt;&quot; valign=&quot;top&quot; width=&quot;47&quot;&gt;&lt;div align=&quot;center&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 10.0pt;&quot;&gt;R/W&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-left-alt: solid windowtext 1.0pt; mso-border-top-alt: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 208.3pt;&quot; valign=&quot;top&quot; width=&quot;278&quot;&gt;&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 10.0pt;&quot;&gt;‘0’ =&amp;gt;
  resolución 12 bit RH / 14 bit Tª&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 10.0pt;&quot;&gt;‘1’ =&amp;gt;
  resolución 8 bit RH / 12 bit Tª&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-left-alt: solid windowtext 1.0pt; mso-border-top-alt: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 46.75pt;&quot; width=&quot;62&quot;&gt;&lt;div align=&quot;center&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 10.0pt;&quot;&gt;0&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;;&quot;&gt;Si no se desea cambiar los valores por defecto
(0x00), no es necesaria la llamada a la función.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;;&quot;&gt;El valor actual del registro de estado se puede leer
con la función:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;margin: 0cm 0cm 0.0001pt; text-align: left;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot;;&quot;&gt;/** Llamada a la función lectura del
valor del Registro de Estado **/&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;b style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: teal; font-family: &amp;quot;courier new&amp;quot;;&quot;&gt;sht_registro=SHTxx_LECTURA_REGISTRO_ESTADO
();&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=5250193391449144895#&quot; onclick=&quot;Effect.toggle(&amp;quot;expandir1&amp;quot;,&amp;quot;slide&amp;quot;); return false&quot;&gt;[+/-] Ver / Ocultar programa completo en C&lt;/a&gt;&lt;br /&gt;
&lt;div id=&quot;expandir1&quot; style=&quot;display: none;&quot;&gt;
&lt;br /&gt;
&lt;div style=&quot;font-family: Courier New, Courier, monospace; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;////////////////////////////////////////////////////////////////////////////////&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; CONTROL SENSOR SHTxx con PIC &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;// &amp;nbsp; &amp;nbsp;Ejemplo de uso y control de un sensor SHT11 (Temperatura y Humedad) &amp;nbsp; &amp;nbsp; //&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; Válido también para los sensores SHT10, SHT15, SHT71 y SHT75 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; RobotyPic 2013 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; http://robotypic.blogspot.com/ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;////////////////////////////////////////////////////////////////////////////////&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;#include &amp;lt;16F876.h&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;//Driver del PIC&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;#use delay(clock=4000000) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;//Frecuencia de oscilador&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;#fuses NOPROTECT,NOCPD,NOWDT,XT,NOBROWNOUT,NOLVP &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;//Fuses configuración&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;/** Configuración de los puertos ***/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;#use standard_io (A)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;#use standard_io (B)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;#define use_portb_lcd TRUE &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;//Puerto B habilitado para LCD&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;/** Librerías C externas empleadas **/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;#include &amp;lt;LCD.c&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;//Librería C para uso LCD 16x2&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;#include &amp;lt;SHTxx_RyP.c&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;//Librería para uso de sensor SHTxx&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;/******************************************************************************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;/*************************** FUNCIÓN PRINCIPAL ********************************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;void main () {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;port_b_pullups(TRUE); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;//Habilitación resistencias pull ups puerto B&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;lcd_init(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;//Inicialización del LCD&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;SHTxx_init(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;//Inicialización del SHT11&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;printf(lcd_putc, &quot;\f &amp;nbsp;RobotyPic (c) &quot;); &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;//Mensaje de bienvenida&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;/** Configuración del Registro de Estado **********************************&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;Se trata de escribir la configuración en el registro de estado. Por defecto&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;se carga de inicio a 0x00 por lo que si se emplea esta configuración no es&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;necesaria la llamada a esta función. &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;//Configuración a cargar en el Registro de Estado&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;sht_registro = 0x00;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;//Escritura en el Registro de Estado del código contenido en sht_registro&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;SHTxx_ESCRITURA_REGISTRO_ESTADO (sht_registro);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;while(true){&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;/** Llamada a la función de lectura de la Temperatura y Humedad medidas **/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;SHTxx (sht_temperatura, sht_humedad);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;delay_ms (500);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;/** Llamada a la función de lectura del valor del Registro de Estado **/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;sht_registro=SHTxx_LECTURA_REGISTRO_ESTADO ();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;delay_ms(100);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;/** Representación en LCD de los valores medidos **/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;printf(lcd_putc, &quot;\f%3.1f%cC *** %3.1f%%&quot;, sht_temperatura, 223, &amp;nbsp;sht_humedad);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;printf(lcd_putc, &quot;\n REG. ESTADO = %u&quot;,sht_registro);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;El ejemplo que se ha realizado para confirmar el funcionamiento consiste simplemente en la muestra en un LCD de los valores de Temperatura y Humedad leídos. También se muestra el valor de configuración del Registro de Estado, que previamente se ha cargado con el valor 0x00. Aunque, como se ha hecho referencia antes,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;no sería necesario puesto que reside en el Registro de Estado por defecto. Tan solo se trata de una demostración de como se cargaría el valor deseado.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;En esta animación se puede ver el funcionamiento.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;iframe allowfullscreen=&quot;&quot; frameborder=&quot;0&quot; height=&quot;360&quot; src=&quot;https://www.youtube.com/embed/W3KTxBmdSlU?feature=player_embedded&quot; width=&quot;640&quot;&gt;&lt;/iframe&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;a href=&quot;http://dfiles.eu/files/6e9pizraw&quot; target=&quot;_blank&quot;&gt;Descargar archivos &quot;Sensor SHT11 con PIC + Librerías C&quot;.&lt;/a&gt;&lt;/span&gt;

&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: large;&quot;&gt;Artículo relacionado&amp;gt;&amp;gt;&amp;nbsp;&lt;a href=&quot;http://robotypic.blogspot.com.es/2013/09/Libreria-C-para-SHT11.html&quot; target=&quot;_blank&quot;&gt;Librería C para sensor SHT11 con PIC&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;border: 5px solid rgb(224, 248, 236); padding: 5px;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;El proyecto contenido en el artículo ha sido diseñado y probado &amp;nbsp;utilizando estas versiones de software:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;- Windows 7&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;- Proteus V7.7 SP2 y V8&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;- CCS PIC C COMPILER v4.084&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=5250193391449144895&quot; name=&quot;PIC16F876A&quot;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;b style=&quot;background-color: white; color: #444444; font-family: &#39;Trebuchet MS&#39;, sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;b style=&quot;background-color: white; color: #444444; font-family: &#39;Trebuchet MS&#39;, sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;PINES PIC16F876A&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;b style=&quot;background-color: white; color: #444444; font-family: &#39;Trebuchet MS&#39;, sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-UmPS7vAO3MMxBE-BRdt9y3rBxYAg1_5MCChXzGa2zSPF1HBkQ3SC-9gAVN08EdAyk69Xi6KImbzJhRyAuzBlEwXGSRm8ylHx7I12UxHFp1zVP-ns98um2RGHXursiHDOZ6dwV8X3PgM/s1600/PIC16F876A+robotypic+patillas.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-UmPS7vAO3MMxBE-BRdt9y3rBxYAg1_5MCChXzGa2zSPF1HBkQ3SC-9gAVN08EdAyk69Xi6KImbzJhRyAuzBlEwXGSRm8ylHx7I12UxHFp1zVP-ns98um2RGHXursiHDOZ6dwV8X3PgM/s320/PIC16F876A+robotypic+patillas.jpg&quot; width=&quot;279&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://robotypic.blogspot.com/feeds/6031503781508955732/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5250193391449144895/6031503781508955732?isPopup=true' title='1 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5250193391449144895/posts/default/6031503781508955732'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5250193391449144895/posts/default/6031503781508955732'/><link rel='alternate' type='text/html' href='http://robotypic.blogspot.com/2013/09/SHT11conPIC.html' title='Sensor de Temperatura y Humedad SHT11 con PIC'/><author><name>Robotypic</name><uri>http://www.blogger.com/profile/16455462312458405515</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEixIlvnkL8zD0Pk_WQ3l0eIO3_x0_ABb_HhCR0G6PjAvib2ZNgtjBd30AaDTkEfMACgA5cQwzhcpyPtueAc6XunENrJGxrE7lVYMjy1OFuz2ZVNjKWh8cLeQWs1kYqnLkpprRjn3m9r5Sk/s72-c/sht11_RobotyPic.jpg" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5250193391449144895.post-518084408104737062</id><published>2013-05-30T22:25:00.000+02:00</published><updated>2017-03-24T23:55:43.842+01:00</updated><title type='text'>PIC controlador de servos por I2C</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhBpVwjoDSJ_AVkTcJfxB5wNOZQUktF5USzlKapTtp6Dt7WjbEpaIokIxDIO-XpdZjBoL3Itsa9iBoAfP7rhpakoi9EpIaxjK39DHlxYwfFk_z6TggMp2WU8TvOEVDolkh8_4-eqPvXl6s/s1600/PIC+controlador+servos.JPG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;250&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhBpVwjoDSJ_AVkTcJfxB5wNOZQUktF5USzlKapTtp6Dt7WjbEpaIokIxDIO-XpdZjBoL3Itsa9iBoAfP7rhpakoi9EpIaxjK39DHlxYwfFk_z6TggMp2WU8TvOEVDolkh8_4-eqPvXl6s/s640/PIC+controlador+servos.JPG&quot; width=&quot;630&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;En el artículo &quot;&lt;/span&gt;&lt;a href=&quot;http://robotypic.blogspot.com.es/2010/11/control-de-8-servos-con-pic-16f876a_13.html&quot; style=&quot;font-family: Verdana, sans-serif;&quot; target=&quot;_blank&quot;&gt;Control de 8 servos con PIC&lt;/a&gt;&quot;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;, se ha mostrado un procedimiento para controlar 8 servos mediante código en un PIC, ampliable a tantos servos como lineas de salida de puerto disponibles haya. Para según qué aplicaciones, en las que necesitamos además usar el PIC para otros menesteres, podemos encontrarnos con dos problemas. Por un lado, vamos a inutilizar para otras funciones tantos pines del PIC como servos conectemos, y esto puede ser un problema para un número alto de servos. Y por otro lado, las continuas llamadas a la interrupción por rebose del Timer para la generación de las señales de modulación de los servos, ralentiza la ejecución del resto del programa del PIC.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Para solucionar esto, en este artículo, se va a proponer el uso de un PIC secundario exclusivamente para el control de servos utilizando los conceptos &amp;nbsp;mostrados en el otro artículo. Concretamente el control de 20 servos con los 20 pines I/O disponibles de un 16F876A. Y un segundo PIC, como PIC principal, que ejecutará el programa genérico de la aplicación que se desee además de controlar los 20 servos. En resumen, con dos lineas de un PIC vamos a controlar 20 servos. Y como además, estas dos lineas son el bus I2C, también podrán ser utilizadas para cualquier otro dispositivo I2C.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Por tanto, en el PIC secundario controlador de los servos, empleamos todas las lineas de los puertos como salida a excepción de los pines RC3 y RC4 del puerto C que son necesarios para el bus I2C. Otra observación; en el 16F876A es necesario emplear una resistencia pull-up en el pin RA4 cuando este se emplea como puerto de salida.&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEinv3s4NroADUFmw0NWzlH_6MvcJlflU2bQv4M8tjvjIuBWDR6TFtik2w4J4J2y_oDUgpKFXZOxedj39hNIYJWsQ02OvwTOC5RIgARAG0z1zzuTNZZ6c4DnbtmsrB2HHZM6t_4UVArrrXw/s1600/Esquema+PIC+controlador+de+servos+RyP.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;448&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEinv3s4NroADUFmw0NWzlH_6MvcJlflU2bQv4M8tjvjIuBWDR6TFtik2w4J4J2y_oDUgpKFXZOxedj39hNIYJWsQ02OvwTOC5RIgARAG0z1zzuTNZZ6c4DnbtmsrB2HHZM6t_4UVArrrXw/s640/Esquema+PIC+controlador+de+servos+RyP.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Para obtener la señal de modulación, emplearemos la interrupción por rebose del Timer0. Previamente cargado con el valor 244 se irá incrementando hasta 255, momento en el que se ejecutará la interrupción y volveremos a iniciar la cuenta desde 244.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;/span&gt;

&lt;br /&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;set_timer0(244); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;//Carga del contador&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Obtendremos un incremento en 1 de su valor cada 4 ciclos de reloj con la configuración empleada:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;/span&gt;

&lt;br /&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;setup_timer_0(RTCC_INTERNAL);&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;//Configuración interrupción generación pwm&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Cada acceso a la subrutina de interrupción, es decir, cada rebose del Timer0, incrementamos la variable &quot;Control_PWM&quot; hasta un valor máximo de 550, momento en el cual se reinicia desde cero.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;/span&gt;

&lt;br /&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;control_PWM=control_PWM+1; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;//Incremento cada rebose del timer0&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;if (control_PWM==550) control_PWM=0; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi91fr1tPj4WIdjgi_bXWnm6-zuhZUgkwhQBBgw0bdalq_qPCAkISCPsdDvT7MvMGEb4JUHw9wKpjO1ro8iSBL_kZzQ7ABJoUn5D8pmoHsHZgDFt3Qq2K9hgsk-C-bQb0c4zWRzIpb-Fpk/s1600/Gr%C3%A1ficas+control+servos+con+PIC.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;390&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi91fr1tPj4WIdjgi_bXWnm6-zuhZUgkwhQBBgw0bdalq_qPCAkISCPsdDvT7MvMGEb4JUHw9wKpjO1ro8iSBL_kZzQ7ABJoUn5D8pmoHsHZgDFt3Qq2K9hgsk-C-bQb0c4zWRzIpb-Fpk/s640/Gr%C3%A1ficas+control+servos+con+PIC.jpg&quot; width=&quot;580&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Este valor será el que determine el periodo total de la señal de modulación, en este caso 20msg. Todas las señales de modulación individuales (Bit_PWM1, Bit_PWM2, Bit_PWM3, etc.) comienzan en estado alto cuando Control_PWM se reinicia.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;/span&gt;

&lt;br /&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;if (control_PWM==0){ &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;//inicio del ciclo con todos los pulsos pwm a 1&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;Bit_PWMx=1; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;//x = nº de modulación&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;La variable Control_PWM se compara con todas las variables individuales de control de cada servo (PWM1, PWM2, PWM3, etc.). A estas variables de control de los servos se les cargará los valores de control desde el PIC principal en un rango desde 20 a 60 (correspondientes a impulsos de 0.8 msg a 2.1 msg). Cuando son comparados a la modulación en cada interrupción de rebose del Timer0 y coincide con su respectiva señal de modulación &amp;nbsp;de su respectivo servo se termina el pulso de control de ese servo hasta reiniciar de nuevo el ciclo con la variable Control_PWM = 0.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;/span&gt;

&lt;br /&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;if (control_PWM==PWM[x]) Bit_PWMx=0; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;//x = nº de servo&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj2d1yjhFn1uTOMdY5eKkbEbeyJVn_GfK613Djk3IRPpNAhYy1EDTioHA6wxT2LSfjyuv0ESeDdMzeNLh3cweOcrV5nJd4r0p1DJqLAbOu9oQMG9_rfizLzqRbwOWzteXI3BJfNE3CVnGM/s1600/Gr%C3%A1ficas+2+control+servos+con+PIC.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;420&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj2d1yjhFn1uTOMdY5eKkbEbeyJVn_GfK613Djk3IRPpNAhYy1EDTioHA6wxT2LSfjyuv0ESeDdMzeNLh3cweOcrV5nJd4r0p1DJqLAbOu9oQMG9_rfizLzqRbwOWzteXI3BJfNE3CVnGM/s640/Gr%C3%A1ficas+2+control+servos+con+PIC.jpg&quot; width=&quot;580&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Para ejecutar el control de los servos, simplemente habrá que enviar por I2C el valor de las variables de nº de servo, posición y velocidad.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;/span&gt;

&lt;br /&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;void PicServos_I2C(direccion, servo, posicion, velocidad){&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_start(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;// Comienzo comunicación&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_write(direccion); &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;// Dirección del esclavo en el bus I2C&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_write(servo); &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;// Servo que se controlará en el esclavo&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_write(posicion); &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;// Posición del servo controlado&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_write(velocidad); &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;// Velocidad de cambio del servo&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_stop(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;// Fin comunicación&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;delay_ms(10);&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; text-align: left;&quot;&gt;&amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=5250193391449144895#&quot; onclick=&quot;Effect.toggle(&amp;quot;expandir1&amp;quot;,&amp;quot;slide&amp;quot;); return false&quot;&gt;[+/-] Ver / Ocultar programa PIC principal en C&lt;/a&gt;&lt;br /&gt;
&lt;div id=&quot;expandir1&quot; style=&quot;display: none;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;////////////////////////////////////////////////////////////////////////////////&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; CONTROL DE SERVOS &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; PIC principal &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;http://robotypic.blogspot.com/ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; RobotyPic 2013 (c) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;////////////////////////////////////////////////////////////////////////////////&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#include &amp;lt;16F876a.h&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#use delay(clock=4000000)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#fuses XT, NOWDT, BROWNOUT, NOPUT, NOPROTECT, NOLVP, NOCPD, NOWRT, NODEBUG&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#use i2c(Master,fast,sda=PIN_C4,scl=PIN_C3,force_sw)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#use fast_io(a)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#use fast_io(B)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#use fast_io(C)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define use_portb_lcd TRUE &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //Configuración puerto b control lcd&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#include &amp;lt;lcd.c&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //archivo para control del lcd&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;servo1 &amp;nbsp;1&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;Servo2 &amp;nbsp;2&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;Servo3 &amp;nbsp;3 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;Servo4 &amp;nbsp;4 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;Servo5 &amp;nbsp;5&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;Servo6 &amp;nbsp;6 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;Servo7 &amp;nbsp;7&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;Servo8 &amp;nbsp;8&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;Servo9 &amp;nbsp;9&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;Servo10 10&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;Servo11 11&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;Servo12 12&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;Servo13 13&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;Servo14 14&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;Servo15 15&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;Servo16 16&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;Servo17 17&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;Servo18 18&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;servo19 19&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;Servo20 20&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define PICServos_ID 0xA0; //Dirección I2C de acceso al PIC controlador de servos&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/************************ Variables globales **********************************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;int posicion=0; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Variable para registro de posición del servo&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;int direccion=0; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //Variable para dirección I2C de acceso a los servos&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;int servo=0; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //Variable para registro de número de servo&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;int velocidad=0; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //Variable para registro de velocidad de movimiento&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/******************************************************************************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/************* FUNCIÓN ESCRITURA EN PIC CONTROLADOR DE SERVOS *****************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;void PicServos_I2C(direccion, servo, posicion, velocidad){&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_start(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// Comienzo comunicación&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_write(direccion); &amp;nbsp; // Dirección del esclavo en el bus I2C&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_write(servo); &amp;nbsp; &amp;nbsp; &amp;nbsp; // Servo que se controlará en el esclavo&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_write(posicion); &amp;nbsp; &amp;nbsp;// Posición del servo controlado&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_write(velocidad); &amp;nbsp; // Velocidad de cambio del servo&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_stop(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Fin comunicación&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;delay_ms(10);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/******************************************************************************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/************************* FUNCIÓN ESCRITURA LCD ******************************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;void LCD_display () { &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; float grados;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; grados= (4.5 * (posicion-20));&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; printf(lcd_putc,&quot;\fServo %d Vel. %u&quot;, servo, velocidad);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; printf(lcd_putc,&quot;\n Angulo = %3.1f\337&quot;, grados);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/******************************************************************************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/*************************** FUNCIÓN PRINCIPAL ********************************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;void main(){&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;port_b_pullups(TRUE); &amp;nbsp; //Habilitación resistencias pullups puerto b&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;lcd_init(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //Inicialización del lcd&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;delay_ms(1000);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;while(true){&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; //Control servo 3. Pos.0º Velocidad 60&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; direccion=PICServos_ID; //Dirección PIC servos&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; servo=servo3; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //nº de servo &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion=20; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Registro de Posición servo de 20 (0º) a 60 (180º) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; velocidad=60; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //Registro de velocidad (de 0 a 255)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; PicServos_I2C(direccion, servo, posicion, velocidad);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; LCD_display (); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //Muestra información enviada en LCD&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; delay_ms(3000); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //Retardo hasta movimiento siguiente servo&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; //Control servo 3. Pos.180º Velocidad 200&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; direccion=PICServos_ID; //Dirección PIC servos&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; servo=servo3; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //nº de servo &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion=60; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Registro de Posición servo de 20 (0º) a 60 (180º) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; velocidad=200; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Registro de velocidad (de 0 a 255)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; PicServos_I2C(direccion, servo, posicion, velocidad);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; LCD_display (); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //Muestra información enviada en LCD&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; delay_ms(3000); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //Retardo hasta movimiento siguiente servo&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; //Control servo 3. Pos.0º Velocidad máxima&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; direccion=PICServos_ID; //Dirección PIC servos&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; servo=servo3; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //nº de servo &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion=20; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Registro de Posición servo de 20 (0º) a 60 (180º) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; velocidad=0; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Registro de velocidad (de 0 a 255)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; PicServos_I2C(direccion, servo, posicion, velocidad);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; LCD_display (); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //Muestra información enviada en LCD&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; delay_ms(3000); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //Retardo hasta movimiento siguiente servo&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; //Control servo 3. Pos.117º Velocidad máxima&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; direccion=PICServos_ID; //Dirección PIC servos&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; servo=servo3; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //nº de servo &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion=46; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Registro de Posición servo de 20 (0º) a 60 (180º) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; velocidad=200; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Registro de velocidad (de 0 a 255)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; PicServos_I2C(direccion, servo, posicion, velocidad);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; LCD_display (); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //Muestra información enviada en LCD&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; delay_ms(3000); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //Retardo hasta movimiento siguiente servo&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; //Control servo 6. Pos.63º Velocidad 60&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; direccion=PICServos_ID; //Dirección PIC servos&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; servo=servo6; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //nº de servo &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion=34; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Registro de Posición servo de 20 (0º) a 60 (180º)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; velocidad=60; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //Registro de velocidad (de 0 a 255)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; PicServos_I2C(direccion, servo, posicion, velocidad);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; LCD_display (); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //Muestra información enviada en LCD&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; delay_ms(3000);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; //Control servo 6. Pos.180º Velocidad 60&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; direccion=PICServos_ID; //Dirección PIC servos&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; servo=servo6; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //Nº de servo &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion=60; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Registro de Posición servo de 20 (0º) a 60 (180º)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; velocidad=60; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //Registro de velocidad (de 0 a 255)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; PicServos_I2C(direccion, servo, posicion, velocidad);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; LCD_display (); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //Muestra información enviada en LCD&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; delay_ms(3000);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; //Control simultáneo de varios servos&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; //Control servo 3. Pos.180º&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; direccion=PICServos_ID; //Dirección PIC servos&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; servo=servo3; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //nº de servo &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion=200; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Registro de Posición servo de 20 (0º) a 60 (180º) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; velocidad=255; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Registro de velocidad (de 0 a 255)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; PicServos_I2C(direccion, servo, posicion, velocidad);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; //Control servo 1. Pos.180º&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; direccion=PICServos_ID; //Dirección PIC servos&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; servo=servo1; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //nº de servo &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion=60; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Registro de Posición servo de 20 (0º) a 60 (180º) &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; velocidad=200; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Registro de velocidad (de 0 a 255)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; PicServos_I2C(direccion, servo, posicion, velocidad); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; //Control servo 2. Pos.0º&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; direccion=PICServos_ID; //Dirección PIC servos&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; servo=servo2; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //nº de servo &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion=20; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Registro de Posición servo de 20 (0º) a 60 (180º) &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; velocidad=200; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //Registro de velocidad (de 0 a 255)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; PicServos_I2C(direccion, servo, posicion, velocidad); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; LCD_display ();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; delay_ms(3000);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; //Control simultáneo de varios servos&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; //Control servo 3. Pos.180º&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; direccion=PICServos_ID; //Dirección PIC servos&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; servo=servo3; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //nº de servo &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion=60; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Registro de Posición servo de 20 (0º) a 60 (180º) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; velocidad=0; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Registro de velocidad (de 0 a 255)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; PicServos_I2C(direccion, servo, posicion, velocidad);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; //Control servo 1. Pos.81º&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; direccion=PICServos_ID; //Dirección PIC servos&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; servo=servo1; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //nº de servo &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion=38; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Registro de Posición servo de 20 (0º) a 60 (180º) &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; velocidad=0; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //Registro de velocidad (de 0 a 255)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; PicServos_I2C(direccion, servo, posicion, velocidad); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; //Control servo 2. Pos.90º&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; direccion=PICServos_ID; //Dirección PIC servos&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; servo=servo2; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //nº de servo &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion=40; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Registro de Posición servo de 20 (0º) a 60 (180º) &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; velocidad=0; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Registro de velocidad (de 0 a 255)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; PicServos_I2C(direccion, servo, posicion, velocidad); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; delay_ms(4000);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;

&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=5250193391449144895#&quot; onclick=&quot;Effect.toggle(&amp;quot;expandir2&amp;quot;,&amp;quot;slide&amp;quot;); return false&quot;&gt;[+/-] Ver / Ocultar programa PIC controlador servos en C&lt;/a&gt;&lt;br /&gt;
&lt;div id=&quot;expandir2&quot; style=&quot;display: none;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;////////////////////////////////////////////////////////////////////////////////&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;MÓDULO CONTROLADOR DE 20 SERVOS CON PIC v1.1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;http://robotypic.blogspot.com/ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(c) RobotyPic 2015 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;////////////////////////////////////////////////////////////////////////////////&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#include &amp;lt;16f876a.h&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //archivo para control del pic 16f876a&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#FUSES NOWDT, HS, NOPUT, NOPROTECT, NOCPD, NOBROWNOUT, NOLVP, NODEBUG, NOWRT&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#use delay(clock=20000000) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//frecuencia de reloj 20 MHz&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#use i2c(SLAVE, fast, SDA=PIN_C4, SCL=PIN_C3, address=0xA0)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#byte trisb=0x86&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#byte portb=0x06&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#byte trisc=0x87&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#byte portc=0x07&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#byte trisa=0x85&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#byte porta=0x05&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#bit &amp;nbsp;Bit_PWM1 &amp;nbsp; &amp;nbsp;= &amp;nbsp;PORTB.0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Bit 0 puerto B Salida modulación 0&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#bit &amp;nbsp;Bit_PWM2 &amp;nbsp; &amp;nbsp;= &amp;nbsp;PORTB.1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Bit 1 puerto B Salida modulación 1&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#bit &amp;nbsp;Bit_PWM3 &amp;nbsp; &amp;nbsp;= &amp;nbsp;PORTB.2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Bit 2 puerto B Salida modulación 2&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#bit &amp;nbsp;Bit_PWM4 &amp;nbsp; &amp;nbsp;= &amp;nbsp;PORTB.3 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Bit 3 puerto B Salida modulación 3&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#bit &amp;nbsp;Bit_PWM5 &amp;nbsp; &amp;nbsp;= &amp;nbsp;PORTB.4 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Bit 4 puerto B Salida modulación 4&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#bit &amp;nbsp;Bit_PWM6 &amp;nbsp; &amp;nbsp;= &amp;nbsp;PORTB.5 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Bit 5 puerto B Salida modulación 5&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#bit &amp;nbsp;Bit_PWM7 &amp;nbsp; &amp;nbsp;= &amp;nbsp;PORTB.6 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Bit 6 puerto B Salida modulación 6&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#bit &amp;nbsp;Bit_PWM8 &amp;nbsp; &amp;nbsp;= &amp;nbsp;PORTB.7 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Bit 7 puerto B Salida modulación 7&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#bit &amp;nbsp;Bit_PWM9 &amp;nbsp; &amp;nbsp;= &amp;nbsp;PORTC.0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Bit 0 puerto C Salida modulación 0&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#bit &amp;nbsp;Bit_PWM10 &amp;nbsp; = &amp;nbsp;PORTC.1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Bit 1 puerto C Salida modulación 1&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#bit &amp;nbsp;Bit_PWM11 &amp;nbsp; = &amp;nbsp;PORTC.2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Bit 2 puerto C Salida modulación 2&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#bit &amp;nbsp;Bit_PWM12 &amp;nbsp; = &amp;nbsp;PORTC.5 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Bit 5 puerto C Salida modulación 5&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#bit &amp;nbsp;Bit_PWM13 &amp;nbsp; = &amp;nbsp;PORTC.6 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Bit 6 puerto C Salida modulación 6&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#bit &amp;nbsp;Bit_PWM14 &amp;nbsp; = &amp;nbsp;PORTC.7 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Bit 7 puerto C Salida modulación 7&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#bit &amp;nbsp;Bit_PWM15 &amp;nbsp; = &amp;nbsp;PORTA.0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Bit 0 puerto A Salida modulación 0&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#bit &amp;nbsp;Bit_PWM16 &amp;nbsp; = &amp;nbsp;PORTA.1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Bit 1 puerto A Salida modulación 1&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#bit &amp;nbsp;Bit_PWM17 &amp;nbsp; = &amp;nbsp;PORTA.2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Bit 2 puerto A Salida modulación 2&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#bit &amp;nbsp;Bit_PWM18 &amp;nbsp; = &amp;nbsp;PORTA.3 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Bit 3 puerto A Salida modulación 3&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#bit &amp;nbsp;Bit_PWM19 &amp;nbsp; = &amp;nbsp;PORTA.4 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Bit 4 puerto A Salida modulación 4&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#bit &amp;nbsp;Bit_PWM20 &amp;nbsp; = &amp;nbsp;PORTA.5 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Bit 5 puerto A Salida modulación 5&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;typedef enum {NOTHING,N_SERVO_READ,POSICION_READ,VELOCIDAD_READ} I2C_STATE;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;I2C_STATE fState;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/********************** Prototipos de las funciones ***************************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;void main (void); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //función principal&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;void generacion_pwm (void); &amp;nbsp; //genera señales moduladas para control de servos&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/********************** Variables para generación PWM *************************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;int8 PWM[21];&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;int8 pwm_servo[21];&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;int8 velocidad[21];&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;int16 control_PWM=0; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;int8 n_servo;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;int8 i;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/******************************************************************************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/******************* FUNCIÓN GENERACIÓN MODULACIONES PWM **********************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#int_TIMER0&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;void generacion_pwm(){&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; control_PWM=control_PWM+1; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Incremento cada rebose del timer0&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; if (control_PWM==550) control_PWM=0; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;if (control_PWM==0){ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//inicio del ciclo con todos los pulsos pwm a 1&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Bit_PWM1=1;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Bit_PWM2=1;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Bit_PWM3=1;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Bit_PWM4=1;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Bit_PWM5=1;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Bit_PWM6=1;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Bit_PWM7=1;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Bit_PWM8=1;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Bit_PWM9=1;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Bit_PWM10=1;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Bit_PWM11=1;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Bit_PWM12=1;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Bit_PWM13=1;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Bit_PWM14=1;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Bit_PWM15=1;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Bit_PWM16=1;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Bit_PWM17=1;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Bit_PWM18=1;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Bit_PWM19=1;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Bit_PWM20=1;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;//Finalizará el pulso de modulación según el valor del correspondiente pwm&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;if (control_PWM==PWM[1]) Bit_PWM1=0;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;if (control_PWM==PWM[2]) Bit_PWM2=0;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;if (control_PWM==PWM[3]) Bit_PWM3=0;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;if (control_PWM==PWM[4]) Bit_PWM4=0;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;if (control_PWM==PWM[5]) Bit_PWM5=0;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;if (control_PWM==PWM[6]) Bit_PWM6=0;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;if (control_PWM==PWM[7]) Bit_PWM7=0;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;if (control_PWM==PWM[8]) Bit_PWM8=0;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;if (control_PWM==PWM[9]) Bit_PWM9=0;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;if (control_PWM==PWM[10]) Bit_PWM10=0;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;if (control_PWM==PWM[11]) Bit_PWM11=0;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;if (control_PWM==PWM[12]) Bit_PWM12=0;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;if (control_PWM==PWM[13]) Bit_PWM13=0;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;if (control_PWM==PWM[14]) Bit_PWM14=0;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;if (control_PWM==PWM[15]) Bit_PWM15=0;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;if (control_PWM==PWM[16]) Bit_PWM16=0;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;if (control_PWM==PWM[17]) Bit_PWM17=0;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;if (control_PWM==PWM[18]) Bit_PWM18=0;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;if (control_PWM==PWM[19]) Bit_PWM19=0;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;if (control_PWM==PWM[20]) Bit_PWM20=0;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;set_timer0(244); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Carga del contador&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/******************************************************************************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/********************* FUNCIÓN TIEMPO DE RETARDO ******************************/ &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;void retardo_servo (){&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; for (i=1; i&amp;lt;=20; ++i) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; if (PWM[i] != pwm_servo[i]) &amp;nbsp;{ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Si el servo no está en su posición...&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; if (PWM[i] &amp;gt; pwm_servo[i]) &amp;nbsp;--PWM[i]; //...retrocede una posición... &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; else if (PWM[i] &amp;lt; pwm_servo[i]) ++PWM[i];//...o avanza una posición &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; delay_us(10*velocidad[i]); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Retardo movimiento de posición &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; }&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; }&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/******************************************************************************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/***************** FUNCIÓN INTERRUPCIÓN POR RECEPCION I2C *********************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#INT_SSP&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;void ssp_interupt (){&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;byte incoming; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//donde se recibe el byte que manda el maestro&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;fstate = i2c_isr_state(); &amp;nbsp; &amp;nbsp; //estado del bus tras la interrupción&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;if (fstate == 0x80) { &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //no hay dato recibido&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;else { &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //Sino es que hay dato en el bus I2C...&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; incoming = i2c_read(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//... lo lee&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; if (fState == NOTHING){ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //Información recibida es aviso de que va mandar algo master&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;fState = N_SERVO_READ; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //Siguiente información será nº de servo&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; else if (fState == N_SERVO_READ) { &amp;nbsp;//Información recibida corresponde al nº de servo&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;n_servo = incoming; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Se guarda nº de servo&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;fState = POSICION_READ; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Siguiente información recibida será posicion&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; else if (fState == POSICION_READ) { &amp;nbsp;//Información recibida corresponde a la posición&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;pwm_servo[n_servo] = incoming; &amp;nbsp; &amp;nbsp;//Se guarda posición de servo&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;fState = VELOCIDAD_READ; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Siguiente información será velocidad&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; else if (fState == VELOCIDAD_READ) { &amp;nbsp;//Información recibida corresponde a velocidad&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;velocidad[n_servo] = incoming; &amp;nbsp; &amp;nbsp; //Se guarda velocidad&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;fState = NOTHING; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Siguiente información será aviso de nuevo envío del master&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/******************************************************************************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/******************** FUNCIÓN PRINCIPAL ***************************************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;void main(){&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;//Configuración I/O puertos&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;trisc=0b00011000; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;trisb=0x00;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;trisa=0x00;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;//Posiciones iniciales de los servos 90º&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;for (i=1; i&amp;lt;=20; ++i) PWM[i]=40;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;for (i=1; i&amp;lt;=20; ++i) pwm_servo[i]=40;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;//Inicialización velocidades a valor máximo&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;for (i=1; i&amp;lt;=20; ++i) velocidad[i]=0;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;//Configuración timer0 e interrupciones&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;setup_timer_0(RTCC_INTERNAL); &amp;nbsp; &amp;nbsp; //Configuración interrupción generación pwm&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;enable_interrupts(INT_TIMER0); &amp;nbsp; &amp;nbsp;//Habilitación interrupción generación pwm&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;enable_interrupts(INT_SSP); &amp;nbsp; &amp;nbsp; &amp;nbsp; //Habilitación interrupción recepción I2C&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;enable_interrupts(GLOBAL); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Habilitación de las interrupciones&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;while (true){&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;retardo_servo ();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;En la simulación, reflejada en este vídeo, se puede ver el resultado de todo lo explicado. Se intenta mostrar las señales moduladas de control de los 20 servos. En el display del PIC principal, se observa el último servo que se modifica. Esta variación de giro se puede ver en la variación del ancho de pulso de la señal de modulación del correspondiente servo en las gráficas de osciloscopio.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Al final del vídeo se detalla varios tiempos de variación de los pulsos de modulación según la velocidad elegida y que actuará directamente sobre la velocidad de giro del servo.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;center&gt;
&lt;iframe allowfullscreen=&quot;&quot; frameborder=&quot;0&quot; height=&quot;330&quot; src=&quot;https://www.youtube.com/embed/0L0iIY1_Izc?feature=player_detailpage&quot; width=&quot;580&quot;&gt;&lt;/iframe&gt;&lt;/center&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;En el siguiente enlace se pueden descargar todos los archivos.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;a href=&quot;https://www.dropbox.com/s/m9794kad8hs8zrf/Pic%20controlador%20de%20servos%20v1.2.rar?dl=0&quot; target=&quot;_blank&quot;&gt;Descargar PIC controlador de servos&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;El proyecto contenido en el artículo ha sido diseñado y probado con éxito utilizando las siguientes versiones de software:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;- Windows 7 32 bits&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;- Proteus V7.7 SP2&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;- CCS PIC C COMPILER v4.104&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif; font-size: xx-small;&quot;&gt;&lt;i&gt;Última revisión del artículo marzo de 2017&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif; font-size: xx-small;&quot;&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif; font-size: xx-small;&quot;&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;
</content><link rel='replies' type='application/atom+xml' href='http://robotypic.blogspot.com/feeds/518084408104737062/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5250193391449144895/518084408104737062?isPopup=true' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5250193391449144895/posts/default/518084408104737062'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5250193391449144895/posts/default/518084408104737062'/><link rel='alternate' type='text/html' href='http://robotypic.blogspot.com/2013/05/pic-controlador-de-servos.html' title='PIC controlador de servos por I2C'/><author><name>Robotypic</name><uri>http://www.blogger.com/profile/16455462312458405515</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhBpVwjoDSJ_AVkTcJfxB5wNOZQUktF5USzlKapTtp6Dt7WjbEpaIokIxDIO-XpdZjBoL3Itsa9iBoAfP7rhpakoi9EpIaxjK39DHlxYwfFk_z6TggMp2WU8TvOEVDolkh8_4-eqPvXl6s/s72-c/PIC+controlador+servos.JPG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5250193391449144895.post-5100630897062490703</id><published>2013-04-24T21:23:00.001+02:00</published><updated>2020-06-19T15:24:56.201+02:00</updated><title type='text'>Brazo Robot de 6 ejes con PIC y SD21</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Consiste en el control de un brazo de 6 ejes con un PIC. En este caso se va a utilizar, junto con el PIC, una controladora de servos SD21. Por supuesto se podría prescindir de ella y controlar los servos directamente con el PIC tal como se mostró en el caso de un &lt;a href=&quot;http://robotypic.blogspot.com.es/2011/11/control-de-un-brazo-robotico.html&quot; target=&quot;_blank&quot;&gt;brazo con 4 ejes&lt;/a&gt;&amp;nbsp;simplemente añadiendo otras dos señales moduladas para el control de los dos servos adicionales. Sin embargo, el uso de esta controladora aporta ciertas ventajas, como el poder separar la alimentación de los servos (de 6V a 7,5V) de la alimentación del circuito lógico (5V) con una única fuente de alimentación y aportar mayor fuerza a los servos al proporcionarles una tensión superior a los 5V.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;center&gt;
&lt;iframe allowfullscreen=&quot;&quot; frameborder=&quot;0&quot; height=&quot;360&quot; src=&quot;https://www.youtube.com/embed/I_K8n6uwUP4?feature=player_detailpage&quot; width=&quot;580&quot;&gt;&lt;/iframe&gt;&lt;/center&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Como muestra didáctica, el ejemplo realizará un ciclo repetitivo del brazo robot. Este ciclo consistirá en recoger una pieza de una posición inicial y depositarla en una segunda ubicación. Vuelve a recoger la pieza y la retorna a &amp;nbsp;la posición inicial. Por supuesto todo de una forma autónoma. El ciclo se repetirá indefinidamente.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-kI3RFbeNqsuU1IMEzdxhfQ2SG2_eVqHzjVf-5GaoqcMkFTwnLjh47ihWgbJPSqWkI9jm25unWVixEXPy0HqRjQl94XQ2bJ-pFNKrriPgN-QFODuxdkfsSeZRen65PFtAwMVkwgRcFl0/s1600/Brazo+robot+6+ejes+RobotyPic.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;470&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-kI3RFbeNqsuU1IMEzdxhfQ2SG2_eVqHzjVf-5GaoqcMkFTwnLjh47ihWgbJPSqWkI9jm25unWVixEXPy0HqRjQl94XQ2bJ-pFNKrriPgN-QFODuxdkfsSeZRen65PFtAwMVkwgRcFl0/s640/Brazo+robot+6+ejes+RobotyPic.jpg&quot; width=&quot;570&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Lo primero será difinir, en la cabecera del programa, los valores de los registros del SD21 con su correspondiente eje o servo:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;#define &amp;nbsp;servo1 &amp;nbsp;0&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;#define &amp;nbsp;Servo2 &amp;nbsp;3&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;#define &amp;nbsp;Servo3 &amp;nbsp;6 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;#define &amp;nbsp;Servo4 &amp;nbsp;9 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;#define &amp;nbsp;Servo5 &amp;nbsp;12&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;#define &amp;nbsp;Servo6 &amp;nbsp;15&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt; &lt;/span&gt;&amp;nbsp;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Para cada uno de los ejes, deberemos enviar la información correspondiente para la nueva posición desde el PIC al módulo SD21. Esto lo haremos mediante en bus I2C. La subrutina de comunicación será la siguiente:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;void sd21_servo(byte SD21_ID,int num_servo,int velocidad,int16 posicion){&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_start(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;//Comienzo de la comunicación I2C ...&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_write(SD21_ID); &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;//...con la dirección del SD21...&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_write(num_servo); &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;//...apuntando al registro del servo num_servo&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_write(velocidad); &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;//velocidad&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_write(posicion); &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;//Parte baja de Posicion &lt;/span&gt;&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_write(posicion&amp;gt;&amp;gt;8); &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;//Parte alta de posicion&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_stop (); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;//Finalización de la transmisión&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Cuando queremos establecer una posición del brazo, indicamos las posiciones de cada uno de los ejes o servos además de la velocidad con la que queremos que se produzca el movimiento, y hacemos una llamada a la subrutina anterior:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;velocidad = 10;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;num_servo = servo1;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;posicion = 1500; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Esto para cada uno de los servos. Para cada nueva posición del brazo &amp;nbsp;completo enviaremos la información de todos los ejes. Cuando alguna posición &amp;nbsp;no varíe o la velocidad sea la misma no será necesario enviar esa información concreta, ya residente en el SD21:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;//Movimiento nueva posición&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;velocidad = 10;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;num_servo = servo2;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;posicion = 2000; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;num_servo = servo3;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;posicion = 1200; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;velocidad = 15;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;num_servo = servo4;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;posicion = 1850; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;num_servo = servo5;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;posicion = 1500; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Previamente habremos configurado las variables empleadas en el control:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;int velocidad; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;//Valor de velocidad de servo&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;int16 posicion; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;//Valor de la posición del servo&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;int num_servo; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;//Identificación del servo a controlar&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=5250193391449144895#&quot; onclick=&quot;Effect.toggle(&amp;quot;expandir1&amp;quot;,&amp;quot;slide&amp;quot;); return false&quot;&gt;[+/-] Ver / Ocultar programa completo en C&lt;/a&gt;&lt;br /&gt;
&lt;div id=&quot;expandir1&quot; style=&quot;display: none;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;////////////////////////////////////////////////////////////////////////////////&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Brazo Robot 6 ejes con PIC y SD21 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;http://robotypic.blogspot.com/ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(c) RobotyPic &amp;nbsp;2013 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;////////////////////////////////////////////////////////////////////////////////&lt;/span&gt;&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#include &amp;lt;16F876A.h&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//PIC a utilizar&lt;/span&gt;&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#fuses XT,NOWDT,NOPROTECT &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#use delay(clock=4000000) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Frecuencia cristal de cuarzo&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#use i2c(master, SCL=PIN_C3, SDA=PIN_C4) &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Configuración comunicación I2C&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#use standard_io(C) &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#use standard_io(B)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#use standard_io(A)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;servo1 &amp;nbsp;0&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;Servo2 &amp;nbsp;3&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;Servo3 &amp;nbsp;6 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;Servo4 &amp;nbsp;9 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;Servo5 &amp;nbsp;12&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;Servo6 &amp;nbsp;15 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;Servo7 &amp;nbsp;18&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;Servo8 &amp;nbsp;21&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;Servo9 &amp;nbsp;24&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;Servo10 27&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;Servo11 30&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;Servo12 33&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;Servo13 36&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;Servo14 39&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;Servo15 42&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;Servo16 45&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;Servo17 48&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;Servo18 51&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;servo19 54&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;Servo20 57&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;Servo21 60 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;int SD21_ID &amp;nbsp; = &amp;nbsp;0xC2; &amp;nbsp; &amp;nbsp; //Dirección I2C de acceso al SD21&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/*********************** Variables globales ***********************************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;int velocidad; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Valor de velocidad de servo&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;int16 posicion; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Valor de la posición del servo&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;int num_servo; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Identificación del servo a controlar&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/******************************************************************************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/*********************** FUNCIÓN CONTROL DE SERVOS &amp;nbsp;***************************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;void sd21_servo (byte SD21_ID, int num_servo, int velocidad, int16 posicion){&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_start(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Comienzo de la comunicación I2C ...&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_write(SD21_ID); &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//...con la dirección del SD21...&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_write(num_servo); &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//...apuntando al registro del servo num_servo&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_write(velocidad); &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//velocidad&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_write(posicion); &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Parte baja de Posicion&lt;/span&gt;&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_write(posicion&amp;gt;&amp;gt;8); &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Parte alta de posicion&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_stop (); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Finalización de la transmisión&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;delay_ms(60);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/******************************************************************************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/************************ FUNCIÓN PRINCIPAL ***********************************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;void main() {&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Posición reposo&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;velocidad = 10;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;num_servo = servo1;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;posicion = 1500; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;num_servo = servo2;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;posicion = 1050; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;num_servo = servo3;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;posicion = 1500; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;num_servo = servo4;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;posicion = 1500; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;num_servo = servo5;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;posicion = 1500; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;num_servo = servo6;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;posicion = 2100; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;delay_ms(5000); &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Tiempo de espera hasta inicio de ciclo&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;while(true){ &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Ciclo repetitivo&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; //Posición inicial&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; velocidad = 10;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo1;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 1500; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo2;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 1050; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo3;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 1500; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo4;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 1500; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo5;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 1500; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo6;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 2100; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Retardo hasta siguiente movimiento&lt;/span&gt;&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; delay_ms(3000);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//1º Movimiento - Semilevantado pinza abierta&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; velocidad = 10;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo2;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 1500; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo3;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 1050; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; velocidad = 15;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo5;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 2400; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo6;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 1000; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Retardo hasta siguiente movimiento &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; delay_ms(1000);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//2º Movimiento - Levantado posición pieza 1&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; velocidad = 10;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo1;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 1050; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo3;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 600; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo4;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 950; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo5;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 1500; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Retardo hasta siguiente movimiento&lt;/span&gt;&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; delay_ms(1000); &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//3º Movimiento - Bajo posición pieza 1&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; velocidad = 10;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo2;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 2000; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo3;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 1200; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; velocidad = 15;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo4;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 1850; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo5;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 1500; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Retardo hasta siguiente movimiento&lt;/span&gt;&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; delay_ms(2000);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//4º Movimiento - Coger pieza posición 1&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; velocidad = 10;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo6;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 1800; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Retardo hasta siguiente movimiento&lt;/span&gt;&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; delay_ms(2000);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//5º Movimiento - Semilevantado posición 1&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; velocidad = 10;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo2;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 1500; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo3;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 1050; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; velocidad = 15;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo4;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 950; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Retardo hasta siguiente movimiento&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; delay_ms(1000);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//6º Movimiento - Semilevantado posición 2&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; velocidad = 15;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo1;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 1950; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Retardo hasta siguiente movimiento&lt;/span&gt;&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; delay_ms(1000);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//7º Movimiento - Posición baja posición 2&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; velocidad = 10;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo2;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 2000; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo3;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 1200; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; velocidad = 20;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo4;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 1850; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt; //Retardo hasta siguiente movimiento&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; delay_ms(2000);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//8º Movimiento - Dejar pieza posición 2&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; velocidad = 10;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo6;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 1000; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Retardo hasta siguiente movimiento&lt;/span&gt;&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; delay_ms(2000);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//9º Movimiento - Semilevantado posición 2&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; velocidad = 10;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo2;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 1500; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo3;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 1050; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; velocidad = 20;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo4;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 950; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Retardo hasta siguiente movimiento&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; delay_ms(1000);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//10º Movimiento - Posición inicial reposo&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; velocidad = 10;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo1;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 1500; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo2;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 1050; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo3;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 1500; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo4;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 1500; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo5;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 1500; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo6;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 2100; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Retardo hasta siguiente movimiento&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; delay_ms(3000);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//11º Movimiento - Semilevantado posición 2&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; velocidad = 10;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo1;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 1950; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo2;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 1500; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo3;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 1050; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; velocidad = 20;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo4;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 950; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo6;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 1000; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt; //Retardo hasta siguiente movimiento&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; delay_ms(1000);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//12º Movimiento - Posición baja posición 2&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; velocidad = 10;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo2;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 2000; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo3;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 1200; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; velocidad = 20;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo4;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 1850; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Retardo hasta siguiente movimiento&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; delay_ms(2000);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//13º Movimiento - Coger pieza posición 2&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; velocidad = 10;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo6;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 1800; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Retardo hasta siguiente movimiento&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; delay_ms(2000);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//14º Movimiento - Semilevantado posición 2&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; velocidad = 10;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo1;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 1950; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo2;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 1500; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo3;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 1050; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; velocidad = 20;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo4;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 950; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Retardo hasta siguiente movimiento&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; delay_ms(1000);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//15º Movimiento - Semilevantado posición 1&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; velocidad = 15;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo1;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 1050; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Retardo hasta siguiente movimiento&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; delay_ms(1000);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//16º Movimiento - Posición baja posición 1&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; velocidad = 10;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo2;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 2000; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo3;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 1200; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; velocidad = 20;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo4;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 1850; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo5;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 1500; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Retardo hasta siguiente movimiento&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; delay_ms(2000);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//17º Movimiento - Dejar pieza posición 1&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; velocidad = 10;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo6;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 1000; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Retardo hasta siguiente movimiento&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; delay_ms(2000);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//18º Movimiento - Semilevantado posición 1&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; velocidad = 10;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo2;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 1500; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo3;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 1050; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; velocidad = 20;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo4;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 950; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt; //Retardo hasta siguiente movimiento&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; delay_ms(1000);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana, sans-serif; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Los archivos se pueden descargar en este enlace:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;a href=&quot;https://www.dropbox.com/s/mukeac9qmifvny5/Brazo%20robot%206%20ejes%20con%20PIC%20y%20SD21.rar?dl=0&quot; target=&quot;_blank&quot;&gt;Descargar brazo robot 6 ejes&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;El proyecto contenido en el artículo ha sido diseñado con la versión v4.084 de&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;CCS PIC C COMPILER&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;center&gt;
&lt;script language=&quot;javascript&quot; src=&quot;https://codenew.impresionesweb.com/r/banner_iw.php?idrotador=72253&amp;amp;tamano=468x60&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;&lt;/center&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;El servo mostrado a continuación es el modelo que se ha empleado en el diseño. Dentro de su gama es de los más económicos con respecto a sus prestaciones. No es necesario emplear el mismo servo pero se añade como orientación a la hora de elegir el modelo a emplear en este tipo de sistemas.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2RXEAdZpJUMSclP9my_owuHyb-Xw80fHzfrF4Cah1FSkJhbSAGInhuictNqjPKWyDMjMXTYhsptPrcXkCq0x6TZSr98Oo4F81bY9830M-HlZiYCyqOCrNuIQLIM3j0aLEAV45EOCikUY/s1600/servo.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2RXEAdZpJUMSclP9my_owuHyb-Xw80fHzfrF4Cah1FSkJhbSAGInhuictNqjPKWyDMjMXTYhsptPrcXkCq0x6TZSr98Oo4F81bY9830M-HlZiYCyqOCrNuIQLIM3j0aLEAV45EOCikUY/s1600/servo.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;center&gt;
&lt;script language=&quot;javascript&quot; src=&quot;https://codenew.impresionesweb.com/r/banner_iw.php?idrotador=72253&amp;amp;tamano=468x60&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;&lt;/center&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://robotypic.blogspot.com/feeds/5100630897062490703/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5250193391449144895/5100630897062490703?isPopup=true' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5250193391449144895/posts/default/5100630897062490703'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5250193391449144895/posts/default/5100630897062490703'/><link rel='alternate' type='text/html' href='http://robotypic.blogspot.com/2013/04/brazo-de-6-ejes-con-PIC.html' title='Brazo Robot de 6 ejes con PIC y SD21'/><author><name>Robotypic</name><uri>http://www.blogger.com/profile/16455462312458405515</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/I_K8n6uwUP4/default.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5250193391449144895.post-6768916342155158721</id><published>2013-03-19T21:09:00.000+01:00</published><updated>2013-08-02T18:39:33.241+02:00</updated><title type='text'>Configuración del EasyVR.</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;El EasyVR es un potente módulo desarrollado por la firma &lt;a href=&quot;http://www.veear.eu/&quot; target=&quot;_blank&quot;&gt;VeeaR&lt;/a&gt;&amp;nbsp;que permite el reconocimiento de voces. Bien sean propias del módulo (voces SI) o &amp;nbsp;definidas por el usuario (voces SD). Permite además la reprodución de sonidos o frases.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Para la configuración del módulo necesitaremos la aplicación &lt;a href=&quot;http://www.veear.eu/downloads/&quot; target=&quot;_blank&quot;&gt;EasyVR Commander&lt;/a&gt; proporcionada por el fabricante gratuitamente desde su página. Permite la
configuración del módulo de una forma sencilla desde un PC conectado al módulo
por el puerto serie. Esta conexión física entre ambos es necesaria hacerla mediante la
correspondiente adaptación de los niveles lógicos de tensión, por ejemplo con el típico MAX232. El fabricante dispone de un completo &lt;a href=&quot;http://download.tigal.com/veear/EasyVR_User_Manual_3.4.2.pdf&quot; target=&quot;_blank&quot;&gt;manual&lt;/a&gt; en el que poder consultar patillajes, conexiones, etc.&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjtFhwSlCMYbNoLEAiFnWXtk486jjyrZ0UH_UqHPhrF4GwPyHq4JjLadUo0kJK5NZ6MY5l50NFMHZAaLqe2Tqe1vMUJSSz3sXuVl1NlnIDeIzasb3O4sDdayDCcyIClEv4MiRYKovtXAMU/s1600/Esquema+MAX232+-+EasyVR.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;350&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjtFhwSlCMYbNoLEAiFnWXtk486jjyrZ0UH_UqHPhrF4GwPyHq4JjLadUo0kJK5NZ6MY5l50NFMHZAaLqe2Tqe1vMUJSSz3sXuVl1NlnIDeIzasb3O4sDdayDCcyIClEv4MiRYKovtXAMU/s640/Esquema+MAX232+-+EasyVR.jpg&quot; width=&quot;580&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Cuando ejecutamos el EasyVR Comander nos encontramos un entorno gráfico con dos áreas diferenciadas.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Por un lado un área dedicada a los grupos, wordsets y tabla de sonidos. Por otro lado un área donde aparecen las etiquetas asociadas a las voces contenidas en el grupo que tenemos seleccionado.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Con el módulo bajo tensión y conectado físicamente al PC,
nos dará opción a elegir el puerto COM correspondiente. Con los dos comandos que se encuentran justo a la izquierda del desplegable
podremos conectar o desconectar el módulo con el puerto de comunicaciones.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Con el módulo conectado podremos ver las
etiquetas de las voces contenidas en los grupos (voces SD) y podemos elegir el
idioma de las voces con el control superior &quot;&lt;b&gt;Set Language&lt;/b&gt;&quot;.
Los idiomas posibles son Inglés, Italiano, Japonés, Alemán, Español y Francés.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiLf4k9S9tMFRESUSw9Gbhomf_mEx8mSBT2NCfPHnXk4dMwtxVqpI_UfZUD2zamaC_TdzWF_bSfes2Sox524AmmRj2ViRa2P-ujBosl94ZdniT9nlx2bs1yLjHD_uBfI-N4e6WNTOvOPP8/s1600/Pantalla+easyVR_Grupos.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: justify;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;440&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiLf4k9S9tMFRESUSw9Gbhomf_mEx8mSBT2NCfPHnXk4dMwtxVqpI_UfZUD2zamaC_TdzWF_bSfes2Sox524AmmRj2ViRa2P-ujBosl94ZdniT9nlx2bs1yLjHD_uBfI-N4e6WNTOvOPP8/s640/Pantalla+easyVR_Grupos.jpg&quot; width=&quot;580&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Aprendizaje de voces.&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: start;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Consiste en añadir nuevas voces a los grupos para posteriormente poder ser reconocidas. Para ello, en el grupo elegido, vamos escribiendo una a una las etiquetas para todas las voces. Etiqueta y voz no tienen necesariamente que coincidir. Cada etiqueta se crea con el comando del menú superior “&lt;b&gt;Add Command&lt;/b&gt;”.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Con todas las etiquetas creadas, se puede ya
asociar cada una a su voz correspondiente. Para ello se selecciona la etiqueta
en cuestión. Con el comando del menú superior “&lt;b&gt;Train Command&lt;/b&gt;”, nos solicitará
una primera dicción de la voz a asociar. Reconocida, indicará “&lt;st1:metricconverter productid=&quot;1”&quot; w:st=&quot;on&quot;&gt;1”&lt;/st1:metricconverter&gt; en la columna Trained y
solicitará una segunda dicción. Si ambas dicciones le resultan coincidentes,
indicará “&lt;st1:metricconverter productid=&quot;2”&quot; w:st=&quot;on&quot;&gt;2”&lt;/st1:metricconverter&gt;
en la columna Trained y la voz quedará asociada a la etiqueta. En caso
contrario indicará el error y anulará la asociación. Este proceso hay que repetirlo para cada una de las etiquetas.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Reconocimiento
de voces.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Para comprobar el reconocimiento de las voces
que acabamos de asociar o las de cualquier otro grupo, seleccionamos el grupo
en el que se encuentran las voces a reconocer. En la pantalla izquierda
aparecerán las etiquetas asociadas. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Con el comando “&lt;b&gt;Test Group&lt;/b&gt;” del menú,
solicitará la dicción de la voz. Si reconoce la voz como una de las que se
encuentra en el grupo actual, sobre-impresiona con color la etiqueta con varias
intermitencias. En caso contrario, sino la reconoce o no se encuentra una voz coincidente
en el grupo, indica el error.&lt;/span&gt;&lt;span style=&quot;font-family: Arial Unicode MS; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;Tabla de sonidos.&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;El módulo también puede reproducir sonidos o frases grabados en su memoria. Todos los sonidos a reproducir se organizan en la tabla de sonidos (Sound Table). De origen, el módulo trae esta tabla de sonidos vacía,&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;a excepción del característico “&lt;b&gt;Beep&lt;/b&gt;” en la primera posición de la tabla.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;El usuario puede crear su propia tabla de sonidos, para ello hay que seguir el siguiente proceso:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;/span&gt;

&lt;br /&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; text-indent: -18pt;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; text-indent: -18pt;&quot;&gt;* &amp;nbsp; Crear los archivos de sonido que queremos utilizar para la tabla con cualquier software grabador&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; text-indent: -18pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; text-indent: -18pt;&quot;&gt;y en formato .wav. Por ejemplo Audacity disponible gratuitamente en su web&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; text-indent: -18pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; text-indent: -18pt;&quot;&gt;http://audacity.sourceforge.net/&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; text-indent: -18pt;&quot;&gt;* &amp;nbsp; Abrimos QuickSynthesis&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; text-indent: -18pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; text-indent: -18pt;&quot;&gt;para crear la tabla en función de los archivos de sonido elegidos.&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; text-indent: -18pt;&quot;&gt;* &amp;nbsp; Con el programa abierto elegimos “Nuevo Proyecto”. Elegimos la opción RSC4 family. Le damos un nombre al proyecto y vamos añadiendo todos los archivos .wav que queramos que formen parte de la tabla de sonidos.&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; text-indent: -18pt;&quot;&gt;* &amp;nbsp; Los seleccionamos todos y ejecutamos comprimir (Compress).&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; text-indent: -18pt;&quot;&gt;* &amp;nbsp; Posteriormente ejecutamos “Built”. Aparece una nueva ventana en la que dejaremos todas las opciones que aparecen por defecto.&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Creada la
tabla de sonidos, ahora hay que añadírla al módulo. Para ello:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;/span&gt;

&lt;br /&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; text-indent: -18pt;&quot;&gt;* &amp;nbsp; Nos
aseguramos de que no tenemos el módulo bajo tensión.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; text-indent: -18pt;&quot;&gt;* &amp;nbsp; Llevamos
la patilla XM del módulo a la línea de Vcc +5V por mediación de una resistencia
de 680 Ω. De esta forma tendremos el módulo en modo de actualización de tabla
de sonidos.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; text-indent: -18pt;&quot;&gt;* &amp;nbsp;Volvemos
a energizar el módulo, incluida la patilla XM que hemos indicado.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; text-indent: -18pt;&quot;&gt;* &amp;nbsp;Accedemos
al EasyVR_Commander y ejecutamos el comando del menú superior ”Update Sound
Table”.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; text-indent: -18pt;&quot;&gt;* &amp;nbsp;Nos
pedirá buscar la ubicación del archivo del proyecto que habíamos creado con el
QuickSyntesis (extensión .qxp).&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; text-indent: -18pt;&quot;&gt;* &amp;nbsp;Elegido,
nos aparece una nueva ventana con la lista de los archivos de la tabla de
sonidos. Si nos indica error, abrimos el proyecto creado con el QuickSyntesis y
volvemos a guardarlo para tener una versión más actualizada.&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgx1S0-z15kOB0IQ8jh9QfrDRNf9lTvUyTcJHQzpm_bHT5t11TECWu_lvxuoj0zEaQfGy55-9AvCT0BHmn_hUymYJZipRXRYNjvMm1EAFy0R7oqyWQwEN056p4QLMmjgg-g7gA-U4POskA/s1600/Pantalla+easyVR_Tabla+sonido.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;440&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgx1S0-z15kOB0IQ8jh9QfrDRNf9lTvUyTcJHQzpm_bHT5t11TECWu_lvxuoj0zEaQfGy55-9AvCT0BHmn_hUymYJZipRXRYNjvMm1EAFy0R7oqyWQwEN056p4QLMmjgg-g7gA-U4POskA/s640/Pantalla+easyVR_Tabla+sonido.jpg&quot; width=&quot;580&quot; /&gt;&lt;/a&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; text-align: justify; text-indent: -18pt;&quot;&gt;Queda
cargarlos al módulo. Seleccionamos la opción “&lt;b&gt;Slow transfers&lt;/b&gt;” y pulsamos “&lt;b&gt;Download&lt;/b&gt;”.
La tabla de sonidos se transfiere al módulo. Todos los sonidos que había
anteriormente en el módulo se eliminan automáticamente a excepción del predeterminado
“&lt;b&gt;Beep&lt;/b&gt;”.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; text-indent: -18pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; text-indent: -18pt;&quot;&gt;Volvemos
a dejar la patilla XM del módulo al aire desconectada de Vcc.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; text-indent: -18pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; text-indent: -18pt;&quot;&gt;Conectamos
la comunicación del módulo con el PC y accediendo a la tabla de sonidos veremos
la nueva tabla de sonidos cargada.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCvMol9sL_8IMHXVzGM0-eSlXtE2ku9-bQJxHrK1pGeLurc0MrNBfY30YeIiIFoGNK1_KsmwYzOzakL2RZpy4SbcHSkEoI7zT9J3hY26t34AAMOm_4BVsVZTN9_ymFsQJNnNc3e4kRCcU/s1600/Pantalla+easyVR_Tabla+sonido2.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;440&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCvMol9sL_8IMHXVzGM0-eSlXtE2ku9-bQJxHrK1pGeLurc0MrNBfY30YeIiIFoGNK1_KsmwYzOzakL2RZpy4SbcHSkEoI7zT9J3hY26t34AAMOm_4BVsVZTN9_ymFsQJNnNc3e4kRCcU/s640/Pantalla+easyVR_Tabla+sonido2.jpg&quot; width=&quot;580&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Para poder reproducir los sonidos con el EasyVR deberemos conectar un altavoz de 8Ω al módulo.&amp;nbsp;Con el comando &lt;i&gt;&lt;b&gt;“Play Sound”&lt;/b&gt;&lt;/i&gt; reproduciremos los sonidos contenidos en la tabla.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Aquí se puede descargar el software y manuales:&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;a href=&quot;http://depositfiles.com/files/36gmv07si&quot; target=&quot;_blank&quot;&gt;Descargar Software&amp;amp;Manuales EasyVR&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: large;&quot;&gt;Artículo relacionado&amp;gt;&amp;gt;&amp;nbsp;&lt;a href=&quot;http://robotypic.blogspot.com.es/2013/03/control-PIC-por-voz.html&quot; target=&quot;_blank&quot;&gt;Control de un PIC por voz con el EasyVR&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://robotypic.blogspot.com/feeds/6768916342155158721/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5250193391449144895/6768916342155158721?isPopup=true' title='2 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5250193391449144895/posts/default/6768916342155158721'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5250193391449144895/posts/default/6768916342155158721'/><link rel='alternate' type='text/html' href='http://robotypic.blogspot.com/2013/03/configuracion-del-easyvr.html' title='Configuración del EasyVR.'/><author><name>Robotypic</name><uri>http://www.blogger.com/profile/16455462312458405515</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjtFhwSlCMYbNoLEAiFnWXtk486jjyrZ0UH_UqHPhrF4GwPyHq4JjLadUo0kJK5NZ6MY5l50NFMHZAaLqe2Tqe1vMUJSSz3sXuVl1NlnIDeIzasb3O4sDdayDCcyIClEv4MiRYKovtXAMU/s72-c/Esquema+MAX232+-+EasyVR.jpg" height="72" width="72"/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5250193391449144895.post-6602911460803329491</id><published>2013-03-19T20:54:00.000+01:00</published><updated>2013-08-02T18:32:26.125+02:00</updated><title type='text'>Control de un PIC por voz</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgoVi_uJAzoTk3_gvG3SRGNSOvyPVqybCKLZVv6g6e8q7btrd3vnIip4PpUoIDlwTpRZQPxYHo40JVSAXozu4YR87XNn11T7tFsoaZoFig3ozMs7rRPjkjPGkmVl553ZXaPw_3e0zHClLg/s1600/Imagen+EasyVR.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;280&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgoVi_uJAzoTk3_gvG3SRGNSOvyPVqybCKLZVv6g6e8q7btrd3vnIip4PpUoIDlwTpRZQPxYHo40JVSAXozu4YR87XNn11T7tFsoaZoFig3ozMs7rRPjkjPGkmVl553ZXaPw_3e0zHClLg/s640/Imagen+EasyVR.jpg&quot; width=&quot;580&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Para el control del PIC mediante órdenes verbales vamos a emplear el módulo EasyVR de &lt;a href=&quot;http://www.veear.eu/&quot; target=&quot;_blank&quot;&gt;Veear&lt;/a&gt; al que previamente le hemos creado las voces a reconocer (voces definidas por el usuario SD) y la tabla de sonidos a emplear. Aunque la enseñanza de estas voces se puede realizar desde código en el PIC, resulta más sencilla la enseñanza mediante el software &lt;a href=&quot;http://download.tigal.com/veear/EasyVR-Commander-3.4.10-QS-5.2.1.zip&quot; target=&quot;_blank&quot;&gt;EasyVR Commander&lt;/a&gt; a través del PC, tal como se ha explicado en el &lt;a href=&quot;http://robotypic.blogspot.com.es/2013/03/configuracion-del-easyvr.html&quot; target=&quot;_blank&quot;&gt;artículo correspondiente&lt;/a&gt;.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;El ejemplo, meramente didáctico, va a consistir en reconocer voces, ya sean SI o SD, contenidas en uno de los grupos o wordset del EasyVR, reconocer parejas de voces mediante la combinación de 2 grupos y reproducir textos hablados. En el caso de voces SD, en un LCD aparecerá la etiqueta de la voz reconocida y la posición que ocupa dentro de su grupo. En el caso de voces SI, tan solo aparecerá la posición. Si se produce algún error en el reconocimiento de las voces, se mostrará el código del error y su descripción. Cada vez que se solicita el reconocimiento de una nueva voz, se indica en un mensaje de texto y simultáneamente con la reproducción de una frase. Todas estas opciones serán elegidas individualmente o de forma combinada según el estado de las entradas en el puerto A.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi2VXiqqdEbnCx5hqmqRSiEKI1pQXc4J0e8a4yvhMVh_B2p4tPzDVjGyCyGrCTa-laHF1pvccd0ox7SeNIzWjgCqkYqSQTTGz0RgE8uisCy6TjzyhIB0HvSA0jZMWG6GlgiolzAKqPDBSE/s1600/Esquema+Control+PIC+por+voz.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;380&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi2VXiqqdEbnCx5hqmqRSiEKI1pQXc4J0e8a4yvhMVh_B2p4tPzDVjGyCyGrCTa-laHF1pvccd0ox7SeNIzWjgCqkYqSQTTGz0RgE8uisCy6TjzyhIB0HvSA0jZMWG6GlgiolzAKqPDBSE/s640/Esquema+Control+PIC+por+voz.jpg&quot; width=&quot;580&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;/div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Este sería el procedimiento para la ejecución de un comando del PIC sobre el EasyVR:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;


&lt;br /&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;comando = &#39;l&#39;;&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;//Comando a emplear (l = idioma)&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;argumento = 4;&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;//Argumento del comando (4 = español)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;putc(comando);&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;//Envía comando elegido&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;putc(argumento+&#39;A&#39;);&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;//Envío del argumento en su equivalente ASCII&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;Respuesta=getc();&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;//Recibe la respuesta del EasyVR&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana, sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana, sans-serif;&quot;&gt;
Para el reconocimiento de voces...&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana, sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;comando = &#39;d&#39;;&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;//Comando a emplear (d = reconocimiento voces SD)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;grupo = 3;&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;//Elección del grupo 3&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;putc(comando);&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;//Envía comando reconocimiento voces SD&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;putc(grupo+&#39;A&#39;);&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;//Envío del argumento (Grupo)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: #38761d; font-family: &#39;Courier New&#39;, Courier, monospace; text-align: left;&quot;&gt;respuesta=getc();&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; text-align: left;&quot;&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &#39;Courier New&#39;, Courier, monospace; text-align: left;&quot;&gt;//Recibe respuesta del EasyVR&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;if (respuesta == &#39;r&#39;){&lt;/span&gt; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;//Si se ha reconocido la voz&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #38761d;&quot;&gt;putc(&#39; &#39;);&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #999999;&quot;&gt;//Solicita siguiente dato&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #38761d;&quot;&gt;respuesta=getc();&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;//Recibe posición en el grupo&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #38761d;&quot;&gt;posicion = respuesta;&lt;/span&gt; &amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;//guarda la posición obtenida&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;if (respuesta == &#39;e&#39;){&lt;/span&gt; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;//Si no se ha reconocido la voz&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #38761d;&quot;&gt;putc(&#39; &#39;);&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #999999;&quot;&gt;//Solicita siguiente dato&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #38761d;&quot;&gt;respuesta=getc();&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;//Recibe 1º dato de error de 4 bits&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #38761d;&quot;&gt;error=respuesta;&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #999999;&quot;&gt;//Guarda el dato de error&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #38761d;&quot;&gt;putc(&#39; &#39;);&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #999999;&quot;&gt;//Solicita siguiente dato&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #38761d;&quot;&gt;respuesta&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;=getc();&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;//Recibe 2º dato de error de 4 bits&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #38761d;&quot;&gt;error=(error&amp;lt;&amp;lt;4)|(respuesta);&lt;/span&gt; &lt;span style=&quot;color: #999999;&quot;&gt;//Transforma error en un byte de 8 bits&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Obtenida la posición o el error, los gestionaremos para hacer la función deseada sobre el PIC. En el caso de reconocimiento de voces SI el procedimiento sería el mismo pero utilizando su correspondiente comando (&#39;i&#39;). La respuesta en caso de &amp;nbsp;reconocimiento sería &#39;s&#39;.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Con este otro código, reproduciremos un sonido o frase de la tabla de sonidos:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;int16 indice = 1;&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;//Posición del sonido a reproducir en la tabla&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;volumen = 30;&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;//Volumen de la reproducción (entre 0 y 31)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;indice_bajo=make8(indice,0);&lt;/span&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;//Parte alta de indice a indice_bajo&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;indice_alto=make8(indice,1);&lt;/span&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;//Parte alta de indice a indice_alto&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;putc(&#39;w&#39;);&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;//Envía comando&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;putc(indice_alto+&#39;A&#39;);&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;//Envía byte más peso del indice(8 bits)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;putc(indice_bajo+&#39;A&#39;);&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;//Envía byte más peso del indice(8 bits)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;putc(volumen+&#39;A&#39;);&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;//Envía el nivel de volumen&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;respuesta=getc();&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;//Recibe un dato del EasyVR&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Para leer la etiqueta asociada a una voz SD:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;/span&gt;


&lt;br /&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;int i=0; &amp;nbsp;&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;//Indice del buffer&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;int grupo = 3; &lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;//nº de grupo&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;int posicion = 6;&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;//posición en el grupo&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;char etiqueta [16]; &lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #999999;&quot;&gt;//Buffer etiqueta; max.16&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;putc(&#39;p&#39;);&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;//Envía comando &quot;lectura etiqueta&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;putc(Grupo+&#39;A&#39;);&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;//Envía el número de grupo&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;putc(posicion+&#39;A&#39;);&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #999999;&quot;&gt;//Envía posición en el grupo&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;respuesta=getc(); &lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #999999;&quot;&gt;//Recibe un dato del EasyVR&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;putc(&#39; &#39;);&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;//Solicita siguiente dato&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;respuesta=getc()&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;;&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #999999;&quot;&gt;//Recibe un dato del EasyVR&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;putc(&#39; &#39;);&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;//Solicita siguiente dato&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;respuesta=getc()&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;;&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #999999;&quot;&gt;//Recibe un dato del EasyVR&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;putc(&#39; &#39;);&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;//Solicita siguiente dato&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;respuesta=getc()&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;-&#39;A&#39;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;;&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #999999;&quot;&gt;//Recibe nº de caracteres de la etiqueta&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;n_caracteres=respuesta;&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #999999;&quot;&gt;//Guarda nº caracteres de la etiqueta&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;//Llena el buffer con los caracteres de la etiqueta&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;for(i=0;i&amp;lt;n_caracteres;i++) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #38761d;&quot;&gt;putc(&#39; &#39;); &amp;nbsp; &lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;//&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;Solicita siguiente carácter&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #38761d;&quot;&gt;etiqueta[i]=&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #38761d; font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;getc();&lt;/span&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;//Llena el buffer&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #38761d;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; text-align: justify;&quot;&gt;Finalmente el procedimiento para obtener el nº de etiquetas dentro de un grupo de voces SD:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; text-align: justify;&quot;&gt;&lt;/span&gt;


&lt;br /&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;int grupo = 3;&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;//nº de grupo&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;putc(&#39;c&#39;);&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;//Envía comando&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;putc(Grupo+&#39;A&#39;);&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;//Envia nº de grupo&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;respuesta=getc(); &lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #999999;&quot;&gt;//Recibe un dato del EasyVR&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;putc(&#39; &#39;);&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;//Solicita siguiente dato&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;respuesta=getc()&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;-&#39;A&#39;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;; &amp;nbsp;&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #999999;&quot;&gt;//Recibe nº de etiquetas del grupo&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;font-family: Verdana, sans-serif; text-align: justify;&quot;&gt;
El programa completo que se muestra para el ejemplo de funcionamiento está estructurado con llamadas a funciones para poderlo emplear como plantilla para otros proyectos cambiando tan solo el código contenido en la función main.&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana, sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=5250193391449144895#&quot; onclick=&quot;Effect.toggle(&amp;quot;expandir1&amp;quot;,&amp;quot;slide&amp;quot;); return false&quot;&gt;[+/-] Ver / Ocultar programa completo en C&lt;/a&gt;&lt;br /&gt;
&lt;div id=&quot;expandir1&quot; style=&quot;display: none;&quot;&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;////////////////////////////////////////////////////////////////////////////////&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; CONTROL PIC POR VOZ CON EL MÓDULO EasyVR &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (c) RobotyPic &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;http://robotypic.blogspot.com/ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;////////////////////////////////////////////////////////////////////////////////&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#include &amp;lt;16f876a.h&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#fuses &amp;nbsp; XT,NOLVP,PUT,NOWDT,NOWRT &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#use delay(clock=4000000) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Frecuencia de reloj externa&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Habilitación y configuración de las funciones RS232&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#use RS232(BAUD=9600,BITS=8,PARITY=N,XMIT=PIN_C6,RCV=PIN_C7)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Configuración de la gestión de los puertos&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#define use_portb_lcd TRUE &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Puerto B para uso LCD&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#use fast_io (A) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Configuración puerto A&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#use fast_io (B) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Configuración puerto A&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#include &amp;lt;lcd.c&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Driver para pantalla lcd&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/********************** COMANDOS DE CONTROL EasyVR ****************************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/* Definición de comandos de entrada al módulo de reconocimiento de voz EasyVR*/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;CMD_LANGUAGE &amp;nbsp; &#39;l&#39; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Selecciona idioma de las palabras predefinidas (SI)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Espera recibir STS_SUCCESS&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;CMD_BREAK &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39;b&#39; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Detiene cualquier comando o reconocimiento en proceso&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Espera recibir STS_SUCCESS o STS_INTERR&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;CMD_RECOG_SI &amp;nbsp; &#39;i&#39; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Activa el reconocimiento de una voz predefinida (SI)&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Espera recibir STS_SIMILAR, STS_TIMEOUT o STS_ERROR&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;CMD_RECOG_SD &amp;nbsp; &#39;d&#39; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Activa reconocimiento de una palabra o voz de usuario (SD)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Espera recibir STS_RESULT, STS_TIMEOUT o STS_ERROR&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;CMD_KNOW &amp;nbsp; &amp;nbsp; &amp;nbsp; &#39;k&#39; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Ajusta el nivel de reconocimiento para las palabras predefinidas (SI)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Espera recibir STS_SUCCESS&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;CMD_LEVEL &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39;v&#39; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Ajusta el nivel de reconocimiento de las voces usuario (SD)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Espera recibir STS_SUCCESS&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;CMD_PLAY_SX &amp;nbsp; &amp;nbsp;&#39;w&#39; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Reproduce los sonidos de la tabla de sonidos&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Espera recibir STS_SUCCESS o STS_ERROR&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;CMD_DUMP_SD &amp;nbsp; &amp;nbsp;&#39;p&#39; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Lee la etiqueta de un comando SD&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Espera recibir STS_DATA&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;CMD_COUNT_SD &amp;nbsp; &#39;c&#39; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Indica número de comandos SD que hay en un grupo &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Espera recibir STS_COUNT&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;CMD_TIMEOUT &amp;nbsp; &amp;nbsp;&#39;o&#39; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Ajusta el tiempo de reconocimiento &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Espera recibir STS_SUCCESS&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/*************************** REGISTROS DE ESTADO ******************************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/*Definición de estados o respuestas del módulo EasyVR tras ejecutar un comando*/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;STS_SUCCESS &amp;nbsp; &amp;nbsp;&#39;o&#39; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Ejecución correcta. Respuesta a varios comandos.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;STS_SIMILAR &amp;nbsp; &amp;nbsp;&#39;s&#39; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Voz similar. Respuesta al comando SI&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;STS_TIMEOUT &amp;nbsp; &amp;nbsp;&#39;t&#39; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Tiempo sobrepasado en enseñanza o reconocimiento de voz&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;STS_ERROR &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39;e&#39; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Error en los comandos de enseñanza o reconocimiento de voces&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;STS_RESULT &amp;nbsp; &amp;nbsp; &#39;r&#39; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Voz reconocida. Respuesta al reconocimiento de voces SD&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;STS_INTERR &amp;nbsp; &amp;nbsp; &#39;i&#39; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Interrupción durante reconocimiento. Respuesta a CMD_BREAK&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;STS_DATA &amp;nbsp; &amp;nbsp; &amp;nbsp; &#39;d&#39; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Respuesta al comando CMD_DUMP_SD.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;STS_COUNT &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39;c&#39; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Respuesta al comando CMD_COUNT_SD.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/********************* Prototipos de las funciones ****************************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;FUN_COMANDO (); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Envío de un comando&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;FUN_RESPUESTA_COMANDO(); &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Recepción de la respuesta del EasyVR tras un comando&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;FUN_BREAK(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Aborta cualquier operación en curso en el EasyVR&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;FUN_RECONOCIMIENTO(int); &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Función de reconocimiento de voces&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;FUN_ACK_RESPUESTA(); &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Función para solicitud de recepción de siguiente dato&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;FUN_ERROR(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Crea mensaje de texto en función del error recibido&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;FUN_ETIQUETA_SD(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Reconocimiento de la etiqueta asociada a una voz SD&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;FUN_ARGUMENTO(int); &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Envío del argumento del comando&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;FUN_N_ETIQUETAS(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Obtención del nº de etiquetas dentro de un grupo&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/******************* Definición de variables globales *************************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;int &amp;nbsp; EVR_Dato; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Datos de propósito general&lt;/span&gt;&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;int &amp;nbsp; EVR_Replica; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Recibe las respuestas de los comandos. Códigos STS&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;int &amp;nbsp; EVR_Grupo; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Determina grupo (0=Trigger,1-15 genérico, 16=password)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;int &amp;nbsp; EVR_Posicion; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Recibe la posición(0-31)dentro de un grupo&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;char &amp;nbsp;EVR_TipoVoz; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Tipo de voz 1=SI o 0=SD&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;char &amp;nbsp;EVR_Resultado; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Guarda el resultado del reconocimiento&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;int &amp;nbsp; EVR_Error; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Guarda código de error a partir de dos datos de 4 bits&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;char &amp;nbsp;EVR_Mensaje[16]; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Mensaje de error&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;char &amp;nbsp;EVR_Etiqueta[16]; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Etiqueta de la correspondiente voz&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;int &amp;nbsp; EVR_Volumen; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Volumen de reproducción del sonido&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;int16 EVR_Indice; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Índice del mensaje o sonido a reproducir de la Tabla&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;int &amp;nbsp; EVR_IndiceAlto; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Byte alto del indice&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;int &amp;nbsp; EVR_IndiceBajo; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Byte bajo del índice&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;int &amp;nbsp; EVR_NCaracteres; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Nº de caracteres de la etiqueta de una voz&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;int &amp;nbsp; EVR_Esperado; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Respuesta esperada del reconocimiento de voces&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;int &amp;nbsp; EVR_NEtiquetas; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Nº de etiquetas de un grupo SD&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/*************************** FUNCIÓN COMANDO **********************************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/* &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Envía el comando al EasyVR y su argumento &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;FUN_COMANDO(int comando) {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;putc(comando); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Envía comando&lt;/span&gt;&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;FUN_ARGUMENTO(EVR_Dato); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Función de envío del argumento del comando&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/********************** FUNCIÓN ARGUMENTO DE COMANDO **************************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/* Envía el argumento para los comandos que lo necesitan. Se espera a recibir&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; respuesta que se deposita en EVR_Replica &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; */&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;FUN_ARGUMENTO(int dato) {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;putc(dato+&#39;A&#39;); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Envío del argumento en su equivalente ASCII&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;EVR_Replica=FUN_RESPUESTA_COMANDO(); &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Recibe respuesta del comando&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/************************ FUNCIÓN DE RUPTURA **********************************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/* &amp;nbsp; &amp;nbsp; Aborta cualquier operación en curso. Devuelve &#39;o&#39;(STS_SUCCESS)&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; si no hay errores o &#39;i&#39; (STS_INTERR) si la detención se produce durante el&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;reconocimiento o enseñanza de una voz &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;FUN_BREAK() { &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;putc(CMD_BREAK); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Envía comando CMD_BREAK&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;EVR_Replica=FUN_RESPUESTA_COMANDO(); &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Lee el byte recibido&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/************************ FUNCIÓN RESET BUFFER ********************************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/*Reinicializa el buffer empleado para alojar la etiqueta leída correspondiente&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;a una voz &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;FUN_RESET_ETIQUETA() {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;int &amp;nbsp; i; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Índice del buffer&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;for(i=0;i&amp;lt;16;i++) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Nº de posiciones del buffer&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;EVR_Etiqueta[i]=0; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Borra posición i del buffer&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/******************** &amp;nbsp;FUNCIÓN RESPUESTA DEL EasyVR &amp;nbsp;**************************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/* &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Recepción de un carácter de respuesta a un comando &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; */&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;FUN_RESPUESTA_COMANDO() {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;int &amp;nbsp; dato;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;dato=getc(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Recibe un dato del EasyVR&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;delay_ms(1); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Retardo entre un byte y el siguiente&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;return dato; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Retorna el dato recibido&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/******************* FUNCIÓN CONFIRMACIÓN Y RESPUESTA *************************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/* Envía confirmación de la recepción de un caracter de respuesta a un comando y&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; solicita el siguiente caracter de respuesta al Easy_VR &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;FUN_ACK_RESPUESTA() &amp;nbsp;{&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;putc(&#39; &#39;); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Envía confirmación&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;EVR_Dato=FUN_RESPUESTA_COMANDO()-&#39;A&#39;; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Recibe siguiente byte de respuesta&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/********************* FUNCIÓN RESULTADO RECONOCIMIENTO ***********************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/**** Resultado obtenido del reconocimiento de la voz y muestra en el LCD *****/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;FUN_RESULTADO() &amp;nbsp;{ &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;switch (EVR_Resultado) &amp;nbsp;{&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Caso error de reconocimiento: muestra en LCD código de error y mensaje&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; case STS_ERROR: &amp;nbsp;{&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; printf(lcd_putc, &quot;\fError %x Repetir&quot;, EVR_Error);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; printf(lcd_putc, &quot;\n%s&quot;, EVR_Mensaje);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; break;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Caso reconocimiento SI: muestra la posición en su grupo de la voz&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; case STS_SIMILAR: &amp;nbsp;{&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; printf(lcd_putc, &quot;\fSI n.%u &quot;, EVR_Posicion);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; break;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Caso reconocimiento SD: muestra la posición de la voz y su etiqueta&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; case STS_RESULT: &amp;nbsp;{&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; printf(lcd_putc, &quot;\fSD n.%u %s&quot;, EVR_Posicion,EVR_Etiqueta);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; break;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Caso sobrepasamiento de tiempo: muestra mensaje&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; case STS_TIMEOUT: &amp;nbsp;{&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; printf(lcd_putc, &quot;\fFuera de Tiempo&quot;);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Break;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Caso por defecto: muestra mensaje&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; default: &amp;nbsp;{&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; printf(lcd_putc, &quot;\fEsperando&quot;);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Break;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; } &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/*********************** FUNCIÓN MENSAJE DE ERROR *****************************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/* Elije texto de error en función del código de error indicado por el módulo */&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;FUN_ERROR() {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;switch(EVR_Error) { &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Analiza el error producido&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; case 0x03: { &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//En EVR_Mensaje se guarda el mensaje&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;strcpy (EVR_Mensaje, &quot;Demasiado ruido&quot;); &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; break;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; case 0x04: { &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//En EVR_Mensaje se guarda el mensaje&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;strcpy (EVR_Mensaje, &quot;Voz muy baja&quot;); &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; break;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; } &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; case 0x05: { &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//En EVR_Mensaje se guarda el mensaje&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;strcpy (EVR_Mensaje, &quot;Voz muy alta&quot;); &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; break;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; } &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; case 0x06: { &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//En EVR_Mensaje se guarda el mensaje&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;strcpy (EVR_Mensaje, &quot;Voz adelantada&quot;); &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; break;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; } &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; case 0x07: { &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;/&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/En EVR_Mensaje se guarda el mensaje &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;strcpy (EVR_Mensaje, &quot;Voz muy compleja&quot;);&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; break;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; }&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; case 0x11: { &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//En EVR_Mensaje se guarda el mensaje &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;strcpy (EVR_Mensaje, &quot;Voz desconocida&quot;);&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; break;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; } &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; case 0x12: { &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//En EVR_Mensaje se guarda el mensaje &lt;/span&gt;&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;strcpy (EVR_Mensaje, &quot;Voz dudosa&quot;); &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; break;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; } &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; case 0x13: { &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//En EVR_Mensaje se guarda el mensaje&lt;/span&gt;&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;strcpy (EVR_Mensaje, &quot;Voz dudosa&quot;); &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; break;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; } &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; case 0x14: { &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//En EVR_Mensaje se guarda el mensaje &lt;/span&gt;&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;strcpy (EVR_Mensaje, &quot;Fallo de comando&quot;); &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; break;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; } &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; case 0x17: { &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//En EVR_Mensaje se guarda el mensaje&lt;/span&gt;&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;strcpy (EVR_Mensaje, &quot;Duracion no ok&quot;); &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; break;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; } &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; case 0x4A: { &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//En EVR_Mensaje se guarda el mensaje&lt;/span&gt;&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;strcpy (EVR_Mensaje, &quot;Version fichero&quot;); &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; break;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; } &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; case 0x4E: { &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//En EVR_Mensaje se guarda el mensaje &lt;/span&gt;&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;strcpy (EVR_Mensaje, &quot;Datos fichero&quot;); &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; break;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; } &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;case 0x80: { &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//En EVR_Mensaje se guarda el mensaje &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;strcpy (EVR_Mensaje, &quot;Voz no registrada&quot;); &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; break;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; } &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; default: { &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//En EVR_Mensaje se guarda el mensaje &lt;/span&gt;&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;strcpy (EVR_Mensaje, &quot;Indefinido&quot;); &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; break;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; }&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/********************** FUNCIÓN RECONOCIMIENTO DE VOCES ***********************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/* Función para el reconocimiento de una voz predeterminada (SI) o definida por&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;el usuario (SD)según valor de &quot;comando&quot; (CMD_RECOG_SD o CMD_RECOG_SI).&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;En EVR_Replica se devuelve: &#39;r&#39; (STS_RESULT) si la voz ha sido reconocida (para&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;voces SD), &#39;s&#39; (STS_SIMILAR) si la voz ha sido reconocida (para voces SI),&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&#39;t&#39; (STS_TIMEOUT) si ha habido sobre pasamiento en el tiempo o &#39;e&#39; STS_ERROR&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;si ha habido error en el reconocimiento.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;En EVR_Posicion se devuelve la posición dentro del grupo que ocupa la voz, en&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;caso de ser reconocida.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;En el caso de una voz &amp;nbsp;SD reconocida, además de la posición, su correspondiente&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;etiqueta se almacena en EVR_Etiqueta[]. &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; */&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;FUN_RECONOCIMIENTO(int comando) {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;putc(comando); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Envía comando CMD_RECOG_SD o CMD_RECOG_SI&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;FUN_ARGUMENTO(EVR_Grupo); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Envía nº de grupo o Wordset&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;switch(EVR_Replica) { &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Analiza la respuesta&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; case STS_RESULT: { &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Si es una voz reconocida SD...&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;EVR_Resultado = STS_RESULT;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;FUN_ACK_RESPUESTA(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Recibe el nº de posición dentro del grupo&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;EVR_Posicion=EVR_Dato; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Lo guarda&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if(EVR_TipoVoz==CMD_RECOG_SD); &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Si es una voz SD ...&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; FUN_ETIQUETA_SD(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Lee la etiqueta asociada a esa voz&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; break;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; case STS_SIMILAR: { &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Si es una voz reconocida SI...&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;EVR_Resultado = STS_SIMILAR;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;FUN_ACK_RESPUESTA(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Recibe nº de posición dentro del grupo&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;EVR_Posicion=EVR_Dato; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Lo salva&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; break;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; case STS_TIMEOUT: { &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Si hay sobre pasamiento del tiempo&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;EVR_Resultado = STS_TIMEOUT;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;EVR_Posicion=0; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Puesta a 0 de la posición&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; break;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; case STS_ERROR: { &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Si hay error&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; EVR_Resultado = STS_ERROR;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; FUN_ACK_RESPUESTA(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Recibe 1º dato de 4bits de código de error&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; EVR_Error=EVR_Dato; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Lo guarda&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; FUN_ACK_RESPUESTA(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Recibe 2º dato de 4bits de código de error&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; EVR_Error=(EVR_Error&amp;lt;&amp;lt;4)|(EVR_Dato);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; FUN_ERROR(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Elije texto de mensaje según código de error&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; EVR_Posicion=0; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Puesta a 0 de la posición&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; break;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/**************** FUNCIÓN NÚMERO ETIQUETAS GRUPO DE VOZ SD ********************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/* Obtiene el número de etiquetas dentro de un grupo de voces SD y lo guarda en&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;EVR_NEtiquetas. Necesita la variable EVR_Grupo que contiene el grupo de voces SD&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;(de 0 y 16). &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;FUN_N_ETIQUETAS() {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;putc(CMD_COUNT_SD); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Envía comando &#39;c&lt;/span&gt;&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;putc(EVR_Grupo+&#39;A&#39;); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Envia nº de grupo&lt;/span&gt;&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;EVR_Replica=FUN_RESPUESTA_COMANDO(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Recibe la respuesta y guarda&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;putc(&#39; &#39;); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Solicita siguiente dato&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;EVR_NEtiquetas=FUN_RESPUESTA_COMANDO()-&#39;A&#39;; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Guarda el nº de etiquetas&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/********************** FUNCIÓN LECTURA ETIQUETA VOZ SD ***********************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/* &amp;nbsp; &amp;nbsp;Lee la etiqueta asociada a una voz SD y la guarda en EVR_Etiqueta[].&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;Necesita la variable EVR_Grupo que contiene el grupo de la voz SD (de 0 y 16).&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;Y la variable EVR_Posicion, la posición dentro del grupo (de 0 y 31) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; */&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;FUN_ETIQUETA_SD() &amp;nbsp;{&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;int i; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Indice del buffer&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;FUN_RESET_ETIQUETA(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Reset buffer de la etiqueta&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;putc(CMD_DUMP_SD); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Transmite comando &#39;p&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;putc(EVR_Grupo+&#39;A&#39;); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Envía el número de grupo&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;putc(EVR_Posicion+&#39;A&#39;); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt; //Envía posición en el grupo&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;EVR_Replica=FUN_RESPUESTA_COMANDO(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Recibe la respuesta y salva&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;putc(&#39; &#39;); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Solicita siguiente dato&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;EVR_Dato=FUN_RESPUESTA_COMANDO()-&#39;A&#39;; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Recibe información de la enseñanza&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;putc(&#39; &#39;); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Solicita siguiente dato&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;EVR_Dato=FUN_RESPUESTA_COMANDO()-&#39;@&#39;; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Recibe posición conflictiva&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;putc(&#39; &#39;); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Solicita siguiente dato&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;EVR_NCaracteres=FUN_RESPUESTA_COMANDO()-&#39;A&#39;; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Recibe nºcaracteres de la etiqueta&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;//Llena el buffer con los caracteres de al etiqueta&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;i=0;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;for(i=0;i&amp;lt;EVR_NCaracteres;i++) {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; putc(&#39; &#39;); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Solicita siguiente carácter&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; EVR_Etiqueta[i]=FUN_RESPUESTA_COMANDO(); &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Llena el buffer&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/************************** FUNCIÓN INICIALIZACIÓN ****************************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/* Inicia la comunicación serie con el módulo de reconocimiento EasyVR. También&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;espera Wake Up del módulo trás un Power Down. Debe retornar &#39;o&#39; en EVR_Replica */&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;FUN_SERIAL() {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;do{&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; FUN_BREAK(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Envía comando VR_BREAK...&lt;/span&gt;&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;}while(EVR_Replica!=STS_SUCCESS); &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//...hasta recibir STS_SUCCESS&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/**************************FUNCIÓN REPRODUCCIÓN SONIDO ************************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/* Reproduce el sonido de la Tabla de sonidos. En EVR_Indice se indica el índice&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;de 16 bits del sonido a reproducir (entre 0 y 1023). En EVR_Volumen se indica el&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;volumen de reproducción entre 0 y 31.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;En EasyVR_Replica se devuelve &#39;o&#39; al finalizar correctamente la reproducción o&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&#39;e&#39; si hay error. &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; */&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;FUN_REPRODUCCION(int16 EVR_Indice,int EVR_Volumen) {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;EVR_IndiceBajo=make8(EVR_Indice,0); &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Parte alta de EVR_indice a EVR_IndiceBajo&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;EVR_IndiceAlto=make8(EVR_Indice,1); &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Parte alta de EVR_indice a EVR_IndiceAlto&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;putc(CMD_PLAY_SX); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Envía comando &#39;w&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;putc(EVR_IndiceAlto+&#39;A&#39;); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Envía byte de más peso del indice(8 bits)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;putc(EVR_IndiceBajo+&#39;A&#39;); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt; //Envía byte de más peso del indice(8 bits)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;putc(EVR_Volumen+&#39;A&#39;); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Envía el nivel de volumen&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;EVR_Replica=FUN_RESPUESTA_COMANDO();&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Lee respuesta&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;}&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/******************************************************************************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;main() {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;int1 EVR_Grupo1; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Grupo 1 elegido si-no&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;int1 EVR_Grupo2; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Grupo 2 elegido si-no&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;set_tris_a(0xff); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Definición de entradas y salidas en puerto A&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;set_tris_c(0b10111100); &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Definición de entradas y salidas en puerto C&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;lcd_init(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Inicialización del LCD&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;//Configuración inicial del EasyVR&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;FUN_SERIAL(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;//Inicia el módulo EasyVR&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;//Elección del idioma empleado para el reconocimiento de las voces SI&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;//según EVR_Dato: 0=Ingles,1=Italiano,2=Japonés,3=Alemán,4=Español,5=Francés&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;EVR_Dato=4; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Elección del idioma español para las voces&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;FUN_COMANDO(CMD_LANGUAGE); &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Envío del idioma elegido al EasyVR&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;//Ajuste nivel de exigencia del reconocimiento para voces predefinidas (SI)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;//según EVR_Dato: 0=nivel bajo, 2=valor medio(por defecto),4= nivel alto&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;EVR_Dato=4; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Elección del nivel de reconocimiento de voces SI&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;FUN_COMANDO(CMD_KNOW); &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Envío del nivel SI elegido a EasyVR&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;//Ajuste del nivel de exigencia del reconocimiento para voces de usuario (SD)&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;//según EVR_Dato: 0=nivel bajo, 2=valor medio(por defecto),5=nivel alto&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;EVR_Dato=2; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Elección del nivel de reconocimiento de voces SD&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;FUN_COMANDO(CMD_LEVEL); &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Envío del nivel SD elegido a EasyVR &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;//Ajuste del tiempo de respuesta (Time Out). Si durante la ejecución de&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;//determinados comandos se supera este tiempo, dicha ejecución se da por&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;//finalizada. Según EVR_Dato: -1 (0xFF)= defecto, 0=infinito, .1 a .32 valor&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;//del Time Out en segundos&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;EVR_Dato=0; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Elección de tiempo infinito para el Time Out&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;FUN_COMANDO(CMD_TIMEOUT); &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Envío de la configuración del Time Out&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;FUN_RESET_ETIQUETA(); &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Reset buffer de la etiqueta de voz&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;//Elección tipo de voz a reconocer, SD o SI, según el valor del PIN A0&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;if (input(PIN_A0) == 1) {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; EVR_TipoVoz=CMD_RECOG_SD;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; EVR_Esperado = STS_RESULT;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; printf(lcd_putc, &quot;\fIniciado voz SD&quot;);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;else {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; EVR_TipoVoz=CMD_RECOG_SI;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; EVR_Esperado = STS_SIMILAR;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; printf(lcd_putc, &quot;\fIniciado voz SI&quot;);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Reconocimiento de voces&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;While(true) {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Elección del grupo o wordset, según valores de PIN A1 y PIN A2.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; //Si ambos son 1 realiza el reconocimiento combinado de los dos grupos&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; if (input(PIN_A1) == 1) EVR_Grupo1 = 1;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; else EVR_Grupo1=0;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; if (input(PIN_A2) == 1) EVR_Grupo2 = 1;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; else EVR_Grupo2=0;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Si hay al menos un Grupo seleccionado se pide en LCD dictar la voz&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; if ((EVR_Grupo1 == 1) || (EVR_Grupo2 == 1)) {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;lcd_gotoxy(1,2); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Texto en la segunda linea&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;printf(lcd_putc, &quot;Dictar Voz&quot;); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Texto a mostrar&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Si además PIN A3 = 1 lo solicita también reproduciendo un texto&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (input (PIN_A3) == 1) {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; EVR_Indice = 1; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Sonido correspondiente a la 1º posición&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; EVR_Volumen = 30; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Volumen de la reproducción (entre 0 y 31)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; FUN_REPRODUCCION(EVR_Indice,EVR_Volumen); &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Reproducir sonido&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; //Reconocimiento de voces SI o SD según valor de EVR_TipoVoz&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; //y del Grupo elegido según valor EVR_Grupo&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; if (EVR_Grupo1==1) {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;EVR_Grupo=1; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Grupo de la voz a reconocer&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;do &amp;nbsp;{&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; FUN_RECONOCIMIENTO(EVR_TipoVoz); &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Reconocimiento de voces&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; FUN_RESULTADO(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Resultado del reconocimiento de voz&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}while (EVR_Resultado !=(EVR_Esperado)); &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Repetir hasta reconocimiento ok&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Si se combinan los dos Grupos se pide en LCD la segunda voz&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; if ((EVR_Grupo1 == 1) &amp;amp;&amp;amp; (EVR_Grupo2 == 1)) {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;lcd_gotoxy(1,2); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Texto en la segunda linea&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;printf(lcd_putc, &quot;Siguiente Voz&quot;); &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Texto a mostrar&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Si además PIN A3 = 1 lo solicita también reproduciendo un texto&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (input (PIN_A3) == 1) {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; EVR_Indice = 2; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Sonido correspondiente a la 1º posición&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; EVR_Volumen = 30; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Volumen de la reproducción (entre 0 y 31)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; FUN_REPRODUCCION(EVR_Indice,EVR_Volumen); &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Reproducir sonido&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;} &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt; //Reconocimiento de voces SI o SD según valor de EVR_TipoVoz&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; //y del Grupo elegido según valor EVR_Grupo&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; if (EVR_Grupo2==1) {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;EVR_Grupo=2; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Grupo de la voz a reconocer&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;do &amp;nbsp;{&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; FUN_RECONOCIMIENTO(EVR_TipoVoz); &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Reconocimiento de voces&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; FUN_RESULTADO(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Resultado del reconocimiento de voz&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}while (EVR_Resultado !=(EVR_Esperado)); &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Repetir hasta reconocimiento ok&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; } &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;font-family: Verdana, sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana, sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana, sans-serif;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
En este vídeo se muestra el resultado. Se intenta reconocer voces de dos grupos diferentes. En uno de ellos hay contenidas voces de dirección y en el otro números. Deliberadamente se le hace reconocer un número (el nº 11) que no existe en el grupo para ver el mensaje de error asociado sobre el LCD.&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana, sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;center&gt;
&lt;iframe allowfullscreen=&quot;&quot; frameborder=&quot;0&quot; height=&quot;340&quot; src=&quot;http://www.youtube.com/embed/y4GVJ6WddzM?feature=player_detailpage&quot; width=&quot;580&quot;&gt;&lt;/iframe&gt;&lt;/center&gt;
&lt;div style=&quot;font-family: Verdana, sans-serif;&quot;&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana, sans-serif;&quot;&gt;
Descarga del proyecto:&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://depositfiles.com/files/cx5typ7o0&quot; target=&quot;_blank&quot;&gt;Control PIC por voz.&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;El proyecto contenido en el artículo ha sido diseñado con la versión v4.084 de&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;CCS PIC C COMPILER&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;Artículo relacionado &amp;gt;&amp;gt;&amp;nbsp;&lt;a href=&quot;http://robotypic.blogspot.com.es/2013/03/configuracion-del-easyvr.html&quot; target=&quot;_blank&quot;&gt;Configuración del módulo EasyVR&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://robotypic.blogspot.com/feeds/6602911460803329491/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5250193391449144895/6602911460803329491?isPopup=true' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5250193391449144895/posts/default/6602911460803329491'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5250193391449144895/posts/default/6602911460803329491'/><link rel='alternate' type='text/html' href='http://robotypic.blogspot.com/2013/03/control-PIC-por-voz.html' title='Control de un PIC por voz'/><author><name>Robotypic</name><uri>http://www.blogger.com/profile/16455462312458405515</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgoVi_uJAzoTk3_gvG3SRGNSOvyPVqybCKLZVv6g6e8q7btrd3vnIip4PpUoIDlwTpRZQPxYHo40JVSAXozu4YR87XNn11T7tFsoaZoFig3ozMs7rRPjkjPGkmVl553ZXaPw_3e0zHClLg/s72-c/Imagen+EasyVR.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5250193391449144895.post-8294367605809076484</id><published>2013-02-20T21:12:00.000+01:00</published><updated>2013-12-13T00:04:58.570+01:00</updated><title type='text'>Comunicación PC-PIC por USB con Visual Basic</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Este proyecto es una versión más elaborada del artículo &lt;a href=&quot;http://robotypic.blogspot.com.es/2013/02/comunicacion-pc-pic-por-usb.html&quot; target=&quot;_blank&quot;&gt;Comunicación PC-PIC por USB&lt;/a&gt;, al que remito para más detalle en la configuración de fuses, descripción de funciones USB, etc. En este caso se emplea una aplicación desarrollada bajo visual basic para poder interactuar con el PIC desde el PC. Esta aplicación permite la lectura del canal analógico del Puerto A de un PIC 18F4550, además de la lectura o escritura de los puertos B y D. Todo controlado desde el PC a través de una conexión USB.&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgwl4zVnoaKxu_to_xRvYRNi49C980kOgbbNEf6I0x8nOqBjRQZbFMGaY2bzEWeU2WpH6U_Q-_gvHqtjiD4C46ljnJ-mYzuTKSLjbRMI-26yJic-FDK5kRupuzFRLTh3dos3OAUxICyh30/s1600/Interface+Visual+Basic+PIC-PC+USB.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;380&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgwl4zVnoaKxu_to_xRvYRNi49C980kOgbbNEf6I0x8nOqBjRQZbFMGaY2bzEWeU2WpH6U_Q-_gvHqtjiD4C46ljnJ-mYzuTKSLjbRMI-26yJic-FDK5kRupuzFRLTh3dos3OAUxICyh30/s640/Interface+Visual+Basic+PIC-PC+USB.jpg&quot; width=&quot;580&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;La aplicación VB indica la orden al PIC mediante un código de 4 caracteres. El primero de esos caracteres le indica al PIC la actuación que debe realizar,&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&amp;nbsp;ya sea la lectura de la entrada analógica, lectura del puerto D o puerto B, escrituras en los puertos,etc.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;


&lt;br /&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;if (usb_cdc_kbhit()){ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;//Si hay recepción de datos los lee&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; recepcion_datos();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; switch(opcion[0]){ &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;//Gestión según información recibida&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; case &#39;0&#39;: escritura_puertoD();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; break; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; case &#39;1&#39;: canal_analogico();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; break;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; case &#39;2&#39;: lectura_puertoD();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; break;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; case &#39;3&#39;: lectura_puertoB();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; break;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; case &#39;4&#39;: escritura_puertoB();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; break;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; default:&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; break;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;} &lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;/span&gt;

&lt;br /&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;recepcion_datos() {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;char c; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;//Caracteres individuales de la cadena&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;i=0; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;//Reinicio del puntero para 1º caracter&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;for (i=0;i&amp;lt;4;i++){ &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;//Recepción máxima de 4 caracteres&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Hasta que buffer se quede vacío&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (usb_cdc_kbhit()) &amp;nbsp;c=usb_cdc_getc();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;opcion[i]=c; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;//Guarda el caracter recibido&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;El resto de caracteres del código será la información a mostrar en el puerto del PIC en el caso de la escritura en los puertos.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;/span&gt;

&lt;br /&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;i&lt;/span&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;=3; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//ultimo caracter recibido...&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;decodificacion(i); &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;//lo transforma en los 4 bits bajos Puerto B&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;PuertoB_bajo = numero; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;//guarda valor&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;i=2; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;//penultimo caracter recibido...&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;decodificacion(i); &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;//lo transforma en los 4 bits altos Puerto B&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;PuertoB_alto = numero; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;//guarda el valor&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;//Salida de los dos caracteres leidos como un byte&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;PORTB=(PuertoB_alto&amp;lt;&amp;lt;4)|(PuertoB_bajo); &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;font-family: Verdana, sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana, sans-serif;&quot;&gt;
Por su lado, el PIC envía la información solicitada al PC mediante cadenas de caracteres acotadas por un primer carácter que indica de que información se trata y un carácter final (#) para separarla de las posteriores cadenas. La aplicación Visual Basic se encarga de identificarlos. Los caracteres contenidos entre ambos será la información &quot;útil&quot;.&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana, sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;lectura_puertoD() {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;TRISD=0xff; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;//Puerto D como entrada&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;PuertoD= PORTD;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Envío por USB a la aplicación visual basic&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;printf(usb_cdc_putc, &quot;\fD%x#&quot;, PuertoD); &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=5250193391449144895#&quot; onclick=&quot;Effect.toggle(&amp;quot;expandir1&amp;quot;,&amp;quot;slide&amp;quot;); return false&quot;&gt;[+/-] Ver / Ocultar programa completo&lt;/a&gt;&lt;br /&gt;
&lt;div id=&quot;expandir1&quot; style=&quot;display: none;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;////////////////////////////////////////////////////////////////////////////////&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;COMUNICACIÓN PC - PIC POR USB &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; Clase de dispositivo CDC USB emulando dispositivo RS232 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Interfase con aplicación Visual basic &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; RobotyPic (c) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;////////////////////////////////////////////////////////////////////////////////&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#include &amp;lt;18F4550.h&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//PIC a emplear&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#device adc=10; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Conversor A/D de 10 bits&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#fuses HSPLL,NOWDT,NOLVP,USBDIV,PLL5,CPUDIV1,VREGEN&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#use delay(clock=20000000) &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Frecuencia del cristal oscilador externo&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#define USB_CON_SENSE_PIN PIN_B0 &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Pin de detección conexión-desconexión &lt;/span&gt;&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;dispositivo USB&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#include &amp;lt;usb_cdc.h&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Librería de control USB&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#byte TRISD = 0xf95&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#byte PORTD = 0xf83&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#byte TRISB = 0xf93&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#byte PORTB = 0xf81&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/******************************************************************************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;int16 valor_digital; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Valor digital obtenido del conversor A/D&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;float valor_analogico; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Valor analógico medido en el conversor A/D&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;int PuertoB; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Valor del puerto B&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;int PuertoD; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Valor del Puerto D&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;char opcion[4]=&quot;&quot;; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Recepción información del PC&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;int i; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Puntero&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;int PuertoD_bajo; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//4 bits bajos del Puerto D&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;int PuertoD_alto; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//4 bits altos del Puerto D&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;int PuertoB_bajo; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//4 bits bajos del Puerto B&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;int PuertoB_alto; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//4 bits altos del Puerto B&lt;/span&gt;&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;int numero; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Valor numérico de los puertos&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/******************************************************************************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/******************** LECTURA Y ENVIO CANAL ANALOGICO *************************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;canal_analogico() {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;valor_digital=read_adc(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Lectura conversor AD&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;valor_analogico=5.0*valor_digital/1024.0; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Transformación a valor analógico&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;printf(usb_cdc_putc, &quot;\fA%01.2fV#&quot;, valor_analogico); &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Envío por USB&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/******************************************************************************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/************************** RECEPCION CADENA ***********************************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;recepcion_datos() {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;char c; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Caracteres individuales de la cadena&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;i=0; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Reinicio del puntero para 1º caracter&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;for (i=0;i&amp;lt;4;i++){ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Recepción máxima de 4 caracteres&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;if (usb_cdc_kbhit()) &amp;nbsp;c=usb_cdc_getc();&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Hasta que buffer se quede vacío&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;opcion[i]=c; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Guarda el ultimo caracter recibido&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/******************************************************************************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/************************** DECODIFICACIÓN ************************************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;decodificacion(i) {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;if (opcion[i]==&#39;0&#39;) numero=0;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;else if (opcion[i]==&#39;1&#39;) numero=1;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;else if (opcion[i]==&#39;2&#39;) numero=2;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;else if (opcion[i]==&#39;3&#39;) numero=3;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;else if (opcion[i]==&#39;4&#39;) numero=4;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;else if (opcion[i]==&#39;5&#39;) numero=5;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;else if (opcion[i]==&#39;6&#39;) numero=6;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;else if (opcion[i]==&#39;7&#39;) numero=7;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;else if (opcion[i]==&#39;8&#39;) numero=8;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;else if (opcion[i]==&#39;9&#39;) numero=9;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;else if (opcion[i]==&#39;A&#39;) numero=10;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;else if (opcion[i]==&#39;B&#39;) numero=11;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;else if (opcion[i]==&#39;C&#39;) numero=12;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;else if (opcion[i]==&#39;D&#39;) numero=13;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;else if (opcion[i]==&#39;E&#39;) numero=14;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;else if (opcion[i]==&#39;F&#39;) numero=15;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/******************************************************************************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/************************* ESCRITURA PUERTO B *********************************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;escritura_puertoB() {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;TRISB=0b00000100; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Puerto B como salida excepto Bit 2&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;i=3; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//ultimo caracter recibido...&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;decodificacion(i); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//lo transforma en los 4 bits bajos Puerto B&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;PuertoB_bajo = numero; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//guarda valor&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;i=2; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//penultimo caracter recibido...&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;decodificacion(i); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//lo transforma en los 4 bits altos Puerto B&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;PuertoB_alto = numero; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//guarda el valor&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;//Salida de los dos caracteres leidos como un byte&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;PORTB=(PuertoB_alto&amp;lt;&amp;lt;4)|(PuertoB_bajo); &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/******************************************************************************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/************************* ESCRITURA PUERTO D *********************************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;escritura_puertoD() {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;TRISD=0x00; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Puerto D como salida&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;i=3; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//ultimo caracter recibido...&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;decodificacion(i); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//lo transforma en los 4 bits bajos Puerto D&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;PuertoD_bajo = numero; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//guarda valor&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;i=2; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//penultimo caracter recibido...&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;decodificacion(i); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//lo transforma en los 4 bits altos Puerto D&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;PuertoD_alto = numero; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//guarda el valor&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Salida de los dos caracteres leidos como un byte&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;PORTD=(PuertoD_alto&amp;lt;&amp;lt;4)|(PuertoD_bajo); &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/******************************************************************************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/*************************** LECTURA PUERTO B *********************************/&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;lectura_puertoB() {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;TRISB=0xff; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Puerto B como entrada&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;PuertoB= PORTB;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;PuertoB= PuertoB &amp;amp; 0b11111110; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Ignora Bit RB0&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;printf(usb_cdc_putc,&quot;\fB%x#&quot;, PuertoB); &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Envío a aplicación visual basic&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/******************************************************************************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/*************************** LECTURA PUERTO D *********************************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;lectura_puertoD() {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;TRISD=0xff; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Puerto D como entrada&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;PuertoD= PORTD;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;printf(usb_cdc_putc, &quot;\fD%x#&quot;, PuertoD); &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Envío a aplicación visual basic&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/******************************************************************************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/************************* &amp;nbsp;FUNCIÓN PRINCIPAL &amp;nbsp;********************************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;void main() {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;TRISD=0xff; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Puerto D como entrada&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;setup_adc_ports(AN0); &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Definición pin a utilizar como entrada analógica&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;setup_adc(ADC_CLOCK_INTERNAL);&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Definición de la fuente de reloj para el A/D&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;set_adc_channel(0); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Selección del canal analógico&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;usb_cdc_init(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Inicialización del modo CDC&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;usb_init(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Inicialización del control del USB&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;do &amp;nbsp;{&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; usb_task(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Detección de la conexión de dispositivo USB&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; if (usb_enumerated()) { &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Devuelve TRUE si dispositivo ha sido enumerado por el PC&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (usb_cdc_kbhit()){ &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Si hay recepción de datos los lee&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; recepcion_datos();&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; switch(opcion[0]){ &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Gestión según la información recibida&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; case &#39;0&#39;: escritura_puertoD();&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; break; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; case &#39;1&#39;: canal_analogico();&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; break;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; case &#39;2&#39;: lectura_puertoD();&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; break;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; case &#39;3&#39;: lectura_puertoB();&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; break;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; case &#39;4&#39;: escritura_puertoB();&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; break;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; default:&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; break;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;} &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;delay_ms(10);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;} while (TRUE);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana, sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana, sans-serif;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana, sans-serif;&quot;&gt;
Bajo proteus se ha desarrollado un esquema para poder comprobar los puertos como entradas y salidas mediante interruptores y leds.&amp;nbsp;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana, sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh8UPGRaPrKFuOrR33TDR5vvAdYTFEx17rsxQoQMvZxfmch-N5ladVz98Af4jz1h1ZVlQqQ5ZPFKukv0c1GG-_yicF2LJFavjul441cROXqHF1aQ2PsFvSLjL8UvFpxu07ySQDNQygJ3Ek/s1600/Proteus+comunicaci%C3%B3n+PC-PIC+USB+con+VB.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;450&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh8UPGRaPrKFuOrR33TDR5vvAdYTFEx17rsxQoQMvZxfmch-N5ladVz98Af4jz1h1ZVlQqQ5ZPFKukv0c1GG-_yicF2LJFavjul441cROXqHF1aQ2PsFvSLjL8UvFpxu07ySQDNQygJ3Ek/s640/Proteus+comunicaci%C3%B3n+PC-PIC+USB+con+VB.jpg&quot; width=&quot;580&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana, sans-serif;&quot;&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;font-family: Verdana, sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana, sans-serif;&quot;&gt;
Aquí podemos ver el resultado:&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana, sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;center style=&quot;font-family: Verdana, sans-serif;&quot;&gt;
&lt;iframe allowfullscreen=&quot;&quot; frameborder=&quot;0&quot; height=&quot;360&quot; src=&quot;https://www.youtube.com/embed/EBwmNKivLcY?feature=player_detailpage&quot; width=&quot;580&quot;&gt;&lt;/iframe&gt;&lt;/center&gt;
&lt;div style=&quot;font-family: Verdana, sans-serif;&quot;&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
En el archivo de descarga se incluye el archivo &quot;&lt;i&gt;usb_desc_cdc.h&lt;/i&gt;&quot; ya modificado junto al resto de librerías C USB utilizadas.&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;a href=&quot;http://dfiles.eu/files/61b63611w&quot; target=&quot;_blank&quot;&gt;Descargar Comunicación PC-PIC por USB con VB&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;font-family: Verdana, sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana, sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;El proyecto contenido en el artículo ha sido diseñado y probado con éxito utilizando las siguientes versiones de software:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;- Windows xp y windows 7&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;- Proteus V7.7 SP2&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;- CCS PIC C COMPILER v4.084&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=5250193391449144895&quot; name=&quot;pines_USB&quot;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;b style=&quot;background-color: white; color: #444444; font-family: &#39;Trebuchet MS&#39;, sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;PINES CONECTOR USB&lt;/b&gt;&lt;/div&gt;
&lt;b style=&quot;background-color: white; color: #444444; font-family: &#39;Trebuchet MS&#39;, sans-serif; font-size: 13px; line-height: 18px; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/b&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; font-family: Verdana, sans-serif; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgB6VGNiiIhMdDM9Kf1C141X3a5F3MyG0MYWoGEa_xbDuQDAE35J0_wuu2WSVEDdY55Q4oBE2tQkXLXc490TV7uPxCKLO5Zd2CtMj7-b-fvahhLRES_siSBS2zrPsCjLyI2QzYhyphenhyphenP8A2NA/s1600/Conector+con+cable++USB.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;193&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgB6VGNiiIhMdDM9Kf1C141X3a5F3MyG0MYWoGEa_xbDuQDAE35J0_wuu2WSVEDdY55Q4oBE2tQkXLXc490TV7uPxCKLO5Zd2CtMj7-b-fvahhLRES_siSBS2zrPsCjLyI2QzYhyphenhyphenP8A2NA/s200/Conector+con+cable++USB.jpg&quot; width=&quot;200&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; font-family: Verdana, sans-serif; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana, sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; font-family: Verdana, sans-serif; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhToQIU7vNI8PIZJfw05GV053hngCAlJmSGk1I8Z5nZu0pdI-mdws46QGdHMmjG9ap_yHMMX8raUePFflfb1b2fznSmwjatxf_mmly6b3LgkUNi9Dpu8Qwv4g8iRfajyCRiTxrAZifJi74/s1600/Pines+conector+USB.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;191&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhToQIU7vNI8PIZJfw05GV053hngCAlJmSGk1I8Z5nZu0pdI-mdws46QGdHMmjG9ap_yHMMX8raUePFflfb1b2fznSmwjatxf_mmly6b3LgkUNi9Dpu8Qwv4g8iRfajyCRiTxrAZifJi74/s400/Pines+conector+USB.jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana, sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://robotypic.blogspot.com/feeds/8294367605809076484/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5250193391449144895/8294367605809076484?isPopup=true' title='17 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5250193391449144895/posts/default/8294367605809076484'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5250193391449144895/posts/default/8294367605809076484'/><link rel='alternate' type='text/html' href='http://robotypic.blogspot.com/2013/02/comunicacion-pc-pic-por-usb-con-vb.html' title='Comunicación PC-PIC por USB con Visual Basic'/><author><name>Robotypic</name><uri>http://www.blogger.com/profile/16455462312458405515</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgwl4zVnoaKxu_to_xRvYRNi49C980kOgbbNEf6I0x8nOqBjRQZbFMGaY2bzEWeU2WpH6U_Q-_gvHqtjiD4C46ljnJ-mYzuTKSLjbRMI-26yJic-FDK5kRupuzFRLTh3dos3OAUxICyh30/s72-c/Interface+Visual+Basic+PIC-PC+USB.jpg" height="72" width="72"/><thr:total>17</thr:total><georss:featurename>Zaragoza, España</georss:featurename><georss:point>41.6487908 -0.88958109999998669</georss:point><georss:box>41.5538748 -1.0509425999999866 41.7437068 -0.72821959999998676</georss:box></entry><entry><id>tag:blogger.com,1999:blog-5250193391449144895.post-323767854130017817</id><published>2013-02-20T19:44:00.000+01:00</published><updated>2018-04-02T19:01:02.545+02:00</updated><title type='text'>Comunicación PC-PIC por USB</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-D_M_GmTsV1DPp-X-zlZh3tT2puLbc5xmVYIT1BRQoB8jFicNPHN-zAuURm1GLWz4jSjma1SSeB39JPeSU_l3areoc2EPrZ8nYtnKiDUf6j5Kq6t5J3w4AYvvg8IB5-r437Xy8Ddf_CE/s1600/Comunicaci%C3%B3n+PIC+-+PC+por+USB.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;340&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-D_M_GmTsV1DPp-X-zlZh3tT2puLbc5xmVYIT1BRQoB8jFicNPHN-zAuURm1GLWz4jSjma1SSeB39JPeSU_l3areoc2EPrZ8nYtnKiDUf6j5Kq6t5J3w4AYvvg8IB5-r437Xy8Ddf_CE/s640/Comunicaci%C3%B3n+PIC+-+PC+por+USB.JPG&quot; width=&quot;600&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Vamos a mostrar el procedimiento para conectar un PIC de gama alta, el 18F4550, al PC por el puerto USB. Se va a tratar de una clase de dispositivo USB CDC (Communication Device Class) emulando un dispositivo RS232 mostrado como un puerto COM en windows.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;El ejemplo consiste en una comunicación básica que muestra en el PC el valor de tensión leído del conversor A/D. Dicha lectura la activaremos o desactivaremos desde el PC pulsando la barra espaciadora.&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; text-align: justify;&quot;&gt;En el PIC 18F4550 la configuración de fuses va a tener su importancia puesto que de ellos va a depender, entre otros, las frecuencias de reloj que van a ser utilizadas.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;#fuses&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt; &lt;/span&gt;HSPLL&lt;span style=&quot;color: #38761d;&quot;&gt; &lt;/span&gt;&amp;nbsp; &lt;span style=&quot;color: #999999;&quot;&gt;//Uso de un crystal oscilador &amp;gt;4 MHz usando el PLL&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;#fuses&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&amp;nbsp;NOWDT&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&amp;nbsp; &lt;span style=&quot;color: #999999;&quot;&gt;//&lt;/span&gt;&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;No habilitación de reset por watchdog&lt;/span&gt;&lt;b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;#fuses&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&amp;nbsp;NOLVP&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;//&lt;/span&gt;&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;Inhabilitación de programación a bajo voltaje&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;#fuses&lt;/span&gt;&amp;nbsp;USBDIV&amp;nbsp; &lt;span style=&quot;color: #999999;&quot;&gt;//Clock del módulo USB se tomará del PLL/2 (48MHz)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;#fuses&lt;/span&gt;&amp;nbsp;PLL5 &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;//La frecuencia se
dividirá por 5 en el PLL&lt;/span&gt;&lt;b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-right: -6.8pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;#fuses&lt;/span&gt;&amp;nbsp;CPUDIV1 &lt;span style=&quot;color: #999999;&quot;&gt;//El clock para el procesador serán
los 96 MHz del&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-right: -6.8pt;&quot;&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;PLL&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;divididos para 2
(48MHz)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-right: -6.8pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;#fuses&lt;/span&gt;&amp;nbsp;VREGEN &amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;//Habilita regulador 3,3 voltios
para el módulo USB&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-right: -6.8pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-right: -6.8pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Vamos a ver
el porqué de esta configuración, sobre todo en lo que respecta a la frecuencia de reloj. El objetivo es obtener 48 MHz en el módulo
del USB por mediación del PLL. Esta frecuencia no tiene porqué coincidir con la del cristal
empleado. Fijándonos en el diagrama de bloques interno&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;representado&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;del PIC18F4550 (se puede encontrar también en el &lt;/span&gt;&lt;a href=&quot;http://ww1.microchip.com/downloads/en/devicedoc/39632c.pdf&quot; target=&quot;_blank&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;datasheet del PIC18F4550&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt; de Microchip) deberemos conseguir obligatoriamente 4 MHz a la salida del MUX controlado por PLLDIV.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Como empleamos un cristal de 20MHZ deberemos dividir por 5 esta frecuencia para obtener los 4 MHz.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Esto lo conseguimos mediante el fuse&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #339966; font-family: &amp;quot;courier new&amp;quot;;&quot;&gt;PLL5&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: #339966; font-family: &amp;quot;arial&amp;quot;;&quot;&gt;.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgeG6sNoK_XdY94IAovdepkR62gYIS0Dxdye6x9shumyDEevQYbG9tOpddFMIVgxKZT1QXaMPwrnnaLTrkvIFX_e3KoG3F1cu_7buoCceiZm5FQ51-Xb16TWhjdpUA3nOgScS13kSB0VPU/s1600/Diagrama+de+bloques+18F4550.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;500&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgeG6sNoK_XdY94IAovdepkR62gYIS0Dxdye6x9shumyDEevQYbG9tOpddFMIVgxKZT1QXaMPwrnnaLTrkvIFX_e3KoG3F1cu_7buoCceiZm5FQ51-Xb16TWhjdpUA3nOgScS13kSB0VPU/s640/Diagrama+de+bloques+18F4550.jpg&quot; width=&quot;588&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-right: -6.8pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot;;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot;;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-right: -6.8pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Siguiendo el diagrama vemos que los
4 MHz obtenidos se transforman en 96MHz que a continuación son divididos por 2
por lo que se quedan en 48 MHz.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-right: -6.8pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Con la configuración del fuse&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot;;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot;;&quot;&gt;USBDIV1&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;estamos indicando que estos 48MHz
obtenidos del PLL son los que vamos a utilizar para el módulo USB. &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Aclarar que podríamos emplear directamente la frecuencia de
un cristal de 48MHz con&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;NO&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;USBDIV&lt;/span&gt;&lt;/b&gt;.&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-right: -6.8pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Configurado el clock del módulo USB,
debemos ahora hacerlo con el clock del resto de módulos del procesador. Igual
que para el USB obtenemos el clock del módulo PLL. Si nos fijamos en el
diagrama partimos de los 96 MHz conseguidos con los 4 MHz procedentes del PLL.
Esta frecuencia la vamos a dividir por un valor configurado por CPUDIV. Podemos
trabajar a frecuencias diferentes a la del módulo USB pero en este caso
vamos a emplear la misma. Para ello, para obtener 48MHz debemos dividir por 2 por
lo que configuraremos&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot;;&quot;&gt; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot;;&quot;&gt;CPUDIV1&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot;;&quot;&gt;. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-right: -6.8pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Si somos observadores vemos en el
diagrama otro CPUDIV. ¿Por qué la frecuencia de reloj para el procesador no nos
viene por ahí? La respuesta es que al configurar el fuse&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot;;&quot;&gt; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot;;&quot;&gt;HSPLL&lt;/span&gt;&lt;span style=&quot;color: #339966; font-family: &amp;quot;courier new&amp;quot;;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;estamos indicando que hacemos uso de un cristal con
frecuencia superior a 4 MHz (HS) y además que lo hacemos por mediación del
PLL (HSPLL), por lo que ese CPUDIV queda deshabilitado. &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-right: -6.8pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-right: -6.8pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Con respecto a los drivers que vamos a emplear van
a ser, por un lado, lógicamente, el correspondiente al PIC 18F4550 y el
correspondiente a la librería de uso de una clase de dispositivo CDC USB.&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-right: -6.8pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-right: -6.8pt;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: red; font-family: &amp;quot;courier new&amp;quot;;&quot;&gt;#include&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #339966; font-family: &amp;quot;courier new&amp;quot;;&quot;&gt; &lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;font-family: &amp;quot;courier new&amp;quot;;&quot;&gt;&amp;lt;&lt;span style=&quot;color: green;&quot;&gt;18&lt;/span&gt;F4550.h&amp;gt;&lt;span style=&quot;color: #339966;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//PIC
a emplear&lt;/span&gt;&lt;span style=&quot;color: #339966;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-right: -6.8pt;&quot;&gt;
&lt;span style=&quot;color: red; font-family: &amp;quot;courier new&amp;quot;;&quot;&gt;#include&lt;/span&gt;&lt;span style=&quot;color: #339966; font-family: &amp;quot;courier new&amp;quot;;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot;;&quot;&gt;&amp;lt;usb_cdc.h&amp;gt;&lt;span style=&quot;color: #339966;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//
Librería de control USB&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-right: -6.8pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-right: -6.8pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Las funciones utilizadas para
control USB:&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-right: -6.8pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-right: -6.8pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;usb_cdc_init(); &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;//Inicialización del modo CDC&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-right: -6.8pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;usb_init(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;//Inicialización del control del USB&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-right: -6.8pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;usb_task(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;//Detección de la conexión de dispositivo USB&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-right: -6.8pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; text-align: justify;&quot;&gt;usb_enumerated(); &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; text-align: justify;&quot;&gt;//Devuelve TRUE si dispositivo ha sido&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-right: -6.8pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;enumerado&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;por el PC&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;usb_cdc_kbhit();&lt;span style=&quot;color: #999999;&quot;&gt; &amp;nbsp; //Devuelve TRUE si hay recepción de datos&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;usb_cdc_putc();&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; //Envío de caracteres al buffer de trasmisión&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;usb_cdc_getc();&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt; &amp;nbsp; &amp;nbsp;//Lectura del buffer de recepción&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-right: -6.8pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-right: -6.8pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Ya tenemos el programa para el PIC. Pero ahora necesitamos que el PC reconozca el dispositivo USB al conectarlo. Para ello deberemos modificar en el archivo &quot;usb_desc_cdc.h&quot;, que se encuentra en la carpeta &quot;drivers&quot; en el directorio de instalación del PIC C COMPILER, estas dos lineas:&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;0x61,0x04&lt;/span&gt;,&amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;//vendor id(0x04D8 is Microchip,or is it 0x0461 ??)==8,9&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;0x33,0x00&lt;/span&gt;,&amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;//product id ==10,11&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-right: -6.8pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Se deben sustituir respectivamente por estas dos:&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;0xD8,0x04&lt;/span&gt;,&amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;//vendor id(0x04D8 is Microchip, or is it 0x0461??)==8,9&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;0x0A,0x00&lt;/span&gt;,&amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;//product id ==10,11&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-right: -6.8pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Indican el identificador de fabricante (Microchip) y al identificador de producto (familia PIC18), y permiten la localización del driver de windows cuando se conecta el dispositivo USB.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=5250193391449144895#&quot; onclick=&quot;Effect.toggle(&amp;quot;expandir1&amp;quot;,&amp;quot;slide&amp;quot;); return false&quot;&gt;[+/-] Ver / Ocultar programa completo&lt;/a&gt;&lt;br /&gt;
&lt;div id=&quot;expandir1&quot; style=&quot;display: none;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;////////////////////////////////////////////////////////////////////////////////&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;COMUNICACIÓN PC - PIC POR USB &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; Clase de dispositivo CDC USB emulando dispositivo RS232 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; RobotyPic (c) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;////////////////////////////////////////////////////////////////////////////////&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#include &amp;lt;18F4550.h&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//PIC a emplear&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#device adc=10; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Conversor A/D de 10 bits&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#fuses HSPLL,NOWDT,NOLVP,USBDIV,PLL5,CPUDIV1,VREGEN&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#use delay(clock=20000000) &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Frecuencia del cristal oscilador externo&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;#include &amp;lt;usb_cdc.h&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Librería de control USB&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/******************************************************************************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;/************************* &amp;nbsp;FUNCIÓN PRINCIPAL &amp;nbsp;********************************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;void main() {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;int16 valor_digital; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Valor digital obtenido del conversor A/D&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;float valor_analogico; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Valor analógico medido en el conversor A/D&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;char recepcion; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Dato recibido del PC&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;int1 control; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//falso o verdadero para mostrar tensión&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;setup_adc_ports(AN0); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Definición pin a utilizar como entrada analógica&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;setup_adc(ADC_CLOCK_INTERNAL);&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Definición de la fuente de reloj para el A/D&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;set_adc_channel(0); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Selección del canal analógico&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;usb_cdc_init(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Inicialización del modo CDC&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;usb_init(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Inicialización del control del USB&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;do &amp;nbsp;{&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; usb_task(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Detección de la conexión de dispositivo USB&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; //Devuelve TRUE si dispositivo ha sido enumerado por el PC&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; if (usb_enumerated()) { &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Lectura del canal analógico&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;valor_digital=read_adc();&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;valor_analogico=5.0*valor_digital/1024.0;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Si se ha recibido dato...&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (usb_cdc_kbhit()){ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; recepcion=usb_cdc_getc(); &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//lo lee&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//si es caracter vacio(barra espaciadora)enciende o apaga visualización&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (recepcion==&#39; &#39;) control=control+1;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//Si control=1 envia a PC valor de tensión leido&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (control==1)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; printf(usb_cdc_putc, &quot;\f Voltage = %01.2fV&quot;, valor_analogico);&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;//sino deja de enviarlo y limpia la pantalla del hyperterminal&lt;/span&gt;&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;else &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; printf(usb_cdc_putc, &quot;\f &quot;);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;delay_ms(300);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;} while (TRUE);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Si queremos simularlo todo en Proteus nos queda una cosa más. Debemos cargar el driver para la simulación virtual. Para ello, con proteus instalado accedemos a &lt;i&gt;&amp;lt;Menu Inicio&amp;gt;&amp;lt;Todos los programas&amp;gt;&amp;lt;Proteus 7 Profesional&amp;gt;&amp;lt;Virtual USB&amp;gt;&amp;lt;Install USB drivers&amp;gt;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiWhg3vj3_rIpszU8cq76Qe-VghJ_RwYiJyzrXgwKGfqxLQgtjMiJ8EH3lWG1nmFCQb3OFGJBc9UBaBWSZWbQxX7HIllcQirQUrEoBN_O4JlcKjlo41GPBq041lfkefb3HLK0UNl1dsHq4/s1600/Esquema+comunicaci%C3%B3n+PC-PIC+USB.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;340&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiWhg3vj3_rIpszU8cq76Qe-VghJ_RwYiJyzrXgwKGfqxLQgtjMiJ8EH3lWG1nmFCQb3OFGJBc9UBaBWSZWbQxX7HIllcQirQUrEoBN_O4JlcKjlo41GPBq041lfkefb3HLK0UNl1dsHq4/s640/Esquema+comunicaci%C3%B3n+PC-PIC+USB.jpg&quot; width=&quot;600&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Ya podemos probarlo todo. Cuando conectemos el dispositivo USB, bien sea real o virtualmente en proteus, buscará el driver de windows y sino lo encuentra pedirá instalarlo. Se deberá indicar la ubicación del archivo &quot;mchpcdc.inf&quot; bien sea por el asistente de &quot;Nuevo hardware encontrado&quot; o bien manualmente con click derecho en el administrador de dispositivos de windows sobre el dispositivo CCS RS232 DEMO que aparecerá con un signo de interrogación o admiración amarillo, y posteriormente marcando &quot;actualizar controlador&quot; e indicando la ubicación del driver. Este archivo se puede descargar junto con el proyecto completo en el siguiente enlace de descarga. También se incluyen el archivo &quot;&lt;i&gt;usb_desc_cdc.h&lt;/i&gt;&quot; ya modificado así como el resto de librerías C que intervienen:&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;trebuchet ms&amp;quot; , sans-serif;&quot;&gt;&lt;a href=&quot;http://dfiles.eu/files/fmwgp87ge&quot; target=&quot;_blank&quot;&gt;Descargar Comunicación PC-PIC por USB&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Con el driver ya instalado y el dispositivo USB reconocido, abrimos el hyperterminal y seleccionaremos el puerto COM que corresponda al dispositivo.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;En esta animación se puede ver el resultado simulado en proteus:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;center&gt;
&lt;iframe allowfullscreen=&quot;&quot; frameborder=&quot;0&quot; height=&quot;360&quot; src=&quot;//www.youtube.com/embed/x2sZRc5J8W8?feature=player_detailpage&quot; width=&quot;580&quot;&gt;&lt;/iframe&gt;&lt;/center&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Y en esta otra funcionando en un montaje real:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;center&gt;
&lt;iframe allowfullscreen=&quot;&quot; frameborder=&quot;0&quot; height=&quot;360&quot; src=&quot;//www.youtube.com/embed/dtLlnt2g5D8?feature=player_detailpage&quot; width=&quot;580&quot;&gt;&lt;/iframe&gt;&lt;/center&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;El proyecto contenido en el artículo ha sido diseñado y probado con éxito utilizando las siguientes versiones de software:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;- Windows xp y windows 7&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;- Proteus V7.7 SP2&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;- CCS PIC C COMPILER v4.084&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;i&gt;&lt;span style=&quot;color: #0c343d; font-family: &amp;quot;trebuchet ms&amp;quot; , sans-serif; font-size: xx-small;&quot;&gt;Última revisión del artículo: Octubre 2013&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;span style=&quot;color: #0c343d; font-family: &amp;quot;trebuchet ms&amp;quot; , sans-serif; font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/i&gt;
&lt;i&gt;&lt;span style=&quot;color: #0c343d; font-family: &amp;quot;trebuchet ms&amp;quot; , sans-serif; font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/i&gt;</content><link rel='replies' type='application/atom+xml' href='http://robotypic.blogspot.com/feeds/323767854130017817/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5250193391449144895/323767854130017817?isPopup=true' title='46 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5250193391449144895/posts/default/323767854130017817'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5250193391449144895/posts/default/323767854130017817'/><link rel='alternate' type='text/html' href='http://robotypic.blogspot.com/2013/02/comunicacion-pc-pic-por-usb.html' title='Comunicación PC-PIC por USB'/><author><name>Robotypic</name><uri>http://www.blogger.com/profile/16455462312458405515</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-D_M_GmTsV1DPp-X-zlZh3tT2puLbc5xmVYIT1BRQoB8jFicNPHN-zAuURm1GLWz4jSjma1SSeB39JPeSU_l3areoc2EPrZ8nYtnKiDUf6j5Kq6t5J3w4AYvvg8IB5-r437Xy8Ddf_CE/s72-c/Comunicaci%C3%B3n+PIC+-+PC+por+USB.JPG" height="72" width="72"/><thr:total>46</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5250193391449144895.post-679943783822619277</id><published>2012-12-24T13:12:00.000+01:00</published><updated>2013-11-23T18:57:18.689+01:00</updated><title type='text'>Sensor SRF08 con PIC</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjTvdNyNwirZgr6M-208UaboRU3fTPu6g63msucq1BTZlV3BMq2EkWEkvEj6uqwbyyXrFSVVuj7DEI0dW46O3eXTlvLtmUCoYyEHgi1lUEk381V6R2SifewrVAEJIVCy_seyjQGoQbuM1w/s1600/SRF08.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;197&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjTvdNyNwirZgr6M-208UaboRU3fTPu6g63msucq1BTZlV3BMq2EkWEkvEj6uqwbyyXrFSVVuj7DEI0dW46O3eXTlvLtmUCoYyEHgi1lUEk381V6R2SifewrVAEJIVCy_seyjQGoQbuM1w/s320/SRF08.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #222222; font-family: Verdana, sans-serif;&quot;&gt;El SRF08 es una versión evolucionada del sensor por ultrasonidos SRF04. Entre esas mejoras destaca, sin lugar a dudas, que el cálculo de la distancia al objeto la realiza el propio sensor, con lo cual se evita la necesidad de &amp;nbsp;implementar dicho código en el PIC de control. Además la comunicación con éste se realiza por el bus I2C con lo que permitiría la conexión de varios dispositivos SRF08 (hasta 16) con el PIC ocupando tan solo dos lineas. Además dispone de un sensor para la medida de la luminosidad ambiental.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgmVgLOSb4-ATV0SaGNUzXk4eHrm5NZ_6c1N1moCs4v71ANu4DxcKhpR4arSQi7XObCqLou82bpND-CSRJgW_pirOifDNZ9y6Pe8nBp500FbZwTnzGfemaxzhT9ypBeJWI6KPG7PQA8uE/s1600/SRF08+patillaje.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;130&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgmVgLOSb4-ATV0SaGNUzXk4eHrm5NZ_6c1N1moCs4v71ANu4DxcKhpR4arSQi7XObCqLou82bpND-CSRJgW_pirOifDNZ9y6Pe8nBp500FbZwTnzGfemaxzhT9ypBeJWI6KPG7PQA8uE/s400/SRF08+patillaje.jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #222222; font-family: Verdana, sans-serif;&quot;&gt;En este proyecto vamos a mostrar como controlar el componente con un PIC 16F876A. En un primer momento, al iniciar la aplicación mostraremos la versión de firmware del componente sobre un display LCD mediante la lectura del correspondiente registro. Posteriormente y a intervalos regulares, mediremos la distancia a un objeto frontal así como la luminosidad ambiental y la mostraremos sobre el mismo display LCD.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi04ZDRU_GTpEiyzekLAbr9FQ9UzXTJE4fSHVETXetyGhzLtlo-UULJGZk8bIC_Z6a_z7VAq_HaEsU6aJ7gzm7MZjFbSrUCTXbWVzleMGS2tJlvd38btKhNMydRLmhh19wVxcVErCzbhl8/s1600/Esquema+control+SRF08.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;408&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi04ZDRU_GTpEiyzekLAbr9FQ9UzXTJE4fSHVETXetyGhzLtlo-UULJGZk8bIC_Z6a_z7VAq_HaEsU6aJ7gzm7MZjFbSrUCTXbWVzleMGS2tJlvd38btKhNMydRLmhh19wVxcVErCzbhl8/s640/Esquema+control+SRF08.jpg&quot; width=&quot;630&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #222222; font-family: Verdana, sans-serif;&quot;&gt;Para realizar una operación deberemos escribir el correspondiente comando sobre el registro nº 0 del SRF08. Para realizar el cálculo de la distancia a un objeto frontal en modo normal existen 3 posibles comandos según la unidad de medida en el que se desee el resultado. En pulgadas, centímetros y micro segundos y sus correspondientes comandos 0x50, 0x51 y 0x52. Aquí obtendremos el resultado en centímetros por lo que se empleará el comando 0x51 (81 en decimal).&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #38761d;&quot;&gt;SRF08_ID = 0xe0; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;//Dirección I2C del SRF08&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;registro = 0x00;&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;//Registro de comandos&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #38761d;&quot;&gt;comando &amp;nbsp;= 81;&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;//Comando calculo en cm&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_start();&lt;/span&gt;&lt;span style=&quot;color: #274e13;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;//Comienzo de la comunicación I2C ...&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #38761d;&quot;&gt;i2c_write(SRF08_ID);&lt;/span&gt; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;//...con la dirección del SD21...&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #38761d;&quot;&gt;i2c_write(registro); &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;//apuntando al registro de comandos...&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #38761d;&quot;&gt;i2c_write(comando); &lt;/span&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//...comando&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #38761d;&quot;&gt;i2c_stop();&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;delay_ms (80);&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;//Tiempo de adquisición de distancia&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #222222; font-family: Verdana, sans-serif;&quot;&gt;Una vez ejecutado el comando ya se pueden leer los resultados en los correspondientes registros:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #222222; font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #222222; font-family: Verdana, sans-serif;&quot;&gt;- &amp;nbsp;En el 0x01 el valor de la luminosidad en un valor desde 0x00 a 0xff.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #222222; font-family: Verdana, sans-serif;&quot;&gt;- &amp;nbsp;En el 0x02 el byte alto del primer eco recibido&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #222222; font-family: Verdana, sans-serif;&quot;&gt;- &amp;nbsp;En el 0x03 el byte bajo del primer eco recibido&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #222222; font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #222222; font-family: Verdana, sans-serif;&quot;&gt;El SRF08 dispone de 32 registros más para almacenar los valores de otros ecos recibidos por objetos más distantes en una misma medición hasta un total de 17 ecos. Por ello es necesario un retardo de al menos 64ms antes de su lectura para asegurar la recepción de todos ellos.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;b&gt;&amp;nbsp; &lt;/b&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; text-align: justify;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;SRF08_ID = 0xe0; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: &#39;Courier New&#39;, Courier, monospace; text-align: justify;&quot;&gt;//Dirección I2C del SRF08&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;registro=0x01; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace;&quot;&gt;//Primer registro a leer&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;n_registros=0x03; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;//Total de registros a leer&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;indice &amp;nbsp; = 0;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;contador = 0;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_start(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace;&quot;&gt;//Comienzo de la comunicación I2C...&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_write(SRF08_ID); &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace;&quot;&gt;//...con la dirección I2c del SRF08...&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_write(registro); &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace;&quot;&gt;//...apuntando al registro&lt;/span&gt;&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_start(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;// Reinicio&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_write(SRF08_ID+1); &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;// Cambio a función de lectura&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &lt;span style=&quot;background-color: white;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: white; color: #666666;&quot;&gt;//lectura de los n registros&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;For(contador=n_registros-1;contador&amp;gt;=1;contador--) {&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; I2C_Buffer[indice]=i2c_read(); &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;//Envíar ACK y almacenar&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;en el buffer&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; indice++; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace;&quot;&gt;//Siguiente posición del&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #666666;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;buffer&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;I2C_Buffer[indice]=i2c_read(0); &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp;//Envíar NACK y almacena&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;en el buffer&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_stop(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;//Secuencia de stop&lt;/span&gt; &lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #222222; font-family: Verdana, sans-serif;&quot;&gt;En este caso solo leemos 3 registros; el registro de la luminosidad y los dos registros del primer eco recibido correspondiente al objeto más cercano.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=5250193391449144895#&quot; onclick=&quot;Effect.toggle(&amp;quot;expandir1&amp;quot;,&amp;quot;slide&amp;quot;); return false&quot;&gt;[+/-] Ver / Ocultar programa completo en C&lt;/a&gt;&lt;br /&gt;
&lt;div id=&quot;expandir1&quot; style=&quot;display: none;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;////////////////////////////////////////////////////////////////////////////////&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Control sensor SRF08 con PIC 16F876A &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; http://robotypic.blogspot.com &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(c) RobotyPic &amp;nbsp;2012 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;////////////////////////////////////////////////////////////////////////////////&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#include &amp;lt;16F876a.h&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Archivo config.procesador&lt;/span&gt;&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#use delay(clock=4000000) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Frecuencia de trabajo&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#fuses NOPROTECT,NOCPD,NOWDT,XT,NOBROWNOUT,NOLVP&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#use i2c (master,scl=PIN_C3,sda=PIN_C4,slow,force_hw) &lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Configuración I2C&lt;/span&gt;&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#use fast_io (C)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#define use_portb_lcd TRUE&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#include &amp;lt;LCD.c&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#define distancia_cm 81; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Comando lectura distancia en centímetros&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/************************* Dispositivos I2C ***********************************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;int &amp;nbsp; SRF08_ID = &amp;nbsp;0xe0; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Dirección I2C de acceso al SRF08&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/*********************** Variables globales ***********************************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;int I2C_Buffer [35]; &amp;nbsp; &amp;nbsp; &amp;nbsp; //Buffer de recepción del SRF08 hasta 36 registros&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;int registro; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Número del registro del SRF08&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;int luminosidad; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //Valor luminosidad medida&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;int16 distancia; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //Información distancia obtenida del SRF08&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;int version; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //Información de versión firmware del SRF08&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;int comando; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //Comando a ejecutar&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;int n_registros; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //Número de registros a leer&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;float porcen_luz; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Valor luminosidad en %&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/******************************************************************************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/****************** FUNCIÓN LECTURA REGISTROS DEL SRF08 ***********************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;void srf08_lectura (byte SRF08_ID, int registro, int n_registros){&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;int &amp;nbsp; indice=0;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;int &amp;nbsp; contador;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_start(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// Comienzo de la comunicación I2C...&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_write(SRF08_ID); &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// ...con la dirección I2c del SRF08...&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_write(registro); &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// ...apuntando al registro&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_start(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// Reinicio&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_write(SRF08_ID+1); &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// Cambio a función de lectura&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//lectura de los n registros&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;For(contador=n_registros-1;contador&amp;gt;=1;contador--) {&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; I2C_Buffer[indice]=i2c_read(); &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Envíar ACK y almacenar en el buffer&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; indice++; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Siguiente posición del buffer&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;I2C_Buffer[indice]=i2c_read(0); &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Envía NACK y almacena en el buffer&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_stop(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Secuencia de stop &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/******************************************************************************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/************************ FUNCIÓN EJECUTAR COMANDO ****************************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;void srf08_distancia (byte SRF08_ID, int registro, int comando){&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_start(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Comienzo de la comunicación I2C ...&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_write(SRF08_ID); &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//...con la dirección del SRF08...&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_write(registro); &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//...apuntando al registro de comandos...&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_write(comando); &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//...comando&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_stop();&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;delay_ms (80); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Tiempo de adquisición de distancia&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/******************************************************************************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/************************ FUNCIÓN PRINCIPAL ***********************************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;void main() {&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;port_b_pullups(TRUE);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;lcd_init(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Inicialización del display&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;//Lectura de la versión firmware del SRF08&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;registro = 0x00; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Registro de versión&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;srf08_lectura (SRF08_ID, registro, 0x1); &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Lectura del registro&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;version = I2C_Buffer[0]; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//En version firmware del SRF08&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;//Se muestra en pantalla versión&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;printf(lcd_putc, &quot;\fVersion SRF08 %d&quot;, version);&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;printf(lcd_putc, &quot;\n &amp;nbsp;RobotyPic (c) &quot;); &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;delay_ms (4000); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Mantiene información de versión 4 seg. en display&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;while(1){&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Calculo distancia en centímetros&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; registro = 0x00; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Registro de comandos&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; comando = distancia_cm; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Comando calculo en cm&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; srf08_distancia (SRF08_ID, registro, comando); &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Ejecución comando&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; //Lectura última luminosidad y distancia calculada&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; registro=0x01; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Primer registro a leer&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; n_registros=0x03; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//nº regsitros a leer = 3&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; srf08_lectura (SRF08_ID, registro, n_registros);&lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Lectura de los registros&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;//Convierte registros distancia parta alta y baja en un entero de 16 bit&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; distancia=make16(I2C_Buffer[1],I2C_Buffer[2]); &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; porcen_luz=(luminosidad/2.55); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Luminosidad en %&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; luminosidad=I2C_Buffer[0]; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Registro luminosidad &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; //mostrar por pantalla resultados&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; printf(lcd_putc, &quot;\fDistancia %lu cm&quot;, distancia);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; printf(lcd_putc, &quot;\nLuminosidad %3.0f%%&quot;, porcen_luz); &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; delay_ms(2000); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Tiempo hasta siguiente cálculo&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana, sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana, sans-serif;&quot;&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: Verdana, sans-serif;&quot;&gt;
En esta animación se muestra el resultado del programa realizado:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;center&gt;
&lt;iframe allowfullscreen=&quot;allowfullscreen&quot; frameborder=&quot;0&quot; height=&quot;340&quot; src=&quot;https://www.youtube.com/embed/zJ7AYGmHYB0?feature=player_detailpage&quot; width=&quot;600&quot;&gt;&lt;/iframe&gt;&lt;/center&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #222222; font-family: Verdana, sans-serif;&quot;&gt;Y en este enlace la descarga de los archivos del proyecto:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;a href=&quot;http://dfiles.eu/files/xrd8povxf&quot; target=&quot;_blank&quot;&gt;Descarga archivos SRF08 con PIC&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif; font-size: large;&quot;&gt;&lt;b&gt;&lt;a href=&quot;http://www.dfrobot.com/index.php?route=product/product&amp;amp;product_id=80&amp;amp;tracking=5224a9664d7c4&quot; target=&quot;_blank&quot;&gt;Puedes comprar este sensor aquí.&lt;/a&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;El proyecto contenido en el artículo ha sido diseñado con la versión v4.084 de&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;CCS PIC C COMPILER&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://robotypic.blogspot.com/feeds/679943783822619277/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5250193391449144895/679943783822619277?isPopup=true' title='1 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5250193391449144895/posts/default/679943783822619277'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5250193391449144895/posts/default/679943783822619277'/><link rel='alternate' type='text/html' href='http://robotypic.blogspot.com/2012/12/sensor-srf08-con-pic.html' title='Sensor SRF08 con PIC'/><author><name>Robotypic</name><uri>http://www.blogger.com/profile/16455462312458405515</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjTvdNyNwirZgr6M-208UaboRU3fTPu6g63msucq1BTZlV3BMq2EkWEkvEj6uqwbyyXrFSVVuj7DEI0dW46O3eXTlvLtmUCoYyEHgi1lUEk381V6R2SifewrVAEJIVCy_seyjQGoQbuM1w/s72-c/SRF08.jpg" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5250193391449144895.post-4803739418099758287</id><published>2012-12-08T15:37:00.001+01:00</published><updated>2013-08-02T18:23:45.554+02:00</updated><title type='text'>Controladora de servos SD21 con PIC</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Verdana, sans-serif;&quot;&gt;El módulo SD21 permite el control de 21 servos de forma totalmente independiente. En este proyecto vamos a comunicar mediante bus I2C la controladora de servos con el PIC 16F876A.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: Verdana, sans-serif;&quot;&gt;Aunque el número de servos puede ser 21 y el programa mostrado está definido para el control de todos ellos, aquí se van a emplear tan solo 3 como muestra del funcionamiento.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjiiuz54fB0xmhs0cR0HgkQbUfQVcLMNy6GZU2BgOorGi-MHL9fzYTtzQID-ogofLw1Re4nuLss-Yg0YVzp7Th2PYSEV5vukmsjG70BXZeZiNzEY5dPV1K07-6cCTWb6xAgZHIqVywTw74/s1600/Controladora+de+servos+SD21.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;img alt=&quot;Módulo SD21&quot; border=&quot;0&quot; height=&quot;174&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjiiuz54fB0xmhs0cR0HgkQbUfQVcLMNy6GZU2BgOorGi-MHL9fzYTtzQID-ogofLw1Re4nuLss-Yg0YVzp7Th2PYSEV5vukmsjG70BXZeZiNzEY5dPV1K07-6cCTWb6xAgZHIqVywTw74/s320/Controladora+de+servos+SD21.jpg&quot; title=&quot;Módulo SD21&quot; width=&quot;320&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Verdana, sans-serif;&quot;&gt;Como ejemplo demostrativo moveremos el servo 1 en diferentes posiciones a la velocidad máxima. Posteriormente moveremos el servo 2 en otras tantas posiciones pero a una velocidad más reducida. Y finalmente los servos 1 al 3 &amp;nbsp;simultáneamente.&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSzzQ87a7y5q6N6_5ip6tXbXIPgXLA-6E1IAa02aNIcLC_u9hyXAJzNhdIksKYmRPOXLpOQFcI1dVqPdd63nCbHHAZkU1YwNgn90QxTlV4euZdM6_9Q0lEyhDKzRDncYczw8Nc7KiKhLA/s1600/Controladora+de+servos+SD21+-+patillaje.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Módulo SD 21&quot; border=&quot;0&quot; height=&quot;319&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSzzQ87a7y5q6N6_5ip6tXbXIPgXLA-6E1IAa02aNIcLC_u9hyXAJzNhdIksKYmRPOXLpOQFcI1dVqPdd63nCbHHAZkU1YwNgn90QxTlV4euZdM6_9Q0lEyhDKzRDncYczw8Nc7KiKhLA/s320/Controladora+de+servos+SD21+-+patillaje.jpg&quot; title=&quot;Módulo SD 21&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Verdana, sans-serif; text-align: justify;&quot;&gt;El módulo dispone de 2 entradas de tensión de alimentación. Por un lado, entrada de entre 6 y 7,2v para alimentación de los servos. Por otro lado, alimentación de 5v para el resto de la electrónica. Pero permite la obtención de los 5v a partir de la tensión de alimentación de los servos mediante el puenteo de dos pines. Estos mismos 5v los vamos a emplear para alimentar el PIC y todo el resto de electrónica externa al módulo.&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; text-align: justify;&quot;&gt;&amp;nbsp;&lt;/span&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9x1UMk8QzxOPM52wal2Q5zYhcksxYv9SwVDOT8CbzQyjua6Kkj1d8HzxtgrglWHu0SWEtv6asRYL7neAojQKFqf_FRBaet0BZcmx_RBXt1Cv6zb3rm35Xvn-VGNBVU4cr7FlDp5CzVJQ/s1600/Esquema+controladora+SD21+con+PIC.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: justify;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;img alt=&quot;Esquema SD21 con PIC&quot; border=&quot;0&quot; height=&quot;392&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9x1UMk8QzxOPM52wal2Q5zYhcksxYv9SwVDOT8CbzQyjua6Kkj1d8HzxtgrglWHu0SWEtv6asRYL7neAojQKFqf_FRBaet0BZcmx_RBXt1Cv6zb3rm35Xvn-VGNBVU4cr7FlDp5CzVJQ/s640/Esquema+controladora+SD21+con+PIC.jpg&quot; title=&quot;Esquema SD21 con PIC&quot; width=&quot;570&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: black; font-family: Verdana, sans-serif; text-align: justify;&quot;&gt;
En el SD21 hay 2 registros de lectura. Estos son los registros 64 y 65. El registro 64 proporciona la versión del firmware del SD21:&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana, sans-serif; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;registro = 64; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Registro SD21 de valor versión&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;i2c_start(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;// Comienzo de la comunicación I2C...&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;i2c_write(SD21_ID);&lt;/span&gt; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #999999;&quot;&gt;//...con la dirección I2c del SD21...&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;i2c_write(registro);&lt;/span&gt; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;//...apuntando al registro de versión&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;i2c_start(); &lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;// Reinicio&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;i2c_write(SD21_ID+1);&lt;/span&gt; &amp;nbsp; &lt;span style=&quot;color: #999999;&quot;&gt;// Cambio a función de lectura&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;lectura = &amp;nbsp;i2c_read();&lt;/span&gt; &amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;// En lectura información leída&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;i2c_stop (); &lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;// Finalización de la transmisión&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;version = lectura;&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;//En version la versión de firmware&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: black; font-family: Verdana, sans-serif;&quot;&gt;El registro 65 proporciona el valor de la tensión de alimentación. Para obtener el valor real habrá que multiplicar su contenido por 0,039:&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;registro = 65; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Registro SD21 de valor de tensión&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;i2c_start(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;// Comienzo de la comunicación I2C...&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;i2c_write(SD21_ID);&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;//...con la dirección I2c del SD21...&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;i2c_write(registro);&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;//...apuntando al registro de voltaje&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;i2c_start();&amp;nbsp;&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;// Reinicio&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;i2c_write(SD21_ID+1);&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;// Cambio a función de lectura&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;lectura = &amp;nbsp;i2c_read();&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;// En lectura información leída&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;i2c_stop ();&amp;nbsp;&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;// Finalización de la transmisión&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;voltaje= lectura*0.039;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//En voltaje valor de tensión&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Verdana, sans-serif;&quot;&gt;El resto de registros, 3 por cada servo, controlan la velocidad y posición de cada uno de ellos:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;#define&lt;/span&gt; &amp;nbsp;&lt;span style=&quot;color: #38761d;&quot;&gt;servo1 &amp;nbsp;0&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;

&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;num_servo = servo1;&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;//Acceso al registro 0 del SD21&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;velocidad = 0; &lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;//Velocidad máxima&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;posicion = 2400; &lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;//A la posición +90º&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;


&lt;br /&gt;
&lt;div style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;
&lt;span style=&quot;color: #38761d;&quot;&gt;i2c_start(); &lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;//Comienzo de la comunicación I2C ...&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;
&lt;span style=&quot;color: #38761d;&quot;&gt;i2c_write(SD21_ID);&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;//...con la dirección del SD21...&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;
&lt;span style=&quot;color: #38761d;&quot;&gt;i2c_write(num_servo);&lt;/span&gt;&amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;//...apuntando al registro de nº de servo&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;
&lt;span style=&quot;color: #38761d;&quot;&gt;i2c_write(velocidad);&lt;/span&gt; &amp;nbsp; &lt;span style=&quot;color: #999999;&quot;&gt;//velocidad&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;
&lt;span style=&quot;color: #38761d;&quot;&gt;i2c_write(posicion);&lt;/span&gt; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;//Parte baja de Posición &lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;nbsp;&lt;/span&gt; &amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;
&lt;span style=&quot;color: #38761d;&quot;&gt;i2c_write(posicion&amp;gt;&amp;gt;8);&lt;/span&gt; &lt;span style=&quot;color: #999999;&quot;&gt;//Parte alta de posición&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;
&lt;span style=&quot;color: #38761d;&quot;&gt;i2c_stop ();&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;//Finalización de la transmisión&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Verdana, sans-serif;&quot;&gt;La orientación del servo a -90º (ó 0º en una referencia 0-180) se obtiene cargando los registros de posición con el valor 600, 1500 para la posición 0º (90º en una referencia 0-180) y 2400 para +90º (180º en una referencia 0-180). El resto de posiciones son igualmente proporcionales y bastaría aumentar en 10 el valor de una posición concreta por cada grado de más que se desee.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=5250193391449144895#&quot; onclick=&quot;Effect.toggle(&amp;quot;expandir1&amp;quot;,&amp;quot;slide&amp;quot;); return false&quot;&gt;[+/-] Ver / Ocultar programa completo en C&lt;/a&gt;&lt;br /&gt;
&lt;div id=&quot;expandir1&quot; style=&quot;display: none;&quot;&gt;
&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;////////////////////////////////////////////////////////////////////////////////&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Controladora de servos SD21 por bus I2C con PIC 16F876A &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(c) RobotyPic &amp;nbsp;2012 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;////////////////////////////////////////////////////////////////////////////////&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#include &amp;lt;16F876A.h&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//PIC a utilizar&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#fuses XT,NOWDT,NOPROTECT &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#use delay(clock=4000000) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Frecuencia cristal de cuarzo&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#use i2c(master, SCL=PIN_C3, SDA=PIN_C4) &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Configuración comunicación I2C&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#use standard_io(C) &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#use standard_io(B)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#use standard_io(A)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#define use_portb_lcd TRUE&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#include &amp;lt;LCD.c&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;servo1 &amp;nbsp;0&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;Servo2 &amp;nbsp;3&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;Servo3 &amp;nbsp;6 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;Servo4 &amp;nbsp;9 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;Servo5 &amp;nbsp;12&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;Servo6 &amp;nbsp;15 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;Servo7 &amp;nbsp;18&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;Servo8 &amp;nbsp;21&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;Servo9 &amp;nbsp;24&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;Servo10 27&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;Servo11 30&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;Servo12 33&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;Servo13 36&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;Servo14 39&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;Servo15 42&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;Servo16 45&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;Servo17 48&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;Servo18 51&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;servo19 54&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;Servo20 57&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#define &amp;nbsp;Servo21 60 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;int SD21_ID &amp;nbsp; = &amp;nbsp;0xC2; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Dirección I2C de acceso al SD21&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/*********************** Variables globales ***********************************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;int velocidad; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Valor de velocidad de servo&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;int16 posicion; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Valor de la posición del servo&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;float lectura; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Información leida del SD21&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;float voltaje; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Valor de tensión de alimentación&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;int registro; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Número del registro de lectura del SD21&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;int num_servo; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Identificación del servo a controlar&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;int version; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Número de versión del SD21&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/******************************************************************************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/******************* FUNCIÓN LECTURA REGISTROS DEL SD21 ***********************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;void sd21_lectura (byte SD21_ID, int registro){&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_start(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// Comienzo de la comunicación I2C...&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_write(SD21_ID); &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// ...con la dirección I2c del SD21...&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_write(registro); &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// ...apuntando al registro de versión del SD21&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_start(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// Reinicio&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_write(SD21_ID+1); &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// Cambio a función de lectura&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;lectura = &amp;nbsp;i2c_read(); &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// En lectura información leida&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_stop (); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// Finalización de la transmisión&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/******************************************************************************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/*********************** FUNCIÓN CONTROL DE SERVOS &amp;nbsp;***************************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;void sd21_servo (byte SD21_ID, int num_servo, int velocidad, int16 posicion){&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_start(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Comienzo de la comunicación I2C ...&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_write(SD21_ID); &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//...con la dirección del SD21...&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_write(num_servo); &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//...apuntando al registro del servo num_servo&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_write(velocidad); &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//velocidad&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_write(posicion); &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Parte baja de Posicion &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_write(posicion&amp;gt;&amp;gt;8); &lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Parte alta de posicion&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_stop (); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Finalización de la transmisión&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;delay_ms(60);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/******************************************************************************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/************************ FUNCIÓN PRINCIPAL ***********************************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;void main() {&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;port_b_pullups(TRUE);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;lcd_init(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Inicialización del display&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;//Lectura de la versión del SD21 e impresión en LCD&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;registro = 64; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt; //Registro SD21 de valor versión&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;sd21_lectura (SD21_ID, registro); &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Lectura del registro&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;version = lectura; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//En version la versión de firmware&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;printf(lcd_putc, &quot;\f &amp;nbsp; Version %d&quot;, version); &lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Muestra en pantalla la versión&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;delay_ms (5000); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;while(1){&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt; //lectura del valor de tensión de alimentación&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; registro = 65; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Registro SD21 de valor de tensión&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_lectura (SD21_ID, registro); &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Lectura del registro&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; voltaje= lectura*0.039; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Conversión a valor de tensión&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; printf(lcd_putc, &quot;\f &amp;nbsp;Voltaje %01.2fv&quot;, voltaje); &lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Muestra en pantalla el voltaje&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Control posición +90º servo 1&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo1;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; velocidad = 0;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 2400;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; delay_ms(2000);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; //Control posición -90º servo 1&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo1;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; velocidad = 0;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 600;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; delay_ms(2000);&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Control posición 0º servo 1&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo1;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; velocidad = 0;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 1500;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; delay_ms(2000);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Control posición +90º servo 2&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo2;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; velocidad = 30;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 2400;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; delay_ms(2000);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Control posición -90º servo 2&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo2;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; velocidad = 30;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 600;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; delay_ms(2000);&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Control posición 0º servo 2&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo2;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; velocidad = 30;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 1500;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; delay_ms(2000);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Control posición +90º servos 1, 2 y 3&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo1;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; velocidad = 0;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 2400;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo2;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo3;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; delay_ms(2000);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Control posición +45º servos 1, 2 y 3&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo1;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; velocidad = 0;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 1950;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo2;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo3;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; delay_ms(2000);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Control posición -45º servos 1, 2 y 3&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo1;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; velocidad = 0;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 1050;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo2;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo3;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; delay_ms(2000);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Control posición -90º servos 1, 2 y 3&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo1;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; velocidad = 0;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 600;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo2;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo3;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; delay_ms(2000);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Control posición 0º servos 1, 2 y 3&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo1;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; velocidad = 0;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; posicion = 1500;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo2;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num_servo = servo3;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sd21_servo (SD21_ID, num_servo, velocidad, posicion);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; delay_ms(2000);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;color: black; font-family: Verdana, sans-serif;&quot;&gt;En este vídeo se puede comprobar el funcionamiento del programa desarrollado:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;center&gt;
&lt;iframe allowfullscreen=&quot;allowfullscreen&quot; frameborder=&quot;0&quot; height=&quot;360&quot; src=&quot;https://www.youtube.com/embed/EN7M2itG5hg?feature=player_detailpage&quot; width=&quot;640&quot;&gt;&lt;/iframe&gt;&lt;/center&gt;
&lt;center&gt;
&lt;/center&gt;
&lt;center style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Verdana, sans-serif;&quot;&gt;Y en este enlace se pueden descargar los archivos del proyecto:&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: justify;&quot;&gt;
&lt;/center&gt;
&lt;center style=&quot;text-align: justify;&quot;&gt;
&lt;/center&gt;
&lt;center style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;a href=&quot;http://depositfiles.com/files/xibmgnl3z&quot; target=&quot;_blank&quot;&gt;Descargar Controladora SD21 con PIC&lt;/a&gt;&lt;/span&gt;&lt;/center&gt;
&lt;center style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/center&gt;
&lt;br /&gt;&lt;br /&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;El proyecto contenido en el artículo ha sido diseñado con la versión v4.084 de&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;CCS PIC C COMPILER&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
</content><link rel='replies' type='application/atom+xml' href='http://robotypic.blogspot.com/feeds/4803739418099758287/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5250193391449144895/4803739418099758287?isPopup=true' title='2 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5250193391449144895/posts/default/4803739418099758287'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5250193391449144895/posts/default/4803739418099758287'/><link rel='alternate' type='text/html' href='http://robotypic.blogspot.com/2012/12/controladora-de-servos-sd21-con-pic.html' title='Controladora de servos SD21 con PIC'/><author><name>Robotypic</name><uri>http://www.blogger.com/profile/16455462312458405515</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjiiuz54fB0xmhs0cR0HgkQbUfQVcLMNy6GZU2BgOorGi-MHL9fzYTtzQID-ogofLw1Re4nuLss-Yg0YVzp7Th2PYSEV5vukmsjG70BXZeZiNzEY5dPV1K07-6cCTWb6xAgZHIqVywTw74/s72-c/Controladora+de+servos+SD21.jpg" height="72" width="72"/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5250193391449144895.post-7832184077532826215</id><published>2012-11-24T20:55:00.000+01:00</published><updated>2013-08-02T18:11:14.365+02:00</updated><title type='text'>Control de velocidad de un motor DC con PIC</title><content type='html'>&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Se trata de controlar la velocidad de un motor DC con una señal de
impulsos.&amp;nbsp;Variando el tiempo en estado alto de la señal con respecto al
tiempo en estado bajo conseguiremos reducir la tensión media que le llega al
motor y en consecuencia variaremos su velocidad.&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhR043JIM82u-HfWBjHz-WD7mccrIE9Vt5tUuzKGoo4awsT728z8QI7RnNjlJojPB30FYUqSMifrKdEqLZEVt4iGeiBdE9unvGtagfdEb7FUxpqeD3QHHJ4mR6rSsj0e_Dd9M5E5-AGb4w/s1600/Se%C3%B1ales+de+control.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;380&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhR043JIM82u-HfWBjHz-WD7mccrIE9Vt5tUuzKGoo4awsT728z8QI7RnNjlJojPB30FYUqSMifrKdEqLZEVt4iGeiBdE9unvGtagfdEb7FUxpqeD3QHHJ4mR6rSsj0e_Dd9M5E5-AGb4w/s400/Se%C3%B1ales+de+control.jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Para hacer ese control con el PIC, en este proyecto emplearemos el modo
PWM (Pulse Width Modulation). Leeremos una tensión con el conversor AD del PIC
proporcionada por un potenciómetro como control manual de la velocidad. Este
valor determinará el tiempo de los pulsos en estado alto de la señal que controlará
la velocidad.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjDv0c62KvVB8sL7MLvHzHhiZ20l5uRxFiPO0WFCtTDxCPIZqHNDYrsoyLuvg-_0j-tMxngX3uyJozP9hWfumbyOi8vjRlg4GErYsKK_5WfpfvrNPo0Tn2uz6CjXBf_Umqn-AElbq3AwKI/s1600/Esquema+control+velocidad+motor.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;368&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjDv0c62KvVB8sL7MLvHzHhiZ20l5uRxFiPO0WFCtTDxCPIZqHNDYrsoyLuvg-_0j-tMxngX3uyJozP9hWfumbyOi8vjRlg4GErYsKK_5WfpfvrNPo0Tn2uz6CjXBf_Umqn-AElbq3AwKI/s640/Esquema+control+velocidad+motor.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;En el modo PWM el PIC compara el valor del registro CCP (en este caso el
CCP2) con el valor del timer1. En el registro CCP habremos cargado previamente
un valor responsable de la velocidad del motor. Cuando ambos coinciden, se
produce la interrupción con la que gestionaremos el cambio de estado de la
señal hasta una nueva comparación con la cuenta del timer 1.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;lectura_AD=read_adc();
&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;//Lectura canal analógico&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: red;&quot;&gt;#int_ccp2&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #38761d;&quot;&gt;void ccp2_int(){&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #666666;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;//Conmutación estado salida CCP2&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;
if(++cambio==1){&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;nbsp; &amp;nbsp; //Modo
comparación,conmutación salida a 0&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #38761d;&quot;&gt;setup_ccp2(CCP_COMPARE_CLR_ON_MATCH);&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #666666;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #666666;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;//carga del ccp2 con&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;valor semiperiodo alto&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;span class=&quot;apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;ccp_2=lectura_AD; &amp;nbsp;&lt;span class=&quot;apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;nbsp;&lt;span class=&quot;apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;}&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;nbsp;&lt;span class=&quot;apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;else{&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;//Modo comparación, conmutación salida a 1&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #38761d;&quot;&gt;setup_ccp2(CCP_COMPARE_SET_ON_MATCH);&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #666666;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;//Carga del ccp2 con&amp;nbsp;valor del semiperiodo bajo&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;span class=&quot;apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;ccp_2=255-lectura_AD;&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;}&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;//Reinicio del
temporizador para nueva comparación&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;
set_timer1(0);&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;}&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin-bottom: .0001pt; margin: 0cm; text-align: justify;&quot;&gt;
&lt;/div&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=5250193391449144895#&quot; onclick=&quot;Effect.toggle(&amp;quot;expandir1&amp;quot;,&amp;quot;slide&amp;quot;); return false&quot;&gt;[+/-] Ver / Ocultar programa completo en C&lt;/a&gt;&lt;br /&gt;
&lt;div id=&quot;expandir1&quot; style=&quot;display: none;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;////////////////////////////////////////////////////////////////////////////////&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;CONTROL VELOCIDAD MOTOR DC CON PIC &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (c) RobotyPic 2012 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;////////////////////////////////////////////////////////////////////////////////&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#include &amp;lt;16f876a.h&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Archivo para control del pic 16f876a&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#device adc=8 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt; &amp;nbsp;//Configuración conversor AD a 8 bits&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#fuses XT,NOWDT &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#use delay(clock=4000000) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//frecuencia de reloj 4 MHz&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#byte trisb=0x86&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#byte portb=0x06&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#byte trisc=0x87&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#byte portc=0x07&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#define use_portb_lcd TRUE &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Configuración puerto b control lcd&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#include &amp;lt;lcd.c&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//archivo para control del lcd&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/***************** Definición de las variables globales ***********************/&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;int1 cambio=0; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Control del cambio&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;int16 lectura_AD; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Referencia de velocidad&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/********************** Prototipos de las funciones ***************************/&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;void main (void); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//función principal&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;void ccp2_int (void); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;//función por interrupción&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/******************************************************************************/&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/******************* FUNCIÓN GENERACIÓN MODULACIONES PWM **********************/&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#int_ccp2&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;void ccp2_int(){&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;if(++cambio==1){ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Conmutación estado salida CCP2&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; setup_ccp2(CCP_COMPARE_CLR_ON_MATCH); &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Modo comparación, conmutación salida a 0&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; ccp_2=lectura_AD; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//carga del ccp2 con valor semiperiodo alto&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;else{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; setup_ccp2(CCP_COMPARE_SET_ON_MATCH); &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Modo comparación, conmutación salida a 1&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; ccp_2=255-lectura_AD; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Carga del ccp2 con valor semiperiodo bajo&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;set_timer1(0); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Reinicio del temporizador para comparación&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/******************************************************************************/&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/******************** FUNCIÓN PRINCIPAL ***************************************/&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;void main(){&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;float velocidad; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Porcentaje velocidad&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;trisc=0x00; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Puerto C como salida de datos&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;port_b_pullups(TRUE); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt; //Habilitación resistencias pullups puerto b&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;lcd_init(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Inicialización del lcd&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;setup_timer_1(T1_INTERNAL|T1_DIV_BY_1); &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Configuración Timer para comparación&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;setup_ccp2(CCP_COMPARE_SET_ON_MATCH); &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Modo comparación, conmutación salida a 1&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;setup_adc_ports(AN0); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Canal de entrada analógico AN0&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;setup_adc(ADC_CLOCK_INTERNAL); &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Fuente de reloj RC para conversor AD&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;enable_interrupts(int_ccp2); &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//habilitación interrupción por comparación&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;enable_interrupts(GLOBAL); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Habilitación de toda las interrupciones&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;while (true){&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; set_adc_channel(0); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Habiliatación lectura AD&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; delay_us(20); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Estabilización&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; lectura_AD=read_adc(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Lectura canal analógico&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; velocidad=(lectura_AD/2.55); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Cálculo % de velocidad&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; printf(lcd_putc, &quot;\fVelocidad = %3.0f%%&quot;, velocidad);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;En esta animación se puede ver la simulación bajo proteus.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;center&gt;
&lt;iframe allowfullscreen=&quot;allowfullscreen&quot; frameborder=&quot;0&quot; height=&quot;360&quot; src=&quot;https://www.youtube.com/embed/bFHjIhT03C4?feature=player_detailpage&quot; width=&quot;480&quot;&gt;&lt;/iframe&gt;&lt;/center&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Los archivos del
proyecto se pueden descargar en el siguiente enlace:&lt;/span&gt;&lt;span style=&quot;font-size: 13.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;a href=&quot;http://depositfiles.com/files/mwshz6b90&quot;&gt;Descargar archivos Control Velocidad Motor&lt;/a&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;El proyecto contenido en el artículo ha sido diseñado y probado con éxito utilizando las siguientes versiones de software:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;- Windows xp y windows 7&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;- Proteus V7.7 SP2&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;- CCS PIC C COMPILER v4.084&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0cm 0cm 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;center&gt;
&lt;script type=&quot;text/javascript&quot;&gt;&lt;!--
google_ad_client = &quot;ca-pub-2066207416391916&quot;;
/* 336x280, creado 17/10/11 */
google_ad_slot = &quot;3931917296&quot;;
google_ad_width = 336;
google_ad_height = 280;
//&lt;/script&gt;
--&amp;gt;
&lt;script src=&quot;http://pagead2.googlesyndication.com/pagead/show_ads.js&quot; type=&quot;text/javascript&quot;&gt;
&lt;/script&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://robotypic.blogspot.com/feeds/7832184077532826215/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5250193391449144895/7832184077532826215?isPopup=true' title='6 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5250193391449144895/posts/default/7832184077532826215'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5250193391449144895/posts/default/7832184077532826215'/><link rel='alternate' type='text/html' href='http://robotypic.blogspot.com/2012/11/control-de-velocidad-de-un-motor-dc-con.html' title='Control de velocidad de un motor DC con PIC'/><author><name>Robotypic</name><uri>http://www.blogger.com/profile/16455462312458405515</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhR043JIM82u-HfWBjHz-WD7mccrIE9Vt5tUuzKGoo4awsT728z8QI7RnNjlJojPB30FYUqSMifrKdEqLZEVt4iGeiBdE9unvGtagfdEb7FUxpqeD3QHHJ4mR6rSsj0e_Dd9M5E5-AGb4w/s72-c/Se%C3%B1ales+de+control.jpg" height="72" width="72"/><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5250193391449144895.post-4393907393425654496</id><published>2012-08-19T13:19:00.000+02:00</published><updated>2013-08-02T18:09:45.126+02:00</updated><title type='text'>Transmisión variable tipo &quot;float&quot; por RS232</title><content type='html'>&lt;span style=&quot;font-family: Verdana, sans-serif; text-align: justify;&quot;&gt;En esta ocasión se trata de
transmitir una variable tipo &lt;/span&gt;&lt;i style=&quot;font-family: Verdana, sans-serif; text-align: justify;&quot;&gt;float&lt;/i&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; text-align: justify;&quot;&gt; a
través del bus RS232 entre dos PICs. Concretamente el proyecto consiste en la
lectura de un valor analógico de tensión con signo y decimales a través del conversor
AD del PIC emisor. El PIC receptor recibe este valor y lo muestra en la
pantalla LCD.&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-fqE_n2TQxgx01paxQCo3xhn8axN0Pmf7TmnZMIVc-M9RwxZb4nf-HWCuFWipHAD4isOFsHlqFVc-xtUumkP-KBpxxriRP7zNQvXreaNeU1MOIz2qZhCZl_n9oY1wSi9r6nLJ3v3e-aM/s1600/Esquema+trasmisi%C3%B3n+float+por+RS232.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;480&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-fqE_n2TQxgx01paxQCo3xhn8axN0Pmf7TmnZMIVc-M9RwxZb4nf-HWCuFWipHAD4isOFsHlqFVc-xtUumkP-KBpxxriRP7zNQvXreaNeU1MOIz2qZhCZl_n9oY1wSi9r6nLJ3v3e-aM/s640/Esquema+trasmisi%C3%B3n+float+por+RS232.jpg&quot; width=&quot;600&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: right;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;color: #990000; font-family: Trebuchet MS, sans-serif; font-size: xx-small;&quot;&gt;Pulsa en la imagen para ampliarla&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;El procedimiento va a ser:&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;1º se obtiene la lectura y se
guarda en una variable tipo &lt;i&gt;float&lt;/i&gt;.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;2º se transforma el valor
numérico de la variable &lt;i&gt;float&lt;/i&gt; en un
valor tipo &lt;i&gt;string&lt;/i&gt; o &lt;i&gt;cadena de caracteres&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;3º se transmite por RS232
carácter a carácter toda la cadena de caracteres&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;4º se recibe carácter a carácter
toda la cadena&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;5º finalizada la recepción de
toda la cadena se convierte a su valor numérico tipo &lt;i&gt;float&lt;/i&gt;.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;6º se muestra este valor por el
LCD&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Almacenado el dato de la lectura
en la variable “valor” de tipo &lt;i&gt;float&lt;/i&gt;,
se transforma a formato &lt;i&gt;string &lt;/i&gt;en la
variable “string” mediante el siguiente procedimiento :&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: green; font-size: 10pt;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;sprintf(string,&quot;%01.2f&quot;,valor);&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Courier New;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: green; font-size: 10pt;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Ahora ya se puede enviar carácter
a carácter por RS232:&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: green; font-size: 10pt;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;for (i=0;i&amp;lt;=5;++i){&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: green; font-size: 10pt;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; putc(cadena[i]);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: green; font-size: 10pt;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
delay_ms(150);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: green; font-size: 10pt;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;font-family: Courier New;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: green; font-size: 10pt;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;i establece el número de orden
del carácter. En total serán 5; uno para el signo, otro para el valor entero,
uno más para el punto decimal y dos para la parte decimal.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Cuando el valor &lt;i&gt;float&lt;/i&gt; es negativo, el signo negativo
aparece por defecto. Pero cuando es positivo, el signo está omitido. Para que
en este caso el &lt;i&gt;string&lt;/i&gt; mantenga el
mismo formato de 5 caracteres, el signo habrá que añadirlo, o mejor dicho, al
signo ‘+’ añadirle el “valor numérico”:&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: green; font-size: 10pt;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;if (valor&amp;gt;0) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: green; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
strcpy(cadena,&quot;+&quot;);&lt;/span&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: grey; font-size: 10pt;&quot;&gt;//En
&quot;cadena&quot; caracter +&lt;/span&gt;&lt;span style=&quot;color: green; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: green; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
strcat (cadena,string);&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey; font-size: 10pt;&quot;&gt;//Al signo + se añade
el valor numérico&lt;/span&gt;&lt;span style=&quot;color: green; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: green; font-size: 10pt;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;font-family: Courier New;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: green; font-size: 10pt;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;La recepción en el otro PIC se
produce por medio de la interrupción&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: green; font-size: 10pt;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;#int_RDA.&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Deberá recibir la misma cantidad
de caracteres enviados por el PIC emisor, es decir, 5 caracteres organizados en
el &lt;i&gt;array&lt;/i&gt; cadena[ ]&amp;nbsp; por el valor i.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: green; font-size: 10pt;&quot;&gt;cadena[i]=getc();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: grey; font-size: 10pt;&quot;&gt;//Recepción del string&lt;/span&gt;&lt;span style=&quot;color: green; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: green; font-size: 10pt;&quot;&gt;++i;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: grey; font-size: 10pt;&quot;&gt;//Preparación
para recibir el siguiente carácter&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: grey; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Recibidos todos los caracteres
indicados por la variable i, se puede ya convertir la cadena de caracteres
recibida a su valor numérico tipo &lt;i&gt;float&lt;/i&gt;
original y guardarla en la variable “valor”.&amp;nbsp;
La certificación del valor recibido se establece por su representación
en el LCD.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: green; font-size: 10pt;&quot;&gt;if (i==6) {&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey; font-size: 10pt;&quot;&gt;//Todos los caracteres recibidos&lt;/span&gt;&lt;span style=&quot;color: green; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: green; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;
i=0;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey; font-size: 10pt;&quot;&gt;//Preparación
para recibir el siguiente string&lt;/span&gt;&lt;span style=&quot;color: green; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: green; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;
valor = atof(cadena); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey; font-size: 10pt;&quot;&gt;//Paso del string a su valor float&lt;/span&gt;&lt;span style=&quot;color: green; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: green; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;
printf(lcd_putc,&quot;\fVoltage recibido&quot;); &lt;/span&gt;&lt;span style=&quot;color: grey; font-size: 10pt;&quot;&gt;//Muestra en
display mensaje&lt;/span&gt;&lt;span style=&quot;color: green; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: green; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;
printf(lcd_putc,&quot;\n%01.2fV&quot;,valor); &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: 10pt;&quot;&gt;//Muestra en
display valor float&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: green; font-size: 10pt;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;font-family: Courier New;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: green; font-size: 10pt;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=5250193391449144895#&quot; onclick=&quot;Effect.toggle(&amp;quot;expandir1&amp;quot;,&amp;quot;slide&amp;quot;); return false&quot;&gt;[+/-] Ver / Ocultar programa PIC emisor completo en C&lt;/a&gt;&lt;br /&gt;
&lt;div id=&quot;expandir1&quot; style=&quot;display: none;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;background-color: white; color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;////////////////////////////////////////////////////////////////////////////////&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TRANSMISIÓN FLOAT RS232 ENTRE DOS PIC &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;PIC EMISOR &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (c) RobotyPic 2012 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;////////////////////////////////////////////////////////////////////////////////&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#include &amp;lt;16F876a.h&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#device adc=10 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Configuración conversor AD a 10 bits&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#fuses XT, NOWDT&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#use delay(clock=4000000) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Frecuencia del reloj&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#use rs232(baud=9600, xmit=pin_c6, rcv=pin_c7)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#define use_portb_lcd TRUE &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Puerto B para el LCD&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#include &amp;lt;lcd.c&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Librería para el LCD&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#include &amp;lt;stdio.h&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/******************************************************************************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/************************ &amp;nbsp;FUNCIÓN PRINCIPAL &amp;nbsp;*********************************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;void main () {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;float32 valor; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Dato a transmitir en float&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;char cadena[6]; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Dato a transmitir en string&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;char string[6]; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Guarda el valor float como string&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;int i=0; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Número de caracteres del string&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;int16 lectura; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Lectura del conversor AD&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;setup_adc_ports(AN0_vref_vref); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Canal de entrada analógico AN0&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;setup_adc(ADC_CLOCK_INTERNAL); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Fuente de reloj RC&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;lcd_init(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Inicialización del display&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;delay_ms(500);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;while(1){&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; set_adc_channel(0);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; delay_us(20);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; lectura=read_adc(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Lectura canal analógico&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; valor=(-2.5)+(5*lectura/1024.0); &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Valor analógico de la lectura&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Muestra por el LCD los valores digital y analógico de la lectura AD&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; printf(lcd_putc, &quot;\fADC = %4lx&quot;, lectura);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; printf(lcd_putc, &quot;\nVoltage = %01.2fV&quot;, valor);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sprintf(string,&quot;%01.2f&quot;,valor); &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Paso a string el valor float&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; // Si el valor es positivo le añado signo +&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; if (valor&amp;gt;0) {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;strcpy(cadena,&quot;+&quot;); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//En &quot;cadena&quot; caracter +&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;strcat (cadena,string); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Al signo + se añade el valor numérico&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Si el valor es negativo le dejo el signo -&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; else {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;strcpy(cadena,&quot;&quot;);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;strcat (cadena,string);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt; //Envío por RS232 del valor float como string&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; for (i=0;i&amp;lt;=5;++i){&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;putc(cadena[i]);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;delay_ms(150);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; }&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana, sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana, sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=5250193391449144895#&quot; onclick=&quot;Effect.toggle(&amp;quot;expandir2&amp;quot;,&amp;quot;slide&amp;quot;); return false&quot;&gt;[+/-] Ver / Ocultar programa PIC receptor completo en C&lt;/a&gt;&lt;br /&gt;
&lt;div id=&quot;expandir2&quot; style=&quot;display: none;&quot;&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;////////////////////////////////////////////////////////////////////////////////&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TRANSMISIÓN FLOAT RS232 ENTRE DOS PIC &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;PIC RECEPTOR &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(c) RobotyPic 2012 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;////////////////////////////////////////////////////////////////////////////////&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#include &amp;lt;16F876a.h&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#fuses XT, NOWDT&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#use delay(clock=4000000)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#use rs232(baud=9600, xmit=pin_c6, rcv=pin_c7)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#define use_portb_lcd TRUE&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#include &amp;lt;lcd.c&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#include &amp;lt;stdlib.h&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;char cadena[6]; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Guardará el string recibido&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;int i; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Número de caracteres del string&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;float32 valor; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Dato recibido en formato float&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/******************************************************************************/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/************* &amp;nbsp;FUNCIÓN INTERRUPCIÓN POR RECEPCIÓN DE DATOS *******************/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#int_RDA &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Interrupción por recepción de datos&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;void RDA_isr(){&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;cadena[i]=getc(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Recepción del string &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;++i; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Preparación para recibir el siguiente caracter&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;if (i==6) { &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt; //Todos los caracteres recibidos&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; i=0; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Preparación para recibir el siguiente string&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; valor = atof(cadena); &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Paso del string a su valor float&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; printf(lcd_putc,&quot;\fVoltage recibido&quot;); &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Muestra en display mensaje&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; printf(lcd_putc,&quot;\n %01.2fV&quot;,valor); &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Muestra en display valor float&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/******************************************************************************/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/************************ &amp;nbsp;FUNCIÓN PRINCIPAL &amp;nbsp;*********************************/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;void main () {&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;port_b_pullups(TRUE);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;lcd_init(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Inicialización del display&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;enable_interrupts(INT_RDA); &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Habilitación interrupción por recepción RS232&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;enable_interrupts(GLOBAL);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;printf(lcd_putc, &quot;\fEsperando...&quot;);&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;i=0;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;while(1){}&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana, sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana, sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;En esta simulación bajo proteus
se puede ver el funcionamiento:&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;center&gt;
&lt;iframe allowfullscreen=&quot;allowfullscreen&quot; frameborder=&quot;0&quot; height=&quot;360&quot; src=&quot;http://www.youtube.com/embed/YuMBzYhWh5s?feature=player_detailpage&quot; width=&quot;480&quot;&gt;&lt;/iframe&gt;&lt;/center&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Y en el siguiente enlace, la
descarga de los archivos del proyecto:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;a href=&quot;http://depositfiles.com/files/vle6a9dja&quot; target=&quot;_blank&quot;&gt;Descargar archivos Transmisión float por RS232&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;El proyecto contenido en el artículo ha sido diseñado y probado con éxito utilizando las siguientes versiones de software:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;- Windows xp y windows 7&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;- Proteus V7.7 SP2&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;- CCS PIC C COMPILER v4.084&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
</content><link rel='replies' type='application/atom+xml' href='http://robotypic.blogspot.com/feeds/4393907393425654496/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5250193391449144895/4393907393425654496?isPopup=true' title='13 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5250193391449144895/posts/default/4393907393425654496'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5250193391449144895/posts/default/4393907393425654496'/><link rel='alternate' type='text/html' href='http://robotypic.blogspot.com/2012/08/transmision-variable-tipo-float-por.html' title='Transmisión variable tipo &quot;float&quot; por RS232'/><author><name>Robotypic</name><uri>http://www.blogger.com/profile/16455462312458405515</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-fqE_n2TQxgx01paxQCo3xhn8axN0Pmf7TmnZMIVc-M9RwxZb4nf-HWCuFWipHAD4isOFsHlqFVc-xtUumkP-KBpxxriRP7zNQvXreaNeU1MOIz2qZhCZl_n9oY1wSi9r6nLJ3v3e-aM/s72-c/Esquema+trasmisi%C3%B3n+float+por+RS232.jpg" height="72" width="72"/><thr:total>13</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5250193391449144895.post-5417845356865996623</id><published>2012-03-24T16:43:00.003+01:00</published><updated>2015-06-11T15:20:13.332+02:00</updated><title type='text'>Comunicación I2C entre 3 PIC</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_qnLJTEX_XuOaLQp3ggAC46Nmt_v5pLF4md20ntUW-iG9KP_AnNu4ZBAVNDwIXCGjBj9JPAM-WorIGud-BKOSIc8CLf_ioW_af-_bQ8mcdT3V0m3uopU5jmdajlAOYFoYGyPp-nlWOac/s1600/i2c+2+pic.JPG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;230&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_qnLJTEX_XuOaLQp3ggAC46Nmt_v5pLF4md20ntUW-iG9KP_AnNu4ZBAVNDwIXCGjBj9JPAM-WorIGud-BKOSIc8CLf_ioW_af-_bQ8mcdT3V0m3uopU5jmdajlAOYFoYGyPp-nlWOac/s640/i2c+2+pic.JPG&quot; width=&quot;600&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Verdana;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: black; font-family: Verdana;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: black; font-family: Verdana;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: black; font-family: Verdana;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: black; font-family: Verdana;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: black; font-family: Verdana;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: black; font-family: Verdana;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: black; font-family: Verdana;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: black; font-family: Verdana;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: black; font-family: Verdana;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: black; font-family: Verdana;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: black; font-family: Verdana;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: black; font-family: Verdana;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: black; font-family: Verdana;&quot;&gt;El&amp;nbsp;ejemplo didáctico consiste en lo siguiente. El PIC maestro carga en los PIC esclavos datos aleatorios en 10 posiciones de memoria. Primero con el PIC esclavo 1, dirección I2C en el bus 0xA0. Posteriormente con el PIC esclavo 2, con dirección I2C 0xB0. Cuando ha cargado los datos en ambos PIC, hace una lectura del dato que ha guardado en la posición 5 de ambos PIC y la muestra por el LCD.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_HFOz9ITaqd-7lepsQkYpkAWEyHyy2bzlOi66IDo9aLtb_Y0NJSQYshbhyRyTr916HZ_N2sB27vpoABWScPGtqaBTuUpMN8Z9JhmIEMyOjVgD6CiV-_wc1xY9l2NRSOWa9OfMqTYH-UQ/s1600/esquema+I2C+tres+pic.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_HFOz9ITaqd-7lepsQkYpkAWEyHyy2bzlOi66IDo9aLtb_Y0NJSQYshbhyRyTr916HZ_N2sB27vpoABWScPGtqaBTuUpMN8Z9JhmIEMyOjVgD6CiV-_wc1xY9l2NRSOWa9OfMqTYH-UQ/s640/esquema+I2C+tres+pic.png&quot; width=&quot;540&quot; yda=&quot;true&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: right;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&lt;em&gt;&lt;span style=&quot;color: #990000; font-family: Arial, Helvetica, sans-serif;&quot;&gt;Pulsa en la imagen para ampliarla&lt;/span&gt;&lt;/em&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;span style=&quot;color: #990000; font-family: Arial; font-size: xx-small;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.65pt;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;PIC Maestro&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.65pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.65pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Lo
primero de todo será configurar la comunicación I2C en la cabecera del programa.
En dicha configuración vamos a establecer que se trata del PIC maestro
(master), que vamos a usar velocidad rápida (fast), y que los pines del PIC van
a ser C4 para la línea sda del bus y C3 para scl, propios del módulo SSP que
este PIC posee.&lt;/span&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.65pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.65pt; text-align: left;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;#use i2c(Master, fast, sda=PIN_C4,scl=PIN_C3)&lt;/span&gt;&lt;span style=&quot;color: #993300; font-family: Courier New;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.65pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.65pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana;&quot;&gt;Si
el PIC no posee módulo SSP o queremos emplear otros pines diferentes, se puede
realizar la comunicación mediante software forzando esta característica e
indicando los pines que van a ser utilizados.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.65pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.65pt; text-align: left;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;#use i2c(Master, fast, sda=PIN_B2,scl=PIN_B3, force_sw)&lt;/span&gt;&lt;span style=&quot;color: #993300; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;span style=&quot;color: black; font-family: Verdana;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.65pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana;&quot;&gt;A
partir de este momento, para enviar algo por el bus I2C ejecutamos la función &lt;b&gt;&lt;i&gt;Envio_I2C(),&lt;/i&gt;&lt;/b&gt;
en la que deberemos especificar previamente la dirección en el bus I2C del
esclavo con el que se quiere comunicar, la posición del buffer de memoria donde
se va a guardar en el esclavo el dato enviado y la información del propio dato.&lt;span style=&quot;font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: black; font-family: Verdana;&quot;&gt;&lt;br /&gt;&lt;/span&gt;

&lt;br /&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Courier;&quot;&gt;&amp;nbsp;&lt;span style=&quot;color: #38761d;&quot;&gt;direccion=0xA0;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//Dirección del esclavo en el bus I2C&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Courier;&quot;&gt;&amp;nbsp;&lt;span style=&quot;color: #38761d;&quot;&gt;posicion=0x05;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//Posición donde se guardará el dato&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;dato=0xfb;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//Dato a transmitir&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; line-height: 13.65pt; text-align: left;&quot;&gt;&amp;nbsp;Envio_I2C(direccion, posicion, dato); &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace; line-height: 13.65pt; text-align: left;&quot;&gt;//Función para envio I2C&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;span style=&quot;color: black; font-family: Verdana;&quot;&gt;&lt;br /&gt;&lt;/span&gt;

&lt;span style=&quot;color: black; font-family: Verdana;&quot;&gt;Dentro ya de la función, el envío de cada byte de datos se realizará con las siguientes sentencias:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Courier;&quot;&gt;&amp;nbsp;&lt;span style=&quot;color: #38761d;&quot;&gt;i2c_start();&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;//Comienzo comunicación&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Courier;&quot;&gt;&amp;nbsp;&lt;span style=&quot;color: #38761d;&quot;&gt;i2c_write(direccion);&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;//Dirección del esclavo en el bus I2C&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Courier;&quot;&gt;&amp;nbsp;&lt;span style=&quot;color: #38761d;&quot;&gt;i2c_write(posicion);&lt;/span&gt;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//Posición donde se guardará el dato&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Courier;&quot;&gt;&amp;nbsp;&lt;span style=&quot;color: #38761d;&quot;&gt;i2c_write(dato);&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;//Dato a transmitir&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Courier;&quot;&gt;&amp;nbsp;&lt;span style=&quot;color: #38761d;&quot;&gt;i2c_stop();&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;//Fin comunicación&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.65pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Para la
lectura de los esclavos el proceso es similar, pero esta vez ejecutando la
función&amp;nbsp;&lt;b&gt;&lt;i&gt;Lectura_I2C()&lt;/i&gt;&lt;/b&gt;. También
previamente deberemos especificar la dirección del esclavo en el bus I2C, la
posición en el buffer de memoria del PIC esclavo de donde queremos obtener el
byte que contiene y la variable donde lo vamos a guardar (&amp;amp;dato).&lt;/span&gt;&lt;span style=&quot;font-family: Verdana; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier;&quot;&gt;&amp;nbsp;&lt;span style=&quot;color: #38761d;&quot;&gt;direccion=0xA0;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//Dirección del esclavo en el bus I2C&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Courier; text-align: left;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #38761d; font-family: Courier; text-align: left;&quot;&gt;posicion=0x05;&lt;/span&gt;&lt;span style=&quot;font-family: Courier; text-align: left;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier; text-align: left;&quot;&gt;//Posición donde se guardará el dato&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;span style=&quot;font-family: Courier;&quot;&gt;
&lt;/span&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.65pt; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp;Lectura_I2C(direccion, posicion, &amp;amp;dato); &lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Courier New, Courier, monospace;&quot;&gt;//Función para envío I2C&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.65pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Dentro ya de la función ejecutaremos las sentencias para el envío de cada byte de datos:&lt;/span&gt;&lt;span style=&quot;font-family: Verdana; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Courier;&quot;&gt;&amp;nbsp;&lt;span style=&quot;color: #38761d;&quot;&gt;i2c_start();&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//Comienzo de la comunicación&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Courier;&quot;&gt;&amp;nbsp;&lt;span style=&quot;color: #38761d;&quot;&gt;i2c_write(direccion);&lt;/span&gt;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//Dirección del esclavo en el bus I2C&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Courier;&quot;&gt;&amp;nbsp;&lt;span style=&quot;color: #38761d;&quot;&gt;i2c_write(posicion);&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//Posición de donde se leerá el dato&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #666666; font-family: Courier;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; en&amp;nbsp;el esclavo&lt;/span&gt;&lt;span style=&quot;font-family: Courier;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Courier;&quot;&gt;&amp;nbsp;&lt;span style=&quot;color: #38761d;&quot;&gt;i2c_start();&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//Reinicio&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier;&quot;&gt;&amp;nbsp;i2c_write(direccion+1);&lt;/span&gt;&lt;span style=&quot;font-family: Courier;&quot;&gt; &lt;span style=&quot;color: #666666;&quot;&gt;//Dirección del esclavo en modo lectura&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier;&quot;&gt;&amp;nbsp;dato=i2c_read(0);&lt;/span&gt;&lt;span style=&quot;font-family: Courier;&quot;&gt; &lt;span style=&quot;color: #666666;&quot;&gt;//Lectura del dato&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Courier;&quot;&gt;&amp;nbsp;&lt;span style=&quot;color: #38761d;&quot;&gt;i2c_stop();&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//Fin comunicación&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.65pt;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;PIC esclavo&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.65pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.65pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Igual
que en el PIC master, en cada PIC esclavo se debe configurar la comunicación
I2C. En este caso vamos a establecer que se trata de un PIC esclavo (slave),
que vamos a usar velocidad rápida (fast), que los pines del PIC van a ser C4
para la línea sda y C3 para scl, y cual va a ser su dirección en el bus (address).&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.65pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.65pt; text-align: left;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace;&quot;&gt;#use
i2c(slave, fast, sda=PIN_C4, scl=PIN_C3, address=0xA0)&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.65pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.65pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;A
diferencia del PIC maestro que es quien decide en que momento iniciar la
comunicación, en los esclavos, la comunicación&amp;nbsp;se establece cuando,
mediante la interrupción&lt;span class=&quot;apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;i&gt;&lt;b&gt;#INT_SSP&lt;/b&gt;&lt;/i&gt;&lt;span class=&quot;apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;se
detecta actividad en el bus I2C.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.65pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.65pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;En el
caso del PIC esclavo, si que vamos a necesitar del módulo SSP, por tanto no se
puede forzar una comunicación por software como en el PIC maestro y los pines
han de ser necesariamente los propios del bus I2C del PIC.&lt;/span&gt;&lt;span style=&quot;font-family: Verdana; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: black; font-family: Verdana;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.65pt; text-align: left;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #38761d; font-family: &#39;Courier New&#39;;&quot;&gt;#INT_SSP&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.65pt; text-align: left;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #38761d; font-family: &#39;Courier New&#39;;&quot;&gt;void ssp_interupt (){&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.65pt; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int incoming; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;/Variable donde se recibe el
byte que manda el maestro&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.65pt; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;fstate = i2c_isr_state();&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Lectura del estado del bus I2c la
interrupción&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.65pt; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;/* Solicitud de lectura del esclavo por el
master */&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.65pt; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp; if(fstate == 0x80) {&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.65pt; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Manda al maestro la información
contenida en la posición de memoria que le ha solicitado&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.65pt; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i2c_write (buffer[posicion]);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.65pt; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
SolicitudMaster=1;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Fin de solicitud del master&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.65pt; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.65pt; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;/* Sino está solicitando lectura es que está
enviando algo */&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.65pt; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;&amp;nbsp; else {&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Sino es que hay
dato en el bus I2C...&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.65pt; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; incoming = i2c_read();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//... lo lee&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.65pt; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;if
(fState == 1) {&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Información
recibida corresponde a la posicion&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.65pt; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; posicion = incoming;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Se guarda posición&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.65pt; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.65pt; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else if (fState == 2) {&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Información recibida corresponde al
dato&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.65pt; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; buffer[posicion] = incoming;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Se guarda dato&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.65pt; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; EnvioMaster=1; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Fin del envío del master&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.65pt; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #38761d; font-family: &#39;Courier New&#39;;&quot;&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.65pt; text-align: left;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #38761d; font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.65pt; text-align: left;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: #38761d; font-family: &#39;Courier New&#39;;&quot;&gt;}&lt;span style=&quot;font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=5250193391449144895#&quot; onclick=&quot;Effect.toggle(&amp;quot;expandir1&amp;quot;,&amp;quot;slide&amp;quot;); return false&quot;&gt;[+/-] Ver / Ocultar programa en C PIC Maestro&lt;/a&gt;&lt;br /&gt;
&lt;div id=&quot;expandir1&quot; style=&quot;display: none;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;////////////////////////////////////////////////////////////////////////////////&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; COMUNICACIÓN I2C TRES PIC &amp;nbsp;v2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;PIC &amp;nbsp;Master &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; RobotyPic 2015 (c) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; CCS PIC C Compiler v4.104 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;////////////////////////////////////////////////////////////////////////////////&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// FUNCIONAMIENTO DEL EJEMPLO: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// PIC Master envía por el bus I2C a PIC esclavo1 10 bytes que guardará en las//&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// posiciones del buffer de memoria indicadas por el Master (de la posición 1 //&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// a la 10). &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// Posteriormente envía otros 10 bytes de datos al PIC esclavo2 que guardará &amp;nbsp;//&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// igualmente en las 10 primeras posiciones de memoria. &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// Finalizados los envíos, el PIC maestro leerá los byte que previamente había //&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// enviado a los PIC esclavos y que estos habían guardado en la posición 5 &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// Los bytes enviados son generados aleatoriamente. &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;////////////////////////////////////////////////////////////////////////////////&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#include &amp;lt;16F876a.h&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#use delay(clock=4000000) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Frecuencia de reloj&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/* Configuración de fuses&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;XT &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Cristal oscilador &amp;lt;= 4MHz&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;NOWDT &amp;nbsp; &amp;nbsp; &amp;nbsp; Sin uso del watchdog&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;NOLVP &amp;nbsp; &amp;nbsp; &amp;nbsp; Inhabilitación modo LVP&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; */&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#fuses XT, NOWDT, NOLVP&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/* Configuración I2C modo Master por hardware e identificación de los pines */&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#use i2c(Master,fast,sda=PIN_C4,scl=PIN_C3)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/* Configuración de los puertos */&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#use fast_io(a)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#use fast_io(B)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#use fast_io(C)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#define use_portb_lcd TRUE &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Configuración puerto b control lcd&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/* Carga de librerías */&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#include &amp;lt;stdlib.h&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt; &amp;nbsp;//Libreria necesaria para función rand()&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#include &amp;lt;lcd.c&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt; //Libreria para control del lcd&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/******************************************************************************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/************** FUNCIÓN GENERACIÓN DE NÚMEROS ALEATORIOS **********************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/** &amp;nbsp; &amp;nbsp;Genera números aleatorios como datos a guardar en los PIC esclavos &amp;nbsp; &amp;nbsp;**/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;void aleatorio (byte &amp;amp;n_aleatorio){&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;srand(get_rtcc()); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Función para la generación de un número aleatorio&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;n_aleatorio=rand() % (256); &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Limitación a un número aleatorio entre 0 y 255&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/******************************************************************************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/******************* FUNCIÓN ESCRITURA EN PICS ESCLAVOS ***********************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/** Guarda un dato (número aleatorio) en la posición de memoria indicada y en el&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; PIC correspondiente a la dirección I2C proporcionada &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; **/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;void Envio_I2C(direccion, posicion, dato){&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_start(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// Comienzo comunicación&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_write(direccion); &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// Dirección del esclavo en el bus I2C&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_write(posicion); &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// Posición donde se guardara el dato transmitido&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_write(dato); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// Dato a transmitir&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_stop(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// Fin comunicación&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;delay_ms(50);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/******************************************************************************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/******************** FUNCIÓN LECTURA DE PICS ESCLAVOS ************************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/** &amp;nbsp; &amp;nbsp; Lee el dato guardado en la posición de memoria indicada del PIC&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; correspondiente a la dirección I2C proporcionada &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; **/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;void Lectura_I2C (byte direccion, byte posicion, byte &amp;amp;dato) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_start(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// Comienzo de la comunicación&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_write(direccion); &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// Dirección del esclavo en el bus I2C&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_write(posicion); &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// Posición de donde se leerá el dato en el esclavo&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_start(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// Reinicio&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_write(direccion+1); &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// Dirección del esclavo en modo lectura&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;dato=i2c_read(0); &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// Lectura del dato&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_stop(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// Fin comunicación&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;delay_ms(50); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// Espera finalización del envio&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/******************************************************************************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/*************************** FUNCIÓN PRINCIPAL ********************************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;void main(){&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;/* Definición de variables */&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;byte dato=0; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Contendrá la información a enviar o recibir&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;byte direccion=0; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Contendrá la dirección del esclavo en el bus I2C&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;byte posicion=0; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Contendrá la posición en el buffer de memoria del esclavo donde se almacenará o de donde se recuperará el dato&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;byte n_aleatorio=0;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/* Configuraciones */&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;setup_timer_0(RTCC_INTERNAL|RTCC_DIV_2); &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Config. timer0 necesario para números aleatorios&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;enable_interrupts(global);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/* Inicialización de componentes hardware */&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;lcd_init(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Inicialización del lcd&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;port_b_pullups(TRUE); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Habilitación resistencias pull ups puerto b&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;printf(lcd_putc, &quot;\f Pulsar para I2C&quot;); &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Mensaje lcd de inicio&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;while(true){&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; if (input(pin_A0)==1) { &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Cuando se pulsa comienza trasmisión&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;printf(lcd_putc, &quot;\f &amp;nbsp; &amp;nbsp;Enviando&quot;); &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Mensaje en lcd&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/** Envío a PIC esclavo dirección 0xA0 bus I2C posiciones 1 a 10 **/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;for (posicion=1; posicion&amp;lt;=10; posicion++){&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; direccion=0xA0; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Al PIC con I2C A0 en el bus&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; aleatorio (n_aleatorio); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Generación de un número aleatorio&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dato=n_aleatorio; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Número aleatorio como dato&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; lcd_gotoxy(1,2); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Posición en el lcd&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Muestra en el lcd las variables de la transmisión&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; printf(lcd_putc, &quot;%x Pos%d Dato=%x &quot;, direccion, posicion, dato);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Envio_I2C(direccion, posicion, dato); &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Envío I2C&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; delay_ms(500); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Envío cada medio segundo&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/** Envío a PIC esclavo dirección 0xB0 bus I2C posiciones 1 a 10 **/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;for (posicion=1; posicion&amp;lt;=10; posicion++){&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; direccion=0xB0; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Al PIC con I2C B0 en el bus&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; aleatorio (n_aleatorio); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;/&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/Generación de un número aleatorio&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dato=n_aleatorio; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Número aleatorio como dato&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; lcd_gotoxy(1,2); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Posición en el lcd&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //Muestra en el lcd las variables de la transmisión &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; printf(lcd_putc, &quot;%x Pos%d Dato=%x &quot;, direccion, posicion, dato);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Envio_I2C(direccion, posicion, dato); &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Envío I2C&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; delay_ms(500); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Envío cada medio segundo&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;printf(lcd_putc, &quot;\f &amp;nbsp; &amp;nbsp;Enviado&quot;); &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Mensaje en lcd&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;delay_ms(1000); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Espera de 1 segundo&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/* Lectura del dato contenido en la posición de memoria 5 del pic esclavo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;cuya dirección en el bus I2C es 0xA0 */&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;direccion=0xA0; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Dirección en el bus I2c&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;posicion=0x05; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Posición de memoria a leer&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Lectura_I2C(direccion, posicion, dato); &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Lectura por I2C&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Muestra en el lcd las variables de la transmisión&lt;/span&gt;&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;printf(lcd_putc, &quot;\fI2C=%x Pos.%d =%x&quot; direccion, posicion, dato);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;delay_ms (1000); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Espera de 1 segundo&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;/* Lectura del dato contenido en la posición de memoria 5 del pic esclavo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;cuya dirección en el bus I2C es 0xB0 */&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;direccion=0xB0; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Dirección en el bus I2c&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;posicion=0x05; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Posición de memoria a leer&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Lectura_I2C(direccion, posicion, dato); &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Lectura por I2C&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Muestra en el lcd las variables de la transmisión&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;printf(lcd_putc, &quot;\nI2C=%x Pos.%d =%x&quot; direccion, posicion, dato);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;delay_ms(10); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Espera de 10 milisegundos&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=5250193391449144895#&quot; onclick=&quot;Effect.toggle(&amp;quot;expandir2&amp;quot;,&amp;quot;slide&amp;quot;); return false&quot;&gt;[+/-] Ver / Ocultar programa en C PIC Esclavo 1&lt;/a&gt;&lt;br /&gt;
&lt;div id=&quot;expandir2&quot; style=&quot;display: none;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;////////////////////////////////////////////////////////////////////////////////&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; COMUNICACIÓN I2C TRES PIC v2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Esclavo 1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;RobotyPic 2015 (c) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;CCS PIC C Compiler v4.104 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;////////////////////////////////////////////////////////////////////////////////&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;#include &amp;lt;16F876A.h&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;#fuses XT,NOWDT,NOPROTECT,NOLVP&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;#use delay(clock=4000000)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;/* Configuración de la comunicación I2c */&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;#use i2c(slave, fast, sda=PIN_C4, scl=PIN_C3, address=0xA0)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;#define use_portb_lcd TRUE &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;//Puerto b para lcd&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;#include &amp;lt;LCD.c&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;//Librería para uso del lcd&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;/* Variables globales */&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;byte fstate; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;//Guardara el estado del bus I2C&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;byte posicion, buffer[0x10]; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt; //Buffer de memoria&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;short EnvioMaster; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;//Indicación de fin del byte enviado por el master&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;short SolicitudMaster=0; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;//Indicación de fin de la entrega del byte solicitado por el master&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;/******************************************************************************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;/***************** FUNCIÓN INTERRUPCIÓN POR RECEPCION I2C *********************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;/** &amp;nbsp;Saltará a esta función cada vez que se detecte actividad en el bus I2C &amp;nbsp;**/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;#INT_SSP&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;void ssp_interupt (){&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;int incoming; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;//Variable donde se recibe el byte que manda el maestro&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;fstate = i2c_isr_state(); &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;//Lectura del estado del bus I2c la interrupción&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;/* Solicitud de lectura del esclavo por el master */&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;if(fstate == 0x80) { &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;//Manda al maestro la información contenida en la posición de memoria que le ha solicitado&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; i2c_write (buffer[posicion]);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; SolicitudMaster=1; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;//Fin de solicitud del master&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;/* Sino está solicitando lectura es que está enviando algo */&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;else { &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;//Sino es que hay dato en el bus I2C...&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; incoming = i2c_read(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;//... lo lee&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; if (fState == 1) { &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;//Información recibida corresponde a la posicion&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;posicion = incoming; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;//Se guarda posición&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; else if (fState == 2) { &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;//Información recibida corresponde al dato&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;buffer[posicion] = incoming; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;//Se guarda dato&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;EnvioMaster=1; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;//Fin del envío del master&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; }&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;/******************************************************************************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;/************************* FUNCIÓN PRINCIPAL **********************************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;void main (){&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;lcd_init(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;//Inicialización del lcd&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;fState = 0;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;for (posicion=0;posicion&amp;lt;0x10;posicion++)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;buffer[posicion] = 0x00;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;enable_interrupts(INT_SSP);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;enable_interrupts(GLOBAL);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;while(true){&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;/* Si el master ha enviado algo */&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; if (EnvioMaster==1) {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;printf(lcd_putc, &quot;\f &amp;nbsp; Recibido ... \n&quot;);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;printf(lcd_putc, &quot;Pos.%d &amp;nbsp;Dato= %x &quot;, posicion, buffer[posicion]);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;EnvioMaster=0; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;//Preparado para señalizar nuevo solicitud del master&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt; &amp;nbsp;/* Si el master ha solicitado algo */&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;if (SolicitudMaster==1) {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;//Muestra por LCD valor en posición de memoria solicitada por el master&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;printf (lcd_putc, &quot;\fDireccion I2C=A0\n&quot;);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;printf (lcd_putc, &quot;Pos.%d &amp;nbsp; Dato= %x&quot; &amp;nbsp;posicion, buffer[posicion]);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;SolicitudMaster=0; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;//Preparado para señalizar nuevo solicitud del master&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=5250193391449144895#&quot; onclick=&quot;Effect.toggle(&amp;quot;expandir3&amp;quot;,&amp;quot;slide&amp;quot;); return false&quot;&gt;[+/-] Ver / Ocultar programa en C PIC Esclavo 2&lt;/a&gt;&lt;br /&gt;
&lt;div id=&quot;expandir3&quot; style=&quot;display: none;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;////////////////////////////////////////////////////////////////////////////////&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; COMUNICACIÓN I2C TRES PIC v2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Esclavo 2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;RobotyPic 2015 (c) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;CCS PIC C Compiler v4.104 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;////////////////////////////////////////////////////////////////////////////////&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;#include &amp;lt;16F876A.h&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;#fuses XT,NOWDT,NOPROTECT,NOLVP&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;#use delay(clock=4000000)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;#use i2c(SLAVE,fast, SDA=PIN_C4, SCL=PIN_C3, address=0xB0)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;#define use_portb_lcd TRUE&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;#include &amp;lt;LCD.c&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;byte fState;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;byte posicion, buffer[0x10];&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;short EnvioMaster=0;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;short SolicitudMaster=0;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;/******************************************************************************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;/***************** FUNCIÓN INTERRUPCIÓN POR RECEPCION I2C *********************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;#INT_SSP&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;void ssp_interupt (){&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;int incoming; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;//Variable donde se recibe el byte que manda el maestro&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;fstate = i2c_isr_state(); &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;//Estado del bus tras la interrupción&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;if(fstate == 0x80) { &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;//Solicitud de lectura del esclavo por el master&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Manda al maestro la información contenida en la posición de memoria que le ha solicitado&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; i2c_write (buffer[posicion]);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; SolicitudMaster=1; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;//Fin de solicitud del master&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;else { &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;//Sino es que hay dato en el bus I2C...&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; incoming = i2c_read(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;//... lo lee&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; if (fState == 1) { &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;//Información recibida corresponde a la posicion&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;posicion = incoming; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;//Se guarda posición&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; else if (fState == 2) { &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;//Información recibida corresponde al dato&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;buffer[posicion] = incoming; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;//Se guarda dato&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;EnvioMaster=1; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;//Fin del envío del master&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; }&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;/******************************************************************************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;/************************* FUNCIÓN PRINCIPAL **********************************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;void main (){&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;lcd_init();&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;fState = 0;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;for (posicion=0;posicion&amp;lt;0x10;posicion++)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;buffer[posicion] = 0x00;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;enable_interrupts(INT_SSP);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;enable_interrupts(GLOBAL);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;while(true){&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;/* Si el master ha enviado algo */&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; if (EnvioMaster==1) {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;printf(lcd_putc, &quot;\f &amp;nbsp; Recibido ... \n&quot;);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;printf(lcd_putc, &quot;Pos.%d &amp;nbsp;Dato= %x &quot;, posicion, buffer[posicion]);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;EnvioMaster=0; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;//Preparado para señalizar nuevo envío del master&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;/* Si el master ha solicitado algo */&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;if (SolicitudMaster==1){&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;//Muestra por LCD valor en posición de memoria solicitada por el master&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;printf (lcd_putc, &quot;\fDireccion I2C=B0\n&quot;);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;printf (lcd_putc, &quot;Pos.%d &amp;nbsp; Dato= %x&quot; &amp;nbsp;posicion, buffer[posicion]);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;SolicitudMaster=0; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New; font-size: x-small;&quot;&gt;//Preparado para señalizar nuevo solicitud del master&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New; font-size: x-small;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Verdana;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;En esta animación se ve la demostración de funcionamiento bajo proteus.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;center&gt;
&lt;iframe allowfullscreen=&quot;&quot; frameborder=&quot;0&quot; height=&quot;360&quot; src=&quot;http://www.youtube.com/embed/t6c42YOH62c?feature=player_embedded&quot; width=&quot;540&quot;&gt;&lt;/iframe&gt;&lt;/center&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Verdana, sans-serif;&quot;&gt;Descarga de los archivos del proyecto.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://dfiles.eu/files/z5hf93dtc&quot; target=&quot;_blank&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;, sans-serif;&quot;&gt;Descargar archivos I2C tres PICs&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;El proyecto contenido en el artículo ha sido diseñado y probado con éxito utilizando las siguientes versiones de software:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;- Windows xp y windows 7 (32 y 64 bits)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;- Proteus V7.7 SP2&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;- CCS PIC C COMPILER v4.104&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif; font-size: xx-small;&quot;&gt;&lt;i&gt;Última revisión del artículo junio de 2015&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif; font-size: xx-small;&quot;&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif; font-size: xx-small;&quot;&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;center&gt;
&lt;!-- CODIGO ADPV --&gt;
&lt;div id=&quot;adsadpv29140&quot;&gt;
&lt;/div&gt;
&lt;script type=&quot;text/javascript&quot;&gt;&lt;!--
var adpv_client = &quot;29140&quot;;
var adpv_width = 468;
var adpv_height = 60;
var adpv_container_id = &quot;adsadpv29140&quot;;
//--&gt;&lt;/script&gt;
&lt;script src=&quot;http://ads.adpv.com/ads.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
&lt;!-- FIN CODIGO ADPV --&gt;&lt;/center&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://robotypic.blogspot.com/feeds/5417845356865996623/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5250193391449144895/5417845356865996623?isPopup=true' title='22 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5250193391449144895/posts/default/5417845356865996623'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5250193391449144895/posts/default/5417845356865996623'/><link rel='alternate' type='text/html' href='http://robotypic.blogspot.com/2012/03/comunicacion-i2c-entre-tres-pics.html' title='Comunicación I2C entre 3 PIC'/><author><name>Robotypic</name><uri>http://www.blogger.com/profile/16455462312458405515</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_qnLJTEX_XuOaLQp3ggAC46Nmt_v5pLF4md20ntUW-iG9KP_AnNu4ZBAVNDwIXCGjBj9JPAM-WorIGud-BKOSIc8CLf_ioW_af-_bQ8mcdT3V0m3uopU5jmdajlAOYFoYGyPp-nlWOac/s72-c/i2c+2+pic.JPG" height="72" width="72"/><thr:total>22</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5250193391449144895.post-736793750343954120</id><published>2011-11-04T20:13:00.003+01:00</published><updated>2013-12-31T18:23:41.298+01:00</updated><title type='text'>Control de un brazo Robot de 4 ejes con PIC</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Verdana, sans-serif;&quot;&gt;Se trata del control de&amp;nbsp;un brazo de 4 ejes para aplicar a un robot. El principio de funcionamiento es similar al empleado en el artículo &lt;a href=&quot;http://robotypic.blogspot.com/2010/11/control-de-8-servos-con-pic-16f876a_13.html&quot; target=&quot;_blank&quot;&gt;Control de 8 servos con PIC&lt;/a&gt;.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div align=&quot;center&quot;&gt;
&lt;iframe allowfullscreen=&quot;&quot; frameborder=&quot;0&quot; height=&quot;349&quot; src=&quot;http://www.youtube.com/embed/c5ko0U6NWMw?hl=es&amp;amp;fs=1&quot; width=&quot;425&quot;&gt;&lt;/iframe&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Verdana;&quot;&gt;Lo lógico es que la fuente de energía de los robots sean baterías o similares. Cuando intentamos hacer funcionar varios ejes del brazo a la vez, puede pasar que se produzcan bajadas de tensión momentaneas que ocasione el reset del PIC e impidan el movimiento del brazo. Para evitarlo hay que indicar en la configuración del programa:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;#fuses NOBROWNOUT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;//No reset por baja tensión&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div align=&quot;left&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Verdana;&quot;&gt;Mediante interrupción por desborde del Timer 0 generaremos las señales de control de los servos. Y mediante el valor numérico contenido en una variable la posición de giro. Estas variables las hemos denominado &#39;pinza&#39; , &#39;muneca&#39; , &#39;brazo&#39; y &#39;hombro&#39;, e identifican a cada uno de los ejes.&amp;nbsp;Con otra variable, &#39;velocidad&#39; especificaremos la rapidez de los movimientos.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: right;&quot;&gt;
&lt;br /&gt;
&lt;div style=&quot;clear: left; cssfloat: left; float: left; margin-bottom: 1em; margin-right: 1em; text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;clear: left; cssfloat: left; float: left; margin-bottom: 1em; margin-right: 1em; text-align: justify;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;clear: left; cssfloat: left; float: left; margin-bottom: 1em; margin-right: 1em; text-align: left;&quot;&gt;
&lt;img border=&quot;0&quot; height=&quot;369&quot; ida=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjcxZaa0gLTrp-p8QMuViC8GPsiA-yUL7P6ixreTPe9T4aydt6GctgYBJoDSygs4D3rx4oLjU4IoMVRWYmjwHPmQMLbb7KU6suh6PSp4w5OdHtDk4LBdmwK9d-MwYw_p5sJxSL8syIylks/s640/Esquema+Control+brazo+rob%25C3%25B3tico.jpg&quot; width=&quot;640&quot; /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #783f04; font-family: Arial, Helvetica, sans-serif; font-size: xx-small;&quot;&gt;&lt;em&gt;pulsa en la imagen para ampliarla&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/em&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align=&quot;justify&quot; style=&quot;text-align: right;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Verdana, sans-serif;&quot;&gt;Para conseguir controlar la velocidad de los movimientos se ha establecido este procedimiento:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #666666; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;﻿//Modificará posición del servo mientras flag=1&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;while (flag){&lt;br /&gt;
&amp;nbsp; flag=0;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;nbsp; //Si el eje brazo no está en su posición...&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;if (pwm_brazo != brazo){&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //...retrocede una posición si la nueva es menor&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (pwm_brazo &amp;gt; brazo) --pwm_brazo;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//...o avanza una posición si la nueva es mayor&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else if (pwm_brazo &amp;lt; brazo) ++pwm_brazo;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//Con retardo de movimiento de posición&amp;nbsp;indicado&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; delay_ms(velocidad);&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #666666; font-family: Courier New;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Y se comprueba&amp;nbsp;otra vez si coincide posición actual &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #666666; font-family: Courier New;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //con posición&amp;nbsp;deseada&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; flag=1;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New;&quot;&gt;&amp;nbsp;&amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: black; font-family: Verdana, sans-serif;&quot;&gt;Y&amp;nbsp;la forma de indicar las posiciones del servo mediante dos procedimientos. Por un lado indicando numéricamente las nuevas posiciones de los servos que han de cambiar:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;velocidad=5;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;//Velocidad del movimiento&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;muneca= 16;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;//Nueva posición muñeca&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;brazo=20;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;//Nueva posición brazo&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;hombro=13;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;//Nueva posición hombro&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;//Acceso a la función del cambio de posiciones&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;movimiento_brazo_num (muneca, pinza, brazo, hombro, velocidad);&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Verdana, sans-serif;&quot;&gt;O tener unas posiciones preestablecidas definidas por una opción que se envía para obtener la nueva posición:&lt;/span&gt;&lt;/div&gt;
&lt;div align=&quot;justify&quot; style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div align=&quot;justify&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;﻿brazo_pos=2;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;//Brazo levantado&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align=&quot;justify&quot; style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div align=&quot;justify&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #666666; font-family: Courier New;&quot;&gt;//Acceso a la función del cambio de posiciones&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;movimiento_brazo (brazo_pos,velocidad);&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div align=&quot;justify&quot;&gt;
&lt;span style=&quot;color: black; font-family: Verdana, sans-serif;&quot;&gt;Donde brazo_pos indicará la posición genericamente preestablecida:&lt;/span&gt;&lt;/div&gt;
&lt;div align=&quot;justify&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;switch (brazo_pos){&lt;br /&gt;
&lt;span style=&quot;color: #666666;&quot;&gt;//Brazo recogido&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;case0:muneca=8;pinza=8;brazo=5;hombro=21;break;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #666666; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;//Brazo recogido&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;case1:muneca=pwm_muneca;pinza=pwm_pinza;brazo=5;hombro=21;break;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #666666; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;//Brazo levantado&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;case2:muneca=pwm_muneca;pinza=pwm_pinza;brazo=16;hombro=16;break;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;|&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;|&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;|&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #666666; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;//Brazo abajo extendido&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;case9:muneca=pwm_muneca;pinza=pwm_pinza;brazo=16;hombro=11;break;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div align=&quot;justify&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;﻿&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Verdana, sans-serif;&quot;&gt;La generación de las señales pulsatorias para el control de los servos se realiza mediante la interrupción por rebose del timer 0. Con cada rebose del timer 0 se accede a la función de interrupción donde se incrementa la variable &quot;Ancho_pulso&quot; y comparandola con cada una de las variables que contienen la posición de los servos se decide cuando la señal de control correspondiente a cada servo debe pasar a cero. Cuando la variable &quot;Ancho_pulso&quot; incrementandose pasa de 0xff a 0x00, comienza un nuevo ciclo y por tanto un nuevo pulso para todos los servos. De esta forma se consigue un pulso&amp;nbsp;cíclico para los servos de entre unos 0,9 ms a 2,1 ms cuando establecemos valores de la variable del&amp;nbsp;servo de entre unos 7 y 21, correspondientes a las posiciones extremas. ¡Ojo! Todos estos valores corresponden al uso de un cristal de cuarzo de 4 MHz y un preescaler de 32 del timer 0.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=5250193391449144895#&quot; onclick=&quot;Effect.toggle(&amp;quot;expandir1&amp;quot;,&amp;quot;slide&amp;quot;); return false&quot;&gt;[+/-] Ver / Ocultar programa completo en C&lt;/a&gt;&lt;br /&gt;
&lt;div id=&quot;expandir1&quot; style=&quot;display: none;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;//////////////////////////////////////////////////////////////////////////////// &lt;br /&gt;
//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // &lt;br /&gt;
//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BRAZO ROBOT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //&lt;br /&gt;
//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //&lt;br /&gt;
//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (c) RobotyPic&amp;nbsp; 2011&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //&lt;br /&gt;
//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // &lt;br /&gt;
////////////////////////////////////////////////////////////////////////////////&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;#include &amp;lt;16F876A.h&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;#fuses NOWDT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
#fuses XT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;//Oscilador por cristal entre 4Mhz y 10Mhz&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;#fuses NOBROWNOUT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//No reset por baja tensión&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;#use delay(clock=4000000)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;//Frecuencia del cristal oscilador 4MHz&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;#byte trisa=0x85&lt;br /&gt;
#byte porta=0x05&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;#bit&amp;nbsp; Bit_PWM_muneca =&amp;nbsp; PORTA.0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//Bit 0 puerto A Salida modulación muñeca&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;#bit&amp;nbsp; Bit_PWM_pinza&amp;nbsp; =&amp;nbsp; PORTA.1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//Bit 1 puerto A Salida modulación pinza&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;#bit&amp;nbsp; Bit_PWM_brazo&amp;nbsp; =&amp;nbsp; PORTA.2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//Bit 2 puerto A Salida modulación codo&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;#bit&amp;nbsp; Bit_PWM_hombro =&amp;nbsp; PORTA.3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//Bit 3 puerto A Salida modulación hombro&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;/********************** Prototipos de las funciones ***************************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;void main (void);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//función principal&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;void generacion_pwm (void);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//genera señales moduladas control de servos&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;void movimiento_brazo (void);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//Mueve brazo con retardo de movimientos&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;/********************** Variables para movimiento brazo ***********************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;int8 PWM_muneca=0,PWM_pinza=0,PWM_brazo=0,PWM_hombro=0; &lt;span style=&quot;color: #666666;&quot;&gt;//Guardará los valores de las señales PWM&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;int8 Ancho_pulso=0;&lt;br /&gt;
short int flag;&lt;br /&gt;
int8 muneca=0, pinza=0, brazo=0, hombro=0;&lt;br /&gt;
int8 brazo_pos;&lt;br /&gt;
int8 velocidad=3;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//Lentitud de los movimientos&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;/******************************************************************************/&lt;br /&gt;
/********* FUNCIÓN GENERACIÓN MODULACIONES PWM PARA SERVOS BRAZO **************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;#int_Timer0&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;
void generacion_pwm() {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp; Ancho_pulso++;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//Incremento cada rebose del timer0&lt;/span&gt;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp; if (Ancho_pulso==0) {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Bit_PWM_muneca =1;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Bit_PWM_pinza&amp;nbsp; =1;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Bit_PWM_brazo&amp;nbsp; =1;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Bit_PWM_hombro =1;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp; if (Ancho_pulso==PWM_pinza)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Bit_PWM_pinza=0;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; if (Ancho_pulso==PWM_brazo)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Bit_PWM_brazo=0;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; if (Ancho_pulso==PWM_hombro)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Bit_PWM_hombro=0;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; if (Ancho_pulso==PWM_muneca)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Bit_PWM_muneca=0;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp; set_timer0(255);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &lt;br /&gt;
/****************************************************************************/&lt;br /&gt;
/*********** FUNCIÓN MOVIMIENTO BRAZO POR ESTADOS PREESTABLECIDOS ***********/&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;
void movimiento_brazo (brazo_pos, velocidad){&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;
&amp;nbsp;switch (brazo_pos){&lt;br /&gt;
&amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;nbsp;&amp;nbsp;//Brazo recogido&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;case 0:&amp;nbsp;muneca=8; pinza=8; brazo=5;&amp;nbsp;hombro=21; break;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #666666; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;//Brazo recogido&lt;/span&gt;&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp; case 1:&amp;nbsp;muneca=pwm_muneca; pinza=pwm_pinza; brazo=5;&amp;nbsp; hombro=21; break;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;//Brazo levantado&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;case 2:&amp;nbsp; muneca=pwm_muneca; pinza=pwm_pinza; brazo=16; hombro=16; break;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;//Brazo levantado extendido&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp; case 3:&amp;nbsp; muneca=pwm_muneca; pinza=pwm_pinza; brazo=20; hombro=11; break;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;//Brazo semiextendido&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp; case 4:&amp;nbsp; muneca=pwm_muneca; pinza=pwm_pinza; brazo=5;&amp;nbsp; hombro=16; break;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #666666; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;//Girar muñeca&lt;/span&gt;&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp; case 5:&amp;nbsp;muneca=16;pinza=pwm_pinza;brazo=pwm_brazo; hombro=pwm_hombro;break;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;//Regirar muñeca&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp; case 6:&amp;nbsp;muneca=8; pinza=pwm_pinza;brazo=pwm_brazo; hombro=pwm_hombro;break;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #666666; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;//Abrir pinza&lt;/span&gt;&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp; case 7:&amp;nbsp;muneca=pwm_muneca;pinza=19;brazo=pwm_brazo; hombro=pwm_hombro;break;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//Cerrar pinza&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp; case 8:&amp;nbsp;muneca=pwm_muneca;pinza=8;brazo=pwm_brazo; hombro=pwm_hombro;break;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//Brazo abajo extendido&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp; case 9:&amp;nbsp; muneca=pwm_muneca; pinza=pwm_pinza; brazo=16; hombro=11; break;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;}&lt;br /&gt;
&amp;nbsp;flag=1;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;//Permiso para revisar posiciones del brazo&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;
&amp;nbsp; while (flag){&lt;br /&gt;
&amp;nbsp; flag=0;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//Cuando todos servos en posición se sale del while&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;
&amp;nbsp; if (pwm_muneca != muneca)&amp;nbsp; {&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;background-color: white; color: #666666;&quot;&gt;//Si muñeca no está en su posición...&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (pwm_muneca &amp;gt; muneca)&amp;nbsp; --pwm_muneca&lt;span style=&quot;color: #666666;&quot;&gt;;//...retrocede una posición...&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else if (pwm_muneca &amp;lt; muneca) ++pwm_muneca;&amp;nbsp; &lt;span style=&quot;background-color: white; color: #666666;&quot;&gt;//...o avanza una posición&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; delay_ms(velocidad);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//Retardo mivimiento de posición&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp; flag=1;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//Una posición avanzada&lt;/span&gt;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;}&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp; if (pwm_pinza != pinza)&amp;nbsp; {&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;//Si pinza no está en su posición...&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (pwm_pinza &amp;gt; pinza)&amp;nbsp; --pwm_pinza;&amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;//...retrocede una posición...&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else if (pwm_pinza &amp;lt; pinza) ++pwm_pinza;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//...o avanza una posición&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; flag=1;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//Una posición avanzada&lt;/span&gt;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;}&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp; if (pwm_hombro != hombro)&amp;nbsp; {&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;//Si hombro no está en su posición...&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (pwm_hombro &amp;gt; hombro)&amp;nbsp; --pwm_hombro; &lt;span style=&quot;color: #666666;&quot;&gt;//...retrocede una posición...&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else if (pwm_hombro &amp;lt; hombro) ++pwm_hombro;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//...o avanza una posición&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; delay_ms(velocidad);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//Retardo mivimiento de posición&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; flag=1;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//Una posición avanzada&lt;/span&gt;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;}&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; if (pwm_brazo != brazo)&amp;nbsp; {&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//Si brazo no está en su posición...&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;if (pwm_brazo &amp;gt; brazo)&amp;nbsp; --pwm_brazo;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;background-color: white; color: #666666;&quot;&gt;//...retrocede una posición...&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else if (pwm_brazo &amp;lt; brazo) ++pwm_brazo;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//...o avanza una posición&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; delay_ms(velocidad);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//Retardo mivimiento de posición&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; flag=1;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//Una posición avanzada&lt;/span&gt;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;}&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;}&lt;br /&gt;
&amp;nbsp; delay_ms(50);&lt;br /&gt;
&amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;/****************************************************************************/&lt;br /&gt;
/************* FUNCIÓN MOVIMIENTO BRAZO POR VALORES NUMÉRICOS ***************/&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;void movimiento_brazo_num (muneca, pinza, brazo, hombro, velocidad){&lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
&amp;nbsp; flag=1;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;//Permiso para revisar posiciones del brazo&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; while (flag){&lt;br /&gt;
&amp;nbsp; flag=0;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;//Cuando todos servos en posición se sale del while&lt;/span&gt;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; if (pwm_muneca != muneca)&amp;nbsp; {&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//Si muñeca no está en su posición...&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (pwm_muneca &amp;gt; muneca)&amp;nbsp; --pwm_muneca;&amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;//...retrocede una posición...&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;else if (pwm_muneca &amp;lt; muneca) ++pwm_muneca;&lt;span style=&quot;color: #666666;&quot;&gt;//...o avanza una posición&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; delay_ms(velocidad);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;//Retardo mivimiento de posición&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; flag=1;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//Una posición avanzada&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;if (pwm_pinza != pinza)&amp;nbsp; {&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;//Si pinza no está en su posición...&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (pwm_pinza &amp;gt; pinza)&amp;nbsp; --pwm_pinza;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//...retrocede una posición...&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else if (pwm_pinza &amp;lt; pinza) ++pwm_pinza;&amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;//...o avanza una posición&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; flag=1;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//Una posición avanzada&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; }&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;
&amp;nbsp;&amp;nbsp;if (pwm_hombro != hombro)&amp;nbsp; {&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;//Si hombro no está en su posición...&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (pwm_hombro &amp;gt; hombro)&amp;nbsp; --pwm_hombro; &lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;//...retrocede una posición...&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else if (pwm_hombro &amp;lt; hombro) ++pwm_hombro;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//...o avanza una posición&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; delay_ms(velocidad);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;//Retardo mivimiento de posición&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; flag=1;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//Una posición avanzada&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;if (pwm_brazo != brazo)&amp;nbsp; {&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;//Si brazo no está en su posición...&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (pwm_brazo &amp;gt; brazo)&amp;nbsp; --pwm_brazo;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//...retrocede una posición...&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else if (pwm_brazo &amp;lt; brazo) ++pwm_brazo;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//...o avanza una posición&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; delay_ms(velocidad);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//Retardo mivimiento de posición&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; flag=1;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//Una posición avanzada&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp; }&lt;br /&gt;
&amp;nbsp; delay_ms(50);&lt;br /&gt;
&amp;nbsp;}&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: black; color: #666666;&quot;&gt;&lt;span style=&quot;background-color: white;&quot;&gt;/******************************************************************************/&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;background-color: black; color: #666666;&quot;&gt;&lt;span style=&quot;background-color: white;&quot;&gt;/*************************** FUNCIÓN PRINCIPAL ********************************/&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;void main(){&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//INICIALIZACIÓN&lt;/span&gt;&amp;nbsp;&amp;nbsp; trisa=0x00;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//Puerto A todo salidas&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//Posición inicial del brazo&lt;/span&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp; pwm_muneca=8;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//muñeca&amp;nbsp; recta&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp; pwm_pinza=8;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//pinza cerrada&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp; pwm_brazo=5;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//codo recogido&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp; pwm_hombro=21;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//hombro recogido&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; setup_timer_0(RTCC_INTERNAL|RTCC_DIV_32);&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//Configuración generación PWM&lt;/span&gt;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp; enable_interrupts(INT_TIMER0);&amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;//Inhabilitación interrupción generación pwm&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp; enable_interrupts (GLOBAL);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp; delay_ms(100);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//Estabilización en el arranque del sistema&lt;/span&gt;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp; while (1){&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;//Movimiento del brazo con controles predefinidos&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; velocidad=3;&lt;/span&gt;&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;brazo_pos=1; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;//Brazo recogido&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; movimiento_brazo (brazo_pos,velocidad);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; brazo_pos=2;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//Brazo levantado&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; movimiento_brazo (brazo_pos,velocidad);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; brazo_pos=3;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//Brazo levantado extendido&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; movimiento_brazo (brazo_pos,velocidad);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;brazo_pos=7;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//Abrir pinza&amp;nbsp;&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;movimiento_brazo (brazo_pos,velocidad);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;brazo_pos=5;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//Girar muñeca&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; movimiento_brazo (brazo_pos,velocidad);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;brazo_pos=6;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//Regirar muñeca&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; movimiento_brazo (brazo_pos,velocidad);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;brazo_pos=5;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//Girar muñeca&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; movimiento_brazo (brazo_pos,velocidad);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;brazo_pos=6;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//Regirar muñeca&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; movimiento_brazo (brazo_pos,velocidad);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;delay_ms(300);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;//descanso en los movimientos&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; brazo_pos=8;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//Cerrar pinza&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; movimiento_brazo (brazo_pos,velocidad);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;brazo_pos=2;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//Brazo levantado&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; movimiento_brazo (brazo_pos,velocidad);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;brazo_pos=9;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//Brazo recogido&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; movimiento_brazo (brazo_pos,velocidad);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;delay_ms(300);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//descanso en los movimientos&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;//Movimiento del brazo mediante controles numéricos&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; velocidad=6;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//Movimiento más lento&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; muneca= 20;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//Girar muñeca&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;movimiento_brazo_num (muneca, pinza, brazo, hombro, velocidad);&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pinza=19;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//Abrir pinza&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; movimiento_brazo_num (muneca, pinza, brazo, hombro, velocidad);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;delay_ms(50);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;pinza=8;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//Cerrar pinza&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; movimiento_brazo_num (muneca, pinza, brazo, hombro, velocidad);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;delay_ms(300);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//descanso en los movimientos&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;velocidad=10;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//Movimiento más rápido&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; brazo=20;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//Extender brazo&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; movimiento_brazo_num (muneca, pinza, brazo, hombro, velocidad);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;velocidad=15;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//Movimiento más lento&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; muneca= 8;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//Girar muñeca&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;movimiento_brazo_num (muneca, pinza, brazo, hombro, velocidad);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;delay_ms(100);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//descanso en los movimientos&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; velocidad=5;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//Movimiento más lento&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; muneca= 16;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;background-color: white; color: #666666;&quot;&gt;//Girar muñeca&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; brazo=20;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;nbsp; //Mover brazo&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; hombro=13;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//Mover hombro&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; movimiento_brazo_num (muneca, pinza, brazo, hombro, velocidad);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;delay_ms(300);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;velocidad=3;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;muneca= 8;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//Girar muñeca&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pinza=8;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//Cerrar pinza&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; brazo=5;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//Mover brazo&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; hombro=21;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//Mover hombro&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; movimiento_brazo_num (muneca, pinza, brazo, hombro, velocidad);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
}&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;color: black; font-family: Verdana, sans-serif;&quot;&gt;Todos los archivos se pueden descargar en el siguiente enlace:&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://depositfiles.com/files/smlxkrijq&quot; target=&quot;_blank&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;, sans-serif;&quot;&gt;Descarga de archivos Brazo Robot&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;El proyecto contenido en el artículo ha sido diseñado con la versión v4.084 de&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;CCS PIC C COMPILER&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=5250193391449144895&quot; name=&quot;condensadores&quot;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;background-color: white; color: #444444; font-family: &#39;Trebuchet MS&#39;, sans-serif; font-size: 13px; line-height: 18px; text-align: center;&quot;&gt;CÓDIGO DE COLORES Y NOMENCLATURA PARA CONDENSADORES&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhb4EwBEhM8jshbYDfNbtLHWiQJVf18cpTJ7DkQqccGin2lPre6POg6FNnSlhySwVX4G7NLsI8fmKN-MbVtVwmGRYPt9mBATxKFgEzCUwSeMmNECj-gu1CYHbt2YjYXe431Vmz_sE9LH4c/s1600/Condensadores+_+RobotyPic.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhb4EwBEhM8jshbYDfNbtLHWiQJVf18cpTJ7DkQqccGin2lPre6POg6FNnSlhySwVX4G7NLsI8fmKN-MbVtVwmGRYPt9mBATxKFgEzCUwSeMmNECj-gu1CYHbt2YjYXe431Vmz_sE9LH4c/s640/Condensadores+_+RobotyPic.jpg&quot; width=&quot;428&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;hr align=&quot;center&quot; color=&quot;#E0F8EC&quot; size=&quot;5&quot; width=&quot;100%&quot; /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;b style=&quot;background-color: white; color: #444444; font-family: &#39;Trebuchet MS&#39;, sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;&lt;/b&gt;&lt;/div&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=5250193391449144895&quot; name=&quot;resistencias&quot;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;b style=&quot;background-color: white; color: #444444; font-family: &#39;Trebuchet MS&#39;, sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;CÓDIGO DE COLORES &amp;nbsp;PARA RESISTENCIAS&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAHcgwINzbBwPQxhhqWOCEt7uWV3wtqQd_jf5JSQhiJzdJh3kb1O99dLkIFsQ1qLuYOW-SsBACjXA8bIQEz6hJxmO8qZp2S05xr2RzhbDlVa_nm20lObMbcPVUoxwRQju6y0TCTEHHir4/s1600/Codigo+Colores+Resistencia+_+RobotyPic.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;360&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAHcgwINzbBwPQxhhqWOCEt7uWV3wtqQd_jf5JSQhiJzdJh3kb1O99dLkIFsQ1qLuYOW-SsBACjXA8bIQEz6hJxmO8qZp2S05xr2RzhbDlVa_nm20lObMbcPVUoxwRQju6y0TCTEHHir4/s400/Codigo+Colores+Resistencia+_+RobotyPic.jpg&quot; width=&quot;428&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;hr align=&quot;center&quot; color=&quot;#E0F8EC&quot; size=&quot;5&quot; width=&quot;100%&quot; /&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://robotypic.blogspot.com/feeds/736793750343954120/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5250193391449144895/736793750343954120?isPopup=true' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5250193391449144895/posts/default/736793750343954120'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5250193391449144895/posts/default/736793750343954120'/><link rel='alternate' type='text/html' href='http://robotypic.blogspot.com/2011/11/control-de-un-brazo-robotico.html' title='Control de un brazo Robot de 4 ejes con PIC'/><author><name>Robotypic</name><uri>http://www.blogger.com/profile/16455462312458405515</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/c5ko0U6NWMw/default.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5250193391449144895.post-3647024946667057566</id><published>2011-10-16T18:58:00.002+02:00</published><updated>2013-03-03T20:53:39.440+01:00</updated><title type='text'>Diseño de la plataforma móvil para el Robot</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Verdana, sans-serif;&quot;&gt;Esta es una pequeña muestra de como fabricar una plataforma para&amp;nbsp;el robot. &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Verdana;&quot;&gt;Lo primero, disponer de las dos plataformas para los dos niveles. En el primer nivel se colocarán todos los elementos de la trasmisión. &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Verdana;&quot;&gt;Descarga de los croquis de las plataformas:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;a href=&quot;http://dfiles.eu/files/dggplbynm&quot; target=&quot;_blank&quot;&gt;Descarga de archivos Croquis Robot&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Por otro lado preparamos el sistema de transmisión. Para ello se emplearán 4 varillas huecas o tubos de aluminio de 150mm de longitud y diámetro interior de 4mm. Otras&amp;nbsp;4 varillas roscadas de M4 ligeramente mas largas, de unos 170mm.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglkBaBKmg0cpcqOaIdAZxxFX7NggSkvpOW6wTe34_RhaI5Ejuq9V4unzXnrDdtFGdLI7QZRt9q-frJj3KsOC5j94tgG8hy-k0_ULdUlCB4RJo1NjxJFhPYGl74ZNZjpCIeVRPbRf2Lkc4/s1600/Montaje+grupo+trasmisi%25C3%25B3n+RobotyPic.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;283&quot; oda=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglkBaBKmg0cpcqOaIdAZxxFX7NggSkvpOW6wTe34_RhaI5Ejuq9V4unzXnrDdtFGdLI7QZRt9q-frJj3KsOC5j94tgG8hy-k0_ULdUlCB4RJo1NjxJFhPYGl74ZNZjpCIeVRPbRf2Lkc4/s320/Montaje+grupo+trasmisi%25C3%25B3n+RobotyPic.JPG&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Verdana, sans-serif;&quot;&gt;Se pasan las varillas roscadas por el interior de los tubos de aluminio. En los extremos por donde sobresalen las varillas roscadas se sujetan los servos de giro continuo mediante tuercas. De esta forma los dos servos quedan unidos a la distancia marcada por los tubos de aluminio, a modo de separadores.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjOyLpkla2zyLyjGPyYCtz8xfDgHj7EyEzCYcfcUQrnODOHXokJKVTztFRbw2BDXm4iW3CLtNcCQRi4EIOmgAPvWEb8-UQViOnp8yWi0tpcAmd4rO09xTW0_zFMMt7bm7zlRYWipDm__Bw/s1600/Grupo+trasmisi%25C3%25B3n+Robot+RobotyPic.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;283&quot; oda=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjOyLpkla2zyLyjGPyYCtz8xfDgHj7EyEzCYcfcUQrnODOHXokJKVTztFRbw2BDXm4iW3CLtNcCQRi4EIOmgAPvWEb8-UQViOnp8yWi0tpcAmd4rO09xTW0_zFMMt7bm7zlRYWipDm__Bw/s320/Grupo+trasmisi%25C3%25B3n+Robot+RobotyPic.JPG&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Verdana, sans-serif;&quot;&gt;Vamos a sujetar ahora el conjunto de la transmisión al chasis. Para ello, de 4 sujetacables para sirgas aprovecharemos las &quot;U&quot; con las tuercas. Las hacemos pasar por los separadores entre servos del sistema de trasmisión... &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifZm_limPo25KmP-3cuMtdEYhPzD90Os8oLrah5PnEaAHUU98OhtKxlonOmNXJ6qvSBSnp9Qc7cFf-lMFeVtOokBfk-YLAGRST68UX3xZ9A4FiHmJTq45qtlUZbaRtKXr-iBn0OQ8UVCE/s1600/Chasis+robot+RobotyPic.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;283&quot; oda=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifZm_limPo25KmP-3cuMtdEYhPzD90Os8oLrah5PnEaAHUU98OhtKxlonOmNXJ6qvSBSnp9Qc7cFf-lMFeVtOokBfk-YLAGRST68UX3xZ9A4FiHmJTq45qtlUZbaRtKXr-iBn0OQ8UVCE/s320/Chasis+robot+RobotyPic.JPG&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Verdana;&quot;&gt;...y lo sujetamos con las tuercas al chasis.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYbGLJU1Vb6GFPX92-nfSgWiJwfA1n2mxBGifsVInqlcdijfSDGdrYZHkQhFo74sO9r31KDpEjzJDTytW5m6M0w39nP61oZZ6uZsydFi6EUPx9RbbxgoqCn7W4OpiSOlOwVTe6JgSS2yk/s1600/Chasis+vista+inferior+robot+RobotyPic.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;283&quot; oda=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYbGLJU1Vb6GFPX92-nfSgWiJwfA1n2mxBGifsVInqlcdijfSDGdrYZHkQhFo74sO9r31KDpEjzJDTytW5m6M0w39nP61oZZ6uZsydFi6EUPx9RbbxgoqCn7W4OpiSOlOwVTe6JgSS2yk/s320/Chasis+vista+inferior+robot+RobotyPic.JPG&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Verdana;&quot;&gt;Se atornilla la rueda giratoria trasera. &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWfdmHekG7klGV0ASVGaY-j8do5W2rv36kmWR1pRdaCi86OzZKWa48nl35mTP-rH15cQhwGACIh8j_6RROzIZyeiiybbX4hAFDGVlJTxrybxHwkrougMRcvNWVX9hAXXPz3Npeo14r2bg/s1600/Rueda+giratoria+robot+RobotyPic.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;283&quot; oda=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWfdmHekG7klGV0ASVGaY-j8do5W2rv36kmWR1pRdaCi86OzZKWa48nl35mTP-rH15cQhwGACIh8j_6RROzIZyeiiybbX4hAFDGVlJTxrybxHwkrougMRcvNWVX9hAXXPz3Npeo14r2bg/s320/Rueda+giratoria+robot+RobotyPic.JPG&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Verdana;&quot;&gt;El siguiente paso, acoplar la plataforma superior. Para ello se roscan las varillas de M4 a la plataforma superior, se colocan los separadores pasándolos por las varillas roscadas y se sujetan con las tuercas al chasis.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1_FVRMYfeLeBCJGXufPTzptqOh5HsqSQTsN6uZD3SAtg1FgRmJ_YmBOU4nWJd4mR3pCxGlWRzTNoj1hadkXFFaRzm23McIdniIVtJQgTAwtl4RtPeLIZLODuEZJfgGbPnsN0Fc1EeMA0/s1600/Montaje+plataforma+robot+RobotyPic.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;283&quot; oda=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1_FVRMYfeLeBCJGXufPTzptqOh5HsqSQTsN6uZD3SAtg1FgRmJ_YmBOU4nWJd4mR3pCxGlWRzTNoj1hadkXFFaRzm23McIdniIVtJQgTAwtl4RtPeLIZLODuEZJfgGbPnsN0Fc1EeMA0/s320/Montaje+plataforma+robot+RobotyPic.JPG&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Verdana;&quot;&gt;Y queda la plataforma ensamblada a falta de colocarle las ruedas.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-Ef7sg3XmJBHfHIjNKOv1ecnSkOGLuIBvNgtLlYKjVKhacUjotg536ZzWxliZ1OSOmkRJ_6xX6DD-eg9lV5s_5P3gAkLM3oX2agOE9uS4U74YDMQlBJDUqXTzza5ux7csrUVs6_wRScs/s1600/Plataforma+sin+ruedas+robot+RobotyPic.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;283&quot; oda=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-Ef7sg3XmJBHfHIjNKOv1ecnSkOGLuIBvNgtLlYKjVKhacUjotg536ZzWxliZ1OSOmkRJ_6xX6DD-eg9lV5s_5P3gAkLM3oX2agOE9uS4U74YDMQlBJDUqXTzza5ux7csrUVs6_wRScs/s320/Plataforma+sin+ruedas+robot+RobotyPic.JPG&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Verdana;&quot;&gt;Dependiendo de las ruedas de las que se trate,&amp;nbsp;bastará con insertarlas al eje de los servos y mantenerlas con los tornillos propios del kit de los servos.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnZUB-90OEdgLSsI4YSUnr4JGrFgPoG0CL3x7nION1h_RpBzDV2Tw8FNMhqn30ekDu38MorcYaXZ-b5gfMwxgXIZnsB_EGtl3eGfMS9NlcJknm_k2Twdn2IRoY5e_fKbP4rqqPhyphenhyphenWLsAY/s1600/Montaje+ruedas+robot+RobotyPic.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;283&quot; oda=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnZUB-90OEdgLSsI4YSUnr4JGrFgPoG0CL3x7nION1h_RpBzDV2Tw8FNMhqn30ekDu38MorcYaXZ-b5gfMwxgXIZnsB_EGtl3eGfMS9NlcJknm_k2Twdn2IRoY5e_fKbP4rqqPhyphenhyphenWLsAY/s320/Montaje+ruedas+robot+RobotyPic.JPG&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Verdana;&quot;&gt;Queda finalmente la plataforma montada.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0LIcjeRQlTxH5qaAXMO8jcga9lQZi3QpjxdQV2-71w9pOFr_ean7OH8x4dK-e58Mzr6vEnQHAVO0DcearV7o0FAmOPxm845Nh8FcDPFnGA-2j06ga5EFm83yWl1dqElEcTd5J3bcYqRs/s1600/Plataforma+robot+RobotyPic.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;283&quot; oda=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0LIcjeRQlTxH5qaAXMO8jcga9lQZi3QpjxdQV2-71w9pOFr_ean7OH8x4dK-e58Mzr6vEnQHAVO0DcearV7o0FAmOPxm845Nh8FcDPFnGA-2j06ga5EFm83yWl1dqElEcTd5J3bcYqRs/s320/Plataforma+robot+RobotyPic.JPG&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://robotypic.blogspot.com/feeds/3647024946667057566/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5250193391449144895/3647024946667057566?isPopup=true' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5250193391449144895/posts/default/3647024946667057566'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5250193391449144895/posts/default/3647024946667057566'/><link rel='alternate' type='text/html' href='http://robotypic.blogspot.com/2011/10/diseno-de-la-plataforma-movil-para-el.html' title='Diseño de la plataforma móvil para el Robot'/><author><name>Robotypic</name><uri>http://www.blogger.com/profile/16455462312458405515</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglkBaBKmg0cpcqOaIdAZxxFX7NggSkvpOW6wTe34_RhaI5Ejuq9V4unzXnrDdtFGdLI7QZRt9q-frJj3KsOC5j94tgG8hy-k0_ULdUlCB4RJo1NjxJFhPYGl74ZNZjpCIeVRPbRf2Lkc4/s72-c/Montaje+grupo+trasmisi%25C3%25B3n+RobotyPic.JPG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5250193391449144895.post-7337302131202577373</id><published>2011-06-28T23:53:00.006+02:00</published><updated>2013-10-30T19:11:46.326+01:00</updated><title type='text'>Medida de distancias con SRF05</title><content type='html'>&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Verdana, sans-serif;&quot;&gt;A diferencia del artículo referente a la&lt;span style=&quot;color: blue;&quot;&gt; &lt;span style=&quot;color: black;&quot;&gt;&lt;a href=&quot;http://robotypic.blogspot.com/2010/10/medida-de-distancias-con-srf04.html&quot;&gt;medida de distancias con el &amp;nbsp;SRF04&lt;/a&gt;&lt;/span&gt; &lt;/span&gt;o SRF05 en modo de funcionamiento 1, en esta ocasión se va a emplear el sensor&amp;nbsp; de ultrasonidos &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;SRF05 en el modo de funcionamiento 2&lt;/b&gt;, es decir, empleando el mismo pin como entrada del pulso de test y como salida para el pulso eco que nos dará la información de la distancia en función de su duración en tiempo. &lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Verdana, sans-serif;&quot;&gt;Para conectar el sensor de ultrasonidos en este modo de funcionamiento, &amp;nbsp;el pin de “modo” (sin conectar en SRF04 o SRF05 modo 1) debe llevarse a 0v. De esta forma, el pin empleado para dar el pulso de test será el que nos ofrezca igualmente el pulso ECO.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: black; font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDUYdGal6XcY4EbhEFERWBSlpADb9TTxaB3MeRZ1ROLWFyu4NXGXoeVpHRpvwxddID5GnTY7M7gmp1bJGnW2roTLBz9DJgJkBYc__ELG1CKx__QYYD20d-j292zw_fKn1MyMEhu9HaWgg/s1600/Esquema+SRF05+con+PIC.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;497&quot; i=&quot;i&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDUYdGal6XcY4EbhEFERWBSlpADb9TTxaB3MeRZ1ROLWFyu4NXGXoeVpHRpvwxddID5GnTY7M7gmp1bJGnW2roTLBz9DJgJkBYc__ELG1CKx__QYYD20d-j292zw_fKn1MyMEhu9HaWgg/s640/Esquema+SRF05+con+PIC.png&quot; true=&quot;true&quot; width=&quot;560&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div align=&quot;right&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div align=&quot;justify&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Verdana, sans-serif;&quot;&gt;El proceso consiste en un ciclo que se repite cada vez que se toma una nueva medida.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: black; font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEidMcgx5y10ikmoI32OOxdkz1dLPJT92cmVebh9tUNGGXr_naOdCmo_XxaGUKu-12j8JmQe4CM9ZEyxp9zAGor55q2bKUwPDtn72Uu7uHcb2fIMl4oFelbp_R_zlPThuJ6VBzNVY_j2JNI/s1600/Gr%C3%A1fica+SRF05+con+PIC.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEidMcgx5y10ikmoI32OOxdkz1dLPJT92cmVebh9tUNGGXr_naOdCmo_XxaGUKu-12j8JmQe4CM9ZEyxp9zAGor55q2bKUwPDtn72Uu7uHcb2fIMl4oFelbp_R_zlPThuJ6VBzNVY_j2JNI/s640/Gr%C3%A1fica+SRF05+con+PIC.jpg&quot; width=&quot;580&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.5pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; line-height: 13.5pt;&quot;&gt;Traducido al código de programación del PIC, primero
damos el pulso trigger o de disparo (mínimo 10 uS) con el pin RC1 (CCP2) como
salida y deshabilitada la interrupción...&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.5pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.5pt; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #339966;&quot;&gt;disable_interrupts(INT_CCP2);&lt;span class=&quot;apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: #999999;&quot;&gt;//Deshabilitación
interrupción&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.5pt; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; color: #999999;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; modo&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: white; color: #999999; font-family: &#39;Courier New&#39;, Courier, monospace; line-height: 13.5pt; text-indent: 35.4pt;&quot;&gt;comparación&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.5pt; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #339966; font-family: &#39;Courier New&#39;, Courier, monospace; line-height: 13.5pt;&quot;&gt;trisc=0x00;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class=&quot;apple-converted-space&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &#39;Courier New&#39;, Courier, monospace; line-height: 13.5pt;&quot;&gt;//Puerto C todos los pines todo
salidas&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.5pt; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.5pt; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #339966;&quot;&gt;BIT_TEST_ON; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Comienzo del
pulso de disparo&lt;/span&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.5pt; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #339966;&quot;&gt;delay_us(10); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Tiempo del
pulso de disparo&lt;/span&gt;&lt;span style=&quot;color: #339966;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #339966; line-height: 13.5pt;&quot;&gt;BIT_TEST_OFF; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; line-height: 13.5pt;&quot;&gt;//Fin del
pulso de disparo&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.5pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;...e inmediatamente después se vuelve a configurar dicho pin como entrada y
a habilitar la interrupción para detección de flanco...&lt;/span&gt;&lt;span style=&quot;color: #444444; font-family: Arial; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.5pt; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #339966;&quot;&gt;trisc=0b00000010;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Pin RC1 como entrada para lectura eco&lt;/span&gt;&lt;span style=&quot;color: #339966;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.5pt; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #339966; font-family: &#39;Courier New&#39;, Courier, monospace; line-height: 13.5pt;&quot;&gt;PIR2=0; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: &#39;Courier New&#39;, Courier, monospace; line-height: 13.5pt;&quot;&gt;//Reset del
flag de la interrupción&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.5pt; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #339966; line-height: 13.5pt;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;enable_interrupts(INT_CCP2); &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #999999; line-height: 13.5pt;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;//Habilitación
interrupción para medida de pulso eco&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.5pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;.. y se espera la lectura del pulso eco...&lt;/span&gt;&lt;span style=&quot;font-family: Verdana; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.5pt;&quot;&gt;
&lt;span style=&quot;color: #339966;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;while(NuevoEco==0)
{}&lt;/span&gt;&lt;span style=&quot;font-family: Courier New; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.5pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Como se ve, es imprescindible resetear el flag
de interrupción mediante su puesta a cero (PIR2=0).
Sino se hace, nos detectará interrupción por flanco de subida desde el mismo
momento de habilitar la interrupción.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.5pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.5pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Cuando,
esperando el flanco de subida del eco, se activa la interrupción, deberemos
guardar el valor que en ese momento se carga en el registro CCP2, y memorizar
que el próximo flanco será de bajada.&lt;/span&gt;&lt;span style=&quot;font-family: Verdana; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.5pt;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.5pt;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #339966;&quot;&gt;if(TipoFlanco==0){ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Si es flanco
de subida...&lt;/span&gt;&lt;span style=&quot;color: #339966;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.5pt;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #339966;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
Contador_FS=CCP_2;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Guarda el
valor del registro CCP2&lt;/span&gt;&lt;span style=&quot;color: #339966;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.5pt;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #339966;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
setup_ccp2(CCP_CAPTURE_FE);&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Modo captura en flanco de bajada&lt;/span&gt;&lt;span style=&quot;color: #339966;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.5pt;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #339966;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
TipoFlanco=1;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Próximo
flanco debe ser de bajada&lt;/span&gt;&lt;span style=&quot;color: #339966;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.5pt;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.5pt;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #339966;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;font-family: Courier New; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; line-height: 13.5pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; line-height: 13.5pt;&quot;&gt;Ahora,
el programa continua esperando en la misma instrucción (While) en la que
aguardaba a recibir el comienzo del pulso eco, hasta activarse de nuevo la interrupción,
pero esta vez por la recepción del flanco de bajada. En ese mismo momento,
volveremos a tomar el valor del registro CCP2. Además, memorizaremos que el
pulso eco en curso ha finalizado y que por tanto, el próximo flanco será de
subida por tratarse de un nuevo pulso eco.&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.5pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.5pt; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #339966;&quot;&gt;&lt;span style=&quot;font-family: Courier New; font-size: 10pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Contador_FB=CCP_2;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;//Guarda el
valor del registro CCP2&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.5pt; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #339966;&quot;&gt;&amp;nbsp;setup_ccp2(CCP_CAPTURE_RE);&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Modo captura
en flanco de subida&lt;/span&gt;&lt;span style=&quot;color: #339966;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.5pt; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #339966;&quot;&gt;&amp;nbsp;TipoFlanco=0;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Próximo flanco debe ser de subida&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.5pt; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #339966;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp;NuevoEco=1;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;//Pulso eco
actual finalizado.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.5pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; line-height: 13.5pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; line-height: 13.5pt;&quot;&gt;Al
indicar que el pulso eco ha finalizado, salimos del bucle while y se continúa
con la ejecución del programa para calcular, a partir de los valores leídos del
registro CCP, el valor de la distancia al objeto. Primero obteniendo los
incrementos totales producidos en el contador del registro CCP2 (Timer 1) desde
el flanco de subida hasta el de bajada.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.5pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.5pt;&quot;&gt;
&lt;span style=&quot;color: #339966; font-family: Courier New, Courier, monospace;&quot;&gt;Contador_FT=(Contador_FB-Contador_FS);
&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;//Valor
entre flanco de subida y bajada.&lt;/span&gt;&lt;span style=&quot;font-family: Courier New; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.5pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;Ahora,
si multiplicamos este numero de incrementos por el tiempo (en microsegundos)
que tarda en producirse cada uno de ellos, obtendremos el tiempo total del
pulso eco. En este caso, al emplearse un oscilador para el PIC de 4 MHz, el
tiempo de cada incremento es de 1uS, por lo que se multiplicará por 1.0&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.5pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.5pt;&quot;&gt;
&lt;span style=&quot;color: #339966; font-family: Courier New, Courier, monospace;&quot;&gt;T_PulsoEco=Contador_FT*1.0;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;//Valor pulso leido en us de 100u a
25ms&lt;/span&gt;&lt;span style=&quot;font-family: Courier New; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.5pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.5pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;Para saber el tiempo de
cada incremento del contador en función del oscilador empleado, partimos de
esta expresión:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.5pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: 13.5pt; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;T
= Tcm * Preescaler&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.5pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.5pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;b&gt;Tcm&lt;/b&gt;
es el ciclo máquina y que corresponde con 4 ciclos del oscilador (4/Frec.Reloj)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.5pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;b&gt;Preescaler&lt;/b&gt;
es la escala empleada para el Timer1. En este caso Preescaler=1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.5pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: 13.5pt; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;T
= (4/4.000.000) * 1&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.5pt; text-align: center;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.5pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;De
donde obtenemos que el tiempo T es de 1uS para una frecuencia de reloj de 4MHz.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.5pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.5pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;Para
obtener la distancia en centímetros en función del tiempo del eco, lo dividimos
por 58.3&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.5pt;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.5pt;&quot;&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #339966;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Distancia = T_PulsoEco/58.3;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace;&quot;&gt;//Distancia del obstáculo en cm&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.5pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.5pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: 10.0pt; mso-bidi-font-family: Arial;&quot;&gt;Esta
constante es siempre fija y nos da el resultado en cm. La proporciona el
fabricante del sensor en la hoja de características pero se podría obtener
considerando la velocidad del sonido en el aire (340m/s) y que éste recorre el
doble del espacio medido, puesto que dicho trayecto es de ida &amp;nbsp;y vuelta. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.5pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.5pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: 10.0pt; mso-bidi-font-family: Arial;&quot;&gt;Finalizado
el cálculo, volvemos a dejar el pin RC2 como salida y deshabilitamos
temporalmente la interrupción para que no nos detecte el propio pulso de
disparo. Y avisamos de que queda listo para una nueva media.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.5pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.5pt;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #339966;&quot;&gt;NuevoEco=0;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Listo para
recibir nuevo pulso eco&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.5pt;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #339966; font-family: Courier New, Courier, monospace;&quot;&gt;disable_interrupts(INT_CCP2);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.5pt;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #339966;&quot;&gt;trisc=0b00000000; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Pin RC1 como
salida para nuevo disparo&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #339966; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 13.5pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div align=&quot;justify&quot; class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=5250193391449144895#&quot; onclick=&quot;Effect.toggle(&amp;quot;expandir1&amp;quot;,&amp;quot;slide&amp;quot;); return false&quot;&gt;[+/-] Ver / Ocultar programa completo en C&lt;/a&gt;&lt;br /&gt;
&lt;div id=&quot;expandir1&quot; style=&quot;display: none;&quot;&gt;
&lt;div align=&quot;justify&quot; class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;////////////////////////////////////////////////////////////////////////////////&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MEDIDA DE DISTANCIAS CON SRF05 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(c) RobotyPic 2013 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;// &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;////////////////////////////////////////////////////////////////////////////////&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#include &amp;lt;16F876A.h&amp;gt; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Libreria C del PIC a emplear&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#fuses XT, NOWDT, NOPROTECT &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Configuraciones &lt;/span&gt;&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#use delay(clock=4000000) &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Frecuencia del cristal oscilador 4MHz&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#byte PIR2=0x0D &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Configuración del flag de la interrupción&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#byte trisb=0x86&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#byte portb=0x06&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#byte trisc=0x87&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#byte portc=0x07&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#define use_portb_lcd TRUE &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Configuración del puerto b para uso del lcd&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#include &amp;lt;lcd.c&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Libreria C para control del lcd&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#define BIT_TEST_ON &amp;nbsp; &amp;nbsp; output_high(PIN_C1)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#define BIT_TEST_OFF &amp;nbsp; &amp;nbsp;output_low(PIN_C1)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/********************** Prototipos de las funciones ***************************/&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;void main (void); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//función principal&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;void pulso_test (void); &amp;nbsp; &amp;nbsp; &amp;nbsp; /&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/da pulso y calcula distancia al objeto&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;void ccp2_int(void); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;//captura del pulso de eco&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/******************** Variables para lectura distancia ************************/&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;int1 NuevoEco; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Entra otro eco para lectura&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;int16 Contador_FB; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Contador hasta flanco de bajada&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;int16 Contador_FS; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Contador hasta flanco de subida&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;int16 Contador_FT; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Cuenta entre flancos&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;float T_PulsoEco; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Tiempo de duración del pulso eco&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;float Distancia; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Valor distancia al obstáculo&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;int1 TipoFlanco=0; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Control flanco subida (0) o bajada (1) del eco&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/******************************************************************************/&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/*********************** FUNCIÓN PULSO DE TEST ********************************/&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;void pulso_test(){&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt; &amp;nbsp;/** salida de pulso de disparo durante 10us por el pin RC1 **/&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;BIT_TEST_ON; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Comienzo del pulso de disparo&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;delay_us(10); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Duración del pulso&lt;/span&gt;&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;BIT_TEST_OFF; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Fin del pulso de disparo&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;/** cambio al modo de detección del pulso eco **/&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;trisc=0b00000010; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Pin RC1 como entrada para lectura eco&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;PIR2=0; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Reset del flag de la interrupción&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;enable_interrupts(INT_CCP2); &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Habilitación interrupción para medida de pulso eco&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;/** espera hasta que finalice el pulso eco **/&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;while(NuevoEco==0) {}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; /** cálculo de la distancia en función del tiempo de pulso eco medido **/&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;if(NuevoEco==1){ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Finalizado el pulso eco se calcula su valor.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Contador_FT=(Contador_FB-Contador_FS); &lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Valor entre flanco de subida y bajada.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; T_PulsoEco=Contador_FT*1.0; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Valor pulso leido en us de 100u a 25ms&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Distancia = T_PulsoEco/58.3; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Distancia del obstáculo en cm&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; disable_interrupts(INT_CCP2);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; trisc=0b00000000; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Pin RC1 como salida para nuevo disparo&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; NuevoEco=0; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Listo para recibir nuevo pulso eco&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;}&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/******************************************************************************/&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/************************ FUNCIÓN LECTURA OBSTÁCULO ***************************/&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;#int_ccp2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//LLamada por interrupción flanco en RC1&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;void ccp2_int(){&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;if(TipoFlanco==0){ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Si es flanco de subida...&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Contador_FS=CCP_2; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Guarda el valor del registro CCP2&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; setup_ccp2(CCP_CAPTURE_FE); &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Configuración modo captura en flanco de bajada&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; TipoFlanco=1; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Próximo flanco debe ser de bajada&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;else { &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Si es flanco de bajada...&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Contador_FB=CCP_2; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Guarda el valor del registro CCP2&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; setup_ccp2(CCP_CAPTURE_RE); &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Configuración modo captura en flanco de subida&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; TipoFlanco=0; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Próximo flanco debe ser de subida&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; NuevoEco=1; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Pulso eco actual finalizado.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/******************************************************************************/&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;/*************************** FUNCIÓN PRINCIPAL ********************************/&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;void main(){&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;trisb=0x00; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Puerto B todo salidas&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;trisc=0x00; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Puerto C todo salidas&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;setup_timer_1(T1_INTERNAL); &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Configuración timer1 para lectura objeto&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;setup_ccp2(CCP_CAPTURE_RE); &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Configuración modo captura en flanco de subida&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;disable_interrupts(INT_TIMER1);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;disable_interrupts(INT_CCP2); &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Deshabilitación interrupción modo comparación&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;enable_interrupts (GLOBAL);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;lcd_init(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Inicialización de la pantalla lcd&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;printf(lcd_putc, &quot;\fMedida distancia&quot;);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;printf(lcd_putc,&quot;\n &amp;nbsp; con srf05 &amp;nbsp; &quot;);&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;delay_ms(2000); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;printf(lcd_putc,&quot;\f (c) RobotyPic &quot;);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;delay_ms(2000);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;while (1){&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; pulso_test(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Envío del pulso ultrasónico&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; printf(lcd_putc,&quot;\fDistancia=%5.2f&quot;, Distancia);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; delay_ms(500); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//Refresco de la medida&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;En la animación se mestra el funcionamiento empleando el &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;a href=&quot;http://robotypic.blogspot.com/2010/09/circuito-simulador-srf04-para-proteus.html&quot;&gt;simulador del SRF05 para proteus.&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;object style=&quot;height: 390px; width: 640px;&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://www.youtube.com/v/LpF7pTsAySs?version=3&amp;feature=player_detailpage&quot;&gt;&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot;&gt;&lt;param name=&quot;allowScriptAccess&quot; value=&quot;always&quot;&gt;&lt;embed src=&quot;http://www.youtube.com/v/LpF7pTsAySs?version=3&amp;feature=player_detailpage&quot; type=&quot;application/x-shockwave-flash&quot; allowfullscreen=&quot;true&quot; allowScriptAccess=&quot;always&quot; width=&quot;470&quot; height=&quot;345&quot;&gt;&lt;/object&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Verdana, sans-serif;&quot;&gt;Todos los archivos del proyecto en este enlace de descarga:&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana;&quot;&gt;&lt;a href=&quot;http://dfiles.eu/files/3cjl2702w&quot; target=&quot;_blank&quot;&gt;Descargar Medida de distancias con SRF05&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;El proyecto contenido en el artículo ha sido diseñado con la versión v4.084 de&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;CCS PIC C COMPILER&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;a href=&quot;http://www.voltix.com.mx/openvoltix/SRF05?tracking=5202664de12d7&quot; target=&quot;_blank&quot;&gt;Si necesitas comprar el sensor SRF05, puedes hacerlo online pulsando aquí.&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;


&lt;i&gt;&lt;span style=&quot;color: #0c343d; font-family: Trebuchet MS, sans-serif; font-size: xx-small;&quot;&gt;Última revisión del artículo: Agosto 2013&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;span style=&quot;color: #0c343d; font-family: Trebuchet MS, sans-serif; font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/i&gt;
&lt;i&gt;&lt;span style=&quot;color: #0c343d; font-family: Trebuchet MS, sans-serif; font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/i&gt;</content><link rel='replies' type='application/atom+xml' href='http://robotypic.blogspot.com/feeds/7337302131202577373/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5250193391449144895/7337302131202577373?isPopup=true' title='8 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5250193391449144895/posts/default/7337302131202577373'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5250193391449144895/posts/default/7337302131202577373'/><link rel='alternate' type='text/html' href='http://robotypic.blogspot.com/2011/06/medida-de-distancias-con-srf05.html' title='Medida de distancias con SRF05'/><author><name>Robotypic</name><uri>http://www.blogger.com/profile/16455462312458405515</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDUYdGal6XcY4EbhEFERWBSlpADb9TTxaB3MeRZ1ROLWFyu4NXGXoeVpHRpvwxddID5GnTY7M7gmp1bJGnW2roTLBz9DJgJkBYc__ELG1CKx__QYYD20d-j292zw_fKn1MyMEhu9HaWgg/s72-c/Esquema+SRF05+con+PIC.png" height="72" width="72"/><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5250193391449144895.post-2370478184754186984</id><published>2011-05-19T00:08:00.010+02:00</published><updated>2015-10-25T00:48:57.914+02:00</updated><title type='text'>Generación de números aleatorios con PIC.</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Verdana, sans-serif;&quot;&gt;Para obtener números aleatorios vamos a emplear la función &lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;em&gt;rand().&lt;/em&gt;&lt;/span&gt; El rango de números aleatorios que nos va a ofrecer va a ser muy elevado, por lo que deberemos acotarlo entre dos valores deseados.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Verdana;&quot;&gt;En este ejemplo, queremos obtener números aleatorios entre 100 y 200. Para ello emplearemos la función &lt;em&gt;rand()&lt;/em&gt; con la siguiente expresión matemática:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;rand() % ((nº mas alto - nº mas bajo +1) + nº más bajo)&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Verdana, sans-serif;&quot;&gt;donde &quot;%&quot; indica que tomaremos como resultado el resto de dividir &lt;em&gt;rand()&lt;/em&gt; por la expresión indicada.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Verdana;&quot;&gt;Así pues, sustituyendo los limites desados la instrucción quedaría:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;n_aleatorio = rand()%(101)+100;//Numero aleatorio entre 100 y 200&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Verdana, sans-serif;&quot;&gt;Ya tendríamos la generación de números aleatorios. Pero ahora se presenta otro problema. Obtendremos una secuencia de números aleatorios, pero cuando volvamos a activar la generación de números, obtendremos la misma secuencia aleatoria. &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Verdana;&quot;&gt;El problema viene porque &lt;em&gt;rand()&lt;/em&gt; parte de un número inicial sobre el que realiza una serie de cálculos para obtener el siguiente número aleatorio. Como este número inicial y los cálculos son siempre los mismos, cada vez que iniciemos la generación se repetirá la secuencia. Por tanto hay que buscar la forma de&amp;nbsp;que ese número inicial no sea siempre el mismo.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Verdana;&quot;&gt;Para ello existe otra función&amp;nbsp; &lt;em&gt;srand(),&lt;/em&gt; que nos permitirá elegir ese número inicial.&amp;nbsp;&amp;nbsp; Si empleamos por ejemplo &lt;em&gt;srand(3),&lt;/em&gt; el número inicial sobre el que &lt;em&gt;rand()&lt;/em&gt; iniciará los cálculos será el 3. Con &lt;em&gt;srand(1),&lt;/em&gt; será el 1, y así. &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Verdana;&quot;&gt;Ya hemos conseguido elegir ese número inicial. Pero seguimos teniendo el mismo problema puesto que aunque elijamos nosotros el número, éste será siempre el mismo. Para ello, deberemos sustituirlo por una expresión que no nos aporte siempre el mismo valor.&amp;nbsp;Una forma de hacerlo es tomando el valor&amp;nbsp; en un momento concreto&amp;nbsp;&amp;nbsp;del contador RTCC del pic. Que coincidamos con nuestra pulsación dos veces en el mismo valor del RTCC será realmente complicado.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;srand(get_rtcc());&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIacVdGiON1_aCyTPqOBx6AvjUUf6fJ4rSpF-24UO7pWEEzWim79Gl_95LLzOITo_VDTiHVjIVRBbD43Dm7GQlziBnKYJYp41NRNbDK7nKVTOG4gwCXA-kqpQuP7yKSEhWANwH1ZF4tY8/s1600/Generaci%25C3%25B3n+n%25C3%25BAmeros+aleatorios+con+pic.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;390&quot; j8=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIacVdGiON1_aCyTPqOBx6AvjUUf6fJ4rSpF-24UO7pWEEzWim79Gl_95LLzOITo_VDTiHVjIVRBbD43Dm7GQlziBnKYJYp41NRNbDK7nKVTOG4gwCXA-kqpQuP7yKSEhWANwH1ZF4tY8/s640/Generaci%25C3%25B3n+n%25C3%25BAmeros+aleatorios+con+pic.png&quot; width=&quot;570&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: right;&quot;&gt;
&lt;span style=&quot;color: #990000; font-family: Verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;em&gt;Pulsa en la imagen para ampliarla&lt;/em&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Verdana, sans-serif;&quot;&gt;Así pues, para generar los números aleatorios, actuaremos sobre el pulsador que mediante la interrupción por señal externa en RB0 del pic tomaremos el valor que posea en ese momento el contador RTCC y lo emplearemos como valor inicial para la generación de números aleatorios.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Verdana;&quot;&gt;Con cada pulsación desactivaremos y activaremos alternativamente la generación de los números aleatorios.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=5250193391449144895#&quot; onclick=&quot;Effect.toggle(&amp;quot;expandir1&amp;quot;,&amp;quot;slide&amp;quot;); return false&quot;&gt;[+/-] Ver / Ocultar prorama completo en C&lt;/a&gt;&lt;br /&gt;
&lt;div id=&quot;expandir1&quot; style=&quot;display: none;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;////////////////////////////////////////////////////////////////////////////////&lt;br /&gt;
//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //&lt;br /&gt;
//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NÚMEROS ALEATORIOS CON PIC 16F876A&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //&lt;br /&gt;
//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //&lt;br /&gt;
//&amp;nbsp;&amp;nbsp; Mediante interrupción externa por RB0, obtención de números aleatorios&amp;nbsp;&amp;nbsp; //&lt;br /&gt;
//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //&lt;br /&gt;
//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (c) RobotyPic 2011&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //&lt;br /&gt;
//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //&lt;br /&gt;
////////////////////////////////////////////////////////////////////////////////&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;#include &amp;lt;16F876a.h&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Archivo para control del PIC 16f876a&lt;br /&gt;
#include &amp;lt;stdlib.h&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Archivo necesario para función rand()&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;#fuses XT, NOWDT&lt;br /&gt;
#use delay(clock=4000000)&lt;br /&gt;
#use RS232(BAUD=9600,BITS=8,PARITY=N,XMIT=PIN_C6,RCV=PIN_C7)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;int n_aleatorio;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Dato aleatorio&lt;br /&gt;
short int activacion=0;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Puesta en marcha generación números aleatorios&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;/******************************************************************************/&lt;br /&gt;
/***************&amp;nbsp;&amp;nbsp; FUNCIÓN POR INTERRUPCIÓN EXTERNA EN RB0&amp;nbsp; *******************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;#INT_EXT&lt;br /&gt;
int_externa() {&lt;br /&gt;
&amp;nbsp;&amp;nbsp; srand(get_rtcc());&lt;br /&gt;
&amp;nbsp;&amp;nbsp; activacion=activacion+1;&lt;br /&gt;
}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;/******************************************************************************/&lt;br /&gt;
/**************************&amp;nbsp; FUNCIÓN PRINCIPAL&amp;nbsp; *******************************/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;void main (){&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp; setup_timer_0(RTCC_INTERNAL|RTCC_DIV_2);&amp;nbsp; //Configuración timer0&lt;br /&gt;
&amp;nbsp;&amp;nbsp; enable_interrupts(int_ext);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Habilitación interrupción externa&lt;br /&gt;
&amp;nbsp;&amp;nbsp; ext_int_edge (H_TO_L);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //...por flanco de bajada&lt;br /&gt;
&amp;nbsp;&amp;nbsp; enable_interrupts(GLOBAL);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp; while(1){&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (activacion==1){&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//Pulsaciones imparespone en marcha generación&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //rand() % (nº mas alto - nº mas bajo +1) + nº más bajo&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; n_aleatorio=rand() % (101)+100;&amp;nbsp; //Numero aleatorio entre 100 y 200&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Se muestra en pantalla información enviada&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; printf(&quot;\fEl número aleatorio es:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %u&quot;, n_aleatorio);&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; delay_ms(2000);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &lt;br /&gt;
}&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Verdana;&quot;&gt;En esta simulación bajo proteus se puede comprobar el funcionamiento.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;center&gt;
&lt;iframe allowfullscreen=&quot;allowfullscreen&quot; frameborder=&quot;0&quot; height=&quot;360&quot; src=&quot;http://www.youtube.com/embed/EFc2h9rd0Uo?feature=player_embedded&quot; width=&quot;530&quot;&gt;&lt;/iframe&gt;&lt;/center&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Verdana, sans-serif;&quot;&gt;﻿Todos los archivos se pueden descargar en este enlace:&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Trebuchet MS&amp;quot;, sans-serif;&quot;&gt;&lt;a href=&quot;http://depositfiles.com/files/ak1hhloge&quot; target=&quot;_blank&quot;&gt;Descargar archivos Generación de números aleatorios&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;

&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;El proyecto contenido en el artículo ha sido diseñado y probado con éxito utilizando las siguientes versiones de software:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;- Windows xp y windows 7&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;- Proteus V7.7 SP2&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;- CCS PIC C COMPILER v4.084&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;

&lt;center&gt;
&lt;script type=&quot;text/javascript&quot;&gt; 
clicksor_enable_adhere = false; 

clicksor_default_url = &#39;&#39;;
clicksor_banner_border = &#39;#FFFFFF&#39;; 
clicksor_banner_ad_bg = &#39;#FFFFFF&#39;;
clicksor_banner_link_color = &#39;#2198a6&#39;; 
clicksor_banner_text_color = &#39;#666666&#39;;
clicksor_layer_border_color = &#39;&#39;;
clicksor_layer_ad_bg = &#39;&#39;; 
clicksor_layer_ad_link_color = &#39;&#39;;
clicksor_layer_ad_text_color = &#39;&#39;; 
clicksor_text_link_bg = &#39;&#39;;
clicksor_text_link_color = &#39;&#39;; 
clicksor_enable_text_link = false;
   
clicksor_banner_text_banner = true;
clicksor_banner_image_banner = false; 
clicksorcn_enable_layer_pop = false;
&lt;/script&gt;
 &lt;script src=&quot;http://ads.clicksor.com/newServing/showAd.php?nid=1&amp;amp;pid=287820&amp;amp;adtype=2&amp;amp;sid=470154&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt; &lt;noscript&gt;&lt;a href=&quot;http://www.yesads.com&quot;&gt;online marketing&lt;/a&gt;&lt;/noscript&gt;&lt;/center&gt;
_________________________________________________________________________________&lt;br /&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=5250193391449144895&quot; name=&quot;fuses&quot;&gt;&lt;/a&gt;

&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;b&gt;TUTORIAL BÁSICO &amp;nbsp;PIC C COMPILER&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;b&gt;Los Fuses en el PIC 16F876A&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;#FUSES&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 70.5pt; text-align: left; text-indent: -70.5pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;LP&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;//Adapta el
circuito oscilador interno para &amp;nbsp; trabajar con un oscilador de baja potencia &amp;lt;
200KHz&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 70.5pt; text-align: left; text-indent: -70.5pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 70.5pt; text-align: left; text-indent: -70.5pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;XT&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;//Adapta el
ircuito osciladotr interno para trabajar con un cristal resonador de frecuencia
4MHz o inferior&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 70.5pt; text-align: left; text-indent: -70.5pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 70.5pt; text-align: left; text-indent: -70.5pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;HS&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;//Adapta el
circuito oscilador interno para trabajar con un cristal resonador superior a
4MHz &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 70.5pt; text-align: left; text-indent: -70.5pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 70.5pt; text-align: left; text-indent: -70.5pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;RC&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;//Adapta el
circuito oscilador interno para trabajar con un circuito resonador RC. (Opción
por defecto)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 70.5pt; text-align: left; text-indent: -70.5pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 70.5pt; text-align: left; text-indent: -70.5pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;WDT&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;//Habiliatación del reset por rebose de watchdog
(Opción por defecto)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 70.5pt; text-align: left; text-indent: -70.5pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 35.25pt; text-align: left; text-indent: -35.25pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;NOWDT &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;//No habilitación del reset por watchdog&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 35.25pt; text-align: left; text-indent: -35.25pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 70.5pt; text-align: left; text-indent: -70.5pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;BROWNOUT&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;//Reset en bajadas de tensión de
alimentación por debajo de 4V. (Opción por defecto)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 70.5pt; text-align: left; text-indent: -70.5pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 70.5pt; text-align: left; text-indent: -70.5pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;NOBROWNOUT&amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp;//Desactivado reset por bajadas de tensión&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 70.5pt; text-align: left; text-indent: -70.5pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 70.5pt; text-align: left; text-indent: -70.5pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;PUT&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;//“Power up timer”. Mantiene reseteado al PIC un
tiempo en el momento de conexión de la tensión de alimentación. Permite así que
empiece a ejecutar el programa con la tensión de alimentación ya estabilizada.&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 70.5pt; text-align: left; text-indent: -70.5pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;NOPUT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #999999;&quot;&gt;//No
habilita “Power Up Timer”. &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;(Opción por &lt;/span&gt;defecto)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 70.5pt; text-align: left; text-indent: -70.5pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;PROTECT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #999999;&quot;&gt;//Protección de lectura de código de
programa. Impide leer el código con dispositivos externos.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 70.5pt; text-align: left; text-indent: -70.5pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;NOPROTECT&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #999999;&quot;&gt;//No habilita la protección de código.
(Opción por defecto)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 70.5pt; text-align: left; text-indent: -70.5pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;DEBUG&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;//Monitorización hardware interno por dispositivos
externos. Supone la renuncia a los pines RC6 y RC7 como pines I/O&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 70.5pt; text-align: left; text-indent: -70.5pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;NODEBUG&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #999999;&quot;&gt;//Inhabilitación modo DEBUG. (Opción por
defecto)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 70.5pt; text-align: left; text-indent: -70.5pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;LVP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp;//Opción de programación del PIC a bajo voltaje. Supone
la renuncia de uso del pin RB4 como pin I/O. (Opción por
defecto)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 70.5pt; text-align: left; text-indent: -70.5pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;NOLVP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt; //Inhabilitación modo LVP&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 70.5pt; text-align: left; text-indent: -70.5pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;CPD&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;//Protección de lectura del código contenido en &lt;st1:personname productid=&quot;la EEPROM&quot; w:st=&quot;on&quot;&gt;la EEPROM&lt;/st1:personname&gt; con dispositivos
externos.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 70.5pt; text-align: left; text-indent: -70.5pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;NOCPD&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #999999;&quot;&gt;//Modo CPD inhabilitado. (Opción por
defecto)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 70.5pt; text-align: left; text-indent: -70.5pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;WRT_5%&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #999999;&quot;&gt;//Protección a la escritura de los 255
primeros bytes de la memoria de programa&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 70.5pt; text-align: left; text-indent: -70.5pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 70.5pt; text-align: left; text-indent: -70.5pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;WRT_25%&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #999999;&quot;&gt;//Protección a la escritura del primer
cuarto de memoria de programa&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 70.5pt; text-align: left; text-indent: -70.5pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 70.5pt; text-align: left; text-indent: -70.5pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;WRT_50%&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #999999;&quot;&gt;//Proteccción a la escritura de la mitad
inferior de memoria de programa.&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 70.5pt; text-align: left; text-indent: -70.5pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 70.5pt; text-align: left; text-indent: -70.5pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;NOWRT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;//Protección desactivada a la escritura de la&amp;nbsp; memoria de programa. (Opción por defecto)&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 106.2pt; text-align: left; text-indent: -106.2pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://robotypic.blogspot.com/feeds/2370478184754186984/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5250193391449144895/2370478184754186984?isPopup=true' title='1 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5250193391449144895/posts/default/2370478184754186984'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5250193391449144895/posts/default/2370478184754186984'/><link rel='alternate' type='text/html' href='http://robotypic.blogspot.com/2011/05/generacion-de-numeros-aleatorios-con.html' title='Generación de números aleatorios con PIC.'/><author><name>Robotypic</name><uri>http://www.blogger.com/profile/16455462312458405515</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIacVdGiON1_aCyTPqOBx6AvjUUf6fJ4rSpF-24UO7pWEEzWim79Gl_95LLzOITo_VDTiHVjIVRBbD43Dm7GQlziBnKYJYp41NRNbDK7nKVTOG4gwCXA-kqpQuP7yKSEhWANwH1ZF4tY8/s72-c/Generaci%25C3%25B3n+n%25C3%25BAmeros+aleatorios+con+pic.png" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5250193391449144895.post-2716409399940898036</id><published>2011-04-23T15:52:00.023+02:00</published><updated>2013-08-02T18:18:28.947+02:00</updated><title type='text'>Control de un sintetizador de voz SP03 con PIC</title><content type='html'>&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;El sintetizador de voz SP03 “text to speech” reproduce oralmente cualquier cadena de caracteres ASCII. Para ello dispone de 3 posibilidades de comunicación; mediante comunicación RS232, mediante puerto paralelo y por bus I2C. En este proyecto emplearemos la comunicación I2C para el envío de mensajes con el PIC y &lt;personname productid=&quot;la RS&quot; w:st=&quot;on&quot;&gt;la RS&lt;/personname&gt;232 conectado al PC para la configuración y grabación de los mensajes predefinidos.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7Kox7mSpQGX7ZHibdOu2SDSAO65yItwrgaNQzrPKhRznTgCAsoUPNSZwxT-bLpwkqTKkjjQrJ4SCCYrYdo2Ln4mjYx6GRCy2CICs4Pf0kLCF6z7Vd6ZGI_NPOOk-HYeWqBB09CSI5Guw/s1600/Sintetizador+de+voz+SP03.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;190&quot; i8=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7Kox7mSpQGX7ZHibdOu2SDSAO65yItwrgaNQzrPKhRznTgCAsoUPNSZwxT-bLpwkqTKkjjQrJ4SCCYrYdo2Ln4mjYx6GRCy2CICs4Pf0kLCF6z7Vd6ZGI_NPOOk-HYeWqBB09CSI5Guw/s200/Sintetizador+de+voz+SP03.jpg&quot; width=&quot;200&quot; /&gt;&lt;/a&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;El modulo SP03 reproduce en el momento de su conexión siempre el mensaje que tenga alojado en la primera posición de los mensajes predefinidos. Sino se quiere que esto ocurra hay que dejar vacía esta posición.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial;&quot;&gt;&lt;span style=&quot;color: black; font-family: Verdana, sans-serif;&quot;&gt;Por tanto, lo primero que haremos es conectarnos vía RS232 desde el PC para dejar todas las posiciones vacias excepto la nº10 en la que alojaremos el mensaje &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;&lt;i style=&quot;mso-bidi-font-style: normal;&quot;&gt;“Me llamo robotypic”&lt;/i&gt;&lt;/b&gt; configurado en velocidad, tono y volumen y que mas tarde será uno de los mensajes que reproduciremos con el PIC.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEgzODwRasevKU6H_O5AczOUI_qbthHWozn9CJkn3652hWiilQVavyWqKYW_qNNS92RuBIsXzXBBaqV5gsb-M0rTIkzKsotQQ9g0vkQ6__4MDndAKf5N70GMz6MXiyfbJrWapqiAe1EBI/s1600/Conexion+SP03+Rs232.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;201&quot; i8=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEgzODwRasevKU6H_O5AczOUI_qbthHWozn9CJkn3652hWiilQVavyWqKYW_qNNS92RuBIsXzXBBaqV5gsb-M0rTIkzKsotQQ9g0vkQ6__4MDndAKf5N70GMz6MXiyfbJrWapqiAe1EBI/s400/Conexion+SP03+Rs232.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: right;&quot;&gt;
&lt;span style=&quot;color: #990000; font-size: xx-small;&quot;&gt;&lt;em&gt;Pulsa en la imagen para ampliarla.﻿&lt;/em&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: right;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;El software de configuración se puede descargar aquí. &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Verdana, sans-serif;&quot;&gt;﻿&lt;/span&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;&lt;span style=&quot;color: black; font-family: Verdana, sans-serif;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;a href=&quot;http://www.msebilbao.com/notas/software/Software%20sintetizador%20SP03.zip&quot;&gt;&lt;span style=&quot;color: purple; font-family: &amp;quot;Trebuchet MS&amp;quot;, sans-serif;&quot;&gt;http://www.msebilbao.com/notas/software/Software%20sintetizador%20SP03.zip&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial;&quot;&gt;&lt;span style=&quot;color: black; font-family: Verdana, sans-serif;&quot;&gt;Descargado, ejecutamos el archivo &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;sp03.exe&lt;/b&gt; y nos abrirá la siguiente ventana:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhpoKUD_Si9aipLIWRuE3GefgjsiltfNSbpMDkQk7I_tt6WoHxQCHxzN9ET4M6Z-AvnVv7EPS5LY_lPlpHAWZbScLsQR49U_6gpU1nQ37Ahfq_SvUb810FN5i-n863XTfWYosno8pw7NGk/s1600/sp03+window1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;223&quot; i8=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhpoKUD_Si9aipLIWRuE3GefgjsiltfNSbpMDkQk7I_tt6WoHxQCHxzN9ET4M6Z-AvnVv7EPS5LY_lPlpHAWZbScLsQR49U_6gpU1nQ37Ahfq_SvUb810FN5i-n863XTfWYosno8pw7NGk/s400/sp03+window1.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;Se elije el puerto de comunicación al que estamos conectados al PC. Se deja en blanco la primera de las posiciones y escribimos en el resto de posiciones deseadas los mensajes que queramos. En nuestro caso solo emplearemos la posición 10. Se ajustan los valores de volumen, tono y velocidad para el texto y se prueba en el correspondiente botón “Test”.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_o9LgshxELk2kTSxKc78512KhNdXS-dZZsn0YYvw0hs_0O3AqEQyLuAL2QZsaJ7CIXTUB3BdX13fpKCkgbXXhXJePm7NUYH2PN7MdTDKlOO-ogiHAhKL-GfRAjkakg8Fn7KOWF4ORF0w/s1600/sp03+window2.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;223&quot; i8=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_o9LgshxELk2kTSxKc78512KhNdXS-dZZsn0YYvw0hs_0O3AqEQyLuAL2QZsaJ7CIXTUB3BdX13fpKCkgbXXhXJePm7NUYH2PN7MdTDKlOO-ogiHAhKL-GfRAjkakg8Fn7KOWF4ORF0w/s400/sp03+window2.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;Con todos los ajustes y textos deseados se pulsa “Program”. Ahora el sp03 ya se queda cargado y configurado para los textos predefinidos.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;Toca controlar el sp03 mediante el PIC. En este proyecto se va a mostrar 3 formas de reproducir los mensajes:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt 36pt; mso-list: l0 level1 lfo1; tab-stops: list 36.0pt; text-align: justify; text-indent: -18pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;-&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Mediante la carga en el buffer del sp03 de todos los caracteres del mensaje a reproducir uno a uno. Sera el primer mensaje que reproduciremos; “Hola”.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt 18pt; text-align: justify; text-indent: 17.4pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt 36pt; mso-list: l0 level1 lfo1; tab-stops: list 36.0pt; text-align: justify; text-indent: -18pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;-&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Mediante la carga en el buffer del sp03 de la cadena de texto contenida en una variable. Serán los dos siguientes mensajes; &lt;i style=&quot;mso-bidi-font-style: normal;&quot;&gt;“como estas?”&lt;/i&gt; y &lt;i style=&quot;mso-bidi-font-style: normal;&quot;&gt;“soy tu amigo”&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt 36pt; mso-list: l0 level1 lfo1; tab-stops: list 36.0pt; text-align: justify; text-indent: -18pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;-&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Y mediante la reproducción de los mensajes predefinidos accediendo a la posición en el sp03 donde se encuentran. El último de los mensajes; “me llamo robotypic”.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;De los tres procedimientos, el primero es el menos adecuado, sobre todo cuando se quieren reproducir muchos mensajes diferentes, dado que nos dimensiona el codigo del programa del pic en exceso y nos obliga a conocer los valores ASCII de todos los caracteres empleados, pero como muestra didáctica del principio de funcionamiento del sp03 es bastante válido.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXgao9dg649tFoiMk0w8QnqWoEoNAFkTKr1cMaxbXFLmJPledT41IjrcxwgJ3L_GnrToHs8y-9la-x9TMuqef_KPMRXukvqRNm3LPjrc2zT3NPlMhsEWANywVT96v71UUU1KlZR9mov1o/s1600/Esquema+control+sp03+con+pic.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;225&quot; i8=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXgao9dg649tFoiMk0w8QnqWoEoNAFkTKr1cMaxbXFLmJPledT41IjrcxwgJ3L_GnrToHs8y-9la-x9TMuqef_KPMRXukvqRNm3LPjrc2zT3NPlMhsEWANywVT96v71UUU1KlZR9mov1o/s400/Esquema+control+sp03+con+pic.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: right;&quot;&gt;
&lt;span style=&quot;color: #990000; font-family: Arial, Helvetica, sans-serif; font-size: xx-small;&quot;&gt;&lt;em&gt;Pulsa en la imagen para ampliarla&lt;/em&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: right;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;Por tanto, lo primero que se debe hacer es cargar en el buffer del&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;SP03 el mensaje a reproducir:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;i2c_start();&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;//Comienzo de la comunicación I2C ...&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;i2c_write(SP03_ID);&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;//...con la dirección del LCD03...&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;i2c_write(0x00);&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;//...apuntando a la posición 0 del registro del SP03&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;i2c_write(0x00);&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;//Comando nulo&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;i2c_write(0x00);&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;//Volumen máximo&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;i2c_write(0x05);&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;//velocidad&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;i2c_write(0x03);&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;//Tono&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;i2c_write(0x48);&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;//texto &quot;h&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; mso-ansi-language: EN-GB;&quot;&gt;i2c_write(0x6F);&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;//texto &quot;o&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; mso-ansi-language: EN-GB;&quot;&gt;i2c_write(0x6C);&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;//texto &quot;l&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; mso-ansi-language: EN-GB;&quot;&gt;i2c_write(0x61);&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;//texto &quot;a&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;i2c_write(0x00);&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;//Comando nulo&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;i2c_stop ();&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;//Finalización de la transmisión&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;Y una vez cargado reproducirlo con el comando 0x40:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;i2c_start();&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;// Comienzo de la comunicación I2C...&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;i2c_write(SP03_ID);&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;// ...con la dirección I2c del Sp03 ...&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;i2c_write(0x00);&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;//...apuntando a la posición 0 del registro del sp03 &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;i2c_write(0x40);&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//reproduce el último mensaje cargado en el sp03&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;i2c_stop();&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;// Finalización de la transmisión&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;A continuación, para&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;cargar el mensaje en el buffer mediante el segundo procedimiento, primero le asignaremos a la variable “texto” la cadena de caracteres a reproducir:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;strcpy (texto, &quot;como estas?&quot;);&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;//En &quot;texto&quot; texto a reproducir&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #666666;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;Luego identificamos el número de caracteres que posee la cadena de texto:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;n=strlen(texto); &lt;span style=&quot;color: #666666;&quot;&gt;//Obtiene número de caracteres del texto a reproducir&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;span style=&quot;color: black; font-family: Verdana, sans-serif;&quot;&gt;Y lo cargamos en el buffer del SP03:&lt;/span&gt;&lt;span style=&quot;color: green; font-family: Arial; font-size: 10pt;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;i2c_start();&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;//Comienzo de la comunicación I2C ...&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;i2c_write(SP03_ID);&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;//...con la dirección del LCD03...&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;i2c_write(0x00);&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;//...apuntando a la posición 0 del registro del SP03&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; mso-ansi-language: EN-GB;&quot;&gt;i2c_write(0x00);&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;//Comando nulo&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; mso-ansi-language: EN-GB;&quot;&gt;i2c_write(0x00);&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;//Volumen máximo&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; mso-ansi-language: EN-GB;&quot;&gt;i2c_write(0x05);&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;//velocidad&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; mso-ansi-language: EN-GB;&quot;&gt;i2c_write(0x03);&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;//Tono&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; mso-ansi-language: EN-GB;&quot;&gt;for ( i=0; i&amp;lt;n; i++) {&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;i2c_write(texto[i]); &lt;span style=&quot;color: #666666;&quot;&gt;//caracter posición i de la cedena de texto&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;i2c_write(0x00);&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;//Comando nulo&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;i2c_stop ();&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;//Finalización de la transmisión&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;De esta forma, con una única subrutina, cargamos el buffer con cualquier mensaje deseado.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;Y para reproducirlo, igualmente con el comando 0x40.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;Finalmente el último mensaje mediante el acceso a la posición en la que se encuentra guardado. En este caso no hay que cargar el buffer del SP03 sino reproducirlo directamente:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;posicion=10;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;i2c_start();&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;// Comienzo de la comunicación I2C...&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;i2c_write(SP03_ID);&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;// ...con la dirección I2c del Sp03 ...&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;i2c_write(0x00);&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;//...apuntando a la posición 0 del registro del sp03 &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;i2c_write(posicion);&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;//Reproduce el mensaje de la posición x del sp0&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;i2c_stop();&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;// Finalización de la transmisión&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;En éste último procedimiento, la limitación viene dada por el número de mensajes máximo que se pueden alojar en el SP03, en concreto 30.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=5250193391449144895#&quot; onclick=&quot;Effect.toggle(&amp;quot;expandir1&amp;quot;,&amp;quot;slide&amp;quot;); return false&quot;&gt;[+/-] Ver / Ocultar programa completo en C&lt;/a&gt;&lt;br /&gt;
&lt;div id=&quot;expandir1&quot; style=&quot;display: none;&quot;&gt;
&lt;span style=&quot;font-family: Arial;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;//////////////////////////////////////////////////////////////////////////////// &lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;//&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;// &lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;//&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Control de un sintetizador de voz SP03 por bus I2C con PIC 16F876A&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;//&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;//&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;//&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;(c) RobotyPic&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;2011&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;//&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;// &lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;//////////////////////////////////////////////////////////////////////////////// &lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;#include &amp;lt;16F876A.h&amp;gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//PIC a utilizar &lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;#include &amp;lt;string.h&amp;gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//Funcion para tratamiento del texto&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;#fuses XT,NOWDT,NOPROTECT&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//Protecciones&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;#use delay(clock=4000000)&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//Frecuencia cristal de cuarzo&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;#use i2c(master, SCL=PIN_C3, SDA=PIN_C4)&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;//Configuración comunicación I2C&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt; mso-ansi-language: EN-GB;&quot;&gt;#use standard_io(C)&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt; mso-ansi-language: EN-GB;&quot;&gt;#use standard_io(B)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;#use standard_io(A)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;int SP03_ID&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;=&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;0xC4;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//Dirección I2C de acceso al SP03 &lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;int posicion;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//Posición del texto guardado en el spp03 a reproducir&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;char texto[81];&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//Texto a reproducir(máximo 81 caracteres)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;int i;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//Posiciones para Buffer de texto &lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;int n;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//Número de caracteres&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;/******************************************************************************/&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;/************* FUNCIÓN REPRODUCIR TEXTO GUARDADO EN BUFFER ********************/&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt; mso-ansi-language: EN-GB;&quot;&gt;void sp03 (byte SP03_ID){&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt; mso-ansi-language: EN-GB;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;i2c_start();&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;// Comienzo de la comunicación I2C...&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;i2c_write(SP03_ID);&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;// ...con la dirección I2c del Sp03 ...&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;i2c_write(0x00);&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;// ...apuntando a la posición 0 del registro del sp03 &lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;i2c_write(0x40);&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;// reproduce el último mensaje cargado en el buffer del sp0&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;i2c_stop();&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;// Finalización de la transmisión&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;/******************************************************************************/&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;/************* FUNCIÓN REPRODUCIR TEXTO GUARDADO EN &lt;personname productid=&quot;LA POSICIￓN X&quot; w:st=&quot;on&quot;&gt;LA POSICIÓN X&lt;/personname&gt; *************/&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt; mso-ansi-language: EN-GB;&quot;&gt;void sp03_posicion (byte SP03_ID, byte posicion){&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt; mso-ansi-language: EN-GB;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;i2c_start();&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;// Comienzo de la comunicación I2C...&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;i2c_write(SP03_ID);&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;// ...con la dirección I2c del Sp03 ...&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;i2c_write(0x00);&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;// ...apuntando a la posición 0 del registro del sp03 &lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;i2c_write(posicion);&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;// Reproduce el mensaje de la posición x del sp0&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;i2c_stop();&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;// Finalización de la transmisión&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;/******************************************************************************/&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;/**************** FUNCIÓN CARGA EN BUFFER TEXTO &quot;hola&quot; ***********************/&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt; mso-ansi-language: EN-GB;&quot;&gt;void sp03_texto1 (byte SP03_ID){&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt; mso-ansi-language: EN-GB;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;i2c_start();&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//Comienzo de la comunicación I2C ...&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;i2c_write(SP03_ID);&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//...con la dirección del LCD03...&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;i2c_write(0x00);&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//...apuntando a la posición 0 del registro del SP03&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;i2c_write(0x00);&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//Comando nulo&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;i2c_write(0x00);&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//Volumen máximo&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;i2c_write(0x05);&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//velocidad&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;i2c_write(0x03);&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//Tono&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;i2c_write(0x48);&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//texto &quot;h&quot;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt; mso-ansi-language: EN-GB;&quot;&gt;i2c_write(0x6F);&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//texto &quot;o&quot;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt; mso-ansi-language: EN-GB;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;i2c_write(0x6C);&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//texto &quot;l&quot;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt; mso-ansi-language: EN-GB;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;i2c_write(0x61);&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//texto &quot;a&quot;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt; mso-ansi-language: EN-GB;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;i2c_write(0x00);&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//Comando nulo&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;i2c_stop ();&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//Finalización de la transmisión&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&lt;/span&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;/******************************************************************************/&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;/************** FUNCIÓN CARGA EN BUFFER CUALQUIER TEXTO ***********************/&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt; mso-ansi-language: EN-GB;&quot;&gt;void sp03_texto2 (byte SP03_ID){&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt; mso-ansi-language: EN-GB;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;n=strlen(texto);&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//Obtiene número de caracteres del texto a reproducir&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;i2c_start();&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//Comienzo de la comunicación I2C ...&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;i2c_write(SP03_ID);&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//...con la dirección del LCD03...&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;i2c_write(0x00);&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//...apuntando a la posición 0 del registro del SP03&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span lang=&quot;EN-GB&quot; style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt; mso-ansi-language: EN-GB;&quot;&gt;i2c_write(0x00);&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//Comando nulo&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt; mso-ansi-language: EN-GB;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;i2c_write(0x00);&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//Volumen máximo&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt; mso-ansi-language: EN-GB;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;i2c_write(0x05);&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//velocidad&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt; mso-ansi-language: EN-GB;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;i2c_write(0x03); &lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;//Tono&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt; mso-ansi-language: EN-GB;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;for ( i=0; i&amp;lt;n; i++) {&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span lang=&quot;EN-GB&quot; style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt; mso-ansi-language: EN-GB;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;i2c_write(texto[i]); //caracter posición i de la cedena de texto&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;i2c_write(0x00);&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//Comando nulo&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;i2c_stop ();&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//Finalización de la transmisión&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&lt;/span&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;/******************************************************************************/&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;/************************ FUNCIÓN PRINCIPAL ***********************************/&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;void main() { &lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;while(1){&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;delay_ms(2000);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;sp03_texto1 (SP03_ID);&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//Carga en buffer texto &quot;hola&quot;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;delay_ms(500);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;sp03(SP03_ID);&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//Reproduce el texto previamente cargado (hello)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;delay_ms (1000);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;strcpy (texto, &quot;como estas?&quot;);&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//En &quot;texto&quot; texto a reproducir&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;sp03_texto2 (SP03_ID);&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//Carga en buffer texto &lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;delay_ms(500);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;sp03(SP03_ID);&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//Reproduce el texto previamente cargado &lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;delay_ms(4000);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;strcpy (texto, &quot;soy tu amigo&quot;);&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;//En &quot;texto&quot; texto a reproducir&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;sp03_texto2 (SP03_ID);&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//Carga en buffer texto &lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;delay_ms(500);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;sp03(SP03_ID);&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//Reproduce el texto previamente cargado &lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;delay_ms(3000);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//Reproduce texo guardado en la posición 10 &quot;Me llamo robotypic&quot;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;posicion=10;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//En &quot;posicion&quot; ubicación del mensaje&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;sp03_posicion (SP03_ID, posicion); &lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;delay_ms(5000);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: right;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Arial;&quot;&gt;&lt;span style=&quot;color: black; font-family: Verdana, sans-serif;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Verdana; mso-bidi-font-family: Arial;&quot;&gt;En el programa completo, se puede ver que entre sucesivas reproducciones de mensaje, se han colocado unos retardos. Con ellos,&amp;nbsp;&amp;nbsp;además del espaciado en el tiempo entre mensajes, se evita que se cargue en el buffer del SP03 un nuevo mensaje antes de reproducir completamente el anterior. Con este último objetivo se puede utilizar el siguiente bucle de instrucciones:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: 10pt;&quot;&gt;&amp;nbsp;int registro;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: 10pt;&quot;&gt;&amp;nbsp;do{ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//Bucle de ejecución mientras habla&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp; i2c_start(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;//Comienzo de la comunicación I2C ...&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp; i2c_write(SP03_ID); &amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;// ...con la dirección I2c del Sp03 ...&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp; i2c_write(0x00); &amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;//...apuntando posición 0 del registro del sp03&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp;i2c_start(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: 10pt;&quot;&gt;//Reinicio de la comunicación I2C ...&lt;/span&gt;&lt;span style=&quot;color: #38761d; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp; i2c_write(SP03_ID+1); &lt;span style=&quot;color: #666666;&quot;&gt;//... como lectura&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp; registro=I2c_read(); &amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;//Guarda el data leido&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp; i2c_stop(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;// Finalización de la transmisión&lt;/span&gt;&amp;nbsp; &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: 10pt;&quot;&gt;&amp;nbsp;}while(registro != 0);&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Verdana; mso-bidi-font-family: Arial;&quot;&gt;La ejecución del programa se detendrá en dicho bucle hasta que termine de reproducir el texto por completo mediante la consulta del valor del registro del comando que ha originado la orden de reproducción.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;color: black; font-family: Verdana, sans-serif;&quot;&gt;En el siguiente enlace, la descarga de todos los archivos del proyecto:&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://depositfiles.com/files/x3sjsu17q&quot; target=&quot;_blank&quot;&gt;Descargar archivos Control sintetizador voz SP03&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;En la siguiente reproducción se puede escuchar el resultado de lo explicado. Hay que decir que este tipo de sintetizadores de voz están diseñados para el idima inglés por lo que se le nota un marcado acento en ese idioma.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;iframe allowfullscreen=&#39;allowfullscreen&#39; webkitallowfullscreen=&#39;webkitallowfullscreen&#39; mozallowfullscreen=&#39;mozallowfullscreen&#39; width=&#39;320&#39; height=&#39;100&#39; src=&#39;https://www.blogger.com/video.g?token=AD6v5dzu3VGdEHqcigmO0q_gPcXK-sEIIPD5wmfokqPf7yOnA8A3p7cFjlUbrsZbXuaptVJsTJv1XEhbBp5EpkdtBg&#39; class=&#39;b-hbp-video b-uploaded&#39; frameborder=&#39;0&#39;&gt;&lt;/iframe&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;El proyecto contenido en el artículo ha sido diseñado con la versión v4.084 de&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;CCS PIC C COMPILER&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://robotypic.blogspot.com/feeds/2716409399940898036/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5250193391449144895/2716409399940898036?isPopup=true' title='2 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5250193391449144895/posts/default/2716409399940898036'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5250193391449144895/posts/default/2716409399940898036'/><link rel='alternate' type='text/html' href='http://robotypic.blogspot.com/2011/04/control-de-un-sintetizador-de-voz-sp03.html' title='Control de un sintetizador de voz SP03 con PIC'/><author><name>Robotypic</name><uri>http://www.blogger.com/profile/16455462312458405515</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7Kox7mSpQGX7ZHibdOu2SDSAO65yItwrgaNQzrPKhRznTgCAsoUPNSZwxT-bLpwkqTKkjjQrJ4SCCYrYdo2Ln4mjYx6GRCy2CICs4Pf0kLCF6z7Vd6ZGI_NPOOk-HYeWqBB09CSI5Guw/s72-c/Sintetizador+de+voz+SP03.jpg" height="72" width="72"/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5250193391449144895.post-8745550287454002053</id><published>2011-04-02T17:29:00.045+02:00</published><updated>2013-08-02T18:02:57.411+02:00</updated><title type='text'>Control de un LCD03 por bus I2C</title><content type='html'>&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Verdana, sans-serif;&quot;&gt;El LCD03 es un display que permite la comunicación tanto por bus I2C como por RS232. En este caso se va a emplear la conexión I2C con el PIC 16F876A. Para ello hay que sacar el puente trasero que viene conectado por defecto para una conexión RS232.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-DqGL8oiJzYCrnCiV0mqstfO3zedgKn7dadYW-L93gEl72lkVUO87LzQNlZiVN3NGvEL30G3E_HAfzLPOST63MOt1z_zKRTc_ON1ZeqOvAXJmoV6Ic2pYp6qlvpypF0sigPGx8CzHtFg/s1600/LCD03.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;240&quot; r6=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-DqGL8oiJzYCrnCiV0mqstfO3zedgKn7dadYW-L93gEl72lkVUO87LzQNlZiVN3NGvEL30G3E_HAfzLPOST63MOt1z_zKRTc_ON1ZeqOvAXJmoV6Ic2pYp6qlvpypF0sigPGx8CzHtFg/s320/LCD03.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Verdana, sans-serif;&quot;&gt;Dentro de este bus I2C, el acceso al display se establecerá con la dirección 0xC6. Por esta dirección se enviará el texto a mostrar así como los comandos para su control.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div align=&quot;center&quot;&gt;
&lt;table border=&quot;1&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;MsoNormalTable&quot; style=&quot;height: 394px; mso-cellspacing: 0cm; width: 577px;&quot;&gt;&lt;tbody&gt;
&lt;tr style=&quot;mso-yfti-firstrow: yes; mso-yfti-irow: 0;&quot;&gt;&lt;td style=&quot;background: teal; border-bottom: #f0f0f0; border-left: #f0f0f0; border-right: #f0f0f0; border-top: #f0f0f0; padding-bottom: 0.75pt; padding-left: 0.75pt; padding-right: 0.75pt; padding-top: 0.75pt; width: 38.95pt;&quot; width=&quot;52&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: center;&quot;&gt;
&lt;span style=&quot;color: white;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: Verdana; font-size: 8pt;&quot;&gt;Decimal&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Verdana; font-size: 8pt;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;td style=&quot;background: teal; border-bottom: #f0f0f0; border-left: #f0f0f0; border-right: #f0f0f0; border-top: #f0f0f0; padding-bottom: 0.75pt; padding-left: 0.75pt; padding-right: 0.75pt; padding-top: 0.75pt; width: 125.9pt;&quot; width=&quot;168&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: center;&quot;&gt;
&lt;span style=&quot;color: white;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: Verdana; font-size: 8pt;&quot;&gt;Comando&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Verdana; font-size: 8pt;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;td style=&quot;background: teal; border-bottom: #f0f0f0; border-left: #f0f0f0; border-right: #f0f0f0; border-top: #f0f0f0; padding-bottom: 0.75pt; padding-left: 0.75pt; padding-right: 0.75pt; padding-top: 0.75pt; width: 328.25pt;&quot; width=&quot;438&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: center;&quot;&gt;
&lt;span style=&quot;color: white;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: Verdana; font-size: 8pt;&quot;&gt;Descripción&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Verdana; font-size: 8pt;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;mso-yfti-irow: 1;&quot;&gt;&lt;td style=&quot;background-color: transparent; border-bottom: #f0f0f0; border-left: #f0f0f0; border-right: #f0f0f0; border-top: #f0f0f0; padding-bottom: 0.75pt; padding-left: 0.75pt; padding-right: 0.75pt; padding-top: 0.75pt; width: 38.95pt;&quot; width=&quot;52&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 8pt;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;td style=&quot;background-color: transparent; border-bottom: #f0f0f0; border-left: #f0f0f0; border-right: #f0f0f0; border-top: #f0f0f0; padding-bottom: 0.75pt; padding-left: 0.75pt; padding-right: 0.75pt; padding-top: 0.75pt; width: 125.9pt;&quot; width=&quot;168&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 8pt;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;td style=&quot;background-color: transparent; border-bottom: #f0f0f0; border-left: #f0f0f0; border-right: #f0f0f0; border-top: #f0f0f0; padding-bottom: 0.75pt; padding-left: 0.75pt; padding-right: 0.75pt; padding-top: 0.75pt; width: 328.25pt;&quot; width=&quot;438&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 8pt;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;mso-yfti-irow: 2;&quot;&gt;&lt;td style=&quot;background-color: transparent; border-bottom: #f0f0f0; border-left: #f0f0f0; border-right: #f0f0f0; border-top: #f0f0f0; padding-bottom: 0.75pt; padding-left: 0.75pt; padding-right: 0.75pt; padding-top: 0.75pt; width: 38.95pt;&quot; width=&quot;52&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 8pt;&quot;&gt;1&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;td style=&quot;background-color: transparent; border-bottom: #f0f0f0; border-left: #f0f0f0; border-right: #f0f0f0; border-top: #f0f0f0; padding-bottom: 0.75pt; padding-left: 0.75pt; padding-right: 0.75pt; padding-top: 0.75pt; width: 125.9pt;&quot; width=&quot;168&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 8pt;&quot;&gt;Inicio de Cursor&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;td style=&quot;background-color: transparent; border-bottom: #f0f0f0; border-left: #f0f0f0; border-right: #f0f0f0; border-top: #f0f0f0; padding-bottom: 0.75pt; padding-left: 0.75pt; padding-right: 0.75pt; padding-top: 0.75pt; width: 328.25pt;&quot; width=&quot;438&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 8pt;&quot;&gt;Fija el cursor en la posición de inicio (esquina superior izquierda)&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;mso-yfti-irow: 3;&quot;&gt;&lt;td style=&quot;background-color: transparent; border-bottom: #f0f0f0; border-left: #f0f0f0; border-right: #f0f0f0; border-top: #f0f0f0; padding-bottom: 0.75pt; padding-left: 0.75pt; padding-right: 0.75pt; padding-top: 0.75pt; width: 38.95pt;&quot; width=&quot;52&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 8pt;&quot;&gt;2&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;td style=&quot;background-color: transparent; border-bottom: #f0f0f0; border-left: #f0f0f0; border-right: #f0f0f0; border-top: #f0f0f0; padding-bottom: 0.75pt; padding-left: 0.75pt; padding-right: 0.75pt; padding-top: 0.75pt; width: 125.9pt;&quot; width=&quot;168&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 8pt;&quot;&gt;Fijar cursor (1-80)&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;td style=&quot;background-color: transparent; border-bottom: #f0f0f0; border-left: #f0f0f0; border-right: #f0f0f0; border-top: #f0f0f0; padding-bottom: 0.75pt; padding-left: 0.75pt; padding-right: 0.75pt; padding-top: 0.75pt; width: 328.25pt;&quot; width=&quot;438&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 8pt;&quot;&gt;Fija el cursor en una posición especificada tras el byte siguiente, donde 1 es de la esquina superior izquierda y 80 es la esquina inferior derecha&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;mso-yfti-irow: 4;&quot;&gt;&lt;td style=&quot;background-color: transparent; border-bottom: #f0f0f0; border-left: #f0f0f0; border-right: #f0f0f0; border-top: #f0f0f0; padding-bottom: 0.75pt; padding-left: 0.75pt; padding-right: 0.75pt; padding-top: 0.75pt; width: 38.95pt;&quot; width=&quot;52&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 8pt;&quot;&gt;3&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;td style=&quot;background-color: transparent; border-bottom: #f0f0f0; border-left: #f0f0f0; border-right: #f0f0f0; border-top: #f0f0f0; padding-bottom: 0.75pt; padding-left: 0.75pt; padding-right: 0.75pt; padding-top: 0.75pt; width: 125.9pt;&quot; width=&quot;168&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 8pt;&quot;&gt;Fijar cursor (línea, columna)&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;td style=&quot;background-color: transparent; border-bottom: #f0f0f0; border-left: #f0f0f0; border-right: #f0f0f0; border-top: #f0f0f0; padding-bottom: 0.75pt; padding-left: 0.75pt; padding-right: 0.75pt; padding-top: 0.75pt; width: 328.25pt;&quot; width=&quot;438&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 8pt;&quot;&gt;Fija el cursor utilizando dos bytes, donde el primer byte es la línea y el segundo byte es la columna&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;mso-yfti-irow: 5;&quot;&gt;&lt;td style=&quot;background-color: transparent; border-bottom: #f0f0f0; border-left: #f0f0f0; border-right: #f0f0f0; border-top: #f0f0f0; padding-bottom: 0.75pt; padding-left: 0.75pt; padding-right: 0.75pt; padding-top: 0.75pt; width: 38.95pt;&quot; width=&quot;52&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 8pt;&quot;&gt;4&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;td style=&quot;background-color: transparent; border-bottom: #f0f0f0; border-left: #f0f0f0; border-right: #f0f0f0; border-top: #f0f0f0; padding-bottom: 0.75pt; padding-left: 0.75pt; padding-right: 0.75pt; padding-top: 0.75pt; width: 125.9pt;&quot; width=&quot;168&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 8pt;&quot;&gt;Ocultar cursor&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;td style=&quot;background-color: transparent; border-bottom: #f0f0f0; border-left: #f0f0f0; border-right: #f0f0f0; border-top: #f0f0f0; padding-bottom: 0.75pt; padding-left: 0.75pt; padding-right: 0.75pt; padding-top: 0.75pt; width: 328.25pt;&quot; width=&quot;438&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 8pt;&quot;&gt;Oculta la posición del cursor en el display&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;mso-yfti-irow: 6;&quot;&gt;&lt;td style=&quot;background-color: transparent; border-bottom: #f0f0f0; border-left: #f0f0f0; border-right: #f0f0f0; border-top: #f0f0f0; padding-bottom: 0.75pt; padding-left: 0.75pt; padding-right: 0.75pt; padding-top: 0.75pt; width: 38.95pt;&quot; width=&quot;52&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 8pt;&quot;&gt;5&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;td style=&quot;background-color: transparent; border-bottom: #f0f0f0; border-left: #f0f0f0; border-right: #f0f0f0; border-top: #f0f0f0; padding-bottom: 0.75pt; padding-left: 0.75pt; padding-right: 0.75pt; padding-top: 0.75pt; width: 125.9pt;&quot; width=&quot;168&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 8pt;&quot;&gt;Mostrar cursor bajo&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;td style=&quot;background-color: transparent; border-bottom: #f0f0f0; border-left: #f0f0f0; border-right: #f0f0f0; border-top: #f0f0f0; padding-bottom: 0.75pt; padding-left: 0.75pt; padding-right: 0.75pt; padding-top: 0.75pt; width: 328.25pt;&quot; width=&quot;438&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 8pt;&quot;&gt;Cambia el tipo de cursor a un cursor bajo de subrayado&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;mso-yfti-irow: 7;&quot;&gt;&lt;td style=&quot;background-color: transparent; border-bottom: #f0f0f0; border-left: #f0f0f0; border-right: #f0f0f0; border-top: #f0f0f0; padding-bottom: 0.75pt; padding-left: 0.75pt; padding-right: 0.75pt; padding-top: 0.75pt; width: 38.95pt;&quot; width=&quot;52&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 8pt;&quot;&gt;6&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;td style=&quot;background-color: transparent; border-bottom: #f0f0f0; border-left: #f0f0f0; border-right: #f0f0f0; border-top: #f0f0f0; padding-bottom: 0.75pt; padding-left: 0.75pt; padding-right: 0.75pt; padding-top: 0.75pt; width: 125.9pt;&quot; width=&quot;168&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 8pt;&quot;&gt;Mostrar cursor parpadeante&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;td style=&quot;background-color: transparent; border-bottom: #f0f0f0; border-left: #f0f0f0; border-right: #f0f0f0; border-top: #f0f0f0; padding-bottom: 0.75pt; padding-left: 0.75pt; padding-right: 0.75pt; padding-top: 0.75pt; width: 328.25pt;&quot; width=&quot;438&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 8pt;&quot;&gt;Cambia el tipo de cursor a un cursor parpadeante&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;mso-yfti-irow: 8;&quot;&gt;&lt;td style=&quot;background-color: transparent; border-bottom: #f0f0f0; border-left: #f0f0f0; border-right: #f0f0f0; border-top: #f0f0f0; padding-bottom: 0.75pt; padding-left: 0.75pt; padding-right: 0.75pt; padding-top: 0.75pt; width: 38.95pt;&quot; width=&quot;52&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 8pt;&quot;&gt;8&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;td style=&quot;background-color: transparent; border-bottom: #f0f0f0; border-left: #f0f0f0; border-right: #f0f0f0; border-top: #f0f0f0; padding-bottom: 0.75pt; padding-left: 0.75pt; padding-right: 0.75pt; padding-top: 0.75pt; width: 125.9pt;&quot; width=&quot;168&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 8pt;&quot;&gt;Borrar carácter anterior&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;td style=&quot;background-color: transparent; border-bottom: #f0f0f0; border-left: #f0f0f0; border-right: #f0f0f0; border-top: #f0f0f0; padding-bottom: 0.75pt; padding-left: 0.75pt; padding-right: 0.75pt; padding-top: 0.75pt; width: 328.25pt;&quot; width=&quot;438&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 8pt;&quot;&gt;Borra el carácter anterior a la posición del cursor&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;mso-yfti-irow: 9;&quot;&gt;&lt;td style=&quot;background-color: transparent; border-bottom: #f0f0f0; border-left: #f0f0f0; border-right: #f0f0f0; border-top: #f0f0f0; padding-bottom: 0.75pt; padding-left: 0.75pt; padding-right: 0.75pt; padding-top: 0.75pt; width: 38.95pt;&quot; width=&quot;52&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 8pt;&quot;&gt;9&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;td style=&quot;background-color: transparent; border-bottom: #f0f0f0; border-left: #f0f0f0; border-right: #f0f0f0; border-top: #f0f0f0; padding-bottom: 0.75pt; padding-left: 0.75pt; padding-right: 0.75pt; padding-top: 0.75pt; width: 125.9pt;&quot; width=&quot;168&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 8pt;&quot;&gt;Tabulador horizontal (según configuración del tabulador) &lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;td style=&quot;background-color: transparent; border-bottom: #f0f0f0; border-left: #f0f0f0; border-right: #f0f0f0; border-top: #f0f0f0; padding-bottom: 0.75pt; padding-left: 0.75pt; padding-right: 0.75pt; padding-top: 0.75pt; width: 328.25pt;&quot; width=&quot;438&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 8pt;&quot;&gt;Mueve la posición actual del cursor a la posición definida en la configuración del comando 18 (por defecto el espacio del tabulador es 4) &lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;mso-yfti-irow: 10;&quot;&gt;&lt;td style=&quot;background-color: transparent; border-bottom: #f0f0f0; border-left: #f0f0f0; border-right: #f0f0f0; border-top: #f0f0f0; padding-bottom: 0.75pt; padding-left: 0.75pt; padding-right: 0.75pt; padding-top: 0.75pt; width: 38.95pt;&quot; width=&quot;52&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 8pt;&quot;&gt;10&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;td style=&quot;background-color: transparent; border-bottom: #f0f0f0; border-left: #f0f0f0; border-right: #f0f0f0; border-top: #f0f0f0; padding-bottom: 0.75pt; padding-left: 0.75pt; padding-right: 0.75pt; padding-top: 0.75pt; width: 125.9pt;&quot; width=&quot;168&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 8pt;&quot;&gt;Salto de línea (LF) inteligente&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;td style=&quot;background-color: transparent; border-bottom: #f0f0f0; border-left: #f0f0f0; border-right: #f0f0f0; border-top: #f0f0f0; padding-bottom: 0.75pt; padding-left: 0.75pt; padding-right: 0.75pt; padding-top: 0.75pt; width: 328.25pt;&quot; width=&quot;438&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 8pt;&quot;&gt;Mueve el cursor a la línea inferior en la posición de la misma columna&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;mso-yfti-irow: 11;&quot;&gt;&lt;td style=&quot;background-color: transparent; border-bottom: #f0f0f0; border-left: #f0f0f0; border-right: #f0f0f0; border-top: #f0f0f0; padding-bottom: 0.75pt; padding-left: 0.75pt; padding-right: 0.75pt; padding-top: 0.75pt; width: 38.95pt;&quot; width=&quot;52&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 8pt;&quot;&gt;11&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;td style=&quot;background-color: transparent; border-bottom: #f0f0f0; border-left: #f0f0f0; border-right: #f0f0f0; border-top: #f0f0f0; padding-bottom: 0.75pt; padding-left: 0.75pt; padding-right: 0.75pt; padding-top: 0.75pt; width: 125.9pt;&quot; width=&quot;168&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 8pt;&quot;&gt;Tabulador vertical&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;td style=&quot;background-color: transparent; border-bottom: #f0f0f0; border-left: #f0f0f0; border-right: #f0f0f0; border-top: #f0f0f0; padding-bottom: 0.75pt; padding-left: 0.75pt; padding-right: 0.75pt; padding-top: 0.75pt; width: 328.25pt;&quot; width=&quot;438&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 8pt;&quot;&gt;Mueve el cursor a la línea superior en la posición de la misma columna&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;mso-yfti-irow: 12;&quot;&gt;&lt;td style=&quot;background-color: transparent; border-bottom: #f0f0f0; border-left: #f0f0f0; border-right: #f0f0f0; border-top: #f0f0f0; padding-bottom: 0.75pt; padding-left: 0.75pt; padding-right: 0.75pt; padding-top: 0.75pt; width: 38.95pt;&quot; width=&quot;52&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 8pt;&quot;&gt;12&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;td style=&quot;background-color: transparent; border-bottom: #f0f0f0; border-left: #f0f0f0; border-right: #f0f0f0; border-top: #f0f0f0; padding-bottom: 0.75pt; padding-left: 0.75pt; padding-right: 0.75pt; padding-top: 0.75pt; width: 125.9pt;&quot; width=&quot;168&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 8pt;&quot;&gt;Borrar pantalla&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;td style=&quot;background-color: transparent; border-bottom: #f0f0f0; border-left: #f0f0f0; border-right: #f0f0f0; border-top: #f0f0f0; padding-bottom: 0.75pt; padding-left: 0.75pt; padding-right: 0.75pt; padding-top: 0.75pt; width: 328.25pt;&quot; width=&quot;438&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 8pt;&quot;&gt;Borra toda la pantalla y coloca el cursor en la posición de inicio&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;mso-yfti-irow: 13;&quot;&gt;&lt;td style=&quot;background-color: transparent; border-bottom: #f0f0f0; border-left: #f0f0f0; border-right: #f0f0f0; border-top: #f0f0f0; padding-bottom: 0.75pt; padding-left: 0.75pt; padding-right: 0.75pt; padding-top: 0.75pt; width: 38.95pt;&quot; width=&quot;52&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 8pt;&quot;&gt;13&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;td style=&quot;background-color: transparent; border-bottom: #f0f0f0; border-left: #f0f0f0; border-right: #f0f0f0; border-top: #f0f0f0; padding-bottom: 0.75pt; padding-left: 0.75pt; padding-right: 0.75pt; padding-top: 0.75pt; width: 125.9pt;&quot; width=&quot;168&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 8pt;&quot;&gt;Retorno de carro&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;td style=&quot;background-color: transparent; border-bottom: #f0f0f0; border-left: #f0f0f0; border-right: #f0f0f0; border-top: #f0f0f0; padding-bottom: 0.75pt; padding-left: 0.75pt; padding-right: 0.75pt; padding-top: 0.75pt; width: 328.25pt;&quot; width=&quot;438&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 8pt;&quot;&gt;Mueve el cursor al principio de la siguiente línea&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;mso-yfti-irow: 14;&quot;&gt;&lt;td style=&quot;background-color: transparent; border-bottom: #f0f0f0; border-left: #f0f0f0; border-right: #f0f0f0; border-top: #f0f0f0; padding-bottom: 0.75pt; padding-left: 0.75pt; padding-right: 0.75pt; padding-top: 0.75pt; width: 38.95pt;&quot; width=&quot;52&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 8pt;&quot;&gt;17&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;td style=&quot;background-color: transparent; border-bottom: #f0f0f0; border-left: #f0f0f0; border-right: #f0f0f0; border-top: #f0f0f0; padding-bottom: 0.75pt; padding-left: 0.75pt; padding-right: 0.75pt; padding-top: 0.75pt; width: 125.9pt;&quot; width=&quot;168&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 8pt;&quot;&gt;Borrar columna&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;td style=&quot;background-color: transparent; border-bottom: #f0f0f0; border-left: #f0f0f0; border-right: #f0f0f0; border-top: #f0f0f0; padding-bottom: 0.75pt; padding-left: 0.75pt; padding-right: 0.75pt; padding-top: 0.75pt; width: 328.25pt;&quot; width=&quot;438&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 8pt;&quot;&gt;Borra el contenido de la columna actual y mueve el cursor a la siguiente columna&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;mso-yfti-irow: 15;&quot;&gt;&lt;td style=&quot;background-color: transparent; border-bottom: #f0f0f0; border-left: #f0f0f0; border-right: #f0f0f0; border-top: #f0f0f0; padding-bottom: 0.75pt; padding-left: 0.75pt; padding-right: 0.75pt; padding-top: 0.75pt; width: 38.95pt;&quot; width=&quot;52&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 8pt;&quot;&gt;18&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;td style=&quot;background-color: transparent; border-bottom: #f0f0f0; border-left: #f0f0f0; border-right: #f0f0f0; border-top: #f0f0f0; padding-bottom: 0.75pt; padding-left: 0.75pt; padding-right: 0.75pt; padding-top: 0.75pt; width: 125.9pt;&quot; width=&quot;168&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 8pt;&quot;&gt;Configuración tabulador&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;td style=&quot;background-color: transparent; border-bottom: #f0f0f0; border-left: #f0f0f0; border-right: #f0f0f0; border-top: #f0f0f0; padding-bottom: 0.75pt; padding-left: 0.75pt; padding-right: 0.75pt; padding-top: 0.75pt; width: 328.25pt;&quot; width=&quot;438&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 8pt;&quot;&gt;Define el tamaño del tabulador, el byte siguiente puede tener un tamaño de &lt;metricconverter productid=&quot;1 a&quot; w:st=&quot;on&quot;&gt;1 a&lt;/metricconverter&gt; 10&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;mso-yfti-irow: 16;&quot;&gt;&lt;td style=&quot;background-color: transparent; border-bottom: #f0f0f0; border-left: #f0f0f0; border-right: #f0f0f0; border-top: #f0f0f0; padding-bottom: 0.75pt; padding-left: 0.75pt; padding-right: 0.75pt; padding-top: 0.75pt; width: 38.95pt;&quot; width=&quot;52&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 8pt;&quot;&gt;19&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;td style=&quot;background-color: transparent; border-bottom: #f0f0f0; border-left: #f0f0f0; border-right: #f0f0f0; border-top: #f0f0f0; padding-bottom: 0.75pt; padding-left: 0.75pt; padding-right: 0.75pt; padding-top: 0.75pt; width: 125.9pt;&quot; width=&quot;168&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 8pt;&quot;&gt;Apaga la iluminación&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;td style=&quot;background-color: transparent; border-bottom: #f0f0f0; border-left: #f0f0f0; border-right: #f0f0f0; border-top: #f0f0f0; padding-bottom: 0.75pt; padding-left: 0.75pt; padding-right: 0.75pt; padding-top: 0.75pt; width: 328.25pt;&quot; width=&quot;438&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 8pt;&quot;&gt;Apaga la iluminación de la pantalla. &lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;mso-yfti-irow: 17;&quot;&gt;&lt;td style=&quot;background-color: transparent; border-bottom: #f0f0f0; border-left: #f0f0f0; border-right: #f0f0f0; border-top: #f0f0f0; padding-bottom: 0.75pt; padding-left: 0.75pt; padding-right: 0.75pt; padding-top: 0.75pt; width: 38.95pt;&quot; width=&quot;52&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 8pt;&quot;&gt;20&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;td style=&quot;background-color: transparent; border-bottom: #f0f0f0; border-left: #f0f0f0; border-right: #f0f0f0; border-top: #f0f0f0; padding-bottom: 0.75pt; padding-left: 0.75pt; padding-right: 0.75pt; padding-top: 0.75pt; width: 125.9pt;&quot; width=&quot;168&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 8pt;&quot;&gt;Enciende la iluminación&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;td style=&quot;background-color: transparent; border-bottom: #f0f0f0; border-left: #f0f0f0; border-right: #f0f0f0; border-top: #f0f0f0; padding-bottom: 0.75pt; padding-left: 0.75pt; padding-right: 0.75pt; padding-top: 0.75pt; width: 328.25pt;&quot; width=&quot;438&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 8pt;&quot;&gt;Enciende la iluminación de la pantalla.&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;mso-yfti-irow: 18;&quot;&gt;&lt;td style=&quot;background-color: transparent; border-bottom: #f0f0f0; border-left: #f0f0f0; border-right: #f0f0f0; border-top: #f0f0f0; padding-bottom: 0.75pt; padding-left: 0.75pt; padding-right: 0.75pt; padding-top: 0.75pt; width: 38.95pt;&quot; width=&quot;52&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 8pt;&quot;&gt;27&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;td style=&quot;background-color: transparent; border-bottom: #f0f0f0; border-left: #f0f0f0; border-right: #f0f0f0; border-top: #f0f0f0; padding-bottom: 0.75pt; padding-left: 0.75pt; padding-right: 0.75pt; padding-top: 0.75pt; width: 125.9pt;&quot; width=&quot;168&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 8pt;&quot;&gt;Generador de caracteres personalizados&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;td style=&quot;background-color: transparent; border-bottom: #f0f0f0; border-left: #f0f0f0; border-right: #f0f0f0; border-top: #f0f0f0; padding-bottom: 0.75pt; padding-left: 0.75pt; padding-right: 0.75pt; padding-top: 0.75pt; width: 328.25pt;&quot; width=&quot;438&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 8pt;&quot;&gt;Permite la creación de 8 caracteres personalizados. &lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;mso-yfti-irow: 19; mso-yfti-lastrow: yes;&quot;&gt;&lt;td style=&quot;background-color: transparent; border-bottom: #f0f0f0; border-left: #f0f0f0; border-right: #f0f0f0; border-top: #f0f0f0; padding-bottom: 0.75pt; padding-left: 0.75pt; padding-right: 0.75pt; padding-top: 0.75pt; width: 38.95pt;&quot; width=&quot;52&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 8pt;&quot;&gt;32-255&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;td style=&quot;background-color: transparent; border-bottom: #f0f0f0; border-left: #f0f0f0; border-right: #f0f0f0; border-top: #f0f0f0; padding-bottom: 0.75pt; padding-left: 0.75pt; padding-right: 0.75pt; padding-top: 0.75pt; width: 125.9pt;&quot; width=&quot;168&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 8pt;&quot;&gt;Caracteres ASCII &lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;td style=&quot;background-color: transparent; border-bottom: #f0f0f0; border-left: #f0f0f0; border-right: #f0f0f0; border-top: #f0f0f0; padding-bottom: 0.75pt; padding-left: 0.75pt; padding-right: 0.75pt; padding-top: 0.75pt; width: 328.25pt;&quot; width=&quot;438&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: 8pt;&quot;&gt;Escribe caracteres ASCII en el display&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;clear: both; margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;clear: both; margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Verdana, sans-serif;&quot;&gt;Para escribir un comando con el PIC sobre el display y ejecutar su acción correspondiente se escribe sobre el registro 0 del LCD03 el correspondiente comando:&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;clear: both; margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;clear: both; margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;i2c_start();&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Comienzo de la comunicación I2C ...&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;clear: both; margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;i2c_write(LCD03_ID);&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//...con la dirección del LCD03...&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;clear: both; margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;i2c_write(0);&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//...apuntando a la posición 0 del registro del LCD03&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;clear: both; margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;i2c_write(comando);&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//acción a ejecutar según el valor de “comando”&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;clear: both; margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;i2c_stop ();&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Finalización de la transmisión&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;clear: both; margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;clear: both; margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;clear: both; margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Verdana, sans-serif;&quot;&gt;Donde “LCD03_ID” contiene la dirección del bus para el LCD (0xC6) y “comando” el valor decimal que especifica la actuación a realizar sobre el display según la tabla anterior.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;clear: both; margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;clear: both; margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Verdana, sans-serif;&quot;&gt;Si en lugar de ejecutar un comando lo que se desea es escribir un texto, un posible procedimiento es el especificado a continuación.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;clear: both; margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;clear: both; margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;Primero se guarda en una variable tipo buffer (texto) la cadena de caracteres a escribir en el LCD:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;clear: both; margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;clear: both; margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;strcpy (texto, &quot;Mensaje a mostar&quot;);&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//En “texto” se guarda el mensaje&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;clear: both; margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;clear: both; margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: teal; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;clear: both; margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Verdana, sans-serif; font-size: small;&quot;&gt;Si se quiere mostrar centrado en alguna de las lineas del display, antes identificaremos cuantos caracteres posee el mensaje guardado:&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;clear: both; margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;clear: both; margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;n=strlen(texto);&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//En “n” el número de caracteres del mensaje&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;clear: both; margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;clear: both; margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Verdana, sans-serif; font-size: small;&quot;&gt;Y establecemos, teniendo en cuenta que se trata de un display de 4x20 caracteres, con las variables &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;columna&lt;/b&gt; y &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;linea&lt;/b&gt; en que punto del display comenzará a mostrarse el mensaje:&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;clear: both; margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;clear: both; margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;columna=((20-n)/2)+1;&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Posición texto centrado...&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;clear: both; margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;linea=1;&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//... en la 1ª linea&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;clear: both; margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;clear: both; margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Verdana, sans-serif; font-size: small;&quot;&gt;Y se posiciona cursor en el LCD:&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;clear: both; margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&lt;span style=&quot;color: black; font-family: Verdana, sans-serif; font-size: small;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;clear: both; margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;i2c_start();&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Comienzo de la comunicación I2C ...&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;clear: both; margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;i2c_write(LCD03_ID);&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//...con la dirección del LCD03...&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;clear: both; margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;i2c_write(0);&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//...apuntando a la posición 0 del registro del LCD03&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;clear: both; margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;i2c_write(3);&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//comando posicionar cursor...&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;clear: both; margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;i2c_write(linea);&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//...en la linea...&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;clear: both; margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;i2c_write(columna);&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//... y en la columna indicadas&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;clear: both; margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;i2c_stop ();&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Finalización de la transmisión&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;clear: both; margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;clear: both; margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&lt;/span&gt;Finalmente, posicionado ya el cursor, se escribe secuencialmente toda la cadena de texto:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;clear: both; margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;clear: both; margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: teal; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;for ( i=0; i&amp;lt;n; i++) {&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;clear: both; margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;i2c_start();&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Comienzo de la comunicación I2C ...&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;clear: both; margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;i2c_write(LCD03_ID);&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//...con la dirección del LCD03...&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;clear: both; margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;i2c_write(0);&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//...apuntando a la posición 0 del registro del LCD03&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;clear: both; margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;i2c_write(texto[i]);&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//...escribe caracter posición i de texto[]&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;clear: both; margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: teal;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;i2c_stop ();&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #999999;&quot;&gt;//Finalización de la transmisión&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;clear: both; margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: teal; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;delay_ms(10); &lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;clear: both; margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: teal; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;clear: both; margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;clear: both; margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;clear: both; margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=5250193391449144895#&quot; onclick=&quot;Effect.toggle(&amp;quot;expandir1&amp;quot;,&amp;quot;slide&amp;quot;); return false&quot;&gt;[+/-] Ver / Ocultar programa completo en C&lt;/a&gt;&lt;br /&gt;
&lt;div id=&quot;expandir1&quot; style=&quot;display: none;&quot;&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;//////////////////////////////////////////////////////////////////////////////// &lt;br /&gt;
//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // &lt;br /&gt;
//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Control de un LCD03 por bus I2C con PIC 16F876A&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //&lt;br /&gt;
//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //&lt;br /&gt;
//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (c) RobotyPic&amp;nbsp; 2010&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //&lt;br /&gt;
//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // &lt;br /&gt;
//////////////////////////////////////////////////////////////////////////////// &lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;16F876A.h&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //PIC a utilizar &lt;br /&gt;
#include &amp;lt;string.h&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;#fuses XT,NOWDT,NOPROTECT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Protecciones&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;#use delay(clock=4000000)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Frecuencia cristal de cuarzo&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;
#use i2c(master, SCL=PIN_C3, SDA=PIN_C4)&amp;nbsp; //Configuración comunicación I2C&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;#use standard_io(C)&amp;nbsp; &lt;br /&gt;
#use standard_io(B)&lt;br /&gt;
#use standard_io(A)&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;int LCD03_ID&amp;nbsp;&amp;nbsp; =&amp;nbsp; 0xC6;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Dirección I2C de acceso al LCD03 &lt;br /&gt;
char texto[20];&amp;nbsp;&amp;nbsp; &lt;br /&gt;
int i;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Posiciones para Buffer de texto &lt;br /&gt;
int n;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Número de caracteres&lt;br /&gt;
short int luz;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Encender-apagar luz del display&lt;br /&gt;
int comando;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Comando para LCD&lt;br /&gt;
int columna;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Posición en la columna&lt;br /&gt;
int linea;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Posición en la linea&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;/******************** Prototipos de las funciones *****************************/&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;void cursor_lcd(LCD03_ID, linea, columna);&lt;br /&gt;
void escritura_lcd(byte LCD03_ID);&lt;br /&gt;
void comando_lcd ( byte LCD03_ID, byte comando );&lt;br /&gt;
void luz_lcd ();&lt;br /&gt;
void borrar_lcd ();&lt;br /&gt;
void retorno_carro ();&lt;br /&gt;
void texto_lcd();&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;/******************************************************************************/&lt;br /&gt;
/******************** FUNCIÓN ESCRITURA TEXTO EN LCD **************************/&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;void escritura_lcd(byte LCD03_ID){&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp; for ( i=0; i&amp;lt;n; i++) {&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i2c_start();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Comienzo de la comunicación I2C ...&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i2c_write(LCD03_ID);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //...con la dirección del LCD03...&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i2c_write(0);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//...apuntando a la posición 0 del registro del LCD03&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i2c_write(texto[i]);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //...escribe caracter posición i de texto[i]&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i2c_stop ();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Finalización de la transmisión&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; delay_ms(10); &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;br /&gt;
}&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &lt;br /&gt;
/******************************************************************************/&lt;br /&gt;
/********************* FUNCIÓN ESCRITURA COMANDO LCD **************************/&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;void comando_lcd ( byte LCD03_ID, byte comando ) { &lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp; i2c_start();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Comienzo de la comunicación I2C ...&lt;br /&gt;
&amp;nbsp;&amp;nbsp; i2c_write(LCD03_ID);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //...con la dirección del LCD03...&lt;br /&gt;
&amp;nbsp;&amp;nbsp; i2c_write(0);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//...apuntando a la posición 0 del registro del LCD03&lt;br /&gt;
&amp;nbsp;&amp;nbsp; i2c_write(comando);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //escribe acción &lt;br /&gt;
&amp;nbsp;&amp;nbsp; i2c_stop ();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Finalización de la transmisión&lt;br /&gt;
} &lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;/******************************************************************************/&lt;br /&gt;
/***************** FUNCIÓN ENCENDER-APAGAR LUZ DISPLAY ************************/&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &lt;br /&gt;
void luz_lcd (){&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp; luz=luz+1;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Conmutación estado luz&lt;br /&gt;
&amp;nbsp;&amp;nbsp; if (luz==1) comando=19;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Comando encender luz&lt;br /&gt;
&amp;nbsp;&amp;nbsp; else comando=20;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Comando apagar luz&lt;br /&gt;
&amp;nbsp;&amp;nbsp; comando_lcd(LCD03_ID, comando);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Envío de la acción al LCD&lt;br /&gt;
&amp;nbsp;&amp;nbsp; delay_ms(300);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
}&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;/******************************************************************************/&lt;br /&gt;
/********************** FUNCIÓN BORRAR DISPLAY ********************************/&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;void borrar_lcd (){&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; comando=12;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Comando borrar display&lt;br /&gt;
&amp;nbsp;&amp;nbsp; comando_lcd(LCD03_ID, comando);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Envío de la acción al LCD&lt;br /&gt;
&amp;nbsp;&amp;nbsp; delay_ms(150);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;/******************************************************************************/&lt;br /&gt;
/******************* FUNCIÓN BORRAR CARACTER ANTERIOR *************************/&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;void borrar_caracter (){&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; comando=8;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Comando borrar display&lt;br /&gt;
&amp;nbsp;&amp;nbsp; comando_lcd(LCD03_ID, comando);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Envío de la acción al LCD&lt;br /&gt;
&amp;nbsp;&amp;nbsp; delay_ms(300);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;/******************************************************************************/&lt;br /&gt;
/*********************** FUNCIÓN OCULTAR CURSOR *******************************/&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;void borrar_cursor (){&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; comando=4;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Comando ocultar cursor&lt;br /&gt;
&amp;nbsp;&amp;nbsp; comando_lcd(LCD03_ID, comando);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Envío de la acción al LCD&lt;br /&gt;
&amp;nbsp;&amp;nbsp; delay_ms(150);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;/******************************************************************************/&lt;br /&gt;
/*********************** FUNCIÓN MOSTRAR CURSOR *******************************/&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;void mostrar_cursor (){&lt;br /&gt;
&amp;nbsp;&amp;nbsp; comando=6;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Comando mostrar cursor&lt;br /&gt;
&amp;nbsp;&amp;nbsp; comando_lcd(LCD03_ID, comando);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Envío de la acción al LCD&lt;br /&gt;
&amp;nbsp;&amp;nbsp; delay_ms(150);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
}&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;/******************************************************************************/&lt;br /&gt;
/********************** FUNCIÓN RETORNO DE CARRO ******************************/&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;void retorno_carro (){&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; comando=13;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Comando retorno de carro display&lt;br /&gt;
&amp;nbsp;&amp;nbsp; comando_lcd(LCD03_ID, comando);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Envío de la acción al LCD&lt;br /&gt;
&amp;nbsp;&amp;nbsp; delay_ms(300);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;/******************************************************************************/&lt;br /&gt;
/********************* FUNCIÓN ESCRITURA TEXTO ********************************/&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;void texto_lcd(){&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp; strcpy (texto, &quot;Este es un mensaje&quot;);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Texto de la primera línea&lt;br /&gt;
&amp;nbsp;&amp;nbsp; n=strlen(texto);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Obtiene número de caracteres&lt;br /&gt;
&amp;nbsp;&amp;nbsp; columna=((20-n)/2)+1;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Posición texto centrado...&lt;br /&gt;
&amp;nbsp;&amp;nbsp; linea=1;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //... en la 1ª linea&lt;br /&gt;
&amp;nbsp;&amp;nbsp; cursor_lcd (LCD03_ID, linea, columna);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Envío posición del cursor&lt;br /&gt;
&amp;nbsp;&amp;nbsp; escritura_lcd (LCD03_ID);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Envío texto de la primera linea&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp; strcpy (texto, &quot;de bienvenida&quot;);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Texto de la segunda linea&lt;br /&gt;
&amp;nbsp;&amp;nbsp; n=strlen(texto);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Obtiene número de caracteres&lt;br /&gt;
&amp;nbsp;&amp;nbsp; columna=((20-n)/2)+1;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Posición texto centrado...&lt;br /&gt;
&amp;nbsp;&amp;nbsp; linea=2;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //... en la 2ª linea&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp; cursor_lcd(LCD03_ID,linea,columna);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Envío posición del cursor&lt;br /&gt;
&amp;nbsp;&amp;nbsp; escritura_lcd (LCD03_ID);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Envío texto de la 2ª linea&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp; cursor_lcd (LCD03_ID,linea,columna);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Envío comando posicionar cursor&lt;br /&gt;
&amp;nbsp;&amp;nbsp; strcpy (texto, &quot;RobotyPic (c)&quot;);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Texto de la 4ª línea&lt;br /&gt;
&amp;nbsp;&amp;nbsp; n=strlen(texto);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Obtiene número de caracteres&lt;br /&gt;
&amp;nbsp;&amp;nbsp; columna=((20-n)/2)+1;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Posición texto centrado...&lt;br /&gt;
&amp;nbsp;&amp;nbsp; linea=4;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; cursor_lcd(LCD03_ID,linea,columna);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Envío posición del cursor&lt;br /&gt;
&amp;nbsp;&amp;nbsp; escritura_lcd (LCD03_ID);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Envío texto de la 4ªlinea&lt;br /&gt;
&amp;nbsp;}&lt;br /&gt;
&lt;br /&gt;
/******************************************************************************/&lt;br /&gt;
/********************** FUNCIÓN POSICIONAR CURSOR *****************************/&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;void cursor_lcd (byte LCD03_ID, byte linea, byte columna){&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp; i2c_start();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Comienzo de la comunicación I2C ...&lt;br /&gt;
&amp;nbsp;&amp;nbsp; i2c_write(LCD03_ID);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //...con la dirección del LCD03...&lt;br /&gt;
&amp;nbsp;&amp;nbsp; i2c_write(0);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//...apuntando a la posición 0 del registro del LCD03&lt;br /&gt;
&amp;nbsp;&amp;nbsp; i2c_write(3);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //acción de posicionar cursor...&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp; i2c_write(linea);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //...en la linea...&lt;br /&gt;
&amp;nbsp;&amp;nbsp; i2c_write(columna);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //... y en la columna indicadas&lt;br /&gt;
&amp;nbsp;&amp;nbsp; i2c_stop ();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Finalización de la transmisión&lt;br /&gt;
}&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;/******************************************************************************/&lt;br /&gt;
/************************ FUNCIÓN PRINCIPAL ***********************************/&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;void main() {&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; while(1){&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Encender-apagar luz del display&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (input(pin_B0)==1) luz_lcd();&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Borra display&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (input(pin_B1)==1) borrar_lcd();&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Salta cursor al inicio linea siguiente&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (input(pin_B2)==1) retorno_carro();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Escribe texto&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (input(pin_B3)==1) texto_lcd();&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Borra caracter anterior&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (input(pin_B4)==1) borrar_caracter();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Oculta cursor&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (input(pin_B5)==1) borrar_cursor(); &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Muestra cursor&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (input(pin_B6)==1) mostrar_cursor();&amp;nbsp; &lt;br /&gt;
&amp;nbsp; }&lt;br /&gt;
}&lt;/span&gt;&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; margin: 0cm 0cm 0pt; text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgi-GcqkulqPs9Ax6XZ27RVzFVoJmU7hQit6Wls86MmCKkFCbKibNe8V9_me4m9yKNVSx6AZfVRv75S_z80CnNIBpq6wfZgmAUAwv3pUiFjtrX4wpmGZjdQJYMqYxr09wacSVOOzIS3Dz0/s1600/Control+I2C+display+LCD03.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;438&quot; r6=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgi-GcqkulqPs9Ax6XZ27RVzFVoJmU7hQit6Wls86MmCKkFCbKibNe8V9_me4m9yKNVSx6AZfVRv75S_z80CnNIBpq6wfZgmAUAwv3pUiFjtrX4wpmGZjdQJYMqYxr09wacSVOOzIS3Dz0/s640/Control+I2C+display+LCD03.png&quot; width=&quot;620&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Verdana, sans-serif;&quot;&gt;En este video se puede verificar&amp;nbsp;su funcionamiento según el procedimiento explicado.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;center&gt;
&lt;iframe allowfullscreen=&quot;&quot; frameborder=&quot;0&quot; height=&quot;360&quot; src=&quot;https://www.youtube.com/embed/7W929bl9Dz4?feature=player_detailpage&quot; width=&quot;580&quot;&gt;&lt;/iframe&gt;&lt;/center&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Verdana, sans-serif;&quot;&gt;Todos los archivos del proyecto se pueden descargar de este enlace:&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt; text-align: justify;&quot;&gt;
&lt;br /&gt;
&lt;a href=&quot;http://depositfiles.com/files/32ew9sy9d&quot; target=&quot;_blank&quot;&gt;Descargar archivos Control LCD03 por I2C&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border: 5px solid #E0F8EC; padding: 5px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;El proyecto contenido en el artículo ha sido diseñado con la versión v4.084 de&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;CCS PIC C COMPILER&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://robotypic.blogspot.com/feeds/8745550287454002053/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5250193391449144895/8745550287454002053?isPopup=true' title='2 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5250193391449144895/posts/default/8745550287454002053'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5250193391449144895/posts/default/8745550287454002053'/><link rel='alternate' type='text/html' href='http://robotypic.blogspot.com/2011/04/control-de-un-lcd03-por-bus-i2c.html' title='Control de un LCD03 por bus I2C'/><author><name>Robotypic</name><uri>http://www.blogger.com/profile/16455462312458405515</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-DqGL8oiJzYCrnCiV0mqstfO3zedgKn7dadYW-L93gEl72lkVUO87LzQNlZiVN3NGvEL30G3E_HAfzLPOST63MOt1z_zKRTc_ON1ZeqOvAXJmoV6Ic2pYp6qlvpypF0sigPGx8CzHtFg/s72-c/LCD03.jpg" height="72" width="72"/><thr:total>2</thr:total></entry></feed>