Attachment 'capitulo1e.sgml'

Download

        <sect1 id="i2c" xreflabel="i2c">
                <title>M&oacute;dulo I2C</title>
                <para>Autor : Pierre Launay </para>
                <para>per.launay en free.fr</para>
                <para>El bus I2C es un bus serie sincrono desarollado por Philips </para>
                <para>
                        Descripci&oacute;n del bus I2C 
                        <ulink url="http://es.wikipedia.org/wiki/I2C">aqui</ulink>
                </para>
                <para>
                        Entender el bus I2C 
                        <ulink url="http://robots-argentina.com.ar/Comunicacion_busI2C.htm">aqui</ulink>
                </para>

                <para>Aqui se muestran las funciones para poder trabajar con el m&oacute;dulo I2C Maestro Interno de los PIC.
                </para>
                <para>
                        Antes de usar este m&oacute;dulos se debe definir la frecuencia usada con el comando.
                </para>

                <para>
                <screen>
        #define FOSC_HZ 4000000
        #include &lt;i2c.h&gt;
                </screen>
                </para>

                <para>Se han realizado algunas definiciones como: </para>
                <para>
                <screen>
        #define I2C_400K        i2c_find_frec(400000)   //frecuencia de 400Khz
        #define I2C_100K        i2c_find_frec(100000)   //frecuencia de 100Khz
        #define I2C_40K         i2c_find_frec(40000)    //frecuencia de 40Khz
        #define I2C_10K         i2c_find_frec(10000)    //frecuencia de 10Khz
        #define I2C_4K          i2c_find_frec(4000)     //frecuencia de 4Khz
        #define I2C_1K          i2c_find_frec(1000)     //frecuencia de 1Khz
                </screen>
                </para>
                <para>Estas definiciones pueden ser usandas en la funci&oacute;n init_i2c</para>


                <sect2 id="i2cinit" xreflabel="i2c_init">
                <title>i2c_init</title>
                <para>Configura el puerto Serie sincrono</para>
                <screen>
        void i2c_init(unsigned char SPEED_I2C);
                </screen>
                <para>SPEED_I2C es el registro SSPADD, reloj_I2C=FOSC_HZ/(4*(SSPADD+1))</para>
                </sect2>

                <sect2 id="i2cwaitforidle" xreflabel="i2c_wait_for_idle">
                <title>i2c_wait_for_idle</title>
                <para>Espera a que el bus est&eacute; libre </para>
                <screen>
        void i2c_wait_for_idle(void);
                </screen>
                </sect2>

                <sect2 id="i2cstart" xreflabel="i2c_start">
                <title>i2c_start</title>
                <para>principio de trama, secuencia de inicio</para>
                <screen>
        void i2c_start(void);
                </screen>
                </sect2>

                <sect2 id="i2crestart" xreflabel="i2c_restart">
                <title>i2c_restart</title>
                <para>Devolver una trama, fin de trama y principio de trama permite poner dos tramas para leer . Ver i2c_read()
                </para>
                <para>Ejemplo para leer las segundas en una trama :</para>
                <para>
                        Principio de trama (start), escribir la direcci&oacute;n del circuito I2C, escribir el registro de las segundas, 
                </para>
                <para>
                        Devolver una trama (restart), escribir la direcci&oacute;n del circuito I2C, leer el registro de las segundas.
                </para>
                <para>fin de trama (stop)</para>
                <screen>
        void i2c_restart(void); 
                </screen>
                </sect2>

                <sect2 id="i2cstop" xreflabel="i2c_stop">
                <title>i2c_stop</title>
                <para>fin de trama, secuencia de parada</para>
                <screen>
        void i2c_stop(void);
                </screen>
                </sect2>

                <sect2 id="i2cdelay" xreflabel="i2c_delay">
                <title>i2c_delay</title>
                <para>Tiempo de espera entre fin de trama y principio de trama &gt;=4.7 us (Frecuencia Reloj SCL = 100KHz) </para>
                <screen>
        void i2c_stop(void);
                </screen>
                </sect2>

                <sect2 id="i2cackread" xreflabel="i2c_ack_read">
                <title> i2c_ack_read </title>
                <para>recepci&oacute;n del pulso de reconocimiento</para>
                <screen>
        unsigned char i2c_ack_read (void);
                </screen>
                <para>"0" buena recepci&oacute;n</para>
                <para>"1" mala recepci&oacute;n</para>
                </sect2>

                <sect2 id="i2cackwrite" xreflabel="i2c_ack_write">
                <title>i2c_ack_write</title>
                <para>emisi&oacute;n. del pulso de reconocimiento</para>
                <screen>
        void i2c_ack_write(unsigned char ack);
                </screen>
                <para>"0" la trama puede continuar</para>
                <para>"1" la trama se para</para>
                </sect2>

                <sect2 id="i2cwrite" xreflabel="i2c_write">
                <title>i2c_write</title>
                <para>
                        el maestro escribe en el esclavo el caracter c, el caracter c puede ser una direcci&oacute;n, una registro interno, un dato
                </para>
                <screen>
        void i2c_write(unsigned char c);
                </screen>
                </sect2>

                <sect2 id="i2cwritewithack" xreflabel="i2c_write_with_ack">
                <title>i2c_write_with_ack</title>
                <para>
                        El maestro escribe el caracter c en el esclavo y remite el reconocimiento (ack).
                </para>
                <para>Esta rutina junta i2c_write(c) y reception_ack()</para>
                <screen>
        unsigned char i2c_write_with_ack(unsigned char c) ;
                </screen>
                </sect2>

                <sect2 id="i2cread" xreflabel="i2c_read">
                <title>i2c_read</title>
                <para>El maestro lee el caracter enviado por el esclavo</para>
                <screen>
        unsigned char i2c_read(void);
                </screen>
                </sect2>

                <sect2 id="i2creadwithack" xreflabel="i2c_read_with_ack">
                <title>i2c_read_with_ack</title>
                <para>el maestro lee el caracter enviado por el esclavo y envia el reconocimiento (ack).</para>
                <screen>
        unsigned char i2c_read_with_ack(unsigned char ack);
                </screen>
                </sect2>


                <sect2 id="ejemploi2c" xreflabel="Ejemplo I2C">
                <title>Ejemplo de M&oacute;dulo I2C</title>
                <para> para compilar necesitas los siguientes comandos </para>
                <para>
                <screen>
