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

📄 hy502.h

📁 SPI接口读写模块c程序
💻 H
字号:
#ifndef __HY502_H__
#define __HY502_H__

#define   CMD_OK	   0
#define   CMD_ERR      1 

// Define the commands
#define   PCD_PN       0x01		  // 设备型号
#define   PCD_SN       0x02		  // 设备序列号
#define   PWR_DOWN     0x03		  //设备掉电,需重新加电复位!,不带DOG时有效
#define   BAUD_SET     0x04		  //波特率设置
#define   FW_REL       0x10		  //PCD固件版本号
#define   SOFTDOWN     0x11		  //HY502模块软掉电
#define   HALT_CARD    0x12		  //中止卡操作
#define   AUTOSEARCH   0x13		  //自动寻卡
#define   BEEP         0x14		  //蜂鸣器开关
#define   BEEP_TIME    0x15		  //鸣响时间
#define   CARD_TYPE    0x19		  //读取卡类型
#define   CARD_SN      0x20		  //读卡序列号
#define   READ_BLOCK   0x21		  //读块数据
#define   WRITE_BLOCK  0x22		  //写块数据
#define   INIT_PURSE   0x23		  //初始化钱包
#define   READ_PURSE   0x24		  //读钱包
#define   ADD_PURSE    0x25		  //钱包充值
#define   DEC_PURSE    0x26		  //钱包扣款
#define   READ_SECTOR  0x2a       // 读扇区
#define   WRITE_SECTOR 0x2b       // 写扇区
#define   READ_E2      0x30       // 读E2
#define   WRITE_E2     0x31       // 写E2          


// Define the error commands return from HY502 chip

#define   ERR_HALT         0xed		  //中止卡操作错误
#define   ERR_AUTO         0xec		  //自动寻卡错误
#define   ERR_TYPE         0xe6		  //读取卡类型错误
#define   ERR_SN           0xdf		  //读卡序列号错误
#define   ERR_READ_BLOCK   0xde		  //读块数据错误
#define   ERR_WRITE_BLOCK  0xdd		  //写块数据错误
#define   ERR_INIT_PURSE   0xdc		  //初始化钱包错误
#define   ERR_READ_PURSE   0xdb		  //读钱包错误
#define   ERR_ADD_PURSE    0xda		  //钱包充值错误
#define   ERR_DEC_PURSE    0xd9		  //钱包扣款错误
///////////////////////////////////////////////////////////////////

#endif

⌨️ 快捷键说明

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