Home > other >  Refer [new] stm32 + OV7670 + ILI9341 stuck problems
Refer [new] stm32 + OV7670 + ILI9341 stuck problems

Time:11-20

Recently started to contact stm32, still stand a book wrote a OV7670 on TFT display program, completely according to the book did not appear what problem, the program but I again on this foundation to add their own things stuck in the problem, after

# # code:
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
It is my own program, but will appear after add stuck problem
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

 

# include "stm32f10x. H"
# include "delay. H"
# include "led. H"
# include "TFT. H"
# include "led. H"
# include "ov7670. H"
# include "GUI. H"
# include "EasyTracer. H"

Extern u8 ov_sta;//frame number, setting flags

//? Update the LCD display
Void camera_refresh (void)
{
U32 j;
Under-16 color;

If (ov_sta==2)//whether buffer to save video data
{

OV7670_RRST_0;//reset the read pointer
OV7670_RCK_0;
OV7670_RCK_1;
OV7670_RCK_0;
OV7670_RRST_1;//reset the read pointer end
OV7670_RCK_1;


TFT_RS_1;//write data line up and improve the write speed

for(j=0; j<76800;//resolution 240 x320 j++), 16 bits of each color, so need to 240 * 320 * 2=76800
{
OV7670_RCK_0;//read data every clock jump
Color=GPIOD - & gt; IDR& 0 xff00;//read color high byte
OV7670_RCK_1;

OV7670_RCK_0;
Color |=((GPIOD - & gt; IDR& 0 xff00) & gt;> 8);//read color low byte
OV7670_RCK_1;

GPIOB - & gt; BRR=GPIO_Pin_All;//clear register data
GPIOB - & gt; BSRR=color;//will be collected the color value is assigned to PB mouth register

TFT_WR_0;//write
TFT_WR_1;
}

/* * if let TFT here on the basis of the display camera captured images, to show other things form the image on the cover/* *
GUI_fill_box (50,50,100,100, Blue);//(the starting coordinates x, y, length, width, color), according to a specific color solid rectangular
/* * * * * * * * * * * * * * * * * * will card in the camera to capture the first frame of the image on the * * * * * * * * * * * * * * * * * * * * * * * * * * */

EXTI_ClearITPendingBit (EXTI_Line0);//clear the interrupt flag bit on the LINE8
Ov_sta=0;//start the next acquisition

}
}

Int main (void)
{
U8 lightmode=0, saturation=2, brightness=2, contrast=2;
U8 effect=0;


Delay_init ();//delay function to initialize the
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
LED_Init ();//initializes the hardware interface, which is connected with the LED
Lcd_Init ();//LCD initialization
TFT_CS (0);//open the LCD tablet can make
GUI_Clear (White);//clear screen
OV_Gpio_Init ();

While (OV_Init ()!=0)//initialization OV7670
{
GUI_sprintf_hzstr16x (20150, "OV7670 Loading!!!!!! ", Blue, White);
delay_ms(500);
GUI_sprintf_hzstr16x (20150, "", Blue, White);
Delay_ms (100);
}

GUI_Clear (Red);//initialization complete red screen clearing

//camera parameter Settings
OV7670_Light_Mode (lightmode);
OV7670_Color_Saturation (saturation);
OV7670_Brightness (brightness);
OV7670_Contrast (contrast);
OV7670_Special_Effects (effect);

EXTI0_Init ();//initialization in
OV7670_Window_Set (10174240320);//Settings window
OV7670_CS=0;//can make camera piece choose

LCD_scan (5);/set/TFT scanning direction: - on the right and left

,0,319,239,0,0 Address_set (0);//the scanning direction change, origin also change

TFT_RS_1;//data line up, and improve the write speed

While (1)//constantly refresh camera
{
Camera_refresh ();
}
}

CodePudding user response:

Add back not to brush full screen, and then want to show that camera data needs to be set the address

CodePudding user response:

Thank you for your bosses!!!!!!
  • Related