Nestor,

you cant' have output in '1' on I2C bus. The principle is to have output in 
'0', pull-ups on the bus and when you want to set '1', just just switch TRIS to 
'1'. And that's all.

Example routine for I2C START for 12F675 follows:

// I2C definitions
#define SCL     TRISIO2
#define SDA     TRISIO1
#define SCL_IN  GPIO2  
#define SDA_IN  GPIO1  

void i2c_start(void)
{
   SDA = 1;             // i2c start bit sequence
   while( !SDA_IN) ;
   i2c_delay();
   SCL = 1;
   while (!SCL_IN) ;
   i2c_delay();
   SDA = 0;
   SDA_IN = 0;
   i2c_delay();
   SCL = 0;
   SCL_IN = 0;
   i2c_delay();
}

> ------------ Původní zpráva ------------
> Od: Néstor <nesto...@gmail.com>
> Předmět: [Sdcc-user] I2C with PIC 16f877 and 32Kbit 24AA32A EEPROM
> Datum: 11.2.2009 17:44:43
> ----------------------------------------
> Hello.
> 
> I need some information about where to get some samples of a I2C
> implementation for a 16f877 PIC with 32Kbit EEPROM model 24AA32A also
> from Microchip.
> 
> Any comments or suggestions are welcome, until now, I haven't been
> able to get it working, the PIC gets rebooted every time I execute the
> routines.
> 
> I attach some of my code, I'm sorry, but's it's not well commented.
> The functions are Serial*.
> 
> This is the main code which executes the functions, to be printed on a LCD:
> 
> for (i=0; i<16; i++)
>   {
>     for (j=0; j<40; j++)
>     {
>       result = (SerialRead(i,j)%112)+16;
>       PaintChar(result, j+1,i+1, MODE_EXOR);
>     }
>   }
> 
> Any ideas, people??
> 
> Thanks.
> 
> -- 
> Néstor
> +34 687 96 74 81
> nesto...@gmail.com
> 
> 
> 

------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to