Ejemplo de compilacion : ./compila.sh ej_i2c 16f877a
                </screen>
                </para>
                <para> ej_i2c.c </para>

                <screen>
        int main(void)
        {
                return 0;
        }
                </screen>
                </sect2>        

        </sect1>

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2009-03-02 21:07:01, 0.5 KB) [[attachment:GenerarDoc.sh]]
  • [get | view] (2009-03-02 21:49:40, 642.0 KB) [[attachment:GtkPicGccAbout.eps]]
  • [get | view] (2009-03-02 21:50:10, 28.2 KB) [[attachment:GtkPicGccAbout.png]]
  • [get | view] (2009-03-02 21:47:10, 4.9 KB) [[attachment:adc.eps]]
  • [get | view] (2009-03-02 21:47:24, 0.9 KB) [[attachment:adc.png]]
  • [get | view] (2009-03-02 21:00:02, 0.1 KB) [[attachment:capitulo1.sgml]]
  • [get | view] (2009-03-02 21:00:35, 1.7 KB) [[attachment:capitulo1a.sgml]]
  • [get | view] (2009-03-02 21:00:50, 1.7 KB) [[attachment:capitulo1b.sgml]]
  • [get | view] (2009-03-02 21:01:15, 2.8 KB) [[attachment:capitulo1c.sgml]]
  • [get | view] (2009-03-02 21:01:25, 7.0 KB) [[attachment:capitulo1d.sgml]]
  • [get | view] (2009-03-02 21:01:33, 5.0 KB) [[attachment:capitulo1e.sgml]]
  • [get | view] (2009-03-02 21:01:41, 4.9 KB) [[attachment:capitulo1f.sgml]]
  • [get | view] (2009-03-02 21:02:02, 5.7 KB) [[attachment:capitulo1g.sgml]]
  • [get | view] (2009-03-02 21:02:26, 12.8 KB) [[attachment:capitulo1h.sgml]]
  • [get | view] (2009-03-02 21:02:37, 4.4 KB) [[attachment:capitulo1i.sgml]]
  • [get | view] (2009-03-02 21:02:46, 6.3 KB) [[attachment:capitulo1j.sgml]]
  • [get | view] (2009-03-02 21:02:54, 4.3 KB) [[attachment:capitulo1k.sgml]]
  • [get | view] (2009-03-02 21:03:01, 1.6 KB) [[attachment:capitulo1l.sgml]]
  • [get | view] (2009-03-02 21:03:14, 0.2 KB) [[attachment:capitulo2.sgml]]
  • [get | view] (2009-03-02 21:03:32, 2.6 KB) [[attachment:capitulo2a.sgml]]
  • [get | view] (2009-03-02 21:03:44, 2.8 KB) [[attachment:capitulo2b.sgml]]
  • [get | view] (2009-03-02 21:04:00, 22.0 KB) [[attachment:capitulo2c.sgml]]
  • [get | view] (2009-03-02 21:04:22, 0.3 KB) [[attachment:capitulo3.sgml]]
  • [get | view] (2009-03-02 21:04:59, 0.9 KB) [[attachment:capitulo3a.sgml]]
  • [get | view] (2009-03-02 21:05:11, 0.2 KB) [[attachment:capitulo4.sgml]]
  • [get | view] (2009-03-02 21:05:21, 1.4 KB) [[attachment:capitulo4a.sgml]]
  • [get | view] (2009-03-02 21:05:33, 2.7 KB) [[attachment:capitulo4b.sgml]]
  • [get | view] (2009-03-02 21:05:51, 5.6 KB) [[attachment:capitulo4c.sgml]]
  • [get | view] (2009-03-02 21:06:00, 0.2 KB) [[attachment:capitulo5.sgml]]
  • [get | view] (2009-03-02 21:06:20, 9.1 KB) [[attachment:capitulo5a.sgml]]
  • [get | view] (2009-03-02 21:49:04, 5.6 KB) [[attachment:compare.eps]]
  • [get | view] (2009-03-02 21:46:31, 1.1 KB) [[attachment:compare.png]]
  • [get | view] (2009-03-02 21:49:17, 7.6 KB) [[attachment:eeprom.eps]]
  • [get | view] (2009-03-02 21:48:01, 1.2 KB) [[attachment:eeprom.png]]
  • [get | view] (2009-03-02 21:06:33, 0.8 KB) [[attachment:ejemplos.sgml]]
  • [get | view] (2009-03-02 21:06:48, 1.7 KB) [[attachment:faq.sgml]]
  • [get | view] (2009-03-02 21:48:51, 6.3 KB) [[attachment:flash.eps]]
  • [get | view] (2009-03-02 21:50:20, 1.0 KB) [[attachment:flash.png]]
  • [get | view] (2009-03-02 21:50:40, 5.0 KB) [[attachment:i2c.eps]]
  • [get | view] (2009-03-02 21:50:50, 0.9 KB) [[attachment:i2c.png]]
  • [get | view] (2009-03-02 21:50:59, 8.8 KB) [[attachment:interrupt.eps]]
  • [get | view] (2009-03-02 21:51:09, 1.2 KB) [[attachment:interrupt.png]]
  • [get | view] (2009-03-02 21:07:16, 0.6 KB) [[attachment:introduccion.sgml]]
  • [get | view] (2009-03-02 21:07:33, 1.8 KB) [[attachment:introducciona.sgml]]
  • [get | view] (2009-03-02 21:07:43, 1.1 KB) [[attachment:introduccionb.sgml]]
  • [get | view] (2009-03-02 21:08:06, 1.6 KB) [[attachment:introduccionc.sgml]]
  • [get | view] (2009-03-02 21:08:17, 27.5 KB) [[attachment:introducciond.sgml]]
  • [get | view] (2009-03-02 21:08:29, 1.0 KB) [[attachment:introduccione.sgml]]
  • [get | view] (2009-03-02 21:08:42, 64.9 KB) [[attachment:introduccionf.sgml]]
  • [get | view] (2009-03-02 21:51:21, 6.1 KB) [[attachment:pinio.eps]]
  • [get | view] (2009-03-02 21:51:39, 1.0 KB) [[attachment:pinio.png]]
  • [get | view] (2009-03-02 21:51:54, 4.8 KB) [[attachment:pwm.eps]]
  • [get | view] (2009-03-02 21:52:03, 0.9 KB) [[attachment:pwm.png]]
  • [get | view] (2009-03-02 21:09:06, 1.1 KB) [[attachment:referencias.sgml]]
  • [get | view] (2009-03-02 22:26:32, 4.8 KB) [[attachment:spi.eps]]
  • [get | view] (2009-03-02 22:26:54, 0.8 KB) [[attachment:spi.png]]
  • [get | view] (2009-03-02 22:27:21, 7.6 KB) [[attachment:system.eps]]
  • [get | view] (2009-03-02 22:27:31, 1.2 KB) [[attachment:system.png]]
  • [get | view] (2009-03-02 22:27:42, 7.3 KB) [[attachment:timer0.eps]]
  • [get | view] (2009-03-02 22:28:00, 1.1 KB) [[attachment:timer0.png]]
  • [get | view] (2009-03-02 22:28:32, 7.1 KB) [[attachment:timer1.eps]]
  • [get | view] (2009-03-02 22:28:12, 1.0 KB) [[attachment:timer1.png]]
  • [get | view] (2009-03-02 22:28:45, 7.4 KB) [[attachment:timer2.eps]]
  • [get | view] (2009-03-02 22:28:55, 1.1 KB) [[attachment:timer2.png]]
  • [get | view] (2009-03-02 22:26:07, 587.2 KB) [[attachment:tutorial.pdf]]
  • [get | view] (2009-03-02 22:25:35, 2215.3 KB) [[attachment:tutorial.ps]]
  • [get | view] (2009-03-02 21:09:56, 4.4 KB) [[attachment:tutorial.sgml]]
  • [get | view] (2009-03-02 22:29:05, 5.3 KB) [[attachment:uart.eps]]
  • [get | view] (2009-03-02 22:29:16, 0.9 KB) [[attachment:uart.png]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.

Heberge par Ikoula