久久久久久久999_99精品久久精品一区二区爱城_成人欧美一区二区三区在线播放_国产精品日本一区二区不卡视频_国产午夜视频_欧美精品在线观看免费

 找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 4354|回復: 3
打印 上一主題 下一主題
收起左側

STM32F429攝像頭(OV5642)二維碼識別源碼

[復制鏈接]
跳轉到指定樓層
樓主
ID:267076 發表于 2018-6-20 15:34 | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式
STM32F429 + OV5642 攝像頭 二維碼識別 KEIL 程序,上傳分享

單片機源程序如下:
  1. /**
  2.   * @file    main.c
  3.   * @author  WB R&D Team - openmcu666
  4.   * @version V0.1
  5.   * @date    2016.08.24
  6.   * @brief   Main Program body
  7.   */

  8. #include "stm32f4xx.h"
  9. #include "Gpio.h"
  10. #include "usart.h"
  11. #include "delay.h"
  12. #include "stm32f429i_lcd.h"
  13. #include "ov7670.h"
  14. #include "ov2640.h"
  15. #include "ov5642.h"
  16. #include "mt9d111.h"
  17. #include "CamConfig.h"
  18. #include "sccb_bus.h"
  19. #include "RTC.h"
  20. #include "string.h"
  21. #include "QR_Decoder.h"

  22. //only for OV5642

  23. /*****************************************************************************
  24. **   Main Function  main()
  25. ******************************************************************************/
  26. int main(void)
  27. {
  28.         uint16_t temper;
  29.         char  qr_type_len=0;
  30.   short qr_data_len=0;
  31.   char qr_type_buf[10];
  32.   char qr_data_buf[512];
  33.   int addr=0;
  34.   int i=0,j=0;
  35.   char qr_num=0;
  36.        
  37.        
  38.         USART1_Init();
  39.         //LED_Init();
  40.   Key_Init();
  41.         BEEP_Init();
  42.         printf("\r\n");
  43.         printf("Hello Welcome.\r\n");
  44.         printf("Thank You For Choosing Our Products.\r\n");
  45.         printf("Thank You Very Much.\r\n");
  46.         printf("This Example Camera.\r\n");
  47.         printf("\r\n");
  48.         printf("DCMI Initialization...\r\n");
  49.         LCD_Init();
  50.         LCD_LayerInit();
  51.   LTDC_Cmd(ENABLE);
  52.   LCD_SetLayer(LCD_BACKGROUND_LAYER);  
  53.         LCD_SetTransparency(0xFF);
  54.         LCD_Clear(BLACK);
  55.         LCD_SetLayer(LCD_FOREGROUND_LAYER); //使用前景層
  56.   LCD_SetTransparency(0xFF);          //設置透明度
  57.   LCD_Clear_ARGB8888(0x40000000);
  58.    
  59.   LCD_SetTextColor_ARGB8888(0xFFFFFFFF);
  60.   LCD_DrawFullRect_ARGB8888(Frame_Width,Frame_Width);                              //繪制透明框
  61.   
  62.   LCD_DrawBox_ARGB8888(Frame_Width,Frame_Line_Length,Frame_Line_Size,0xD05CBDE7);  //繪制掃描框
  63.        
  64.         printf("Ok,Let's Go...\r\n");
  65.        
  66.         temper = ov7670_check();         //Camera是否為OV7670
  67.          
  68.         if (temper == 0x7673)
  69.         {
  70.                 printf("Cam ID : [0x%02x]\r\n",temper);
  71.                 if (ov7670_init())
  72.                 {
  73.                         printf("Init OV7670 reg Fail...\r\n");
  74.                   while (1)
  75.                   {
  76.                                
  77.                   }
  78.                 }
  79.                 else
  80.                 {
  81.                         printf("Init OV7670 reg OK...\r\n");
  82.                         printf("Show Camer Data...\r\n");

  83.                 }               
  84.                
  85.         }
  86.         else                                       
  87.         {
  88.     temper=ov2640_check();
  89.           
  90.                 if(temper==0x2642)                        //OV2640
  91.                 {
  92.                         if (ov2640_init())
  93.                   {
  94.                         printf("Init OV2640 reg Fail...\r\n");
  95.                         while (1)
  96.                         {}
  97.                   }
  98.                   else
  99.                  {
  100.                         printf("Cam ID : [0x%02x]\r\n",temper);
  101.                         printf("Init OV2640 reg OK...\r\n");
  102.                         printf("Show Camer Data...\r\n");

  103.                  }
  104.         
  105.          }
  106.                 else                                        //ov5642 or mt9d111
  107.     {
  108.                         temper=ov5642_check();
  109.                         printf("Cam ID : [0x%02x]\r\n",temper);
  110.                   if (temper==0x5642)//mt9d111_init
  111.                   {
  112.                           ov5642_init();
  113.                           printf("Init ov5642 reg OK...\r\n");
  114.                           printf("Show Camer Data...\r\n");       
  115.                   }
  116.                  else
  117.                  {
  118.                           printf("Init ov5642 reg Fail...\r\n");                               
  119.                                 while (1){}
  120.                  }
  121.     }
  122.         }
  123. //        if(RTC_Config())                                                           //初始化RTC
  124. //        {
  125. //          printf("\r\nLSE start failed\r\n");
  126. //        }
  127. //        RTC_Set_WakeUp(RTC_WakeUpClock_CK_SPRE_16bits,0);                //配置WAKE UP中斷,1秒鐘中斷一次,用于統計幀率
  128.   systick_delay_ms(100);
  129.         ov5642_auto_focus();
  130.         cam_start();
  131.        
  132.         while (1)
  133.   {
  134.     qr_num = QR_decoder();
  135.                  if(qr_num)
  136.       {
  137.          GPIO_SetBits(BEEP_GPIO_PORT,BEEP_GPIO_PIN);
  138.                                  systick_delay_ms(100);
  139.                                  GPIO_ResetBits(BEEP_GPIO_PORT,BEEP_GPIO_PIN);
  140.          //解碼的數據是按照識別條碼的個數封裝好的二維數組,這些數據需要
  141.          //根據識別條碼的個數,按組解包并通過串口發送到上位機串口終端
  142.          for(i=0;i < qr_num;i++)
  143.          {
  144.            qr_type_len = decoded_buf[i][addr++];//獲取解碼類型長度
  145.                
  146.             for(j=0;j < qr_type_len;j++)
  147.                  qr_type_buf[j]=decoded_buf[i][addr++];//解碼類型
  148.                
  149.              qr_data_len  = decoded_buf[i][addr++]<<8; //解碼數據的高8位
  150.              qr_data_len |= decoded_buf[i][addr++];    //解碼數據的低8位
  151.                
  152.              for(j=0;j < qr_data_len;j++)
  153.                  qr_data_buf[j]=decoded_buf[i][addr++];//獲取解碼數據
  154.                
  155.              USART1_Send_Data((unsigned char *)qr_type_buf, qr_type_len);//串口發送解碼類型
  156.              USART1_Send_Data((unsigned char *)":", 1);           
  157.              USART1_Send_Data((unsigned char *)qr_data_buf, qr_data_len);//串口發送解碼數據
  158.              USART1_Send_Data((unsigned char *)"\r\n", 2);
  159.              addr =0;
  160.           }
  161.                
  162.        }
  163.   }
  164. }
