台灣最大程式設計社群網站
線上人數
1646
 
會員總數:241330
討論主題:186904
歡迎您免費加入會員
討論區列表 >> C# >> C# mifare 讀取多個欄位
[ 變換順序 ]  
[我要回覆]
1
回應主題 加入我的關注話題 檢舉此篇討論 將提問者加入個人黑名單
C# mifare 讀取多個欄位
價值 : 5 QP  點閱數:110 回應數:1

樓主

elsie
門外漢
0 1
6 0
發送站內信

請問我的卡片目前儲存了
sec 1 block 0 ID
sec 1 block 1 NAME
sec 1 block 2 DATE
sec 2 block 0 POINT

原先只可以讀取單一sec
要如何可以讀取多個sec取值 把4個資料帶到畫面上?

public void BtnReadData_Click(object sender, EventArgs e)
{
string SNum = "-1", BNum = "-1", KType = "-1"; //參數預設
SNum = Sector.Text;
BNum = Block.Text;
if (KeyAB.Text == "A") //選擇 key A,B
{
KType = "60";
}
else
{
KType = "61";
}

string ReadCmd = "020A15"; //讀取commend 0x02, 0x0A, 0x15,
string TX = ReadCmd + KType + LoadKey.Text + SNum + BNum;

UInt32 uiLength, uiRead, uiResult, uiWritten;
byte[] ReadBuffer = new byte[0x40];
byte[] WriteBuffer = StringToByteArray(TX);
byte[] sResponse = null;
sResponse = new byte[21];

EasyPOD.VID = 0xe6a;
EasyPOD.PID = 0x317;
Index = 1;
uiLength = 64;


fixed (MW_EasyPOD* pPOD = &EasyPOD)
{

dwResult = PODfuncs.ConnectPOD(pPOD, Index);

if ((dwResult != 0))
{
MessageBox.Show("Not connected yet");
}
else
{
EasyPOD.ReadTimeOut = 200;
EasyPOD.WriteTimeOut = 200;

dwResult = PODfuncs.WriteData(pPOD, WriteBuffer, 12, &uiWritten);
uiResult = PODfuncs.ReadData(pPOD, ReadBuffer, uiLength, &uiRead);

tebReadData.Text = BitConverter.ToString(ReadBuffer, 4,(Int32)uiRead - 4).Replace("-", "");
}
dwResult = PODfuncs.ClearPODBuffer(pPOD);
dwResult = PODfuncs.DisconnectPOD(pPOD);

}
}

搜尋相關Tags的文章: [ C# ] , [ mifare ] ,
本篇文章發表於2017-12-05 09:40
別忘捐VP感謝幫助你的人 新手會員瞧一瞧
1樓
回應

P陳
檢舉此回應

讀多筆的話,不是這堶威訄鶡瑽Y可?

dwResult = PODfuncs.WriteData(pPOD, WriteBuffer, 12, &uiWritten);
uiResult = PODfuncs.ReadData(pPOD, ReadBuffer, uiLength, &uiRead);
本篇文章回覆於2017-12-06 11:48
== 簽名檔 ==
--未登入的會員無法查看對方簽名檔--
[ 變換順序 ]   
1

回覆
如要回應,請先登入.