A Color Vision System for Embedded Robotics Applications

Click here to return to article

'C' function: Retrieve Image



//---------- Not shown here, but remember to turn off processor cacheing for areas listed below
#define RESET_CAPTURE_ADDRESS *(unsigned char volatile *)(FPGA2_BASE_ADDR + DISPLAY_TOP + 0X18)
#define PROC_READ_DATA *(unsigned char volatile *)(FPGA2_BASE_ADDR + DISPLAY_TOP + 0X19)
#define PROC2_READ_DATA *(unsigned char volatile *)(FPGA2_BASE_ADDR + DISPLAY_TOP + 0X1A)

void retrieve_Image(void)
{
unsigned short int i;
unsigned short int j;
unsigned char range_data, range2_data;

	RESET_CAPTURE_ADDRESS = 0xff;
	for(j = 0, j < 240, j++)
	{
     	feed_watchdog();		// Must pet the watch dog as this is currently set up as blocking
     								// and the send fifo is pretty small...
		for(i = 0, i < 320, i++)
		{
			range_data = PROC_READ_DATA;
			range2_data = PROC2_READ_DATA;
			dprintf("%c",(range_data & 0x7C) << 1);	// Red
			dprintf("%c",((range_data & 0x03) << 6) + ((range2_data & 0xE0) >> 2));	// Green
			dprintf("%c",((range2_data & 0x1f) << 3));	// Blue
		}
	}		
	return;
}

Click here to return to article