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

更新时间:2023-10-28 09:06:01 阅读量: 综合文库 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

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

一、实验目标

通过对较常见RFID技术标准(ISO/IEC14443RFID)标准的PICC和PCD 的操作实验,写出M1卡数据读写函数,M1卡钱包读写函数和M1卡钱包加减函数,理解M1卡的数据存取机制、钱包存储结构、钱包工作原理。

二、实验内容

1)(写程序)实践阅读器对M1卡数据读写,理解M1卡的数据存取机制 2)(写程序)实践阅读器对M1卡钱包读写,理解M1卡的钱包存储结构 3)(写程序)实践阅读器对M1卡钱包加减,理解M1卡的钱包工作原理

三、实验分工:

函数的理解和代码实现:XX 实验报告书写:XX

四、分析、步骤、设计和布局

1.分析:通过添加数据读写按钮,块的初始化,快增值,块减值和读块值按钮来实现数据读写,钱包读写和钱包加减。

2.在下载密码,初始化块值,快增值,块减值和读块值的函数里要注意扇区和块地址,是我们事先定好的地址。

3.这是我们的设计和布局:

五、具体代码:

// text2Dlg.cpp : implementation file //

#include \#include \#include \#include \

#ifdef _DEBUG

#define new DEBUG_NEW #undef THIS_FILE

static char THIS_FILE[] = __FILE__; #endif

///////////////////////////////////////////////////////////////////////////// // CText2Dlg dialog

CText2Dlg::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 Win32 m_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_MAP }

BEGIN_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_MAP END_MESSAGE_MAP()

///////////////////////////////////////////////////////////////////////////// // CText2Dlg message handlers

BOOL CText2Dlg::OnInitDialog() { CDialog::OnInitDialog(); // Set the icon for this dialog. The framework does this automatically // when the application's main window is not a dialog SetIcon(m_hIcon, TRUE); // Set big icon SetIcon(m_hIcon, FALSE); // Set small icon // TODO: Add extra initialization here return 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 painting SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0); // Center icon in client rectangle int 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 icon dc.DrawIcon(x, y, m_hIcon); } else { CDialog::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(\ } else {

MessageBox(\ } dc_beep(icdev,10); return; }

void CText2Dlg::OnButton2() { // TODO: Add your control notification handler code here int st; CString linstr;

st=dc_card(icdev,0,&cardsnr); if(st!=0) {

MessageBox(\ return; } else { MessageBox(\ linstr.Format(\ MessageBox(linstr); } }

void CText2Dlg::OnButton3() { // TODO: Add your control notification handler code here int st; unsigned char

databuff[]={0x44,0x33,0x33,0x66,0x33,0x44,0x33,0x66,0x36,0x34,0x33,0x44,0x33,0x66,0x36,0x34,0x00};//

char databuff2[33]; char str[33]; st=dc_write(icdev,1,databuff); if(st!=0) {

MessageBox(\ return; } else { MessageBox(\ sprintf(str,\ MessageBox(str); } }

本文来源:https://www.bwwdw.com/article/wqe2.html

Top