Ане подкинете примерчик работы с eeprom типа 24СХХХ в Code Vision Avr ?
В интернете искал, честно, на си не нашел, нашел только на ассемблере и то случайно...
Добавлено спустя 4 минуты 26 секунд:
Только что додумался поискать в гугле вводя английские запросы, кое что нашел
 
 - Код: Выделить всё • Развернуть
- * the I2C bus is connected to PORTB */
 /* the SDA signal is bit 3*/
 /* the SCL signal is bit 4 */
 #asm
 .equ __i2c_port=0x18
 .equ __sda_bit=3
 .equ __scl_bit=4
 #endasm
 /* now you can include the I2C Functions */
 #include <mega16.h>
 #include <i2c.h>
 /* function declaration for delay_ms */
 #include <delay.h>
 #define EEPROM_BUS_ADDRESS 0xa0
 /* read a byte from the EEPROM */
 unsigned char eeprom_read(unsigned char address) {
 unsigned char data;
 i2c_start();
 i2c_write(EEPROM_BUS_ADDRESS);
 i2c_write(address);
 i2c_start();
 i2c_write(EEPROM_BUS_ADDRESS | 1);
 data=i2c_read(0);
 i2c_stop();
 return data;
 }
 /* write a byte to the EEPROM */
 void eeprom_write(unsigned char address, unsigned char data) {
 i2c_start();
 i2c_write(EEPROM_BUS_ADDRESS);
 i2c_write(address);
 i2c_write(data);
 i2c_stop();
 /* 10ms delay to complete the write operation */
 delay_ms(10);
 }
 void main(void) {
 unsigned char i;
 DDRD = 0xff;
 PORTD = 0x00;
 delay_ms(1000);
 /* initialize the I2C bus */
 i2c_init();
 /* write the byte 55h at address AAh */
 eeprom_write(0xaa,0x55);
 /* read the byte from address AAh */
 i=eeprom_read(0xaa);
 PORTD = i;
 while (1); /* loop forever */
 }
Добавлено спустя 14 минут 24 секунды:
А можете пояснить что значат эти строки:
- Код: Выделить всё • Развернуть
- .equ __i2c_port=0x18
 .equ __sda_bit=3
 .equ __scl_bit=4

 
 





 
 
