A
ahmet2004
Guest
Pic16f877a i2cMaster # #
Zitat:# include <16f877a.h>
# Sicherungen NOWDT, HS, NOPROTECT, Brownout, NOPUT, nodebug, NOLVP
# Benutzen Sie Verzögerung (clock = 20000000)
# Verwendung I2C (MASTER, SDA = PIN_C4, SCL = PIN_C3, FORCE_HW)# byte PORTD = 0x08void main ()
(
set_tris_D (0xb11111111);
OUTPUT_d (0xff);
delay_ms (250);while (1)
(
i2c_start ();
delay_ms (100);
i2c_write (0xa0);
delay_ms (100);
i2c_write (PORTD);
delay_ms (100);
i2c_stop ();
)
)
Zitat:# include <16f877a.h>
# Sicherungen NOWDT, HS, NOPROTECT, Brownout, NOPUT, nodebug, NOLVP
# Benutzen Sie Verzögerung (clock = 20000000)
# Verwendung I2C (MASTER, SDA = PIN_C4, SCL = PIN_C3, FORCE_HW)# byte PORTD = 0x08void main ()
(
set_tris_D (0xb11111111);
OUTPUT_d (0xff);
delay_ms (250);while (1)
(
i2c_start ();
delay_ms (100);
i2c_write (0xa0);
delay_ms (100);
i2c_write (PORTD);
delay_ms (100);
i2c_stop ();
)
)