Using CTS camera to stream to a host

I got a CTS board connected to a Cortex M0 (LPC1227) development board to capture and display data on an attached OLED LCD display.

I could not get the LPC1227 board go over 230400 baud without data loss to test at a higher frame rate, but at this speed seems to work fine. The XBee is only used to allow serial access to the development board from the PC and display some statistics in real-time.

The code used for this is:

// initiate B&W capture
sputs(1, "FYb");
// wait for correct header (0x46 0x00 0x...)
cmd = sgetc(1);
if (cmd != 0x46) {
	sputs(0, "ERR\n");
	return 0;
cmd = sgetc(1);
if (cmd != 0x00) {
	sputs(0, "ERR\n");
	return 0;

// frame details, not used here

// capture frame
y = 0;
while (y < 120) {
	x = 0;
	while (x < 80) {
 		pixel = sgetc(1);
 		// keep only central part 96 x 64 pixels
		if (((x>15)&(x<64))&((y>27)&(y<92))){
			 pixelL = (pixel & 0x0f) <<4;
			 pixelH = (pixel & 0xf0);

// check for end frame byte
while (sgetc(1) != 0xff);

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s