




procedure Init_I2C_materiel;
begin
I2C1_Init(100000);
end.procedure PCF8574_Read;
begin
I2C1_Start; // signal START
I2C1_Wr($41); // addresse lecture PCF8574
Values := I2C1_Rd(0); // lecture port PCF8574
I2C1_Stop; // signal STOP
end;procedure PCF8574_Write;
begin
I2C1_Start; // signal START
I2C1_Wr($70); // addresse ecriture PCF8574A
I2C1_Wr(Values); // ecriture valeurs
I2C1_Stop; // signal STOP
end;
procedure Init_I2C_materiel;
begin
I2C1_Init(100000);
end.
// définition des broches du PIC à utiliser
varSoft_I2C_Scl: sbit at RB0_bit;
Soft_I2C_Sda: sbit at RB4_bit;
Soft_I2C_Scl_Direction: sbit at TRISB0_bit;
Soft_I2C_Sda_Direction: sbit at TRISB1_bit;procedure Init_I2C_logiciel;
begin
Soft_I2C_Init(100000);
end.