Arduino and TSL1402R Problems

Hello everyone, I have come to consult, since I have a few weeks with problems and I have not been able to reach a solution, I am working with the sensor TSL1402R (2 arrays of photosensors in a single sensor), and I need to control the clock frequency that arduino Send to make the measurements, I am working with the existing code in arduino playground but I still can not solve my problem since apparently with arduino can not generate output digital frequencies to send to the sensor that are defined by the user and can only Let arduino decide this parameter. The code I am using is the following:

int CLKpin = 5; // <-- Arduino pin delivering the clock pulses to pin 5 (CLK) of the TSL1402R
int SIpin = 4; // <-- Arduino pin delivering the SI (serial-input) pulse to pin 4 of the TSL1402R
int AOpin1 = 4; // <-- Arduino pin connected to pin 4 (analog output 1)of the TSL1402R
int AOpin2 = 5; // <-- Arduino pin connected to pin 10 (analog output 5)of the TSL1402R
int IntArray[256]; // <-- the array where the readout of the photodiodes is stored, as integers
int np = 128; //Data Number.
void setup()
{

  pinMode(CLKpin, OUTPUT);
  pinMode(SIpin, OUTPUT);

  for ( int i = 0; i < 14; i++ )
  {
    digitalWrite(i, LOW);
  }
  // Clock out any existing SI pulse through the ccd register:
  for (int i = 0; i < 260; i++)
  {
    ClockPulse();
  }
  // Create a new SI pulse and clock out that same SI pulse through the sen sor register:
  digitalWrite(SIpin, HIGH);
  ClockPulse();
  digitalWrite(SIpin, LOW);
  for (int i = 0; i < 260; i++)
  {
    ClockPulse();
  }
  Serial.begin(57600);
}

void loop()
{
  // Stop the ongoing integration of light quanta from each photodiode by clocking in a SI pulse
  // into the sensors register:
  digitalWrite(SIpin, HIGH);
  ClockPulse();
  digitalWrite(SIpin, LOW);
  // Next, read all 256 pixels in parallell. Store the result in the array. Each clock pulse
  // causes a new pixel to expose its value on the two outputs:
  for (int i = 0; i < np; i++)
  {
    // delayMicroseconds(20);// <-- We add a delay to stabilize the AO output from the sensor
    IntArray[i] = analogRead(AOpin1);
    IntArray[i + np] = analogRead(AOpin2);
    ClockPulse();
  }
  // Next, stop the ongoing integration of light quanta from each photodiode by clocking in a
  // SI pulse:
  digitalWrite(SIpin, HIGH);
  ClockPulse();
  digitalWrite(SIpin, LOW);
  // Next, send the measurement stored in the array to host computer using serial (rs -232).
  // communication. This takes ~80 ms during whick time no clock pulses reaches the sensor.
  // No integration is taking place during this time from the photodiodes as the integration
  // begins first after the 18th clock pulse after a SI pulse is inserted:
  int cont = 1;
  int aux = cont++;
  Serial.print(" linea : ");

  //Envía los datos de forma serial
  for (int i = 0; i < 2 * np; i++)
  {
    Serial.print(IntArray[i]);
    Serial.print(" ");

  }

  //delay(1000);
  Serial.println(" "); // <-- Send a linebreak to indicate the measurement is transmitted.
  for (int i = 0; i < 255; i++)
  {
    digitalWrite(CLKpin, HIGH);
    digitalWrite(CLKpin, LOW);
  }
  //delay(2);// <-- Add integration time
}
// This function generates an outgoing clock pulse from the Arduino digital pin 'CLKpin'. This clock
// pulse is fed into pin 3 of the linear sensor:
void ClockPulse()
{
  digitalWrite(CLKpin, HIGH);
  digitalWrite(CLKpin, LOW);
}

I have tried with some variants in the function void clock

void ClockPulse()
{
  TCCR0A = bit(COM0A1) | bit(COM0B1) | bit(WGM01) | bit(WGM00);
  TCCR0B = bit(WGM02) | bit(CS00);
  OCR0A = 255;
  OCR0B = 128;
}

which I understand is where the square frequency that is sent to the sensor clock pin is generated but this only has led me to erroneous reading (inverted at frequencies like 64khz and correct at frequencies like 1.8khz where the datasheet of the sensor indicates that it is not recommended to work), verifying with an oscilloscope and a signal generator I found that the arduino clock does not manage to synchronize with the frequency that I generate in the digital pin 5 like digital output and by this one Reason I do not get the data well, for all this I have worked with interruptions and arduino records.

Someone believes that there is a solution? Or Arduino Uno r3 is very limited for this type stuff?

And most important, there will be some way to control the clock frequency for the sensor work, which works in the range of 5khz to 8mhz. This frequency has to do with the integration time of the light detectors, since that is what I need to control.