
Date: 16/3/2009
Microchip PICs are the MCU of choice in a wide variety of applications, thanks to the unique combination of cost, features and performance they offer. Among the emerging applications that Microchip is currently addressing, CMOS sensors for video surveillance applications pose particular challenges, even for a well established PIC aficionado.
CMOS video sensor configurations are quite complicated and in order to pilot one it’s essential that the PIC features a dedicated video port. The PIC 16F87 is an ideal solution.
The next challenge is the actual image acquisition: Based in the heart of Paris, Cynove www.cynove.com is a specialist in the implementation of video solutions based around its proprietary CMOS sensor technology, which is easily adaptable to any USB 2.0 High Speed link or DSP specification. The company offers an innovative DSP-based camera module (DSPCAM) which enable the PIC MCU to acquire images very simply via a UART link.
The DSPCAM camera module features a SendOrder function (BYTE * Buffer, short length) that sends orders to the camera board through the UART, and a corresponding ReceiveAnswer function (BYTE * Buffer, short * plength) that receive answers from the camera board. The Camera_Power (int on) function powers the camera up or down as and when required by the application.
The Cynove camera module can be adapted to any resolution required by the sensor application. Even MPEG4 encoding is achievable.
Schematic Application
Software:
Thanks to the functionality provided by the PIC16F87 and the DSPCAM it is easy to obtain the image from the Cynove Camara module. To illustrate this the required code, in C, is provided below:
BYTE Buffer[256];
int jpeg_length;
int i;
Camera_Power(1);
Sleep(1);
Buffer[0] = 0x01;
Buffer[1] = 0x98; // order to acquire and compress an image
SendOrder(Buffer,2);
Buffer[0] = 0x01;
Buffer[1] = 0x91;
SendOrder(Buffer,2); // order to ask jpeg file size
ReceiveAnswer(&jpeg_length,4);
for (i=0; i {
// ask for 256 bytes of jpeg file from offset i
Buffer[0] = 0x01;
Buffer[1] = 0x94;
Buffer[2] = (i >> 24) & 0xFF;
Buffer[3] = (i >>16)&0xFF;
Buffer[4] = (i>>8)&0xFF
Buffer[5] = i & 0xFF;
Buffer[6] = (256 >> 8) & 0xFF;
Buffer[7] = (256) & 0xFF;
SendOrder(Buffer,8);
ReceiveAnswer(Buffer,256);
// deal with part of jpeg file
Camera_Power(0)
