标题: 51单片机读取PAW3025鼠标传感器实时坐标程序问题,附PAW3205DB资料 [打印本页]

作者: sanmi    时间: 2018-5-30 12:22
标题: 51单片机读取PAW3025鼠标传感器实时坐标程序问题,附PAW3205DB资料
本人初学,单片机型号为stc89c52rc,鼠标传感器是原相的PAW3025,这个代码该如何写,自己一直没读出来,请大神帮忙,万分感谢!!附件为传感器芯片手册

0.png (147.88 KB, 下载次数: 108)

0.png

PAW3205DB-TJ3T_SPEC_V0.2.pdf

652.75 KB, 下载次数: 121

传感器


作者: abc151922    时间: 2019-6-13 18:57
大佬,请教一下,这个具体怎么操作的?
作者: 没有名字    时间: 2020-12-8 13:32
本帖最后由 没有名字 于 2020-12-8 13:37 编辑

数据手册不是写得很具体了,1写数据,0读D:\project\小米无线蓝牙鼠标\文档\测试数据\捕获.png数据+7位地址+8位data。在时钟下降沿时变换数据。
  1. uint8_t  vMouse_Read_Byte(uint8_t ucAdd)
  2. {
  3.         uint8_t t = 0;
  4.         uint8_t ucSDA = 0;
  5.         uint8_t i,ucReceive = 0;
  6.         
  7.         nrf_gpio_cfg_output(PAW_SCLK);
  8.         nrf_gpio_cfg_output(PAW_SWDO);
  9.         nrf_gpio_pin_clear(PAW_SCLK);
  10.         nrf_delay_us(5);
  11.         for (t = 0;t < 8;t++)
  12.         {  
  13.                 ucSDA = (ucAdd & 0x80) >> 7;
  14.                 if (ucSDA)
  15.                         nrf_gpio_pin_set(PAW_SWDO);
  16.                 else
  17.                         nrf_gpio_pin_clear(PAW_SWDO);               
  18.                 ucAdd<<=1;
  19.                 nrf_delay_us(5);
  20.                 nrf_gpio_pin_set(PAW_SCLK);
  21.                 nrf_delay_us(5);
  22.                 nrf_gpio_pin_clear(PAW_SCLK);
  23.                 nrf_delay_us(5);
  24.         }
  25.             
  26.         nrf_gpio_cfg_input(PAW_SWDO,NRF_GPIO_PIN_PULLUP);        
  27.         for(i = 0;i < 8;i++ )
  28.         {
  29.                 nrf_gpio_pin_clear(PAW_SCLK);
  30.                 nrf_delay_us(5);
  31.                 nrf_gpio_pin_set(PAW_SCLK);
  32.                 ucReceive <<= 1;
  33.                 if (nrf_gpio_pin_read(PAW_SWDO))ucReceive++;   
  34.                 nrf_delay_us(5);
  35.         }                        
  36.         return ucReceive;
  37. }
复制代码

捕获.PNG (197.51 KB, 下载次数: 112)

捕获.PNG

5349E6D6-7E33-4d67-BF87-77EDB44BDFAD.png (92.13 KB, 下载次数: 121)

5349E6D6-7E33-4d67-BF87-77EDB44BDFAD.png

作者: 东湖西泽    时间: 2023-10-15 23:58
没有名字 发表于 2020-12-8 13:32
数据手册不是写得很具体了,1写数据,0读数据+7位地址+8位data。在时钟下降沿时变换数据。

大佬有源码吗,想参考一下,谢谢!




欢迎光临 (http://www.51hei.com/bbs/) Powered by Discuz! X3.1