Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
00001 #include "mbed.h" 00002 #include "ov7670.h" 00003 00004 00005 #define I2C_D 00006 #define I2C_CLK 00007 #define VSYNC 00008 #define HREF 00009 #define WEN 00010 //#define PORT 00011 #define MASK 00012 #define RRST 00013 #define OE 00014 #define RCLK 00015 00016 DigitalOut led_red(LED_RED); 00017 OV7670 camera(I2C_D,I2C_CLK,VSYNC,HREF,WEN,PORT,MASK,RRST,OE,RCLK); 00018 Serial pc(USBTX,USBRX); 00019 00020 00021 int main() 00022 { 00023 00024 int i ; 00025 pc.printf("Camera resetting..\r\n") ; 00026 00027 camera.Reset() ; 00028 00029 pc.printf("Before Init...\r\n") ; 00030 pc.printf("Lecture Registres...\r\n") ; 00031 pc.printf("AD : +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F") ; 00032 for (i=0;i<OV7670_REGMAX;i++) { 00033 int data ; 00034 data = camera.ReadReg(i) ; // READ REG 00035 if ((i & 0x0F) == 0) { 00036 pc.printf("\r\n%02X : ",i) ; 00037 } 00038 pc.printf("%02X ",data) ; 00039 } 00040 00041 pc.printf("\r\n") ; 00042 camera.InitQQVGA() ; 00043 00044 pc.printf("After Init...\r\n") ; 00045 pc.printf("AD : +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F") ; 00046 for (i=0;i<OV7670_REGMAX;i++) { 00047 int data ; 00048 data = camera.ReadReg(i) ; // READ REG 00049 if ((i & 0x0F) == 0) { 00050 pc.printf("\r\n%02X : ",i) ; 00051 } 00052 pc.printf("%02X ",data) ; 00053 } 00054 pc.printf("\r\n") ; 00055 00056 // CAPTURE and SEND LOOP 00057 while(1) 00058 { 00059 pc.printf("Hit Any Key to send RGBx160x120 Capture Data.\r\n") ; 00060 while(!pc.readable()) ; 00061 pc.getc() ; 00062 camera.CaptureNext() ; 00063 while(camera.CaptureDone() == false) ; 00064 pc.printf("*\r\n") ; 00065 camera.ReadStart() ; 00066 i = 0 ; 00067 for (int y = 0;y < SIZEY;y++) { 00068 int r,g,b,d1,d2 ; 00069 for (int x = 0;x < SIZEX;x++) { 00070 d1 = camera.ReadOneByte() ; // upper nibble is XXX , lower nibble is B 00071 d2 = camera.ReadOneByte() ; // upper nibble is G , lower nibble is R 00072 b = (d1 & 0x0F) ; 00073 g = (d2 & 0xF0) >> 4 ; 00074 r = (d2 & 0x0F) ; 00075 pc.printf ("%1X%1X%1X",r,g,b) ; 00076 } 00077 pc.printf("\r\n") ; 00078 } 00079 camera.ReadStop() ; 00080 } 00081 }
Generated on Wed Jul 13 2022 22:19:35 by
1.7.2