復制代碼

所有資料51hei提供下載:
STM32F429_Camera二維碼識別.rar (1.14 MB, 下載次數: 100)


分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏4 分享淘帖 頂1 踩
回復

使用道具 舉報

沙發
ID:371593 發表于 2018-7-14 17:17 | 只看該作者
很 nice
回復

使用道具 舉報

板凳
ID:22559 發表于 2019-3-19 06:35 | 只看該作者
mark。。
回復

使用道具 舉報

地板
ID:563554 發表于 2019-12-3 19:56 | 只看該作者
優秀,頂你
回復

使用道具 舉報

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規則

手機版|小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術交流QQ群281945664

Powered by 單片機教程網

快速回復 返回頂部 返回列表
主站蜘蛛池模板: 极品电影院 | 午夜激情视频在线 | 国产重口老太伦 | 91一区二区三区在线观看 | 亚洲国产一区二区三区在线观看 | 激情五月婷婷丁香 | 色频| 日韩成人在线网址 | 日韩欧美手机在线 | 色网在线播放 | 国产精品久久欧美久久一区 | 91福利在线观看视频 | 中文字幕日韩欧美 | 国产高清精品一区二区三区 | 国产精品日本一区二区在线播放 | 一级网站| 欧美日韩在线观看视频网站 | 久久久久1 | 9999国产精品欧美久久久久久 | 欧美九九九 | 免费精品视频一区 | 国产精品精品久久久 | 亚洲欧洲成人在线 | 欧美成年人视频在线观看 | 一级二级三级黄色 | 久久久久免费精品国产 | 日本高清aⅴ毛片免费 | 国产高清视频在线观看 | 美女久久视频 | 免费精品 | 日日噜噜噜夜夜爽爽狠狠视频97 | 欧美日韩精品一区 | 黄在线免费观看 | 毛片av免费在线观看 | 97视频在线观看免费 | 欧美伊人影院 | 亚洲精品一区二区三区丝袜 | 国产精品国产 | 成人免费一级 | 青青99| 亚洲欧洲一区二区 |