基于SI522的13.56M_1443a工程


基于SI522的软复位休眠模式(ACD模式),当有卡时会唤醒SI522,进行选卡,读卡等操作,支持4字节和7字节UID类型的卡。工程简洁明了,希望可以给有需要的人帮助。
资源截图
代码片段和文件信息
#include “si522_app.h“

uint8 DefKeyA[6]={0xff0xff0xff0xff0xff0xff}; //KEYA
uint8 DefConData[4]={0xFF0x070x800x69 };      //控制
uint8 DefKeyB[6]={0xff0xff0xff0xff0xff0xff}; //KEYB

uint8 DefVlaue[16]=
{
0xff0xff0xff0xff0xff0xff  //KEYA
0xFF0x070x800x69            //控制
0xff0xff0xff0xff0xff0xff   //KEYB
};

/*
*寻卡、防冲撞以及选卡
*/
uint8 FindAnticollSelect(unsigned char *typeunsigned char *idunsigned int *len)  
{
unsigned char ij;
unsigned int type_t;
unsigned char card_type[2]={0x00};
unsigned char card_id[10]={0x00};

  if(PcdRequest(0x52card_type)==MI_OK)
{
   type_t=((card_type[0]<<8) | (card_type[1]));

 for(j=0;j<2;j++)
 {
   *(type+j) = card_type[j];
 }  

    switch(type_t)
{
case 0x4400: 
   if(UL_PcdAnticoll(card_id)==MI_OK)
 {
for(i=0;i<7;i++)
{
*(id+i) = card_id[i];
}
*len=7;
return 1;  
 }
break;
case 0x0400: 
if(PcdAnticoll(card_id)==MI_OK)
{
for(i=0;i<4;i++)
{
*(id+i) = card_id[i];
}
*len=4;
if(PcdSelect(card_id)==MI_OK)
{
return 1;
}
}
break;
case 0x0200:
break;
case 0x0800:
break;
case 0x4403:
break;
default:
break;
}
 
}
return 0;
}
/**
*  读卡
*/
uint8 ReadCard(uint8 authmodeuint8 blockuint8* keyuint8* redata)
{
uint8 type_buff[2];
uint8 idbuff[7];
uint16 id_len;
// uint8 data_buff[16];

if(FindAnticollSelect(type_buffidbuff&id_len)==1)
{
  if(PcdAuthState(authmodeblockkeyidbuff)==MI_OK)
{
  if(PcdRead(blockredata)==MI_OK)
{
//  uart_sendnbyte(data_buff16);
 return 1;
}
}
}
return 0 ;
}
/**
*  写卡
*/
uint8 WriteCard(uint8 authmodeuint8 blockuint8* keyuint8* wrdata)
{
uint8 type_buff[2];
  uint8 idbuff[7];
uint16 id_len;

if(FindAnticollSelect(type_buffidbuff&id_len)==1)
{
  if(PcdAuthState(authmodeblockkeyidbuff)==MI_OK)
{
  if(PcdWrite(blockwrdata)==MI_OK)
{
  return 1;
}
}
}
return 0 ;
}


 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       2166  2019-11-22 15:44  ReadCard_V1.0App522si522_app.c

     文件        336  2019-11-22 11:35  ReadCard_V1.0App522si522_app.h

     文件       3743  2019-11-22 17:36  ReadCard_V1.0Appdata_handledata_handle.c

     文件        922  2019-11-22 17:12  ReadCard_V1.0Appdata_handledata_handle.h

     文件        868  2019-11-22 15:37  ReadCard_V1.0Hardwaregpiogpio.c

     文件        101  2019-09-05 08:53  ReadCard_V1.0Hardwaregpiogpio.h

     文件       9585  2019-11-22 18:01  ReadCard_V1.0Hardwaresi522si522.c

     文件       9561  2019-11-22 14:49  ReadCard_V1.0Hardwaresi522si522.h

     文件       8988  2019-11-25 17:19  ReadCard_V1.0Hardwaresi522si522_operate.c

     文件        527  2019-11-22 14:32  ReadCard_V1.0Hardwaresi522si522_operate.h

     文件       2097  2019-11-22 16:12  ReadCard_V1.0Hardwaresi522si522_reg_ctrl.c

     文件        241  2019-11-22 11:49  ReadCard_V1.0Hardwaresi522si522_reg_ctrl.h

     文件        830  2019-11-22 16:08  ReadCard_V1.0Hardwaresleepsleep.c

     文件        232  2019-09-27 18:59  ReadCard_V1.0Hardwaresleepsleep.h

     文件       1287  2019-11-22 15:19  ReadCard_V1.0Hardwarespispi.c

     文件        131  2019-11-22 15:16  ReadCard_V1.0Hardwarespispi.h

     文件        631  2019-11-22 15:37  ReadCard_V1.0Hardware imer0 imer.c

     文件        331  2019-09-27 16:05  ReadCard_V1.0Hardware imer0 imer.h

     文件        973  2019-11-22 15:49  ReadCard_V1.0Hardwareuartuart.c

     文件        224  2019-09-28 08:27  ReadCard_V1.0Hardwareuartuart.h

     文件       9137  2019-11-25 17:19  ReadCard_V1.0Listingsdata_handle.lst

     文件       2352  2019-11-25 17:19  ReadCard_V1.0Listingsgpio.lst

     文件       4870  2019-11-25 17:19  ReadCard_V1.0Listingsmain.lst

     文件      14724  2019-11-08 11:45  ReadCard_V1.0Listings
c522.lst

     文件       5715  2019-11-22 11:33  ReadCard_V1.0Listings
c522_app.lst

     文件      19183  2019-11-08 11:45  ReadCard_V1.0Listings
c522_operate.lst

     文件     177697  2019-11-25 17:19  ReadCard_V1.0ListingsRJM8L151.m51

     文件      12574  2019-10-24 14:38  ReadCard_V1.0Listings
jm8l151_adc.lst

     文件       8021  2019-10-24 14:38  ReadCard_V1.0Listings
jm8l151_compare.lst

     文件       4790  2019-10-24 14:38  ReadCard_V1.0Listings
jm8l151_crc.lst

............此处省略135个文件信息

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)