【闸机】UID-菜鸟篇

#define STM32ADD_CHIP_ID        	0x1FFF7A10
#define STM32ADD_CHIP_FLASHSIZE 	0x1FFF7A22

void Get_ChipID(unsigned char *p)
{
    unsigned char *pIDStart=(unsigned char *)(CHIP_ID_START);     
    for(unsigned char i=0;i<12;i++)//96位 也就是12个byte
        *p++=*pIDStart++;
}
void Get_ChipSize(unsigned short *p)
{
	unsigned short size;
    size =*(unsigned short *)(CHIP_FLASHSIZE_START);//直接读出 没必要每个U8在拼接       
	p=&size;
}
void Get_ChipID_test(void)
{
    uint8_t  ChipId[12] ;
 

    Get_ChipID(ChipId);
	
	printf("%s\n",ChipId);
}

 

你可能感兴趣的:(【闸机】UID-菜鸟篇)