OV7670 yes OV(OmniVision) One made by the company 1/6 Inch CMOS VGA image sensor . The sensor is small in size , Low working voltage , Provide single piece VGA
All functions of camera and image processor . adopt SCCB bus control , The whole frame can be output , Subsampling , All kinds of resolution in the way of window 8 Bit image data . This product VGA Image up to 30
frame / second . Users can fully control image quality , Data format and transmission mode . All image processing functions including gamma curve , White balance , Chroma and so on can pass SCCB Interface programming .





  At present, the author is still debugging the camera module , So the specific lower computer part , Will be recorded later .


  The source code of the host computer program <https://github.com/jack13163/OV7670>
It's on github upper , It contains the project file , If only the procedure is needed , You can email me . It should be noted that , The upper computer communicates with the lower computer through the serial port , therefore , For different lower computers , It needs different upper computers . There are still some imperfections in the upper computer of the author , If you need reference , Remember to modify it according to your lower computer , Or as I'm going to do next , Modify your lower computer program for testing , This is to OV7670 Color bar test of .

1. Lower machine ( singlechip , What I use is STM32ZET6( Core board ))

The following is a single-chip computer simulation generated color bar program section


// Test of color bar generated by single chip microcomputer void OV7670_CreatColor() { uint16_t i,j,k = 0; uint16_t color = 0;
// Column cache uint16_t buff[320]; while(1) { // Data start ( From top to bottom , Left to right ) printf("data:\n");
for(i=0;i<240;i++) { printf("L");// Column valid for(j=0;j < 320;j++)// A column { // Generate color bar 9E
F7,8D EF ,9E 3F,83 1F,FF F0,43 D9,95 28,82 10 if(i < 30) { color = 0x9EF7;
}else if(i < 60) { color = 0x8DEF; }else if(i < 90) { color = 0x9E3F; }else
if(i < 120) { color = 0x831F; }else if(i < 150) { color = 0xFFF0; }else if(i <
180) { color = 0x43D9; }else if(i < 210) { color = 0x9528; }else { color =
0x8210; } buff[j] = color; } // Prepare a list of data for(k=0;k<320;k++) { printf("%04X",
buff[k]);// Print color bar } printf("\n"); } } }


 2. Upper computer ( use C# and VS2015 development )


The upper computer mainly receives the data sent by the lower computer , And display the data in the PictureBox in , Events that need to use serial port class to monitor whether data arrives

DataReceived.


/// <summary> /// Serial data arrival event /// </summary> /// <param name="sender"></param>
/// <param name="e"></param> private void Sp_DataReceived(object sender,
SerialDataReceivedEventArgs e) { string data; Color[] colors; // Check whether the serial port is open if
(isOpen) { // Code areas where unexpected errors may occur try { // Detect whether to start sending data if
(sp.ReadLine().Equals("data:")) { start = true; } // Start reading data if (start) {
// Drawing an image ( Draw column by column ) for (int Xcount = 0; Xcount < 240; Xcount++) { if (isOpen) {
// Read a column data = sp.ReadLine(); if (data.StartsWith("L"))// Column valid { colors =
RGBToBitmap(data.Substring(1)); } else { return; } } else { return; } for (int
Ycount = 0; Ycount < 320; Ycount++) { OvImage.SetPixel(Xcount, Ycount,
colors[Ycount]); } this.pbImage.Image = OvImage; } start = false;// End of receiving data } }
catch (Exception ex) { return; } } }
For the code of other parts, see github Code on , If there is an error , Welcome to criticize and correct , Test effect of simulated color strip .