RFID技术M1卡数据和钱包操作上机报告

上传人:lisu****2020 文档编号:97851501 上传时间:2022-05-28 格式:DOC 页数:9 大小:54.01KB
收藏 版权申诉 举报 下载
RFID技术M1卡数据和钱包操作上机报告_第1页
第1页 / 共9页
RFID技术M1卡数据和钱包操作上机报告_第2页
第2页 / 共9页
RFID技术M1卡数据和钱包操作上机报告_第3页
第3页 / 共9页
资源描述:

《RFID技术M1卡数据和钱包操作上机报告》由会员分享,可在线阅读,更多相关《RFID技术M1卡数据和钱包操作上机报告(9页珍藏版)》请在装配图网上搜索。

1、M1卡数据和钱包操作上机报告一、 实验目标通过对较常见RFID技术标准(ISO/IEC14443RFID)标准的PICC和PCD 的操作实验,写出M1卡数据读写函数,M1卡钱包读写函数和M1卡钱包加减函数,理解M1卡的数据存取机制、钱包存储结构、钱包工作原理。二、实验内容1)(写程序)实践阅读器对M1卡数据读写,理解M1卡的数据存取机制2)(写程序)实践阅读器对M1卡钱包读写,理解M1卡的钱包存储结构3)(写程序)实践阅读器对M1卡钱包加减,理解M1卡的钱包工作原理三、 实验分工:函数的理解和代码实现:XX实验报告书写:XX四、 分析、步骤、设计和布局1. 分析:通过添加数据读写按钮,块的初始

2、化,快增值,块减值和读块值按钮来实现数据读写,钱包读写和钱包加减。2. 在下载密码,初始化块值,快增值,块减值和读块值的函数里要注意扇区和块地址,是我们事先定好的地址。3.这是我们的设计和布局:五、 具体代码:/ text2Dlg.cpp : implementation file/#include StdAfx.h#include text2.h#include text2Dlg.h#include dcrf32.h#ifdef _DEBUG#define new DEBUG_NEW#undef THIS_FILEstatic char THIS_FILE = _FILE_;#endif/

3、CText2Dlg dialogCText2Dlg:CText2Dlg(CWnd* pParent /*=NULL*/): CDialog(CText2Dlg:IDD, pParent)/AFX_DATA_INIT(CText2Dlg)/ NOTE: the ClassWizard will add member initialization here/AFX_DATA_INIT/ Note that LoadIcon does not require a subsequent DestroyIcon in Win32m_hIcon = AfxGetApp()-LoadIcon(IDR_MAI

4、NFRAME);void CText2Dlg:DoDataExchange(CDataExchange* pDX)CDialog:DoDataExchange(pDX);/AFX_DATA_MAP(CText2Dlg)/ NOTE: the ClassWizard will add DDX and DDV calls here/AFX_DATA_MAPBEGIN_MESSAGE_MAP(CText2Dlg, CDialog)/AFX_MSG_MAP(CText2Dlg)ON_WM_PAINT()ON_WM_QUERYDRAGICON()ON_BN_CLICKED(IDC_BUTTON1, On

5、Button1)ON_BN_CLICKED(IDC_BUTTON2, OnButton2)ON_BN_CLICKED(IDC_BUTTON3, OnButton3)ON_BN_CLICKED(IDC_BUTTON5, OnButton5)ON_BN_CLICKED(IDC_BUTTON6, OnButton6)ON_BN_CLICKED(IDC_BUTTON7, OnButton7)ON_BN_CLICKED(IDC_BUTTON8, OnButton8)ON_BN_CLICKED(IDC_BUTTON9, OnButton9)ON_BN_CLICKED(IDC_BUTTON10, OnBut

6、ton10)ON_BN_CLICKED(IDC_BUTTON11, OnButton11)/AFX_MSG_MAPEND_MESSAGE_MAP()/ CText2Dlg message handlersBOOL CText2Dlg:OnInitDialog()CDialog:OnInitDialog();/ Set the icon for this dialog. The framework does this automatically/ when the applications main window is not a dialogSetIcon(m_hIcon, TRUE);/ S

7、et big iconSetIcon(m_hIcon, FALSE);/ Set small icon/ TODO: Add extra initialization herereturn TRUE; / return TRUE unless you set the focus to a control/ If you add a minimize button to your dialog, you will need the code below/ to draw the icon. For MFC applications using the document/view model,/

8、this is automatically done for you by the framework.void CText2Dlg:OnPaint() if (IsIconic()CPaintDC dc(this); / device context for paintingSendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);/ Center icon in client rectangleint cxIcon = GetSystemMetrics(SM_CXICON);int cyIcon = GetSystemMetri

