RFID技术M1卡数据和钱包操作上机报告.doc_第1页
RFID技术M1卡数据和钱包操作上机报告.doc_第2页
RFID技术M1卡数据和钱包操作上机报告.doc_第3页
RFID技术M1卡数据和钱包操作上机报告.doc_第4页
RFID技术M1卡数据和钱包操作上机报告.doc_第5页
已阅读5页,还剩4页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

M1卡数据和钱包操作上机报告1、 实验目标通过对较常见RFID技术标准(ISO/IEC14443RFID)标准的PICC和PCD 的操作实验,写出M1卡数据读写函数,M1卡钱包读写函数和M1卡钱包加减函数,理解M1卡的数据存取机制、钱包存储结构、钱包工作原理。二、实验内容1)(写程序)实践阅读器对M1卡数据读写,理解M1卡的数据存取机制2)(写程序)实践阅读器对M1卡钱包读写,理解M1卡的钱包存储结构3)(写程序)实践阅读器对M1卡钱包加减,理解M1卡的钱包工作原理3、 实验分工:函数的理解和代码实现:XX实验报告书写:XX4、 分析、步骤、设计和布局1. 分析:通过添加数据读写按钮,块的初始化,快增值,块减值和读块值按钮来实现数据读写,钱包读写和钱包加减。2. 在下载密码,初始化块值,快增值,块减值和读块值的函数里要注意扇区和块地址,是我们事先定好的地址。3.这是我们的设计和布局:5、 具体代码:/ 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/ 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_MAINFRAME);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, OnButton1)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, OnButton10)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);/ Set 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,/ 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 = GetSystemMetrics(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 CText2Dlg: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;void 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 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!); sprintf(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!);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;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;char 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;unsigned 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 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 pieceaddr;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);6、 个人总结:

温馨提示

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

评论

0/150

提交评论