学前班
最后登录1970-1-1
在线时间 小时
注册时间2015-12-15
|
我做了一个自动浇花系统,用到温湿度DHT11例程、以太网例程和照相机例程,我将三个程序结合起来,修改了一些设置,可是三个功能无法同时运行,因为以太网是死循环,无法跳转出来,如果跳转出来,则以太网程序就无法运行。下面是我的主程序,其中的问题很多,求教大家
DHT11_Data_TypeDef DHT11_Data;
__IO uint32_t LocalTime = 0;
extern uint8_t Ov7725_vsync;
volatile uint8_t camera_flag;
int main(void)
{
LCD_Init();
LCD_Clear(0, 0, 240, 320, BACKGROUND);
USART2_Config();
LED_GPIO_Config();
DHT11_GPIO_Config();
EXTI_PC13_Config();
Sd_fs_init();
USART1_Config();
ENC_SPI_Init();
LwIP_Init();
httpd_init();
CMD_init();
while ( 1 )
{
SysTick2_Init();
if( Read_DHT11(&DHT11_Data)==SUCCESS)
{
printf("\r\n\r\n\r\n%d.%d , %d.%d\r\n",\
DHT11_Data.humi_int,DHT11_Data.humi_deci,DHT11_Data.temp_int,DHT11_Data.temp_deci);
printf("\r\n:%d,%d \r\n" ,DHT11_Data.humi_int,DHT11_Data.temp_int);
LCD_DispStr(10, 110, (uint8_t *)"humidity:", WHITE);
LCD_DisNum(64, 110, DHT11_Data.humi_int, WHITE);
LCD_DispStr(10, 130, (uint8_t *)"temperature:", WHITE);
LCD_DisNum(82, 130, DHT11_Data.temp_int, WHITE);
if(DHT11_Data.humi_int<50&&DHT11_Data.temp_int<50)
{
LED1(1);
}
else
{
LED1(0);
}
}
else
{
printf(" ERROR\r\n");
LCD_DispStr(10, 110, (uint8_t *)" ERROR",WHITE);
LED1(0);
}
if(camera_flag == 1)
Ov7725_GPIO_Config();
while(Ov7725_Init() != SUCCESS);
VSYNC_Init();
Ov7725_vsync = 0;
while(1)
{
{
if( Ov7725_vsync == 2 )
{
FIFO_PREPARE;
ImagDisp();
Ov7725_vsync = 0;
}
SysTick_Init();
LwIP_Periodic_Handle(LocalTime);}}
}
}
|
|