A Color Vision System for Embedded Robotics Applications

Given a 72 paged data sheet, a couple dozen configuration registers controling wide ranging filter values and digital interface settings, I've also provided the 'C' code I use to initialize the device:

Click here to return to article

Processor Side 'C' code to set up SAA7111A Video Input Processors

void set_Up_SAA7111(void)
{
	dprintf("\n\r ... I2C write 1 ...\n\r");
	i2c_Write(1,0x24,0x01,0x00);	// chip number, address, subaddress, value
	i2c_Write(1,0x24,0x02,0xc0); 
	i2c_Write(1,0x24,0x03,0x33); 
	i2c_Write(1,0x24,0x04,0x00); 
	i2c_Write(1,0x24,0x05,0x00); 
	i2c_Write(1,0x24,0x06,0xeb); 
	i2c_Write(1,0x24,0x07,0xe0); 
	i2c_Write(1,0x24,0x08,0x88); 
	i2c_Write(1,0x24,0x09,0x01); 
	i2c_Write(1,0x24,0x0a,0x80); 
	i2c_Write(1,0x24,0x0b,0x47); 
	i2c_Write(1,0x24,0x0c,0x40); 
	i2c_Write(1,0x24,0x0d,0x00); 
	i2c_Write(1,0x24,0x0e,0x01); 
	i2c_Write(1,0x24,0x10,0x00); 	
	i2c_Write(1,0x24,0x11,0x0c);	
	i2c_Write(1,0x24,0x12,0x00); 	
	i2c_Write(1,0x24,0x13,0x00); 
	i2c_Write(1,0x24,0x15,0x00); 
	i2c_Write(1,0x24,0x16,0x00); 
	i2c_Write(1,0x24,0x17,0x00); 

	dprintf("\r ... I2C read chip 1 ...\r");
	cuck = i2c_Read(1,0x24,0); 
	if(0x21 == cuck)
	{
		dprintf("--=> this is a valid chip number");
	}
	else
	{
		dprintf("--=> (%d) this is NOT a valid chip number",cuck);
	}
	dprintf("\r0x00(0x%x)",cuck);
	cuck = i2c_Read(1,0x24,0x02); 
	dprintf("\r0x02(0x%x)",cuck);
	cuck = i2c_Read(1,0x24,0x03); 
	dprintf("\r0x03(0x%x)",cuck);
	cuck = i2c_Read(1,0x24,0x04); 
	dprintf("\r0x04(0x%x)",cuck);
	cuck = i2c_Read(1,0x24,0x05); 
	dprintf("\r0x05(0x%x)",cuck);
	cuck = i2c_Read(1,0x24,0x06); 
	dprintf("\r0x06(0x%x)",cuck);
	cuck = i2c_Read(1,0x24,0x07); 
	dprintf("\r0x07(0x%x)",cuck);
	cuck = i2c_Read(1,0x24,0x08); 
	dprintf("\r0x08(0x%x)",cuck);
	cuck = i2c_Read(1,0x24,0x09); 
	dprintf("\r0x09(0x%x)",cuck);
	cuck = i2c_Read(1,0x24,0x0a); 
	dprintf("\r0x0a(0x%x)",cuck);
	cuck = i2c_Read(1,0x24,0x0b); 
	dprintf("\r0x0b(0x%x)",cuck);
	cuck = i2c_Read(1,0x24,0x0c); 
	dprintf("\r0x0c(0x%x)",cuck);
	cuck = i2c_Read(1,0x24,0x0d); 
	dprintf("\r0x0d(0x%x)",cuck);
	cuck = i2c_Read(1,0x24,0x0e); 
	dprintf("\r0x0e(0x%x)",cuck);
	cuck = i2c_Read(1,0x24,0x10); 
	dprintf("\r0x10(0x%x)",cuck);
	cuck = i2c_Read(1,0x24,0x11); 
	dprintf("\r0x11(0x%x)",cuck);
	cuck = i2c_Read(1,0x24,0x12); 
	dprintf("\r0x12(0x%x)",cuck);
	cuck = i2c_Read(1,0x24,0x13); 
	dprintf("\r0x13(0x%x)",cuck);
	cuck = i2c_Read(1,0x24,0x15); 
	dprintf("\r0x15(0x%x)",cuck);
	cuck = i2c_Read(1,0x24,0x16); 
	dprintf("\r0x16(0x%x)",cuck);
	cuck = i2c_Read(1,0x24,0x17); 
	dprintf("\r0x17(0x%x)",cuck);
	cuck = i2c_Read(1,0x24,0x1a); 
	dprintf("\r0x1a(0x%x)",cuck);
	cuck = i2c_Read(1,0x24,0x1b); 
	dprintf("\r0x1b(0x%x)",cuck);
	cuck = i2c_Read(1,0x24,0x1c); 
	dprintf("\r0x1c(0x%x)",cuck);
	cuck = i2c_Read(1,0x24,0x1f); 
	dprintf("\r0x1f(0x%x)",cuck);
	if((cuck & 0x40) == 0x40)
		dprintf(" video not locked");
	else
	{
		dprintf(" video locked on this channel");
		if((cuck & 0x20) == 0x20)
			dprintf(" --> (60Hz)");
		else
			dprintf(" --> (50Hz)");
	}

	if((cuck & 0x01) == 0x01)
		dprintf("\r           valid color signal detected");
	else
		dprintf("\r           no valid color data");
	if((cuck & 0x80) == 0x80)
		dprintf("\r           VTR (fast) Time Constant");
	else
		dprintf("\r           TV (slow) Time Constant");
	if((cuck & 0x04) == 0x04)
		dprintf("\r           White Peak Loop is Activiated");
	return;
}