⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mifare_crc.c

📁 mifarea卡程序mifarea卡程序mifarea卡程序
💻 C
字号:
/*

File nmae: Mifare_CRC.c
Function :UpdateCrc() and ComputerCrc().This function is 
		  original source code in ISO/IEC14443-3 Annex B
Comment  :This file include all of the commputering ISO/IEC
		  14443-3 Annex B type card's CRC function.
Note!!    This files should implemented by the Mifare Pro 
          function and computer the CRC for receive data from 
		  ISO/IEC 14443-4 type A  IC card. 		   

*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "Mifarepro.h"

//unsigned char First, Second;

unsigned short UpdateCrc(unsigned char ch, unsigned short *lpwCrc)
{
    ch = (ch^(unsigned char)((*lpwCrc) & 0x00FF));
    ch = (ch^(ch<<4));
    *lpwCrc = (*lpwCrc >> 8)^((unsigned short)ch << 8)^((unsigned short)ch<<3)^((unsigned short)ch>>4);
    return(*lpwCrc);
}
void ComputeCrc(char *Data, int Length,unsigned char *TransmitFirst, unsigned char *TransmitSecond)
{
    unsigned char chBlock;
    unsigned short wCrc;
   
    wCrc = 0x6363;   /* ITU-V.41 */
    do 
    {
        chBlock = *Data++;
        UpdateCrc(chBlock, &wCrc);
    } while (--Length);
        
    *TransmitFirst = (unsigned char) (wCrc & 0xFF);
    *TransmitSecond = (unsigned char) ((wCrc >> 8) & 0xFF);
}

//ComputeCrc(BuffCRC_A, length, &First, &Second);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -