RFID Read When the Card Touch
이전 댓글 표시
Hello, I wrote a program where fscanf() should run in continuous, for the sake of getting data & storing into my database from RFID, which is connected with serial cable, two callback are there, when I'm running first callback the code contain while(1), run infinite and take the data from RFID reader and storing it. When the callback is running in which while (1) is present the program cant move on any other function or callback. How can I control it ? or what is the shortest way to read data from RFID ? Is it possible to read data only when the RFID Card/Tag touch to RFID Reader ?
댓글 수: 2
Khalid
2014년 5월 14일
편집: Walter Roberson
2014년 5월 14일
Walter Roberson
2014년 5월 14일
Is there a line terminator? Is the string width fixed per sample?
답변 (1개)
Walter Roberson
2014년 5월 14일
0 개 추천
Set the serial port up with a BytesAvailableFcn that runs when the RFID information is detected as having been presented to the serial device. In that callback, fread() or fgetl() from the serial port to transfer from the buffer into your program.
You can check the BytesAvailable property of the serial port to determine whether anything has been received and transferred into the buffer.
댓글 수: 1
Walter Roberson
2014년 5월 14일
s.BytesAvailableFcn = @(src, evt) fastinsert(conn, 'RFID_FINAL', col, {fgetl(s)});
and then no loop will be needed: the callback will be triggered when data is available.
카테고리
도움말 센터 및 File Exchange에서 Characters and Strings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!