9、cs(SM_CYICON);CRect rect;GetClientRect(&rect);int x = (rect.Width() - cxIcon + 1) / 2;int y = (rect.Height() - cyIcon + 1) / 2;/ Draw the icondc.DrawIcon(x, y, m_hIcon);elseCDialog:OnPaint();/ The system calls this to obtain the cursor to display while the user drags/ the minimized window.HCURSOR CT

10、ext2Dlg:OnQueryDragIcon()return (HCURSOR) m_hIcon;HANDLE icdev;unsigned long cardsnr;void CText2Dlg:OnButton1() / TODO: Add your control notification handler code here/初始化串口1, icdev=dc_init(100,9600);if(int)icdev=0) MessageBox(Init Com Error!);else MessageBox(Init Com OK!);dc_beep(icdev,10);return;v

11、oid CText2Dlg:OnButton2() / TODO: Add your control notification handler code hereint st;CString linstr;st=dc_card(icdev,0,&cardsnr); if(st!=0) MessageBox(Find Card Error!); return;elseMessageBox(Find Card Ok!); linstr.Format(%d,cardsnr); MessageBox(linstr);void CText2Dlg:OnButton3() / TODO: Add your

12、 control notification handler code hereint st;unsigned char databuff=0x44,0x33,0x33,0x66,0x33,0x44,0x33,0x66,0x36,0x34,0x33,0x44,0x33,0x66,0x36,0x34,0x00;/char databuff233;char str33;st=dc_write(icdev,1,databuff); if(st!=0) MessageBox(Write Card Error!); return; else MessageBox(Write Card Ok!); spri

13、ntf(str,%X%X,databuff0,databuff1); MessageBox(str);void CText2Dlg:OnButton5() / TODO: Add your control notification handler code here/下载密码, int st; unsigned char keyA6=0xff,0xff,0xff,0xff,0xff,0xff; st=dc_load_key(icdev,0,0,keyA); if(st!=0) MessageBox(Load Key Error!); else MessageBox(Load Key Ok!);

14、void CText2Dlg:OnButton6() / TODO: Add your control notification handler code here/核对密码 int st;st=dc_authentication(icdev,0,0); if(st!=0) MessageBox(Auth Card Error!); else MessageBox(Auth Card Ok!);void CText2Dlg:OnButton7() / TODO: Add your control notification handler code herechar databuff233=0;

15、int st; st=dc_read_hex(icdev,1,databuff2); if(st!=0)MessageBox(Readhex Card Error!);return; elseMessageBox(Readhex Card Ok!);MessageBox(databuff2);void CText2Dlg:OnButton8() / TODO: Add your control notification handler code hereunsigned char pieceaddr;unsigned long value; CString linstr; int st;cha

16、r databuff233=0;value=100;pieceaddr=1; st= dc_initval(icdev, pieceaddr, value);if (st!=0)MessageBox(dc_initval error); linstr.Format(%d,st); MessageBox(linstr);return;MessageBox(dc_initval ok);void CText2Dlg:OnButton9() / TODO: Add your control notification handler code hereunsigned char pieceaddr;u

17、nsigned long value; CString linstr; int st;char databuff233=0;value=2;st= dc_increment( icdev,1,value);if (st!=0)MessageBox(dc_increment error);return;MessageBox(dc_increment ok);void CText2Dlg:OnButton10() / TODO: Add your control notification handler code hereunsigned char pieceaddr;unsigned long

18、value; CString linstr; int st;char databuff233=0;st= dc_readval(icdev,1,&value);if (st!=0)MessageBox(dc_readval error);return;MessageBox(dc_readval ok);linstr.Format(%d,value);MessageBox(linstr);void CText2Dlg:OnButton11() / TODO: Add your control notification handler code hereunsigned char pieceadd

19、r;unsigned long value; CString linstr; int st;char databuff233=0;value=5; st= dc_decrement( icdev,1,value);if (st!=0)MessageBox(dc_decrement error);return;MessageBox(dc_decrement ok);六、 个人总结:1.这是第二次的上机实验,通过第一次老师的指导,我对M1卡已有些掌握,能实现卡的初始化,寻卡。此次实验又开始新的学习。主要是下载密码和核对密码,卡的读写以及块的读写和加减。虽然有成本函数,但是自己的编程前要先看懂弄明白函数,最主要主要的的是形参要看仔细。同时扇区和块也要事先定好。此次实验很成功,使得组员很有成就感,我们相信下次一定会做的更好。2.在这次实验中,我对M1卡的结构,块和扇区有了一定的认识。在此基础上,利用提供的函数编写了一些简单的对M1卡的操作函数。包括初始化,密码核对,下载,校检等。还有钱包操作,实质上就是块的增值和减值。总的来说,这次实验让我对M1卡有了初步的了解。

展开阅读全文
温馨提示:
1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
2: 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
3.本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!