Hello,
I want to get Pixels array from ADNS-9800. It's Datasheet says this:
Procedure of Frame Capture:
Reset the chip by writing 0x5a to Power_Up_Reset register (address 0x3a).
Enable laser by setting Forced_Disable bit (Bit-0) of LASER_CTRL) register to 0.
Write 0x93 to Frame_Capture register.
Write 0xc5 to Frame_Capture register.
Wait for two frames.
Check for first pixel by reading bit zero of Motion register. If = 1, first pixel is available.
Continue read from Pixel_Burst register until all 900 pixels are transferred.
Continue step 3-7 to capture another frame
Here's What I did:
# define REG_Motion 0x02
# define REG_Pixel_Burst 0x64
# define REG_Frame_Capture 0x12
...................
void setup()
{
//Initialization (Uploading Firmware and First two steps from Procedure of Frame Capture)
....
}
void loop()
{
adns_write_reg(REG_Frame_Capture, 0x93);
delay(1);
adns_write_reg(REG_Frame_Capture, 0xc5);
delay(2);
byte check_Motion_register = adns_read_reg(REG_Motion);
//Display Motion Register in serial monitor
Serial.println(check_Motion_register);
if(check_Motion_register == 1)
{
for(int i = 1; i <= 900; i++)
{
Serial.println(adns_read_reg(REG_Pixel_Burst));
delay(1);
}
}
delay(100);
}
But I have problems when I try to do this: When I look at Serial monitor I see that 'check_Motion_register' is always 32 or 160 and sometimes 0 but never 1 but datasheet says that it must be 1 if first pixel is ready. What am I doing wrong? How to fix this?
(NOTE: Circuit and initialization code is correct (Because it reads Delta_X and Delta_Y registers without any problem))
Did you ever figure out how to read the frames from this sensor? I'm trying to do the same thing and running into the same issue as you. I've tried a bunch of combinations of reading these registers according to the data sheet but it does not seem to return the correct data.