简体   繁体   English

清除将原始RFID数据转换为可用字符串时遇到麻烦

[英]Having trouble detirming out to convert raw RFID data to usable string

I have this http://www.parallax.com/Portals/0/Downloads/docs/prod/audiovis/28140-28340-RFIDreader-v2.2.pdf RFID reader connected to a raspberry pi. 我已经将此http://www.parallax.com/Portals/0/Downloads/docs/prod/audiovis/28140-28340-RFIDreader-v2.2.pdf RFID阅读器连接到树莓派。 I have tried to get the ID using Java and Python. 我尝试使用Java和Python获取ID。 I am able to get output from both but cannot decipher what the data is and now to convert it into the actual ID. 我能够从两者获取输出,但无法解读数据是什么,现在无法将其转换为实际ID。

Java code: http://stephenjam.es/wp/wp-content/uploads/java/RFIDReaderBasic.java Java代码: http//stephenjam.es/wp/wp-content/uploads/java/RFIDReaderBasic.java

Java Output: 0xc2 0xbd 0xc3 0x99 0xc2 0xae 0xc3 0xb6 0x76 0xc3 0x96 0x56 0x45 0xc2 0x8b 0x6b 0x56 0x00 Java输出:0xc2 0xbd 0xc3 0x99 0xc2 0xae 0xc3 0xb6 0x76 0xc3 0x96 0x56 0x45 0xc2 0x8b 0x6b 0x56 0x00

I think this is hex but I can't tell. 我认为这是十六进制,但我不知道。

Python Code: Python代码:

#!/usr/bin/env python
import serial
import time
ser = serial.Serial('/dev/ttyUSB0', 2400, timeout=1)
while True:
    string = ser.read(12)
    if len(string) == 0:
        print "Please insert a tag"
        continue
    else:
        print string

Python Output: ?ٮ?v?VE?kV Python输出:?ٮv?VE?kV

I would rather use python, but am willing to use the java code I got from that website as well. 我宁愿使用python,但也愿意使用从该网站获得的java代码。 My biggest question is where to start, am I converting Hex to ascii, hex to decimal or what? 我最大的问题是从哪里开始,我是将十六进制转换为ascii,还是将十六进制转换为十进制还是什么?

May be the baud_rate is wrong. 可能是baud_rate错误。 That's why it is printing garbage. 这就是为什么它要打印垃圾。 Check the default baud_rate of your RFID reader. 检查您的RFID阅读器的默认baud_rate。 May be it's 4800 or 9600. 可能是4800或9600。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM