读取stm32 产品的唯一身份的寄存器

 读取stm32 产品的唯一身份的寄存器

voidGet_ChipID(void)

{

    uint32_t temp0,temp1,temp2;

        temp0 = *(__IO uint32_t*)(0x1FFF7A10);    

        temp1 = *(__IO uint32_t*)(0x1FFF7A14);

        temp2 = *(__IO uint32_t*)(0x1FFF7A18);

//    temp0=(*( uint32_t *)0x1FFF7A10);     //产品唯一身份标识寄存器(96位)

//      temp1=(*( uint32_t *)0x1FFF7A14);

//      temp2=(*( uint32_t *)0x1FFF7A18);

                                  

//ID码地址: 0x1FFFF7E8  0x1FFFF7EC  0x1FFFF7F0 ,只需要读取这个地址中的数据就可以了。

 

    temp[0] = (uint8_t)(temp0 &0x000000FF);

    temp[1] = (uint8_t)((temp0 &0x0000FF00)>>8);

    temp[2] = (uint8_t)((temp0 &0x00FF0000)>>16);

    temp[3] = (uint8_t)((temp0 & 0xFF000000)>>24);

    temp[4] = (uint8_t)(temp1 &0x000000FF);

    temp[5] = (uint8_t)((temp1 &0x0000FF00)>>8);

    temp[6] = (uint8_t)((temp1 &0x00FF0000)>>16);

    temp[7] = (uint8_t)((temp1 &0xFF000000)>>24);

    temp[8] = (uint8_t)(temp2 &0x000000FF);

    temp[9] = (uint8_t)((temp2 &0x0000FF00)>>8);

    temp[10] = (uint8_t)((temp2 &0x00FF0000)>>16);

    temp[11] = (uint8_t)((temp2 &0xFF000000)>>24);        

}

本单片机读取的数据为1D 00 5A 00 03 51 35 34 36 34 39 35。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值