How to store OCR1A value in ATmega16
#include &lt;avr/io.h&gt;

// declaration of a global variable
unsigned int my_global_16bit_variable;

int main(void)
{
    // declaration of a local variable
    unsigned int my_local_16bit_variable = 0;

    my_local_16bit_variable = OCR1A;   // assign value to the local variable
    my_global_16bit_variable = OCR1A;   // assign value to the global variable

    while(1)
    {

    }
}


The local variable is only valid inside main, the global variable can be accessed form anywhere.

If you intend to use the variable is shared between a function and an interrupt then it should be declared as global volatile.

#include &lt;avr/io.h&gt;

// declaration of a global variable
volatile unsigned int my_global_16bit_variable;
.....




To store a variable in the internal AVR eeprom

#include &lt;avr/io.h&gt;
#include &lt;avr/eeprom.h&gt;

// macro for easier usage
#define read_eeprom_word(address) eeprom_read_word ((const uint16_t*)address)
#define write_eeprom_word(address,value) eeprom_write_word ((uint16_t*)address,(uint16_t)value)

//declare an eeprom variable
unsigned int EEMEM   my_eeprom_word;

int main(void)
{

write_eeprom_word(&amp;my_eeprom_word,OCR1A);       // store value in eeprom

OCR1A = read_eeprom_word(&amp;my_eeprom_word);     // restore from eeprom

    while(1)
    {

    }
}




The variable length are shown in stdint.h

Integer types having exactly the specified width

typedef signed char     int8_t
typedef unsigned char   uint8_t
typedef signed int  int16_t
typedef unsigned int    uint16_t
typedef signed long int     int32_t
typedef unsigned long int   uint32_t
typedef signed long long int    int64_t
typedef unsigned long long int  uint64_t


You can either use unsigned int or unt16_t , I prefer the uintxx_t format