본문 바로가기
기술자료/USN

RFID ISO 15963 Spec

by 와이즈캣 2012. 9. 27.
728x90
반응형


ISO15693-HostCommand.pdf



모던 리더기 설정

속도 : 38400

패리티 : 짝수



모던 리더기 테스트(COM1)

main.exe




샘플 코드

#include <windows.h>

#pragma pack(push, 1)
typedef struct COMMON       COMMON;
struct COMMON
{
  unsigned char  ucLen;
  unsigned char  ucComAdr;
  unsigned char  ucCtl;
};
#pragma pack(pop)
unsigned short MecCRC(void *arg)
{
  unsigned short i;
  unsigned short j;
  unsigned short cnt;
  unsigned short crc=0xFFFF;
  unsigned short temp;
  unsigned char *buf = arg;

  cnt = (*buf) - 2;
#ifdef DEBUG
  printf("### rfid_crc : SIZE = [%d]\n", cnt);
#endif //DEBUG

  for(i=0 ; i < cnt ; ++i)
  {
    crc^= *(buf + i);
    for(j=0 ; j < 8 ; ++j){
      if(0 != (crc&0x0001))
      {
        crc=(crc>>1)^0x8408;
      }
      else
      {
        crc=(crc>>1);
      }
    }
  }
#ifdef DEBUG
  printf("### rfid_crc : Result = [0x%04X]\n", crc);
#endif //DEBUG

  return crc;
}
int main()
{
  u_char    caString[128];
  COMMON  *stCommon = (COMMON  *)caString;

  // Packet 설정
  stCommon->ucLen            = 0x07//[1]
  stCommon->ucComAdr        = 0x00//[2]
  stCommon->ucCtl            = 0xB0//[3]
  *(caString+sizeof(COMMON))    = 0x01//[4]
  *(caString+sizeof(COMMON)+1)    = 0x00//[5]
  *((unsigned short *)(caString+sizeof(COMMON)+2)) = MecCRC(caString);
 printf("%02X, %d\n", MecCRC(caString), sizeof(COMMON));
  // Packet 송신 - 직접 구현

  // Packet 수신 - 직접 구현
  printf("[%02X] [%02X] [%02X] [%02X] [%02X] [%02X] [%02X]\n",
          *(caString+0), 
          *(caString+1), 
          *(caString+2), 
          *(caString+3), 
          *(caString+4), 
          *(caString+5), 
          *(caString+6)
          );
  
}


728x90

'기술자료 > USN' 카테고리의 다른 글

RFID ISO 15693 16Bit CRC  (0) 2012.09.27
[AX-12] 모터제어 스펙  (0) 2009.11.17
Zigbee-Full-Source-공개금지  (0) 2009.10.14