更新时间:2023-02-08 07:49:18
Pradeep,
我们可以使用串行端口从RF-ID阅读器读取标签值,为此我们需要使用串行电缆将RF-ID阅读器连接到端口,并使用相关的COM端口号连接到C#的串行端口对象连接.
-通常,System.Net包含串行端口类,并且在工具箱中也可以作为Win Forms应用程序的串行端口组件使用.
-您可以添加Win Forms应用程序.并使用代码的贝娄部分阅读.
Hi Pradeep,
We can use Serial port for Reading the Tag values from the RF-ID Reader.For this we need to connect the RF-ID Reader using the Serial cable to the port and use the relevant COM Port No# to the Serial port Object of C# to Connect.
- Normally the System.Net Contains the Serial Port Class and also available in the Toolbox as Serial port component for your Win Forms App.
-You can add a Win Forms App. and Use the Bellow part of code to read.
private void btnReadTag_Click(object sender, EventArgs e)
{
serialPort = new SerialPort();// if u r not used Serial Port Tool
serialPort.PortName = "COM1";
serialPort.BaudRate = 9600;
serialPort.DataBits = 8;
serialPort.Parity = Parity.None;
serialPort.StopBits = StopBits.One;
serialPort.Open();
serialPort1.ReadTimeout = 2000;
serialPort.DataReceived += new SerialDataReceivedEventHandler(Fun_DataReceived);
serialPort.Close();
}
//Delegate for the Reading the Tag while RFID Card come to the Range.
string data = string.Empty;
private delegate void SetTextDeleg(string text);
void Fun_DataReceived(object sender, SerialDataReceivedEventArgs e)
{
Thread.Sleep(500);
data = serialPort.ReadLine();
this.BeginInvoke(new SetTextDeleg(Fun_IsDataReceived), new object[] { data });
}
private void Fun_IsDataReceived(string data)
{
txtAccessCardNo.Text = data.Trim();
}
学得很好:)
Have great learning :)
好吧,至少您必须知道您的RFID设备正在使用的协议.
:)
Well, you must, at least, know the protocol your RFID device is using.
:)
我用Google搜索了"c#读取rfid数据",获得了108,000次点击.我怀疑您会比等我们中的一个人为您找到答案的速度快得多.
I googled "c# read rfid data", and got 108,000 hits. I suspect you''ll find your answer there much faster than waiting for one of us to do the research for you.