MF-RC522 RFID 在Arduino中的读取 【转】
原文地址:http://blog.chinaunix.net/uid-23686726-id-3444925.html因为最近做项目要用到,所以亲自实践了一把,完全能够实现。
最重要的是通信方式和连接方式。Arduino板子与RC522之间是SPI通信,Arduino工作在主模式下,
RC522工作在从模式下。连接方式如下:
Arduino RC522 (工作电压3.3V)
•D5 <-------------> RST (这个脚不接貌似也可以)
•D10 <-------------> SDA (在RC522中即为CS)
•D11 <-------------> MOSI
•D12 <-------------> MISO
•D13 <-------------> SCK
代码如下:
#include <SPI.h>
#define uchar unsigned char
#define uint unsigned int
//data array maxium length数据中数组最大长度
#define MAX_LEN 16
/////////////////////////////////////////////////////////////////////
//set the pin管脚设置
/////////////////////////////////////////////////////////////////////
const int chipSelectPin = 10;
const int NRSTPD = 5;
//MF522 command bits 命令位
#define PCD_IDLE 0x00 //NO action; cancel current commands无动作,取消当前命令
#define PCD_AUTHENT 0x0E //verify password key密码验证
#define PCD_RECEIVE 0x08 //receive data接收数据
#define PCD_TRANSMIT 0x04 //send data发送数据
#define PCD_TRANSCEIVE 0x0C //send and receive data收发数据
#define PCD_RESETPHASE 0x0F //reset重置
#define PCD_CALCCRC 0x03 //CRC check and caculation CRC校验和计算
//Mifare_One card command bits非接触式读卡器命令
#define PICC_REQIDL 0x26 //Search the cards that not into sleep mode in the antenna area 搜索未进入天线区域睡眠模式的卡
#define PICC_REQALL 0x52 //Search all the cards in the antenna area搜索天线区域所有卡
#define PICC_ANTICOLL 0x93 //prevent conflict防止冲突
#define PICC_SElECTTAG 0x93 //select card选择卡
#define PICC_AUTHENT1A 0x60 //verify A password key验证A密码键
#define PICC_AUTHENT1B 0x61 //verify B password key验证B密码键
#define PICC_READ 0x30 //read 读
#define PICC_WRITE 0xA0 //write写
#define PICC_DECREMENT 0xC0 //deduct value减去值
#define PICC_INCREMENT 0xC1 //charge up value增加值
#define PICC_RESTORE 0xC2 //Restore data into buffer将数据恢复到缓冲区
#define PICC_TRANSFER 0xB0 //Save data into buffer保存数据到缓冲区
#define PICC_HALT 0x50 //sleep mode睡眠模式
//THe mistake code that return when communicate with MF522与MF522交流时返回的错误代码
#define MI_OK 0
#define MI_NOTAGERR 1
#define MI_ERR 2
//------------------MFRC522 register 登记---------------
//Page 0:Command and Status 0页:命令和状态
#define Reserved00 0x00
#define CommandReg 0x01
#define CommIEnReg 0x02
#define DivlEnReg 0x03
#define CommIrqReg 0x04
#define DivIrqReg 0x05
#define ErrorReg 0x06
#define Status1Reg 0x07
#define Status2Reg 0x08
#define FIFODataReg 0x09
#define FIFOLevelReg 0x0A
#define WaterLevelReg 0x0B
#define ControlReg 0x0C
#define BitFramingReg 0x0D
#define CollReg 0x0E
#define Reserved01 0x0F
//Page 1:Command 命令
#define Reserved10 0x10
#define ModeReg 0x11
#define TxModeReg 0x12
#define RxModeReg 0x13
#define TxControlReg 0x14
#define TxAutoReg 0x15
#define TxSelReg 0x16
#define RxSelReg 0x17
#define RxThresholdReg 0x18
#define DemodReg 0x19
#define Reserved11 0x1A
#define Reserved12 0x1B
#define MifareReg 0x1C
#define Reserved13 0x1D
#define Reserved14 0x1E
#define SerialSpeedReg 0x1F
//Page 2:CFG
#define Reserved20 0x20
#define CRCResultRegM 0x21
#define CRCResultRegL 0x22
#define Reserved21 0x23
#define ModWidthReg 0x24
#define Reserved22 0x25
#define RFCfgReg 0x26
#define GsNReg 0x27
#define CWGsPReg 0x28
#define ModGsPReg 0x29
#define TModeReg 0x2A
#define TPrescalerReg 0x2B
#define TReloadRegH 0x2C
#define TReloadRegL 0x2D
#define TCounterValueRegH 0x2E
#define TCounterValueRegL 0x2F
//Page 3:TestRegister 寄存器测试
#define Reserved30 0x30
#define TestSel1Reg 0x31
#define TestSel2Reg 0x32
#define TestPinEnReg 0x33
#define TestPinValueReg 0x34
#define TestBusReg 0x35
#define AutoTestReg 0x36
#define VersionReg 0x37
#define AnalogTestReg 0x38
#define TestDAC1Reg 0x39
#define TestDAC2Reg 0x3A
#define TestADCReg 0x3B
#define Reserved31 0x3C
#define Reserved32 0x3D
#define Reserved33 0x3E
#define Reserved34 0x3F
//-----------------------------------------------
//4 bytes Serial number of card, the 5 bytes is verfiy bytes 4字节卡片编号,5字节变化值
uchar serNum;
void setup()
{
Serial.begin(57600);
SPI.begin();
pinMode(chipSelectPin,OUTPUT); // Set digital pin 10 as OUTPUT to connect it to the RFID /ENABLE pin 设置管脚10为输出并连接到模块使能口
digitalWrite(chipSelectPin, LOW); // Activate the RFID reader激活RFID读卡器
pinMode(NRSTPD,OUTPUT); // Set digital pin 5 , Not Reset and Power-down设置管脚5,非重置或掉电
MFRC522_Init();
}
void loop()
{
uchar status;
uchar str;
// Search card, return card types搜索卡并返回卡片类型
status = MFRC522_Request(PICC_REQIDL, str);
if (status != MI_OK)
{
return;
}
// Show card type显示卡片类型
ShowCardType(str);
//Prevent conflict, return the 4 bytes Serial number of the card防止冲突,返回4个字节的卡片编号
status = MFRC522_Anticoll(str);
// str: serial number of the card卡片编号
// str: XOR checksum of the SN.SN异或校验
if (status == MI_OK)
{
Serial.print("The card's number is: ");
memcpy(serNum, str, 5);
ShowCardID(serNum);
// Check people associated with card ID检查与卡片ID相符合的人
uchar* id = serNum;
if( id==0x4B && id==0xE6 && id==0xD1 && id==0x3B ) {
Serial.println("Hello Mary!");
} else if(id==0x3B && id==0xE6 && id==0xD1 && id==0x3B) {
Serial.println("Hello Greg!");
}else{
Serial.println("Hello unkown guy!");
}
}
MFRC522_Halt(); //命令卡进入睡眠模式
delay(200);
}
/*
* Function:ShowCardID
* Description:Show Card ID
* Input parameter:ID string
* Return:Null
*/
void ShowCardID(uchar *id)
{
int IDlen=4;
for(int i=0; i<IDlen; i++){
Serial.print(0x0F & (id>>4), HEX);
Serial.print(0x0F & id,HEX);
}
Serial.println("");
}
/*
* Function:ShowCardType
* Description:Show Card type
* Input parameter:Type string
* Return:Null
*/
void ShowCardType(uchar* type)
{
Serial.print("Card type: ");
if(type==0x04&&type==0x00)
Serial.println("MFOne-S50");
else if(type==0x02&&type==0x00)
Serial.println("MFOne-S70");
else if(type==0x44&&type==0x00)
Serial.println("MF-UltraLight");
else if(type==0x08&&type==0x00)
Serial.println("MF-Pro");
else if(type==0x44&&type==0x03)
Serial.println("MF Desire");
else
Serial.println("Unknown");
}
/*
* Function:Write_MFRC5200
* Description:write a byte data into one register of MR RC522
* Input parameter:addr--register address;val--the value that need to write in
* Return:Null
*/
void Write_MFRC522(uchar addr, uchar val)
{
digitalWrite(chipSelectPin, LOW);
//address format:0XXXXXX0
SPI.transfer((addr<<1)&0x7E);
SPI.transfer(val);
digitalWrite(chipSelectPin, HIGH);
}
/*
* Function:Read_MFRC522
* Description:read a byte data into one register of MR RC522
* Input parameter:addr--register address
* Return:return the read value
*/
uchar Read_MFRC522(uchar addr)
{
uchar val;
digitalWrite(chipSelectPin, LOW);
//address format:1XXXXXX0
SPI.transfer(((addr<<1)&0x7E) | 0x80);
val =SPI.transfer(0x00);
digitalWrite(chipSelectPin, HIGH);
return val;
}
/*
* Function:SetBitMask
* Description:set RC522 register bit
* Input parameter:reg--register address;mask--value
* Return:null
*/
void SetBitMask(uchar reg, uchar mask)
{
uchar tmp;
tmp = Read_MFRC522(reg);
Write_MFRC522(reg, tmp | mask); // set bit mask
}
/*
* Function:ClearBitMask
* Description:clear RC522 register bit
* Input parameter:reg--register address;mask--value
* Return:null
*/
void ClearBitMask(uchar reg, uchar mask)
{
uchar tmp;
tmp = Read_MFRC522(reg);
Write_MFRC522(reg, tmp & (~mask)); // clear bit mask
}
/*
* Function:AntennaOn
* Description:Turn on antenna, every time turn on or shut down antenna need at least 1ms delay
* Input parameter:null
* Return:null
*/
void AntennaOn(void)
{
uchar temp;
temp = Read_MFRC522(TxControlReg);
if (!(temp & 0x03))
{
SetBitMask(TxControlReg, 0x03);
}
}
/*
* Function:AntennaOff
* Description:Turn off antenna, every time turn on or shut down antenna need at least 1ms delay
* Input parameter:null
* Return:null
*/
void AntennaOff(void)
{
ClearBitMask(TxControlReg, 0x03);
}
/*
* Function:ResetMFRC522
* Description: reset RC522
* Input parameter:null
* Return:null
*/
void MFRC522_Reset(void)
{
Write_MFRC522(CommandReg, PCD_RESETPHASE);
}
/*
* Function:InitMFRC522
* Description:initilize RC522
* Input parameter:null
* Return:null
*/
void MFRC522_Init(void)
{
digitalWrite(NRSTPD,HIGH);
MFRC522_Reset();
//Timer: TPrescaler*TreloadVal/6.78MHz = 24ms
Write_MFRC522(TModeReg, 0x8D); //Tauto=1; f(Timer) = 6.78MHz/TPreScaler
Write_MFRC522(TPrescalerReg, 0x3E); //TModeReg + TPrescalerReg
Write_MFRC522(TReloadRegL, 30);
Write_MFRC522(TReloadRegH, 0);
Write_MFRC522(TxAutoReg, 0x40); //100%ASK
Write_MFRC522(ModeReg, 0x3D); //CRC initilizate value 0x6363 ???
//ClearBitMask(Status2Reg, 0x08); //MFCrypto1On=0
//Write_MFRC522(RxSelReg, 0x86); //RxWait = RxSelReg
//Write_MFRC522(RFCfgReg, 0x7F); //RxGain = 48dB
AntennaOn(); //turn on antenna
}
/*
* Function:MFRC522_Request
* Description:Searching card, read card type
* Input parameter:reqMode--search methods,
* TagType--return card types
* 0x4400 = Mifare_UltraLight
* 0x0400 = Mifare_One(S50)
* 0x0200 = Mifare_One(S70)
* 0x0800 = Mifare_Pro(X)
* 0x4403 = Mifare_DESFire
* return:return MI_OK if successed
*/
uchar MFRC522_Request(uchar reqMode, uchar *TagType)
{
uchar status;
uint backBits; //the data bits that received
Write_MFRC522(BitFramingReg, 0x07); //TxLastBists = BitFramingReg ???
TagType = reqMode;
status = MFRC522_ToCard(PCD_TRANSCEIVE, TagType, 1, TagType, &backBits);
if ((status != MI_OK) || (backBits != 0x10))
{
status = MI_ERR;
}
return status;
}
/*
* Function:MFRC522_ToCard
* Description:communicate between RC522 and ISO14443
* Input parameter:command--MF522 command bits
* sendData--send data to card via rc522
* sendLen--send data length
* backData--the return data from card
* backLen--the length of return data
* return:return MI_OK if successed
*/
uchar MFRC522_ToCard(uchar command, uchar *sendData, uchar sendLen, uchar *backData, uint *backLen)
{
uchar status = MI_ERR;
uchar irqEn = 0x00;
uchar waitIRq = 0x00;
uchar lastBits;
uchar n;
uint i;
switch (command)
{
case PCD_AUTHENT: //verify card password
{
irqEn = 0x12;
waitIRq = 0x10;
break;
}
case PCD_TRANSCEIVE: //send data in the FIFO
{
irqEn = 0x77;
waitIRq = 0x30;
break;
}
default:
break;
}
Write_MFRC522(CommIEnReg, irqEn|0x80); //Allow interruption
ClearBitMask(CommIrqReg, 0x80); //Clear all the interrupt bits
SetBitMask(FIFOLevelReg, 0x80); //FlushBuffer=1, FIFO initilizate
Write_MFRC522(CommandReg, PCD_IDLE); //NO action;cancel current command ???
//write data into FIFO
for (i=0; i<sendLen; i++)
{
Write_MFRC522(FIFODataReg, sendData);
}
//procceed it
Write_MFRC522(CommandReg, command);
if (command == PCD_TRANSCEIVE)
{
SetBitMask(BitFramingReg, 0x80); //StartSend=1,transmission of data starts
}
//waite receive data is finished
i = 2000; //i should adjust according the clock, the maxium the waiting time should be 25 ms???
do
{
//CommIrqReg
//Set1 TxIRq RxIRq IdleIRq HiAlerIRq LoAlertIRq ErrIRq TimerIRq
n = Read_MFRC522(CommIrqReg);
i--;
}
while ((i!=0) && !(n&0x01) && !(n&waitIRq));
ClearBitMask(BitFramingReg, 0x80); //StartSend=0
if (i != 0)
{
if(!(Read_MFRC522(ErrorReg) & 0x1B)) //BufferOvfl Collerr CRCErr ProtecolErr
{
status = MI_OK;
if (n & irqEn & 0x01)
{
status = MI_NOTAGERR; //??
}
if (command == PCD_TRANSCEIVE)
{
n = Read_MFRC522(FIFOLevelReg);
lastBits = Read_MFRC522(ControlReg) & 0x07;
if (lastBits)
{
*backLen = (n-1)*8 + lastBits;
}
else
{
*backLen = n*8;
}
if (n == 0)
{
n = 1;
}
if (n > MAX_LEN)
{
n = MAX_LEN;
}
//read the data from FIFO
for (i=0; i<n; i++)
{
backData = Read_MFRC522(FIFODataReg);
}
}
}
else
{
status = MI_ERR;
}
}
//SetBitMask(ControlReg,0x80); //timer stops
//Write_MFRC522(CommandReg, PCD_IDLE);
return status;
}
/*
* Function:MFRC522_Anticoll
* Description:Prevent conflict, read the card serial number
* Input parameter:serNum--return the 4 bytes card serial number, the 5th byte is recheck byte
* return:return MI_OK if successed
*/
uchar MFRC522_Anticoll(uchar *serNum)
{
uchar status;
uchar i;
uchar serNumCheck=0;
uint unLen;
//ClearBitMask(Status2Reg, 0x08); //strSensclear
//ClearBitMask(CollReg,0x80); //ValuesAfterColl
Write_MFRC522(BitFramingReg, 0x00); //TxLastBists = BitFramingReg
serNum = PICC_ANTICOLL;
serNum = 0x20;
status = MFRC522_ToCard(PCD_TRANSCEIVE, serNum, 2, serNum, &unLen);
if (status == MI_OK)
{
//Verify card serial number
for (i=0; i<4; i++)
{
serNumCheck ^= serNum;
}
if (serNumCheck != serNum)
{
status = MI_ERR;
}
}
//SetBitMask(CollReg, 0x80); //ValuesAfterColl=1
return status;
}
/*
* Function:CalulateCRC
* Description:Use MF522 to caculate CRC
* Input parameter:pIndata--the CRC data need to be read,len--data length,pOutData-- the caculated result of CRC
* return:Null
*/
void CalulateCRC(uchar *pIndata, uchar len, uchar *pOutData)
{
uchar i, n;
ClearBitMask(DivIrqReg, 0x04); //CRCIrq = 0
SetBitMask(FIFOLevelReg, 0x80); //Clear FIFO pointer
//Write_MFRC522(CommandReg, PCD_IDLE);
//Write data into FIFO
for (i=0; i<len; i++)
{
Write_MFRC522(FIFODataReg, *(pIndata+i));
}
Write_MFRC522(CommandReg, PCD_CALCCRC);
//waite CRC caculation to finish
i = 0xFF;
do
{
n = Read_MFRC522(DivIrqReg);
i--;
}
while ((i!=0) && !(n&0x04)); //CRCIrq = 1
//read CRC caculation result
pOutData = Read_MFRC522(CRCResultRegL);
pOutData = Read_MFRC522(CRCResultRegM);
}
/*
* Function:MFRC522_Write
* Description:write block data
* Input parameters:blockAddr--block address;writeData--Write 16 bytes data into block
* return:return MI_OK if successed
*/
uchar MFRC522_Write(uchar blockAddr, uchar *writeData)
{
uchar status;
uint recvBits;
uchar i;
uchar buff;
buff = PICC_WRITE;
buff = blockAddr;
CalulateCRC(buff, 2, &buff);
status = MFRC522_ToCard(PCD_TRANSCEIVE, buff, 4, buff, &recvBits);
if ((status != MI_OK) || (recvBits != 4) || ((buff & 0x0F) != 0x0A))
{
status = MI_ERR;
}
if (status == MI_OK)
{
for (i=0; i<16; i++) //Write 16 bytes data into FIFO
{
buff = *(writeData+i);
}
CalulateCRC(buff, 16, &buff);
status = MFRC522_ToCard(PCD_TRANSCEIVE, buff, 18, buff, &recvBits);
if ((status != MI_OK) || (recvBits != 4) || ((buff & 0x0F) != 0x0A))
{
status = MI_ERR;
}
}
return status;
}
/*
* Function:MFRC522_Halt
* Description:Command the cards into sleep mode
* Input parameters:null
* return:null
*/
void MFRC522_Halt(void)
{
uchar status;
uint unLen;
uchar buff;
buff = PICC_HALT;
buff = 0;
CalulateCRC(buff, 2, &buff);
status = MFRC522_ToCard(PCD_TRANSCEIVE, buff, 4, buff,&unLen);
}
请问这个实现的是什么功能? 因为我现在也在做这个,想具体的了解一下 楼主的代码贴错了:( 原文代码是对的,已验证 天天向上/tp 发表于 2013-6-11 15:51 static/image/common/back.gif
原文代码是对的,已验证
显示错误“stray'#'in program” enzotim 发表于 2013-6-20 17:04 static/image/common/back.gif
显示错误“stray'#'in program”
使用ARDUINO1.01版本试试 sketch_jun25a.cpp:9:9: error: #include expects "FILENAME" or <FILENAME>
sketch_jun25a.cpp:11:8: error: macro names must be identifiers
sketch_jun25a.cpp:12:8: error: macro names must be identifiers
sketch_jun25a:6: error: stray '#' in program
sketch_jun25a.cpp:14:9: error: invalid suffix "E7E" on floating constant
sketch_jun25a.cpp:15:8: error: macro names must be identifiers
sketch_jun25a:9: error: stray '#' in program
sketch_jun25a.cpp:17:9: error: invalid suffix "E7E" on floating constant
sketch_jun25a:10: error: stray '#' in program
sketch_jun25a.cpp:18:9: error: invalid suffix "E7E" on floating constant
sketch_jun25a:11: error: stray '#' in program
sketch_jun25a.cpp:19:9: error: invalid suffix "E7E" on floating constant
sketch_jun25a:12: error: stray '#' in program
sketch_jun25a:12: error: stray '#' in program
sketch_jun25a:13: error: stray '#' in program
sketch_jun25a:13: error: stray '#' in program
sketch_jun25a:17: error: stray '#' in program
sketch_jun25a.cpp:25:9: error: invalid suffix "E7E" on floating constant
sketch_jun25a.cpp:26:8: error: macro names must be identifiers
sketch_jun25a.cpp:27:8: error: macro names must be identifiers
sketch_jun25a.cpp:28:8: error: macro names must be identifiers
sketch_jun25a.cpp:29:8: error: macro names must be identifiers
sketch_jun25a.cpp:30:8: error: macro names must be identifiers
sketch_jun25a.cpp:31:8: error: macro names must be identifiers
sketch_jun25a.cpp:32:8: error: macro names must be identifiers
sketch_jun25a:26: error: stray '#' in program
sketch_jun25a.cpp:34:9: error: invalid suffix "E7E" on floating constant
sketch_jun25a.cpp:35:8: error: macro names must be identifiers
sketch_jun25a.cpp:36:8: error: macro names must be identifiers
sketch_jun25a.cpp:37:8: error: macro names must be identifiers
sketch_jun25a.cpp:38:8: error: macro names must be identifiers
sketch_jun25a.cpp:39:8: error: macro names must be identifiers
sketch_jun25a.cpp:40:8: error: macro names must be identifiers
sketch_jun25a.cpp:41:8: error: macro names must be identifiers
sketch_jun25a.cpp:42:8: error: macro names must be identifiers
sketch_jun25a.cpp:43:8: error: macro names must be identifiers
sketch_jun25a.cpp:44:8: error: macro names must be identifiers
sketch_jun25a.cpp:45:8: error: macro names must be identifiers
sketch_jun25a.cpp:46:8: error: macro names must be identifiers
sketch_jun25a.cpp:47:8: error: macro names must be identifiers
sketch_jun25a:42: error: stray '#' in program
sketch_jun25a.cpp:50:9: error: invalid suffix "E7E" on floating constant
sketch_jun25a.cpp:51:8: error: macro names must be identifiers
sketch_jun25a.cpp:52:8: error: macro names must be identifiers
sketch_jun25a.cpp:53:8: error: macro names must be identifiers
sketch_jun25a:48: error: stray '#' in program
sketch_jun25a.cpp:56:9: error: invalid suffix "E7E" on floating constant
sketch_jun25a:49: error: stray '#' in program
sketch_jun25a.cpp:57:9: error: invalid suffix "E7E" on floating constant
sketch_jun25a.cpp:58:8: error: macro names must be identifiers
sketch_jun25a.cpp:59:8: error: macro names must be identifiers
sketch_jun25a.cpp:60:8: error: macro names must be identifiers
sketch_jun25a.cpp:61:8: error: macro names must be identifiers
sketch_jun25a.cpp:62:8: error: macro names must be identifiers
sketch_jun25a.cpp:63:8: error: macro names must be identifiers
sketch_jun25a.cpp:64:8: error: macro names must be identifiers
sketch_jun25a.cpp:65:8: error: macro names must be identifiers
sketch_jun25a.cpp:66:8: error: macro names must be identifiers
sketch_jun25a.cpp:67:8: error: macro names must be identifiers
sketch_jun25a.cpp:68:8: error: macro names must be identifiers
sketch_jun25a.cpp:69:8: error: macro names must be identifiers
sketch_jun25a.cpp:70:8: error: macro names must be identifiers
sketch_jun25a.cpp:71:8: error: macro names must be identifiers
sketch_jun25a.cpp:72:8: error: macro names must be identifiers
sketch_jun25a.cpp:73:8: error: macro names must be identifiers
sketch_jun25a:66: error: stray '#' in program
sketch_jun25a.cpp:74:9: error: invalid suffix "E7E" on floating constant
sketch_jun25a.cpp:75:8: error: macro names must be identifiers
sketch_jun25a.cpp:76:8: error: macro names must be identifiers
sketch_jun25a.cpp:77:8: error: macro names must be identifiers
sketch_jun25a.cpp:78:8: error: macro names must be identifiers
sketch_jun25a.cpp:79:8: error: macro names must be identifiers
sketch_jun25a.cpp:80:8: error: macro names must be identifiers
sketch_jun25a.cpp:81:8: error: macro names must be identifiers
sketch_jun25a.cpp:82:8: error: macro names must be identifiers
sketch_jun25a.cpp:83:8: error: macro names must be identifiers
sketch_jun25a.cpp:84:8: error: macro names must be identifiers
sketch_jun25a.cpp:85:8: error: macro names must be identifiers
sketch_jun25a.cpp:86:8: error: macro names must be identifiers
sketch_jun25a.cpp:87:8: error: macro names must be identifiers
sketch_jun25a.cpp:88:8: error: macro names must be identifiers
sketch_jun25a.cpp:89:8: error: macro names must be identifiers
sketch_jun25a.cpp:90:8: error: macro names must be identifiers
sketch_jun25a:83: error: stray '#' in program
sketch_jun25a.cpp:91:9: error: invalid suffix "E7E" on floating constant
sketch_jun25a.cpp:92:8: error: macro names must be identifiers
sketch_jun25a.cpp:93:8: error: macro names must be identifiers
sketch_jun25a.cpp:94:8: error: macro names must be identifiers
sketch_jun25a.cpp:95:8: error: macro names must be identifiers
sketch_jun25a.cpp:96:8: error: macro names must be identifiers
sketch_jun25a.cpp:97:8: error: macro names must be identifiers
sketch_jun25a.cpp:98:8: error: macro names must be identifiers
sketch_jun25a.cpp:99:8: error: macro names must be identifiers
sketch_jun25a.cpp:100:8: error: macro names must be identifiers
sketch_jun25a.cpp:101:8: error: macro names must be identifiers
sketch_jun25a.cpp:102:8: error: macro names must be identifiers
sketch_jun25a.cpp:103:8: error: macro names must be identifiers
sketch_jun25a.cpp:104:8: error: macro names must be identifiers
sketch_jun25a.cpp:105:8: error: macro names must be identifiers
sketch_jun25a.cpp:106:8: error: macro names must be identifiers
sketch_jun25a.cpp:107:8: error: macro names must be identifiers
sketch_jun25a:100: error: stray '#' in program
sketch_jun25a.cpp:108:9: error: invalid suffix "E7E" on floating constant
sketch_jun25a.cpp:109:8: error: macro names must be identifiers
sketch_jun25a.cpp:110:8: error: macro names must be identifiers
sketch_jun25a.cpp:111:8: error: macro names must be identifiers
sketch_jun25a.cpp:112:8: error: macro names must be identifiers
sketch_jun25a.cpp:113:8: error: macro names must be identifiers
sketch_jun25a.cpp:114:8: error: macro names must be identifiers
sketch_jun25a.cpp:115:8: error: macro names must be identifiers
sketch_jun25a.cpp:116:8: error: macro names must be identifiers
sketch_jun25a.cpp:117:8: error: macro names must be identifiers
sketch_jun25a.cpp:118:8: error: macro names must be identifiers
sketch_jun25a.cpp:119:8: error: macro names must be identifiers
sketch_jun25a.cpp:120:8: error: macro names must be identifiers
sketch_jun25a.cpp:121:8: error: macro names must be identifiers
sketch_jun25a.cpp:122:8: error: macro names must be identifiers
sketch_jun25a.cpp:123:8: error: macro names must be identifiers
sketch_jun25a.cpp:124:8: error: macro names must be identifiers
sketch_jun25a:117: error: stray '#' in program
sketch_jun25a.cpp:125:9: error: invalid suffix "E7E" on floating constant
sketch_jun25a:119: error: stray '#' in program
sketch_jun25a.cpp:127:9: error: invalid suffix "E7E" on floating constant
sketch_jun25a:123: error: stray '#' in program
sketch_jun25a:123: error: stray '#' in program
sketch_jun25a:125: error: stray '#' in program
sketch_jun25a:125: error: stray '#' in program
sketch_jun25a:127: error: stray '#' in program
sketch_jun25a:127: error: stray '#' in program
sketch_jun25a:129: error: stray '#' in program
sketch_jun25a:129: error: stray '#' in program
sketch_jun25a.cpp:137:78: error: invalid digit "9" in octal constant
sketch_jun25a:129: error: stray '#' in program
sketch_jun25a.cpp:137:110: error: invalid suffix "E7E" on floating constant
sketch_jun25a:130: error: stray '#' in program
sketch_jun25a:130: error: stray '#' in program
sketch_jun25a.cpp:138:84: error: invalid digit "9" in octal constant
sketch_jun25a:130: error: stray '#' in program
sketch_jun25a.cpp:138:113: error: invalid suffix "E7E" on floating constant
sketch_jun25a:131: error: stray '#' in program
sketch_jun25a:131: error: stray '#' in program
sketch_jun25a.cpp:139:71: error: invalid digit "9" in octal constant
sketch_jun25a:131: error: stray '#' in program
sketch_jun25a.cpp:139:103: error: invalid suffix "E7E" on floating constant
sketch_jun25a:137: error: stray '#' in program
sketch_jun25a:137: error: stray '#' in program
sketch_jun25a:140: error: stray '#' in program
sketch_jun25a:144: error: stray '#' in program
sketch_jun25a.cpp:152:33: error: invalid suffix "E7E" on floating constant
sketch_jun25a:145: error: stray '#' in program
sketch_jun25a:146: error: stray '#' in program
sketch_jun25a:146: error: stray '#' in program
sketch_jun25a:148: error: stray '#' in program
sketch_jun25a:152: error: stray '#' in program
sketch_jun25a.cpp:160:33: error: invalid suffix "E7E" on floating constant
sketch_jun25a:155: error: stray '#' in program
sketch_jun25a.cpp:163:33: error: invalid suffix "E7E" on floating constant
sketch_jun25a:156: error: stray '#' in program
sketch_jun25a:158: error: stray '#' in program
sketch_jun25a.cpp:166:33: error: invalid suffix "E7E" on floating constant
sketch_jun25a:159: error: stray '#' in program
sketch_jun25a.cpp:167:33: error: invalid suffix "E7E" on floating constant
sketch_jun25a:160: error: stray '#' in program
sketch_jun25a:160: error: stray '#' in program
sketch_jun25a:162: error: stray '#' in program
sketch_jun25a:162: error: stray '#' in program
sketch_jun25a:162: error: stray '#' in program
sketch_jun25a.cpp:170:123: error: invalid digit "9" in octal constant
sketch_jun25a:166: error: stray '#' in program
sketch_jun25a.cpp:174:57: error: invalid suffix "E7E" on floating constant
sketch_jun25a:168: error: stray '#' in program
sketch_jun25a:169: error: stray '#' in program
sketch_jun25a:169: error: stray '#' in program
sketch_jun25a:169: error: stray '#' in program
sketch_jun25a.cpp:177:149: error: invalid digit "9" in octal constant
sketch_jun25a:170: error: stray '#' in program
sketch_jun25a:170: error: stray '#' in program
sketch_jun25a:171: error: stray '#' in program
sketch_jun25a:171: error: stray '#' in program
sketch_jun25a:171: error: stray '#' in program
sketch_jun25a.cpp:179:149: error: invalid digit "9" in octal constant
sketch_jun25a:172: error: stray '#' in program
sketch_jun25a:173: error: stray '#' in program
sketch_jun25a:173: error: stray '#' in program
sketch_jun25a:173: error: stray '#' in program
sketch_jun25a.cpp:181:149: error: invalid digit "9" in octal constant
sketch_jun25a:178: error: stray '#' in program
sketch_jun25a.cpp:186:54: error: invalid suffix "E7E" on floating constant
sketch_jun25a:180: error: stray '#' in program
sketch_jun25a:183: error: stray '#' in program
sketch_jun25a.cpp:191:9: error: invalid suffix "E7E" on floating constant
sketch_jun25a:189: error: stray '#' in program
sketch_jun25a:191: error: stray '#' in program
sketch_jun25a:192: error: stray '#' in program
sketch_jun25a:192: error: stray '#' in program
sketch_jun25a:193: error: stray '#' in program
sketch_jun25a:193: error: stray '#' in program
sketch_jun25a:193: error: stray '#' in program
sketch_jun25a.cpp:201:142: error: invalid digit "9" in octal constant
sketch_jun25a:194: error: stray '#' in program
sketch_jun25a:194: error: stray '#' in program
sketch_jun25a:194: error: stray '#' in program
sketch_jun25a.cpp:202:136: error: invalid digit "9" in octal constant
sketch_jun25a:196: error: stray '#' in program
sketch_jun25a:196: error: stray '#' in program
sketch_jun25a:196: error: stray '#' in program
sketch_jun25a.cpp:204:101: error: invalid digit "9" in octal constant
sketch_jun25a:199: error: stray '#' in program
sketch_jun25a.cpp:207:9: error: invalid suffix "E7E" on floating constant
sketch_jun25a:205: error: stray '#' in program
sketch_jun25a:207: error: stray '#' in program
sketch_jun25a:207: error: stray '#' in program
sketch_jun25a:207: error: stray '#' in program
sketch_jun25a.cpp:215:99: error: invalid digit "9" in octal constant
sketch_jun25a:208: error: stray '#' in program
sketch_jun25a:209: error: stray '#' in program
sketch_jun25a:209: error: stray '#' in program
sketch_jun25a:209: error: stray '#' in program
sketch_jun25a.cpp:217:125: error: invalid digit "9" in octal constant
sketch_jun25a:210: error: stray '#' in program
sketch_jun25a:210: error: stray '#' in program
sketch_jun25a:211: error: stray '#' in program
sketch_jun25a:211: error: stray '#' in program
sketch_jun25a:211: error: stray '#' in program
sketch_jun25a.cpp:219:125: error: invalid digit "9" in octal constant
sketch_jun25a:212: error: stray '#' in program
sketch_jun25a:212: error: stray '#' in program
sketch_jun25a:213: error: stray '#' in program
sketch_jun25a:213: error: stray '#' in program
sketch_jun25a:213: error: stray '#' in program
sketch_jun25a.cpp:221:125: error: invalid digit "9" in octal constant
sketch_jun25a:214: error: stray '#' in program
sketch_jun25a:214: error: stray '#' in program
sketch_jun25a:215: error: stray '#' in program
sketch_jun25a:215: error: stray '#' in program
sketch_jun25a:215: error: stray '#' in program
sketch_jun25a.cpp:223:125: error: invalid digit "9" in octal constant
sketch_jun25a:216: error: stray '#' in program
sketch_jun25a:216: error: stray '#' in program
sketch_jun25a:217: error: stray '#' in program
sketch_jun25a:217: error: stray '#' in program
sketch_jun25a:217: error: stray '#' in program
sketch_jun25a.cpp:225:125: error: invalid digit "9" in octal constant
sketch_jun25a:218: error: stray '#' in program
sketch_jun25a:219: error: stray '#' in program
sketch_jun25a:219: error: stray '#' in program
sketch_jun25a:219: error: stray '#' in program
sketch_jun25a.cpp:227:125: error: invalid digit "9" in octal constant
sketch_jun25a:222: error: stray '#' in program
sketch_jun25a.cpp:230:9: error: invalid suffix "E7E" on floating constant
sketch_jun25a:228: error: stray '#' in program
sketch_jun25a:230: error: stray '#' in program
sketch_jun25a:230: error: stray '#' in program
sketch_jun25a.cpp:238:84: error: invalid digit "9" in octal constant
sketch_jun25a:232: error: stray '#' in program
sketch_jun25a.cpp:240:33: error: invalid suffix "E7E" on floating constant
sketch_jun25a:233: error: stray '#' in program
sketch_jun25a:233: error: stray '#' in program
sketch_jun25a:234: error: stray '#' in program
sketch_jun25a:234: error: stray '#' in program
sketch_jun25a:236: error: stray '#' in program
sketch_jun25a:236: error: stray '#' in program
sketch_jun25a.cpp:244:84: error: invalid digit "9" in octal constant
sketch_jun25a:240: error: stray '#' in program
sketch_jun25a.cpp:248:9: error: invalid suffix "E7E" on floating constant
sketch_jun25a:250: error: stray '#' in program
sketch_jun25a:250: error: stray '#' in program
sketch_jun25a.cpp:258:84: error: invalid digit "9" in octal constant
sketch_jun25a:252: error: stray '#' in program
sketch_jun25a.cpp:260:33: error: invalid suffix "E7E" on floating constant
sketch_jun25a:253: error: stray '#' in program
sketch_jun25a:253: error: stray '#' in program
sketch_jun25a:254: error: stray '#' in program
sketch_jun25a:254: error: stray '#' in program
sketch_jun25a:256: error: stray '#' in program
sketch_jun25a:256: error: stray '#' in program
sketch_jun25a.cpp:264:84: error: invalid digit "9" in octal constant
sketch_jun25a:258: error: stray '#' in program
sketch_jun25a:261: error: stray '#' in program
sketch_jun25a.cpp:269:9: error: invalid suffix "E7E" on floating constant
sketch_jun25a:267: error: stray '#' in program
sketch_jun25a:271: error: stray '#' in program
sketch_jun25a.cpp:279:85: error: invalid suffix "E7E" on floating constant
sketch_jun25a:275: error: stray '#' in program
sketch_jun25a.cpp:283:9: error: invalid suffix "E7E" on floating constant
sketch_jun25a:281: error: stray '#' in program
sketch_jun25a:285: error: stray '#' in program
sketch_jun25a.cpp:293:88: error: invalid suffix "E7E" on floating constant
sketch_jun25a:289: error: stray '#' in program
sketch_jun25a.cpp:297:9: error: invalid suffix "E7E" on floating constant
sketch_jun25a:295: error: stray '#' in program
sketch_jun25a:295: error: stray '#' in program
sketch_jun25a:300: error: stray '#' in program
sketch_jun25a:307: error: stray '#' in program
sketch_jun25a.cpp:315:9: error: invalid suffix "E7E" on floating constant
sketch_jun25a:313: error: stray '#' in program
sketch_jun25a:313: error: stray '#' in program
sketch_jun25a:319: error: stray '#' in program
sketch_jun25a.cpp:327:9: error: invalid suffix "E7E" on floating constant
sketch_jun25a:325: error: stray '#' in program
sketch_jun25a:325: error: stray '#' in program
sketch_jun25a:331: error: stray '#' in program
sketch_jun25a.cpp:339:9: error: invalid suffix "E7E" on floating constant
sketch_jun25a:337: error: stray '#' in program
sketch_jun25a:337: error: stray '#' in program
sketch_jun25a:339: error: stray '#' in program
sketch_jun25a:339: error: stray '#' in program
sketch_jun25a.cpp:347:76: error: invalid digit "9" in octal constant
sketch_jun25a:343: error: stray '#' in program
sketch_jun25a.cpp:351:33: error: invalid suffix "E7E" on floating constant
sketch_jun25a:344: error: stray '#' in program
sketch_jun25a.cpp:352:74: error: invalid suffix "E7E" on floating constant
sketch_jun25a:345: error: stray '#' in program
sketch_jun25a.cpp:353:79: error: invalid suffix "E7E" on floating constant
sketch_jun25a:349: error: stray '#' in program
sketch_jun25a.cpp:357:75: error: invalid suffix "E7E" on floating constant
sketch_jun25a:350: error: stray '#' in program
sketch_jun25a.cpp:358:73: error: invalid suffix "E7E" on floating constant
sketch_jun25a:352: error: stray '#' in program
sketch_jun25a.cpp:360:33: error: invalid suffix "E7E" on floating constant
sketch_jun25a:353: error: stray '#' in program
sketch_jun25a.cpp:361:33: error: invalid suffix "E7E" on floating constant
sketch_jun25a:354: error: stray '#' in program
sketch_jun25a.cpp:362:33: error: invalid suffix "E7E" on floating constant
sketch_jun25a:356: error: stray '#' in program
sketch_jun25a.cpp:364:51: error: invalid suffix "E7E" on floating constant
sketch_jun25a:360: error: stray '#' in program
sketch_jun25a.cpp:368:9: error: invalid suffix "E7E" on floating constant
sketch_jun25a:374: error: stray '#' in program
sketch_jun25a:375: error: stray '#' in program
sketch_jun25a.cpp:383:58: error: invalid suffix "E7E" on floating constant
sketch_jun25a:377: error: stray '#' in program
sketch_jun25a.cpp:385:79: error: invalid suffix "E7E" on floating constant
sketch_jun25a:380: error: stray '#' in program
sketch_jun25a:382: error: stray '#' in program
sketch_jun25a:382: error: stray '#' in program
sketch_jun25a:384: error: stray '#' in program
sketch_jun25a:387: error: stray '#' in program
sketch_jun25a:387: error: stray '#' in program
sketch_jun25a:391: error: stray '#' in program
sketch_jun25a.cpp:399:9: error: invalid suffix "E7E" on floating constant
sketch_jun25a:401: error: stray '#' in program
sketch_jun25a:403: error: stray '#' in program
sketch_jun25a:410: error: stray '#' in program
sketch_jun25a:412: error: stray '#' in program
sketch_jun25a:412: error: stray '#' in program
sketch_jun25a.cpp:420:98: error: invalid suffix "E7E" on floating constant
sketch_jun25a:416: error: stray '#' in program
sketch_jun25a:418: error: stray '#' in program
sketch_jun25a:418: error: stray '#' in program
sketch_jun25a.cpp:426:101: error: invalid suffix "E7E" on floating constant
sketch_jun25a:422: error: stray '#' in program
sketch_jun25a:424: error: stray '#' in program
sketch_jun25a:425: error: stray '#' in program
sketch_jun25a:428: error: stray '#' in program
sketch_jun25a.cpp:436:82: error: invalid suffix "E7E" on floating constant
sketch_jun25a:429: error: stray '#' in program
sketch_jun25a.cpp:437:75: error: invalid suffix "E7E" on floating constant
sketch_jun25a:430: error: stray '#' in program
sketch_jun25a.cpp:438:75: error: invalid suffix "E7E" on floating constant
sketch_jun25a:432: error: stray '#' in program
sketch_jun25a.cpp:440:80: error: invalid suffix "E7E" on floating constant
sketch_jun25a:434: error: stray '#' in program
sketch_jun25a.cpp:442:33: error: invalid suffix "E7E" on floating constant
sketch_jun25a:435: error: stray '#' in program
sketch_jun25a:437: error: stray '#' in program
sketch_jun25a:440: error: stray '#' in program
sketch_jun25a.cpp:448:33: error: invalid suffix "E7E" on floating constant
sketch_jun25a:442: error: stray '#' in program
sketch_jun25a:444: error: stray '#' in program
sketch_jun25a.cpp:452:100: error: invalid suffix "E7E" on floating constant
sketch_jun25a:447: error: stray '#' in program
sketch_jun25a.cpp:455:33: error: invalid suffix "E7E" on floating constant
sketch_jun25a:448: error: stray '#' in program
sketch_jun25a.cpp:456:58: error: invalid suffix "E7E" on floating constant
sketch_jun25a:449: error: stray '#' in program
sketch_jun25a:451: error: stray '#' in program
sketch_jun25a.cpp:459:57: error: invalid suffix "E7E" on floating constant
sketch_jun25a:452: error: stray '#' in program
sketch_jun25a.cpp:460:57: error: invalid suffix "E7E" on floating constant
sketch_jun25a:456: error: stray '#' in program
sketch_jun25a:458: error: stray '#' in program
sketch_jun25a.cpp:466:78: error: invalid suffix "E7E" on floating constant
sketch_jun25a:460: error: stray '#' in program
sketch_jun25a:462: error: stray '#' in program
sketch_jun25a:462: error: stray '#' in program
sketch_jun25a.cpp:470:117: error: invalid suffix "E7E" on floating constant
sketch_jun25a:464: error: stray '#' in program
sketch_jun25a:465: error: stray '#' in program
sketch_jun25a:467: error: stray '#' in program
sketch_jun25a:467: error: stray '#' in program
sketch_jun25a.cpp:475:150: error: invalid suffix "E7E" on floating constant
sketch_jun25a:470: error: stray '#' in program
sketch_jun25a:474: error: stray '#' in program
sketch_jun25a:478: error: stray '#' in program
sketch_jun25a:483: error: stray '#' in program
sketch_jun25a:487: error: stray '#' in program
sketch_jun25a:492: error: stray '#' in program
sketch_jun25a.cpp:500:105: error: invalid suffix "E7E" on floating constant
sketch_jun25a:493: error: stray '#' in program
sketch_jun25a:499: error: stray '#' in program
sketch_jun25a:501: error: stray '#' in program
sketch_jun25a:506: error: stray '#' in program
sketch_jun25a.cpp:514:33: error: invalid suffix "E7E" on floating constant
sketch_jun25a:507: error: stray '#' in program
sketch_jun25a.cpp:515:33: error: invalid suffix "E7E" on floating constant
sketch_jun25a:509: error: stray '#' in program
sketch_jun25a:509: error: stray '#' in program
sketch_jun25a:513: error: stray '#' in program
sketch_jun25a.cpp:521:9: error: invalid suffix "E7E" on floating constant
sketch_jun25a:521: error: stray '#' in program
sketch_jun25a:526: error: stray '#' in program
sketch_jun25a.cpp:534:33: error: invalid suffix "E7E" on floating constant
sketch_jun25a:527: error: stray '#' in program
sketch_jun25a.cpp:535:33: error: invalid suffix "E7E" on floating constant
sketch_jun25a:528: error: stray '#' in program
sketch_jun25a.cpp:536:79: error: invalid suffix "E7E" on floating constant
sketch_jun25a:532: error: stray '#' in program
sketch_jun25a:534: error: stray '#' in program
sketch_jun25a:534: error: stray '#' in program
sketch_jun25a:536: error: stray '#' in program
sketch_jun25a.cpp:544:57: error: invalid suffix "E7E" on floating constant
sketch_jun25a:537: error: stray '#' in program
sketch_jun25a:541: error: stray '#' in program
sketch_jun25a:543: error: stray '#' in program
sketch_jun25a:547: error: stray '#' in program
sketch_jun25a.cpp:555:33: error: invalid suffix "E7E" on floating constant
sketch_jun25a:549: error: stray '#' in program
sketch_jun25a:549: error: stray '#' in program
sketch_jun25a:553: error: stray '#' in program
sketch_jun25a.cpp:561:9: error: invalid suffix "E7E" on floating constant
sketch_jun25a:559: error: stray '#' in program
sketch_jun25a:563: error: stray '#' in program
sketch_jun25a.cpp:571:74: error: invalid suffix "E7E" on floating constant
sketch_jun25a:564: error: stray '#' in program
sketch_jun25a.cpp:572:75: error: invalid suffix "E7E" on floating constant
sketch_jun25a:565: error: stray '#' in program
sketch_jun25a.cpp:573:33: error: invalid suffix "E7E" on floating constant
sketch_jun25a:567: error: stray '#' in program
sketch_jun25a.cpp:575:33: error: invalid suffix "E7E" on floating constant
sketch_jun25a:568: error: stray '#' in program
sketch_jun25a:574: error: stray '#' in program
sketch_jun25a.cpp:582:33: error: invalid suffix "E7E" on floating constant
sketch_jun25a:576: error: stray '#' in program
sketch_jun25a:581: error: stray '#' in program
sketch_jun25a:581: error: stray '#' in program
sketch_jun25a.cpp:589:85: error: invalid suffix "E7E" on floating constant
sketch_jun25a:583: error: stray '#' in program
sketch_jun25a.cpp:591:33: error: invalid suffix "E7E" on floating constant
sketch_jun25a:590: error: stray '#' in program
sketch_jun25a.cpp:598:9: error: invalid suffix "E7E" on floating constant
sketch_jun25a:598: error: stray '#' in program
sketch_jun25a:606: error: stray '#' in program
sketch_jun25a:608: error: stray '#' in program
sketch_jun25a:608: error: stray '#' in program
sketch_jun25a:610: error: stray '#' in program
sketch_jun25a:613: error: stray '#' in program
sketch_jun25a:613: error: stray '#' in program
sketch_jun25a:615: error: stray '#' in program
sketch_jun25a:615: error: stray '#' in program
sketch_jun25a.cpp:623:101: error: invalid suffix "E7E" on floating constant
sketch_jun25a:620: error: stray '#' in program
sketch_jun25a:622: error: stray '#' in program
sketch_jun25a:622: error: stray '#' in program
sketch_jun25a:624: error: stray '#' in program
sketch_jun25a:628: error: stray '#' in program
sketch_jun25a:628: error: stray '#' in program
sketch_jun25a:632: error: stray '#' in program
sketch_jun25a.cpp:640:9: error: invalid suffix "E7E" on floating constant
sketch_jun25a:638: error: stray '#' in program
sketch_jun25a:638: error: stray '#' in program
sketch_jun25a:640: error: stray '#' in program
sketch_jun25a:648: error: stray '#' in program
sketch_jun25a:-1: error: expected constructor, destructor, or type conversion before ']' token
sketch_jun25a:-1: error: expected constructor, destructor, or type conversion before ']' token
sketch_jun25a:-1: error: expected constructor, destructor, or type conversion before ']' token
sketch_jun25a:-1: error: expected constructor, destructor, or type conversion before ']' token
sketch_jun25a:-1: error: expected constructor, destructor, or type conversion before ']' token
sketch_jun25a:-1: error: expected constructor, destructor, or type conversion before ']' token
sketch_jun25a:0: error: expected unqualified-id before '[' token
sketch_jun25a:13: error: expected unqualified-id before '[' token
sketch_jun25a:17: error: expected unqualified-id before '[' token
sketch_jun25a:120: error: expected constructor, destructor, or type conversion before ';' token
sketch_jun25a:123: error: expected unqualified-id before '[' token
sketch_jun25a:137: error: expected unqualified-id before '[' token
还是出现stray'#'in program 本帖最后由 wasdpkj 于 2013-6-25 22:37 编辑
帮lz重贴代码,= = 太长了
#include <SPI.h>
#define uchar unsigned char
#define uint unsigned int
//data array maxium length数据中数组最大长度
#define MAX_LEN 16
/////////////////////////////////////////////////////////////////////
//set the pin管脚设置
/////////////////////////////////////////////////////////////////////
const int chipSelectPin = 10;
const int NRSTPD = 5;
//MF522 command bits 命令位
#define ;PCD_IDLE 0x00 //NO action; cancel current commands无动作,取消当前命令
#define ;PCD_AUTHENT 0x0E //verify password key密码验证
#define ;PCD_RECEIVE 0x08 //receive data接收数据
#define ;PCD_TRANSMIT 0x04 //send data发送数据
#define ;PCD_TRANSCEIVE 0x0C //send and receive data收发数据
#define ;PCD_RESETPHASE 0x0F //reset重置
#define ;PCD_CALCCRC 0x03 //CRC check and caculation CRC校验和计算
//Mifare_One card command bits非接触式读卡器命令
#define ;PICC_REQIDL 0x26 //Search the cards that not into sleep mode in the antenna area 搜索未进入天线区域睡眠模式的卡
#define ;PICC_REQALL 0x52 //Search all the cards in the antenna area搜索天线区域所有卡
#define ;PICC_ANTICOLL 0x93 //prevent conflict防止冲突
#define ;PICC_SElECTTAG 0x93 //select card选择卡
#define ;PICC_AUTHENT1A 0x60 //verify A password key验证A密码键
#define ;PICC_AUTHENT1B 0x61 //verify B password key验证B密码键
#define ;PICC_READ 0x30 //read 读
#define ;PICC_WRITE 0xA0 //write写
#define ;PICC_DECREMENT 0xC0 //deduct value减去值
#define ;PICC_INCREMENT 0xC1 //charge up value增加值
#define ;PICC_RESTORE 0xC2 //Restore data into buffer将数据恢复到缓冲区
#define ;PICC_TRANSFER 0xB0 //Save data into buffer保存数据到缓冲区
#define ;PICC_HALT 0x50 //sleep mode睡眠模式
//THe mistake code that return when communicate with MF522与MF522交流时返回的错误代码
#define MI_OK 0
#define MI_NOTAGERR 1
#define MI_ERR 2
//------------------MFRC522 register 登记---------------
//Page 0:Command and Status 0页:命令和状态
#define Reserved00 0x00
#define CommandReg 0x01
#define CommIEnReg 0x02
#define DivlEnReg 0x03
#define CommIrqReg 0x04
#define DivIrqReg 0x05
#define ErrorReg 0x06
#define Status1Reg 0x07
#define Status2Reg 0x08
#define FIFODataReg 0x09
#define FIFOLevelReg 0x0A
#define WaterLevelReg 0x0B
#define ControlReg 0x0C
#define BitFramingReg 0x0D
#define CollReg 0x0E
#define Reserved01 0x0F
//Page 1:Command 命令
#define Reserved10 0x10
#define ModeReg 0x11
#define TxModeReg 0x12
#define RxModeReg 0x13
#define TxControlReg 0x14
#define TxAutoReg 0x15
#define TxSelReg 0x16
#define RxSelReg 0x17
#define RxThresholdReg 0x18
#define DemodReg 0x19
#define Reserved11 0x1A
#define Reserved12 0x1B
#define MifareReg 0x1C
#define Reserved13 0x1D
#define Reserved14 0x1E
#define SerialSpeedReg 0x1F
//Page 2:CFG
#define Reserved20 0x20
#define CRCResultRegM 0x21
#define CRCResultRegL 0x22
#define Reserved21 0x23
#define ModWidthReg 0x24
#define Reserved22 0x25
#define RFCfgReg 0x26
#define GsNReg 0x27
#define CWGsPReg 0x28
#define ModGsPReg 0x29
#define TModeReg 0x2A
#define TPrescalerReg 0x2B
#define TReloadRegH 0x2C
#define TReloadRegL 0x2D
#define TCounterValueRegH 0x2E
#define TCounterValueRegL 0x2F
//Page 3:TestRegister 寄存器测试
#define Reserved30 0x30
#define TestSel1Reg 0x31
#define TestSel2Reg 0x32
#define TestPinEnReg 0x33
#define TestPinValueReg 0x34
#define TestBusReg 0x35
#define AutoTestReg 0x36
#define VersionReg 0x37
#define AnalogTestReg 0x38
#define TestDAC1Reg 0x39
#define TestDAC2Reg 0x3A
#define TestADCReg 0x3B
#define Reserved31 0x3C
#define Reserved32 0x3D
#define Reserved33 0x3E
#define Reserved34 0x3F
//-----------------------------------------------
//4 bytes Serial number of card, the 5 bytes is verfiy bytes4字节卡片编号,5字节变化值
uchar serNum;
void setup()
{
Serial.begin(57600);
SPI.begin();
pinMode(chipSelectPin,OUTPUT); // Set digital pin 10 as OUTPUT to connect it to the RFID /ENABLE pin 设置管脚10为输出并连接到模块使能口
digitalWrite(chipSelectPin, LOW); // Activate the RFID reader激活RFID读卡器
pinMode(NRSTPD,OUTPUT); // Set digital pin 5 , Not Reset and Power-down设置管脚5,非重置或掉电
MFRC522_Init();
}
void loop()
{
uchar status;
uchar str;
// Search card, return card types搜索卡并返回卡片类型
status = MFRC522_Request(PICC_REQIDL, str);
if (status != MI_OK)
{
return;
}
// Show card type显示卡片类型
ShowCardType(str);
//Prevent conflict, return the 4 bytes Serial number of the card防止冲突,返回4个字节的卡片编号
status = MFRC522_Anticoll(str);
// str: serial number of the card卡片编号
// str: XOR checksum of the SN.SN异或校验
if (status == MI_OK)
{
Serial.print("The card's number is: ");
memcpy(serNum, str, 5);
ShowCardID(serNum);
// Check people associated with card ID检查与卡片ID相符合的人
uchar* id = serNum;
if( id==0x4B && id==0xE6 && id==0xD1 && id==0x3B ) {
Serial.println("Hello Mary!");
} else if(id==0x3B && id==0xE6 && id==0xD1 && id==0x3B) {
Serial.println("Hello Greg!");
}else{
Serial.println("Hello unkown guy!");
}
}
MFRC522_Halt(); //命令卡进入睡眠模式
delay(200);
}
/*
* Function:ShowCardID
* Description:Show Card ID
* Input parameter:ID string
* Return:Null
*/
void ShowCardID(uchar *id)
{
int IDlen=4;
for(int i=0; i<IDlen; i++){
Serial.print(0x0F & (id>>4), HEX);
Serial.print(0x0F & id,HEX);
}
Serial.println("");
}
/*
* Function:ShowCardType
* Description:Show Card type
* Input parameter:Type string
* Return:Null
*/
void ShowCardType(uchar* type)
{
Serial.print("Card type: ");
if(type==0x04&&type==0x00)
Serial.println("MFOne-S50");
else if(type==0x02&&type==0x00)
Serial.println("MFOne-S70");
else if(type==0x44&&type==0x00)
Serial.println("MF-UltraLight");
else if(type==0x08&&type==0x00)
Serial.println("MF-Pro");
else if(type==0x44&&type==0x03)
Serial.println("MF Desire");
else
Serial.println("Unknown");
}
/*
* Function:Write_MFRC5200
* Description:write a byte data into one register of MR RC522
* Input parameter:addr--register address;val--the value that need to write in
* Return:Null
*/
void Write_MFRC522(uchar addr, uchar val)
{
digitalWrite(chipSelectPin, LOW);
//address format:0XXXXXX0
SPI.transfer((addr<<1)&0x7E);
SPI.transfer(val);
digitalWrite(chipSelectPin, HIGH);
}
/*
* Function:Read_MFRC522
* Description:read a byte data into one register of MR RC522
* Input parameter:addr--register address
* Return:return the read value
*/
uchar Read_MFRC522(uchar addr)
{
uchar val;
digitalWrite(chipSelectPin, LOW);
//address format:1XXXXXX0
SPI.transfer(((addr<<1)&0x7E) | 0x80);
val =SPI.transfer(0x00);
digitalWrite(chipSelectPin, HIGH);
return val;
}
/*
* Function:SetBitMask
* Description:set RC522 register bit
* Input parameter:reg--register address;mask--value
* Return:null
*/
void SetBitMask(uchar reg, uchar mask)
{
uchar tmp;
tmp = Read_MFRC522(reg);
Write_MFRC522(reg, tmp | mask); // set bit mask
}
/*
* Function:ClearBitMask
* Description:clear RC522 register bit
* Input parameter:reg--register address;mask--value
* Return:null
*/
void ClearBitMask(uchar reg, uchar mask)
{
uchar tmp;
tmp = Read_MFRC522(reg);
Write_MFRC522(reg, tmp & (~mask)); // clear bit mask
}
/*
* Function:AntennaOn
* Description:Turn on antenna, every time turn on or shut down antenna need at least 1ms delay
* Input parameter:null
* Return:null
*/
void AntennaOn(void)
{
uchar temp;
temp = Read_MFRC522(TxControlReg);
if (!(temp & 0x03))
{
SetBitMask(TxControlReg, 0x03);
}
}
/*
* Function:AntennaOff
* Description:Turn off antenna, every time turn on or shut down antenna need at least 1ms delay
* Input parameter:null
* Return:null
*/
void AntennaOff(void)
{
ClearBitMask(TxControlReg, 0x03);
}
/*
* Function:ResetMFRC522
* Description: reset RC522
* Input parameter:null
* Return:null
*/
void MFRC522_Reset(void)
{
Write_MFRC522(CommandReg, ;PCD_RESETPHASE);
}
/*
* Function:InitMFRC522
* Description:initilize RC522
* Input parameter:null
* Return:null
*/
void MFRC522_Init(void)
{
digitalWrite(NRSTPD,HIGH);
MFRC522_Reset();
//Timer: TPrescaler*TreloadVal/6.78MHz = 24ms
Write_MFRC522(TModeReg, 0x8D); //Tauto=1; f(Timer) = 6.78MHz/TPreScaler
Write_MFRC522(TPrescalerReg, 0x3E); //TModeReg + TPrescalerReg
Write_MFRC522(TReloadRegL, 30);
Write_MFRC522(TReloadRegH, 0);
Write_MFRC522(TxAutoReg, 0x40); //100%ASK
Write_MFRC522(ModeReg, 0x3D); //CRC initilizate value 0x6363 ???
//ClearBitMask(Status2Reg, 0x08); //MFCrypto1On=0
//Write_MFRC522(RxSelReg, 0x86); //RxWait = RxSelReg
//Write_MFRC522(RFCfgReg, 0x7F); //RxGain = 48dB
AntennaOn(); //turn on antenna
}
/*
* Function:MFRC522_Request
* Description:Searching card, read card type
* Input parameter:reqMode--search methods,
* TagType--return card types
* 0x4400 = Mifare_UltraLight
* 0x0400 = Mifare_One(S50)
* 0x0200 = Mifare_One(S70)
* 0x0800 = Mifare_Pro(X)
* 0x4403 = Mifare_DESFire
* return:return MI_OK if successed
*/
uchar MFRC522_Request(uchar reqMode, uchar *TagType)
{
uchar status;
uint backBits; //the data bits that received
Write_MFRC522(BitFramingReg, 0x07); //TxLastBists = BitFramingReg ???
TagType = reqMode;
status = MFRC522_ToCard(PCD_TRANSCEIVE, TagType, 1, TagType, &backBits);
if ((status != MI_OK) || (backBits != 0x10))
{
status = MI_ERR;
}
return status;
}
/*
* Function:MFRC522_ToCard
* Description:communicate between RC522 and ISO14443
* Input parameter:command--MF522 command bits
* sendData--send data to card via rc522
* sendLen--send data length
* backData--the return data from card
* backLen--the length of return data
* return:return MI_OK if successed
*/
uchar MFRC522_ToCard(uchar command, uchar *sendData, uchar sendLen, uchar *backData, uint *backLen)
{
uchar status = MI_ERR;
uchar irqEn = 0x00;
uchar waitIRq = 0x00;
uchar lastBits;
uchar n;
uint i;
switch (command)
{
case PCD_AUTHENT: //verify card password
{
irqEn = 0x12;
waitIRq = 0x10;
break;
}
case PCD_TRANSCEIVE: //send data in the FIFO
{
irqEn = 0x77;
waitIRq = 0x30;
break;
}
default:
break;
}
Write_MFRC522(CommIEnReg, irqEn|0x80); //Allow interruption
ClearBitMask(CommIrqReg, 0x80); //Clear all the interrupt bits
SetBitMask(FIFOLevelReg, 0x80); //FlushBuffer=1, FIFO initilizate
Write_MFRC522(CommandReg, ;PCD_IDLE); //NO action;cancel current command ???
//write data into FIFO
for (i=0; i<sendLen; i++)
{
Write_MFRC522(FIFODataReg, sendData);
}
//procceed it
Write_MFRC522(CommandReg, command);
if (command == PCD_TRANSCEIVE)
{
SetBitMask(BitFramingReg, 0x80); //StartSend=1,transmission of data starts
}
//waite receive data is finished
i = 2000; //i should adjust according the clock, the maxium the waiting time should be 25 ms???
do
{
//CommIrqReg
//Set1 TxIRq RxIRq IdleIRq HiAlerIRq LoAlertIRq ErrIRq TimerIRq
n = Read_MFRC522(CommIrqReg);
i--;
}
while ((i!=0) && !(n&0x01) && !(n&waitIRq));
ClearBitMask(BitFramingReg, 0x80); //StartSend=0
if (i != 0)
{
if(!(Read_MFRC522(ErrorReg) & 0x1B)) //BufferOvfl Collerr CRCErr ProtecolErr
{
status = MI_OK;
if (n & irqEn & 0x01)
{
status = MI_NOTAGERR; //??
}
if (command == PCD_TRANSCEIVE)
{
n = Read_MFRC522(FIFOLevelReg);
lastBits = Read_MFRC522(ControlReg) & 0x07;
if (lastBits)
{
*backLen = (n-1)*8 + lastBits;
}
else
{
*backLen = n*8;
}
if (n == 0)
{
n = 1;
}
if (n > MAX_LEN)
{
n = MAX_LEN;
}
//read the data from FIFO
for (i=0; i<n; i++)
{
backData = Read_MFRC522(FIFODataReg);
}
}
}
else
{
status = MI_ERR;
}
}
//SetBitMask(ControlReg,0x80); //timer stops
//Write_MFRC522(CommandReg, PCD_IDLE);
return status;
}
/*
* Function:MFRC522_Anticoll
* Description:Prevent conflict, read the card serial number
* Input parameter:serNum--return the 4 bytes card serial number, the 5th byte is recheck byte
* return:return MI_OK if successed
*/
uchar MFRC522_Anticoll(uchar *serNum)
{
uchar status;
uchar i;
uchar serNumCheck=0;
uint unLen;
//ClearBitMask(Status2Reg, 0x08); //strSensclear
//ClearBitMask(CollReg,0x80); //ValuesAfterColl
Write_MFRC522(BitFramingReg, 0x00); //TxLastBists = BitFramingReg
serNum = ;PICC_ANTICOLL;
serNum = 0x20;
status = MFRC522_ToCard(PCD_TRANSCEIVE, serNum, 2, serNum, &unLen);
if (status == MI_OK)
{
//Verify card serial number
for (i=0; i<4; i++)
{
serNumCheck ^= serNum;
}
if (serNumCheck != serNum)
{
status = MI_ERR;
}
}
//SetBitMask(CollReg, 0x80); //ValuesAfterColl=1
return status;
}
/*
* Function:CalulateCRC
* Description:Use MF522 to caculate CRC
* Input parameter:pIndata--the CRC data need to be read,len--data length,pOutData-- the caculated result of CRC
* return:Null
*/
void CalulateCRC(uchar *pIndata, uchar len, uchar *pOutData)
{
uchar i, n;
ClearBitMask(DivIrqReg, 0x04); //CRCIrq = 0
SetBitMask(FIFOLevelReg, 0x80); //Clear FIFO pointer
//Write_MFRC522(CommandReg, PCD_IDLE);
//Write data into FIFO
for (i=0; i<len; i++)
{
Write_MFRC522(FIFODataReg, *(pIndata+i));
}
Write_MFRC522(CommandReg, ;PCD_CALCCRC);
//waite CRC caculation to finish
i = 0xFF;
do
{
n = Read_MFRC522(DivIrqReg);
i--;
}
while ((i!=0) && !(n&0x04)); //CRCIrq = 1
//read CRC caculation result
pOutData = Read_MFRC522(CRCResultRegL);
pOutData = Read_MFRC522(CRCResultRegM);
}
/*
* Function:MFRC522_Write
* Description:write block data
* Input parameters:blockAddr--block address;writeData--Write 16 bytes data into block
* return:return MI_OK if successed
*/
uchar MFRC522_Write(uchar blockAddr, uchar *writeData)
{
uchar status;
uint recvBits;
uchar i;
uchar buff;
buff = ;PICC_WRITE;
buff = blockAddr;
CalulateCRC(buff, 2, &buff);
status = MFRC522_ToCard(PCD_TRANSCEIVE, buff, 4, buff, &recvBits);
if ((status != MI_OK) || (recvBits != 4) || ((buff & 0x0F) != 0x0A))
{
status = MI_ERR;
}
if (status == MI_OK)
{
for (i=0; i<16; i++) //Write 16 bytes data into FIFO
{
buff = *(writeData+i);
}
CalulateCRC(buff, 16, &buff);
status = MFRC522_ToCard(PCD_TRANSCEIVE, buff, 18, buff, &recvBits);
if ((status != MI_OK) || (recvBits != 4) || ((buff & 0x0F) != 0x0A))
{
status = MI_ERR;
}
}
return status;
}
/*
* Function:MFRC522_Halt
* Description:Command the cards into sleep mode
* Input parameters:null
* return:null
*/
void MFRC522_Halt(void)
{
uchar status;
uint unLen;
uchar buff;
buff = ;PICC_HALT;
buff = 0;
CalulateCRC(buff, 2, &buff);
status = MFRC522_ToCard(PCD_TRANSCEIVE, buff, 4, buff,&unLen);
}
wasdpkj 发表于 2013-6-25 22:32 static/image/common/back.gif
帮lz重贴代码,= = 太长了
#include
'PICC_REQIDL' was not declared in thisscope
=================================
sketch_jun29a.cpp:54:9: error: macro names must be identifiers
sketch_jun29a.cpp:56:9: error: macro names must be identifiers
sketch_jun29a.cpp:58:9: error: macro names must be identifiers
sketch_jun29a.cpp:60:9: error: macro names must be identifiers
sketch_jun29a.cpp:62:9: error: macro names must be identifiers
sketch_jun29a.cpp:64:9: error: macro names must be identifiers
sketch_jun29a.cpp:66:9: error: macro names must be identifiers
sketch_jun29a.cpp:72:9: error: macro names must be identifiers
sketch_jun29a.cpp:74:9: error: macro names must be identifiers
sketch_jun29a.cpp:76:9: error: macro names must be identifiers
sketch_jun29a.cpp:78:9: error: macro names must be identifiers
sketch_jun29a.cpp:80:9: error: macro names must be identifiers
sketch_jun29a.cpp:82:9: error: macro names must be identifiers
sketch_jun29a.cpp:84:9: error: macro names must be identifiers
sketch_jun29a.cpp:86:9: error: macro names must be identifiers
sketch_jun29a.cpp:88:9: error: macro names must be identifiers
sketch_jun29a.cpp:90:9: error: macro names must be identifiers
sketch_jun29a.cpp:92:9: error: macro names must be identifiers
sketch_jun29a.cpp:94:9: error: macro names must be identifiers
sketch_jun29a.cpp:96:9: error: macro names must be identifiers
sketch_jun29a.cpp: In function 'void loop()':
sketch_jun29a:288: error: 'PICC_REQIDL' was not declared in this scope
sketch_jun29a.cpp: In function 'void ShowCardID(unsigned char*)':
sketch_jun29a:384: error: invalid operands of types 'unsigned char*' and 'int' to binary 'operator>>'
sketch_jun29a:386: error: invalid operands of types 'int' and 'unsigned char*' to binary 'operator&'
sketch_jun29a.cpp: In function 'void MFRC522_Reset()':
sketch_jun29a:652: error: expected primary-expression before ';' token
sketch_jun29a:652: error: 'PCD_RESETPHASE' was not declared in this scope
sketch_jun29a:652: error: expected `;' before ')' token
sketch_jun29a.cpp: In function 'unsigned char MFRC522_Request(unsigned char, unsigned char*)':
sketch_jun29a:758: error: 'PCD_TRANSCEIVE' was not declared in this scope
sketch_jun29a.cpp: In function 'unsigned char MFRC522_ToCard(unsigned char, unsigned char*, unsigned char, unsigned char*, unsigned int*)':
sketch_jun29a:822: error: 'PCD_AUTHENT' was not declared in this scope
sketch_jun29a:834: error: 'PCD_TRANSCEIVE' was not declared in this scope
sketch_jun29a:862: error: expected primary-expression before ';' token
sketch_jun29a:862: error: 'PCD_IDLE' was not declared in this scope
sketch_jun29a:862: error: expected `;' before ')' token
sketch_jun29a:872: error: invalid conversion from 'unsigned char*' to 'unsigned char'
sketch_jun29a:872: error: initializing argument 2 of 'void Write_MFRC522(unsigned char, unsigned char)'
sketch_jun29a:882: error: 'PCD_TRANSCEIVE' was not declared in this scope
sketch_jun29a:938: error: 'PCD_TRANSCEIVE' was not declared in this scope
sketch_jun29a:988: error: invalid conversion from 'unsigned char' to 'unsigned char*'
sketch_jun29a.cpp: In function 'unsigned char MFRC522_Anticoll(unsigned char*)':
sketch_jun29a:1058: error: expected primary-expression before ';' token
sketch_jun29a:1058: error: 'PICC_ANTICOLL' was not declared in this scope
sketch_jun29a:1062: error: 'PCD_TRANSCEIVE' was not declared in this scope
sketch_jun29a:1076: error: invalid operands of types 'unsigned char' and 'unsigned char*' to binary 'operator^'
sketch_jun29a:1076: error: in evaluation of 'operator^=(unsigned char, unsigned char*)'
sketch_jun29a:1080: error: ISO C++ forbids comparison between pointer and integer
sketch_jun29a.cpp: In function 'void CalulateCRC(unsigned char*, unsigned char, unsigned char*)':
sketch_jun29a:1142: error: expected primary-expression before ';' token
sketch_jun29a:1142: error: 'PCD_CALCCRC' was not declared in this scope
sketch_jun29a:1142: error: expected `;' before ')' token
sketch_jun29a.cpp: In function 'unsigned char MFRC522_Write(unsigned char, unsigned char*)':
sketch_jun29a:1204: error: expected primary-expression before ';' token
sketch_jun29a:1204: error: 'PICC_WRITE' was not declared in this scope
sketch_jun29a:1210: error: 'PCD_TRANSCEIVE' was not declared in this scope
sketch_jun29a:1232: error: incompatible types in assignment of 'unsigned char' to 'unsigned char '
sketch_jun29a.cpp: In function 'void MFRC522_Halt()':
sketch_jun29a:1286: error: expected primary-expression before ';' token
sketch_jun29a:1286: error: 'PICC_HALT' was not declared in this scope
sketch_jun29a:1294: error: 'PCD_TRANSCEIVE' was not declared in this scope enzotim 发表于 2013-6-29 11:51 static/image/common/back.gif
'PICC_REQIDL' was not declared in thisscope
=================================
//MF522 command bits 命令位
#define PCD_IDLE 0x00 //NO action; cancel current commands无动作,取消当前命令
#define PCD_AUTHENT 0x0E //verify password key密码验证
#define PCD_RECEIVE 0x08 //receive data接收数据
#define PCD_TRANSMIT 0x04 //send data发送数据
#define PCD_TRANSCEIVE 0x0C //send and receive data收发数据
#define PCD_RESETPHASE 0x0F //reset重置
#define PCD_CALCCRC 0x03 //CRC check and caculation CRC校验和计算
//Mifare_One card command bits非接触式读卡器命令
#define PICC_REQIDL 0x26 //Search the cards that not into sleep mode in the antenna area 搜索未进入天线区域睡眠模式的卡
#define PICC_REQALL 0x52 //Search all the cards in the antenna area搜索天线区域所有卡
#define PICC_ANTICOLL 0x93 //prevent conflict防止冲突
#define PICC_SElECTTAG 0x93 //select card选择卡
#define PICC_AUTHENT1A 0x60 //verify A password key验证A密码键
#define PICC_AUTHENT1B 0x61 //verify B password key验证B密码键
#define PICC_READ 0x30 //read 读
#define PICC_WRITE 0xA0 //write写
#define PICC_DECREMENT 0xC0 //deduct value减去值
#define PICC_INCREMENT 0xC1 //charge up value增加值
#define PICC_RESTORE 0xC2 //Restore data into buffer将数据恢复到缓冲区
#define PICC_TRANSFER 0xB0 //Save data into buffer保存数据到缓冲区
#define PICC_HALT 0x50 //sleep mode睡眠模式 为啥我的串口监视器看到的都是乱码呢。 rick_hou 发表于 2013-7-18 13:05 static/image/common/back.gif
为啥我的串口监视器看到的都是乱码呢。
波特率有设置一样吗? hp198969 发表于 2013-7-19 10:41 static/image/common/back.gif
波特率有设置一样吗?
一样。不过后来已经好了。忘记是用的谁的代码了 读不了卡里的内容:funk:
页:
[1]
2