[an error occurred while processing this directive]
(+)
(«Телесистемы»: Конференция «Микроконтроллеры и их применение»)

миниатюрный аудио-видеорекордер mAVR

Отправлено винтик 14 июля 2006 г. 14:33
В ответ на: да мож, наконец-то, покажите Ваше произведение,а? отправлено <font color=gray>glamur</font> 14 июля 2006 г. 14:21


void main(void)
{
init_devices();
while(1)
{
label0: if (RTEEPROMReady())
{RTEEPROMwrite(1, 0x155/*0b101010101*/);}
else {goto label0;}
label1: if (RTEEPROMReady())
{RTEEPROMwrite(2, 0b101111101);}
else {goto label1;}

label2: if (RTEEPROMReady())
{PORTC = RTEEPROMread(1);}
else {goto label2;}
Delay(80000);//пауза
label3: if (RTEEPROMReady())
{PORTC = RTEEPROMread(2);}
else {goto label3;}
Delay(80000);//пауза
}
}


файл подцепил из примера


unsigned char RTEEPROMReady(void)
{
return !(EECR & 0x02);
}

// function to initiate an EEPROM write
// writes the specified data byte to the specified location
// this will fail if the EEPROM is not ready!
void RTEEPROMwrite(int location, unsigned char databyte)
{
unsigned char savedSREG;
EEAR = location; // set address
EEDR = databyte; // set data
savedSREG = SREG; // keep setting so it can be restored
CLI(); // disable interrupts
EECR |= BIT(EEMWE) & BIT(EEWE); // set "write enable" bit
EECR |= BIT(EEWE); // set "write" bit
SREG = savedSREG; // restore SREG
EEAR = 0;
}

// function to read from the EEPROM
// reads a byte from the specified location
// this will fail if the EEPROM is not ready!
unsigned char RTEEPROMread(int location)
{
EEAR = location; // set address
EECR |= BIT(EERE); // set "read enable" bit
EEAR = 0;
return (EEDR);
}


Составить ответ  |||  Конференция  |||  Архив

Ответы


Отправка ответа

Имя (обязательно): 
Пароль: 
E-mail: 

Тема (обязательно):
Сообщение:

Ссылка на URL: 
Название ссылки: 

URL изображения: 


Rambler's Top100 Рейтинг@Mail.ru
Перейти к списку ответов  |||  Конференция  |||  Архив  |||  Главная страница  |||  Содержание