Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
microcontrollertechnik:software_i2c_slave [2021/06/20 23:50] – angelegt tfischermicrocontrollertechnik:software_i2c_slave [2023/12/19 17:36] (current) mexleadmin
Line 52: Line 52:
  
 // Konstanten // Konstanten
-#define SET_BIT(PORT, BIT)  ((PORT) |=  (1 << (BIT))) // Port-Bit Zustand setzen +#define SET_BIT(BYTE, BIT) ((BYTE) |=  (1 << (BIT))) // Bit Zustand in Byte setzen 
-#define CLR_BIT(PORT, BIT)  ((PORT) &= ~(1 << (BIT))) // Port-Bit Zustand loeschen +#define CLR_BIT(BYTE, BIT) ((BYTE) &= ~(1 << (BIT))) // Bit Zustand in Byte loeschen 
-#define TGL_BIT(PORT, BIT)  ((PORT) ^=  (1 << (BIT))) // Port-Bit Zustand wechseln (toggle)+#define TGL_BIT(BYTE, BIT)  ((BYTE) ^=  (1 << (BIT))) // Bit Zustand in Byte wechseln (toggle)
  
 /// Port for the I2C /// Port for the I2C
Line 188: Line 188:
  TWAR_soft = (Address<<1); // Adresse in das Pseudoregister schreiben  TWAR_soft = (Address<<1); // Adresse in das Pseudoregister schreiben
  TWAMR_soft= AddressMask; // Adressmaske in das Pseudoregister schreiben  TWAMR_soft= AddressMask; // Adressmaske in das Pseudoregister schreiben
- TWCR_soft = (1<<TWEA)|(1<<TWEN)|(1<<TWIE); // Enable Ack, Enable Interupt und Enable TIW+ TWCR_soft = (1<<TWEA)|(1<<TWEN)|(1<<TWIE); // Enable Ack, Enable Interupt und Enable TWI