So I'm programming a TSL1401R-LF line scan camera module that reads in a a 1 X 128 array of pixels. I've run into a problem with the accuracy of the output. Basically the camera becomes less accurate as the delay times decrease. For debugging I hooked it up to an oscilloscope and monitored the SI and CLK pulses sent to the clock as well as the analog signals coming from it.
That's why I noticed the the duration of the CLK signal appeared to be over 300 microseconds long. This is strange because my code sets the duration to 170 microseconds. Since this is my first electrical project I'm not sure what to make of this so I'm hoping someone can take a look at my code and a screenshot of the oscilloscope and let me know if what I'm seeing is natural or not.
Here is the code:
int delayTime = 170;
void timming()
{
//The timing for the impluses was found through direct experimentation.
//(Meaing that I played around with different delayTimes until the code worked)
digitalWriteFast(SI, HIGH);
delayMicroseconds(delayTime/2);
digitalWriteFast(CLK, HIGH);
delayMicroseconds(delayTime/2);
digitalWriteFast(SI, LOW);
delayMicroseconds(delayTime/2);
digitalWriteFast(CLK, LOW);
delayMicroseconds(delayTime);
for(int i = 0; i < 129; i++)
{
digitalWriteFast(CLK, HIGH);
delayMicroseconds(delayTime);
digitalWriteFast(CLK, LOW);
delayMicroseconds(delayTime);
}
}
Here is the screenshot
The yellow Line is the SI pulse, the light blue is the CLK pulse and the purple is the analog output.
delayMicroseconds
is off. Is this dynamically calibrated? If so, are you supposed to call something to get it calibrated? \$\endgroup\$