1 / 27

指导老师:刘金涛 小组成员:潘志平、卢帆 张新科、于传龙、付欣悦

基于光电鼠标的光学图像导航仪研制. 指导老师:刘金涛 小组成员:潘志平、卢帆 张新科、于传龙、付欣悦. 目录. 整体构思 硬件电路设计 实验板的焊接 软件设计思路 软件的编写 总结分析. 整体构思. 光学成像系统. 上位机. 光电鼠标芯片. 单片机 系统. RS23 接口. 光学发射系统. 激光二极管. 整体思路. 芯片的选用: Avago 公司的 ADNS- 9500

belle
Download Presentation

指导老师:刘金涛 小组成员:潘志平、卢帆 张新科、于传龙、付欣悦

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 基于光电鼠标的光学图像导航仪研制 指导老师:刘金涛 小组成员:潘志平、卢帆 张新科、于传龙、付欣悦

  2. 目录 • 整体构思 • 硬件电路设计 • 实验板的焊接 • 软件设计思路 • 软件的编写 • 总结分析

  3. 整体构思 光学成像系统 上位机 光电鼠标芯片 单片机 系统 RS23接口 光学发射系统 激光二极管

  4. 整体思路 • 芯片的选用:Avago公司的ADNS-9500 • 系统由光学透镜、光电鼠标芯片ADNS- 9500、单片机等组成。激光二极管发出激光, 经过运动物体的反射后进入ADNS- 9500的感光眼。ADNS- 9500的定位传感器就会开始操作,如果物体处在运动状态, 会触发传感器的IAS, 透过镜头和照明系统来撷取极小的表面影像。这些影像经过DSP 的处理, 得到移动的方向和距离。单片机通过串口读取数据,进而传入上位机。上位机处理数据得到速度、加速度等,得到灰度图像。

  5. 硬件电路设计 • 通过查找相关资料,对单片机各个引脚加强了解,根据不同引脚的用途对单片机的基本应用电路进行相关设计,使其理论可行。 • 选择鼠标芯片ADNS-9500,对其性能、特点作相关了解。对其时序进行理解,每个引脚各个时段的工作状态进行细分,设计电路图。

  6. 实验板的焊接 • 根据电路图和PCB板图的设计进行电路板的焊接

  7. 软件设计思路

  8. Main函数 初始化串口 初始化鼠标芯片 中断设置 等待中断

  9. 串口中断 N RI==1? Y N uart_data==‘S’? TI清零 N Y uart_data==‘Q’? 开外部中断 RI清零 Y 关外部中断RI清零 中断返回

  10. 鼠标中断服务子程序 关闭外部中断 NCS=0 Motion_Burst_Read() Capture_Frame() 获取数据回送上位机 NCS=1 开启外部中断 中断返回

  11. 软件的编写 • 软件的编写在于鼠标芯片应用,下面对鼠标的相关程序进行展示: • Motion_Burst_Read() • Capture_Frame()

  12. Motion_Burst_Read() /======================================================================== // FUNCTION: Motion_Burst_Read // Purpose: Used to get the information of motion. //======================================================================== void Motion_Burst_Read(void) { unsigned int i, counter,delay; unsigned char temp,count; EA = 0; // disable irqs before setting irq registers NCS = 0; // enable SPI port - set NCS low temp = Motion_Burst; // load the pixel burst reg address for(count=0;count<8;count++) { SCLK = 0; // set SCLK to low if(temp&0x80) MOSI = 1; // set MOSI to high EA=1; // enable interrupts }

  13. else MOSI = 0; // set MOSI to low for(delay=0;delay<1;delay++); SCLK = 1; // set SCLK to high temp = temp<<1; } SCLK = 1; // set SCLK to high for(i=0;i<10000;i++); // wait 1 frame period for(counter = 0; counter<14; counter++) { // setup to transmit the response data, STC89C52 always master temp = 0; for(count=0;count<8;count++) { SCLK = 0; // set SCLK to low temp = temp<<1; SCLK = 1; // set SCLK to high if(MISO) temp = temp|0x01; else temp = temp&0xfe; for(delay=0;delay<1;delay++); } SCLK = 1; // set SCLK to high } Write_Sensor_Register(0x02, 0x02); // write any value to Motion register to clear any residual motion NCS = 1; // disable SPI port - set NCS high

  14. //========================================================================//======================================================================== // FUNCTION: Pixel_Burst // Purpose: Used to image dump through pixel burst mode. //======================================================================== void Capture_Frame(void) { unsigned int i, counter; unsigned int delay; unsigned char temp, count; unsigned char status; Write_Sensor_Register(0x3a, 0x5a); status=Read_Sensor_Register(0x20); Write_Sensor_Register(0x20, status&0xFE); Write_Sensor_Register(Frame_Capture, 0x93); _nop_(); Write_Sensor_Register(Frame_Capture, 0xc5); for(i=0;i<10000;i++); // wait 1 frame period for(i=0;i<10000;i++); // wait 1 frame period // start Pixel_Burst EA = 0; // disable irqs before setting irq registers NCS = 0; // enable SPI port - set NCS low // setup to transmit the response data, M32C/84 always master temp = Pixel_Burst; // load the pixel burst reg address

  15. for(count=0;count<8;count++) { SCLK = 0; // set SCLK to low if(temp&0x80) MOSI = 1; // set MOSI to high else MOSI = 0; // set MOSI to low for(delay=0;delay<1;delay++); SCLK = 1; // set SCLK to high temp = temp<<1; } SCLK = 1; // set SCLK to high for(i=0;i<10000;i++); // short delay for(counter = 0; counter<900; counter++) { // setup to transmit the response data, STC89C52 always master temp = 0; for(count=0;count<8;count++) { SCLK = 0; // set SCLK to low temp = temp<<1; SCLK = 1; // set SCLK to high if(MISO) temp = temp|0x01; else temp = temp&0xfe; for(delay=0;delay<1;delay++); } SCLK = 1; // set SCLK to high } NCS = 1; // disable SPI port - set NCS high EA=1; // enable interrupts }

  16. 总结分析 在指导老师的指导和团队协作努力下,通过本项目的实施,我们所学到的理论知识应用到实践中去,锻炼实践能力和动手能力,培养发现问题、分析问题、解决问题的能力,提高综合素质。 通过实验我们发现,理论和实践之间的差距是很大的,只有通过不断地实践才能更有效地把握理论知识,如若不然,一切都会只是空中楼阁。

  17. THANK YOU! THE END

More Related