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. Visual Basic
  4. HowTo: 2's Complement sum checksum?

HowTo: 2's Complement sum checksum?

Scheduled Pinned Locked Moved Visual Basic
csharphtmlcomhelp
3 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.
  • D Offline
    D Offline
    DudleyDoorite
    wrote on last edited by
    #1

    Can someone explain to me how to perform this function in VB.Net? A more detailed description can be found at http://www.netfor2.com/checksum.html I need to perform a 2's complement sum CheckSum on some data before sending it to a serial device and when recieving data from the device. Thanks for any help. ================================= When i was in school all I wanted was to get out into the real world. Now that I'm in the real world all I want is to go back to school.

    P 2 Replies Last reply
    0
    • D DudleyDoorite

      Can someone explain to me how to perform this function in VB.Net? A more detailed description can be found at http://www.netfor2.com/checksum.html I need to perform a 2's complement sum CheckSum on some data before sending it to a serial device and when recieving data from the device. Thanks for any help. ================================= When i was in school all I wanted was to get out into the real world. Now that I'm in the real world all I want is to go back to school.

      P Offline
      P Offline
      pxw
      wrote on last edited by
      #2

      all you should need to add is the "not" function like: result = not checksum pxw

      1 Reply Last reply
      0
      • D DudleyDoorite

        Can someone explain to me how to perform this function in VB.Net? A more detailed description can be found at http://www.netfor2.com/checksum.html I need to perform a 2's complement sum CheckSum on some data before sending it to a serial device and when recieving data from the device. Thanks for any help. ================================= When i was in school all I wanted was to get out into the real world. Now that I'm in the real world all I want is to go back to school.

        P Offline
        P Offline
        pxw
        wrote on last edited by
        #3

        My previous really gives a ones compliment -- not really what you asked for. In order to perform a twos compliment I prsonaklly would revert to tyhe interoperability of the .NET languages and write it in C++, then like it to Visual Basic. If you decide to try that, start a Visual C++ .NET Class library. then add the following code to the file that holds the name you gave the library, compile and link to it. NOTE that the code given works only with 32-bit integers, a similar thing sould be done for larger or smaller integers. int TwoCompl(int val) { __asm { mov eax, val not eax mov val, eax }; return val; }

        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