Electronic Speed Controller makes unknown beeps

I think the error was with how I was giving the throttle input to the ESC. I had been using the servo library to generate the ESC signals but yesterday I changed the code to provide manual signals. I stored the esc_pulse values as an integer but after I change the data type of the variable to an unsigned long the issue goes away.

Data type could have been the issue because I was comparing an integer to a long to generate the ESC signals

void applyMotorSpeed() {
  while ((now = micros()) - loop_timer < period);

    // Update loop timer
    loop_timer = now;

    // Set pins #4 #5 #6 #7 HIGH
    PORTD |= B11110000;

    // Wait until all pins #4 #5 #6 #7 are LOW
    while (PORTD >= 16) {
        now        = micros();
        difference = now - loop_timer;

        if (difference >= throttle) PORTD &= B11101111; // Set pin #4 LOW
        if (difference >= throttle) PORTD &= B11011111; // Set pin #5 LOW
        if (difference >= throttle) PORTD &= B10111111; // Set pin #6 LOW
        if (difference >= throttle) PORTD &= B01111111; // Set pin #7 LOW
    }
}

This is my code, the throttle variable was an integer and it was being compared to the difference variable which is a long