資料包含STM32F103驅動TSL1401線性CCD模塊代碼,上位機,指導手冊和拉普蘭德及逐飛紅孩兒CCD資料。本項目使用單片機為正點原子MINI板,CCD為逐飛科技紅孩兒CCD,上位機為拉普蘭德線性CCD調試助手。實際任意一款STM32F103單片機均可使用本代碼驅動TSL1401線性CCD模塊。由于逐飛科技紅孩兒TSL1401線性CCD模塊已停產,可以選用龍邱科技或者平衡小車之家的線性TSL1401線性C
單片機源程序如下:- #include "timer.h"
- #include "adc.h"
- #include "led.h"
- #include "delay.h"
- #include "sys.h"
- #include "usart.h"
- #include "ccd.h"
- #include "rcc.h"
- #include "lcd.h"
- #include "lapland.h"
- //該代碼能實現STM32驅動CCD采集灰度值,
- //并通過串口助手查看灰度值,或通過上位機
- //查看CCD采集灰度信息
- //對應引腳 SI=PC.5 CLK=PC.4 AO=PA.2
- u8 IntegrationTime=10;
- u8 TIME1flag_1ms=0;
- u8 TIME1flag_20ms=0;
- int main(void)
- {
- u8 Pixel[128];
- volatile u8 i,j;
- u8 *pixel_pt;
- SystemInit();
- delay_init(); //延時函數初始化
- NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
- RCC_Configuration();
- uart_init(115200); //串口初始化為115200
- Adc_Init(); //ADC初始化
- LED_Init(); //初始化與LED連接的硬件接口
- // LCD_Init();
- GPIO_CCD();
- TIM3_Int_Init(2,7200);
-
- //CCD采樣數據緩沖區初始化
- pixel_pt=Pixel;
- for(i=0;i<128;i++)
- {
- *pixel_pt++=0;
- }
- /*
- while(1)//CCD采樣并發送到串口助手
- {
- if(TIME1flag_1ms==1)
- {
- TIME1flag_1ms=0;
- }
- if(TIME1flag_20ms==1)
- {
- TIME1flag_20ms=0;
- ImageCapture(Pixel);//CCD采樣
- CalculateIntegrationTime(Pixel); //計算曝光時間
- for(j=0;j<128;j+=8)//發送數據到串口助手,每隔8個發送1個灰度值,共發送128/8=16個
- {
- printf("%5d",Pixel[j]);
- }
- printf(" \n");
- }
- }
- */
- while(1)//CCD采樣并發送到上位機
- {
- if(TIME1flag_1ms==1)
- {
- TIME1flag_1ms=0;
- }
- if(TIME1flag_20ms==1)
- {
- TIME1flag_20ms=0;
- ImageCapture(Pixel);//CCD采樣
- CalculateIntegrationTime(Pixel); //計算曝光時間
- }
- CCD_send(Pixel);//發送數據到拉普蘭德CCD調試助手
- }
-
- }
復制代碼
全部資料51hei下載地址:
STM32F103驅動TSL1401線性CCD模塊.7z
(6.25 MB, 下載次數: 361)
2019-6-15 04:00 上傳
點擊文件名下載附件
|