[an error occurred while processing this directive]
|
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);
}