Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. UDP communication and CRC16 calculations

UDP communication and CRC16 calculations

Scheduled Pinned Locked Moved C#
comhelptutorialquestion
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MaWeRic
    wrote on last edited by
    #1

    I am trying to communicate with a TurnStile but cant understand how that build their commands. This is example of command: [^] The command is 0xA005 as it states as CMD but it shows as 05 A0 ... confuses me. Is that really correct? Shoudn't it be A0 05? Any reason for doing it backwards? CRC16 calculation of command should be "1F 4A" according to that example but I have tried to calculate for that command I cant get same result. Anyone can help me with that CRC15 calculation? Regards // Maw

    L 1 Reply Last reply
    0
    • M MaWeRic

      I am trying to communicate with a TurnStile but cant understand how that build their commands. This is example of command: [^] The command is 0xA005 as it states as CMD but it shows as 05 A0 ... confuses me. Is that really correct? Shoudn't it be A0 05? Any reason for doing it backwards? CRC16 calculation of command should be "1F 4A" according to that example but I have tried to calculate for that command I cant get same result. Anyone can help me with that CRC15 calculation? Regards // Maw

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      MaWeRic wrote:

      Is that really correct? Shouldn't it be A0 05?

      Well 05 A0 is what they say, so I'm inclined to believe it. Though sending little endian over the network is a bit unusual, it is not all *that* weird. As for the CRC16, it seems to use one of the CRC-CCITT polynomials, 0x1021. (I just tried a bunch..) You should be able to plug that in already available crc code.

      M 1 Reply Last reply
      0
      • L Lost User

        MaWeRic wrote:

        Is that really correct? Shouldn't it be A0 05?

        Well 05 A0 is what they say, so I'm inclined to believe it. Though sending little endian over the network is a bit unusual, it is not all *that* weird. As for the CRC16, it seems to use one of the CRC-CCITT polynomials, 0x1021. (I just tried a bunch..) You should be able to plug that in already available crc code.

        M Offline
        M Offline
        MaWeRic
        wrote on last edited by
        #3

        HeyyThanks! If I try this calculator : [^] I try calculate : 05A0 Looking at "CRC-CCITT (XModem)" the result is correct but backwards. Why is that? Edit: I guess I should send it as 1F4A as documentation says? I am totally new to this with UDP and sending bytes. But I gess id I dont ask I dont learn :) I goggled Little and big endians and I guess little endians means sending reversed order? //Henrik

        L 1 Reply Last reply
        0
        • M MaWeRic

          HeyyThanks! If I try this calculator : [^] I try calculate : 05A0 Looking at "CRC-CCITT (XModem)" the result is correct but backwards. Why is that? Edit: I guess I should send it as 1F4A as documentation says? I am totally new to this with UDP and sending bytes. But I gess id I dont ask I dont learn :) I goggled Little and big endians and I guess little endians means sending reversed order? //Henrik

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Yes that's probably little endian again.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups