標(biāo)題:
STM32+ADNS3080光流傳感器測(cè)距 源程序
[打印本頁(yè)]
作者:
butterzx
時(shí)間:
2020-4-15 17:52
標(biāo)題:
STM32+ADNS3080光流傳感器測(cè)距 源程序
這是目前正在做的用ADNS3080光流傳感器做距離定位的工程,主要用來(lái)采集平面移動(dòng)時(shí),坐標(biāo)系X,Y的值。
單片機(jī)源程序如下:
/* Includes ------------------------------------------------------------------*/
#include "stm32f10x.h"
#include "usart.h"
#include "delay.h"
#include "spi.h"
#include"ADNS3080.h"
void RCC_Configuration(void);
void GPIO_Configuration(void);
int main(void)
{
RCC_Configuration();
GPIO_Configuration();
//GPIO_PinRemapConfig(GPIO_Remap_SWJ_Disable,ENABLE); //使能JATG //PB口
USART_Configuration(115200);
delay_init(72); // 精確延時(shí)初始化
delay_ms(10);
ADNS3080_Init();
delay_ms(10);
// printf("%d\n",read_zhenlv());//(3000幀/秒)24000000/3000幀每秒=8000 4800則5000幀
// delay_ms(10);
// printf("%d\n",read_register(Motion)&0x01);//等于1則為1600分辨率
// delay_ms(10);
// printf("%f\n",read_average_pixel()); //平均像素
//read_pixel(); //圖像顯示 鏡頭焦距為8毫米時(shí)離鏡座3毫米時(shí)最清
// read_pixel_burst(); //爆發(fā)方式顯示圖像
while (1)
{
Read_Data_burst(); //用爆發(fā)讀
delay_ms(10);
}
}
void RCC_Configuration(void)
{
SystemInit();// 啟動(dòng)時(shí)鐘 PLL and Flash
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA|RCC_APB2Periph_GPIOB|RCC_APB2Periph_GPIOC|RCC_APB2Periph_GPIOD|RCC_APB2Periph_AFIO,ENABLE);// 時(shí)鐘全打開(kāi)了
}
void GPIO_Configuration(void)
{
GPIO_InitTypeDef GPIO_InitStructure; //定義一個(gè)結(jié)構(gòu)體
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2;//選擇LED管腳
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; //管腳頻率為50MHZ
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; //模式為推挽輸出
GPIO_Init(GPIOD, &GPIO_InitStructure); //初始化GPIOB寄存器
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4|GPIO_Pin_8;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode =GPIO_Mode_Out_PP; //推挽輸出
GPIO_Init(GPIOA, &GPIO_InitStructure);
}
復(fù)制代碼
所有資料51hei提供下載:
ADNS3080測(cè)距離.7z
(1.03 MB, 下載次數(shù): 108)
2020-4-15 18:46 上傳
點(diǎn)擊文件名下載附件
基于STM32F103ZE的光流傳感器傳平面移動(dòng)距離采集
下載積分: 黑幣 -5
作者:
FEIJI1998
時(shí)間:
2021-11-8 11:24
您好,這個(gè)項(xiàng)目的使用效果是怎樣的,數(shù)據(jù)怎么跟別的系統(tǒng)對(duì)接
作者:
32_51_w
時(shí)間:
2024-9-20 15:20
您好 我想問(wèn)一下那個(gè)SROM是干什么用的
歡迎光臨 (http://www.torrancerestoration.com/bbs/)
Powered by Discuz! X3.1