External PWM IC for arduino

Now we're getting close to a specification that can be implemented. The maximum cycle time is 500µs. At 16 ticks per µs that's 8000 ticks, well within the capability of Timer1 (65536 ticks).

void setup()
{
  Serial.begin(115200);
  delay(200);


  pinMode(10, OUTPUT); // OC1B pin
  TCCR1A = 0;
  TCCR1B = 0;

  // Set WGM15: FastPWM, OCR1A is TOP
  TCCR1A |= _BV(WGM11) | _BV(WGM10);
  TCCR1B |= _BV(WGM13) | _BV(WGM12);

  // Enable FastPWM on OC1B (Pin 10)
  TCCR1A |= _BV(COM1B1);

  OCR1A = 7999; // 500 microseconds (8000 ticks) cycle time
  OCR1B = 6400; // 400 microseconds (6400 ticks) on time

  // Start the timer running with a prescale of 1
  TCCR1B |= _BV(CS10);
}

void loop()
{
  unsigned TotalTicks;
  if (Serial.available())
  {
    unsigned highTicks = Serial.parseInt();
    unsigned lowTicks = Serial.parseInt();
    if (highTicks != 0 && lowTicks != 0)
    {
      TotalTicks = highTicks + lowTicks;
      OCR1A = TotalTicks - 1;  // TOP
      OCR1B = highTicks;
    }
  }
}