2943 views|3 replies

1702

Posts

4

Resources
The OP
 

Based on PSOC6 development board simulation I2C solution X-NUCLEO-IKS01A3 LIS2DW12 [Copy link]

 

Today we analyze LIS2DW12, simulate the IIC interface, and verify the ID first:

 uint8_t LIS2DW12_Read_Date(uint8_t SlaveAddress, uint8_t RegAddress)
{
    uint8_t recvDate;
    uint8_t succ, stime=0;
    
    I2C_Start();
    succ = I2C_Send_Byte(SlaveAddress & 0xfe);
    while((succ !=1)&&(stime<3))
    {
        I2C_Stop();
        I2C_Start();
        succ = I2C_Send_Byte(SlaveAddress & 0xfe);  //写
        stime++;
    }
    I2C_Send_Byte(RegAddress);
    
    I2C_Start();
    I2C_Send_Byte(SlaveAddress | 0x01);  //读
    recvDate = I2C_Read_Byte(1);   //NACK
    I2C_Stop();
    return recvDate;
}


printf("PID_LSM2 = %X\r\n",LIS2DW12_Read_Date(LIS2DW12_ADD, 0x0F));



This content is originally created by DavidZH , a netizen of EEWORLD forum . If you want to reprint or use it for commercial purposes, you must obtain the author’s consent and indicate the source.

Supplementary content (2019-9-24 20:47): Attached project
This post is from MEMS sensors

Latest reply

Unable to download  Details Published on 2023-7-28 11:59
 
 

1702

Posts

4

Resources
2
 

The project is attached for reference only; PSOC6_IKS01A3_Code.zip (3.81 MB, downloads: 17)

This post is from MEMS sensors
 
 
 

3

Posts

0

Resources
3
 

For reference

This post is from MEMS sensors
 
 
 

3

Posts

0

Resources
4
 
Unable to download
This post is from MEMS sensors
 
 
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews

Room 1530, Zhongguancun MOOC Times Building, Block B, 18 Zhongguancun Street, Haidian District, Beijing 100190, China Tel:(010)82350740 Postcode:100190

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list