OCR1A is 8-bits short

My new Mega 2560 isn’t accepting 16-bit values into OCR1A.
Code and output follow…

  //
  #include <avr/io.h>
  #include <avr/interrupt.h>
  //
  /////// Throttle definitions ////////////////////////////////////////////////////////////////
  //
  #define PULSE_MAX           1900        // full throttle -- range must be 800
  #define PULSE_MID           1500        //
  #define PULSE_MIN           1100        //
  //
  #define THRO_PIN_OUT        11          //
  #define THRO_PIN_IN         A8          // 
  // 
  uint32_t millisCurrent;
  uint32_t millisLongLoop;
  //
  ///////////// throttle controls /////////////////////////////////////////////////////////////
  //
  volatile uint16_t receiverPulseCount    = 0;        // counts 20ms cycles -- used as a timer
  volatile uint16_t throttlePulseIn       = 0;        // current throttle pulse length
  volatile uint16_t throttlePulseRaw      = 0;        // throttle pulse before adjustments
  //
  ///////////// setup inputs /////////////////////////////////////////////////////////////////
  //
  #define ENABLE_PINS_23_16      PCICR|=(1<<PCIE2)
  #define ENABLE_THRO_IN         PCMSK2|=(1<<PCINT16)
  //
  void enableInputPins()
  { cli();
    ENABLE_PINS_23_16;
    ENABLE_THRO_IN;
    sei();
  }
  ///////////// setup output timers /////////////////////////////////////////////////////////////
  //
  void startOutputTimers()
  { 
    pinMode(THRO_PIN_OUT,OUTPUT);
    //
    TCCR1A  |=  (1<<WGM11);                      // fast PWM, TOP=ICR
    TCCR1B  |= ((1<<WGM13)|(1<<WGM12));          // 
    TCCR1A  |=  (1<<COM1A1);                     // clear on Compare Match, set at BOTTOM
    TCCR1B  |=  (1<<CS11);                       // set the prescaler to 8
  }
  //////////// process Throttle Input on pin A8 ///// ///////////////////////////////////////
  //
  ISR(PCINT2_vect, ISR_BLOCK)
  { static uint32_t throttlePulseStart;
    //
    if (PINK & (1<<PINK0))                   // start of throttle pulse
    { throttlePulseStart = micros();         // start measuring pulse length
      return;                                // 
    }
    receiverPulseCount++;                    // count this pulse
    throttlePulseRaw = micros() - throttlePulseStart;                    // get the pulse length
    throttlePulseIn  = constrain(throttlePulseRaw,PULSE_MIN,PULSE_MAX);  // adjust
    //
    OCR1A = throttlePulseIn*2;              // set compare match value
  }
  //////////////// display readings ////////////////////////////////////////
  //
  void logDisplay() 
  { Serial.print("Pulses: ");
    Serial.print(receiverPulseCount);
    Serial.print("/");
    Serial.print(throttlePulseRaw);
    Serial.print("/");
    Serial.print(throttlePulseIn);
    Serial.print("/");
    Serial.print(ICR1);
    Serial.print("/");
    Serial.print(OCR1A);
    Serial.println("");
  }
  ///////////////  SETUP  //////////////////////////////////////////////////
  void setup()
  { Serial.begin(57600);
    enableInputPins();
    startOutputTimers;
    ICR1 =  40000;
    millisLongLoop = millis();
  }
  ///////////////  MAIN LOOP  //////////////////////////////////////////////
  void loop()
  { millisCurrent = millis();
    //
    //-- long loop runs at about 10hz -------------------------------------
    if ((millisCurrent-millisLongLoop) >= 100)
       { millisLongLoop = millisCurrent;
         //
         logDisplay();
       }
  }
///////////// the end //////////////////////////////////////////////////////

SAMPLE OUTPUT: OCR1A has only low order 8-bits?!

Pulses: 5/1084/1100/40000/152
Pulses: 9/1084/1100/40000/152
Pulses: 14/1084/1100/40000/152
Pulses: 18/1084/1100/40000/152
Pulses: 23/1084/1100/40000/152
Pulses: 27/1084/1100/40000/152

This reproduces your problem:

void setup ()
  {
  Serial.begin (115200);
  Serial.println ();

  OCR1A = 0x4256;
  Serial.println (OCR1A, HEX);
  }  // end of setup

void loop () { }

Output:

56

However:

void setup ()
  {
  Serial.begin (115200);
  Serial.println ();

  TCCR1A = 0;             
  OCR1A = 0x4256;
  Serial.println (OCR1A, HEX);
  }  // end of setup

void loop () { }

Output:

4256

I think the explanation is that some modes of operation do not update OCR1A immediately (it is double-buffered). Stopping the timer before setting OCR1A appears to fix this.

Thank you Nick. I've been tearing out my hair because although the Uno and Mega documentation appears to be "identical" for the 16-bit timers, my Uno code didn't work. I have made a couple of code changes and it's working now.

Your fundamental flaw could perhaps be here:

void startOutputTimers()
  { 
    pinMode(THRO_PIN_OUT,OUTPUT);
    //
    TCCR1A  |=  (1<<WGM11);                      // fast PWM, TOP=ICR
    TCCR1B  |= ((1<<WGM13)|(1<<WGM12));          // 
    TCCR1A  |=  (1<<COM1A1);                     // clear on Compare Match, set at BOTTOM
    TCCR1B  |=  (1<<CS11);                       // set the prescaler to 8
  }

You never set TCCR1A to zero, so you are ORing in bits without being aware of their start status. The init() function does some initial setup, I believe, so you can’t rely on the timers being in a certain state.