Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 531913
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T09:21:02+00:00 2026-05-13T09:21:02+00:00

I am communicating with a machine over serial. Part of the protocol communication spec

  • 0

I am communicating with a machine over serial. Part of the protocol communication spec states that the control sum is an “arithmetic sum of bytes from <‘PS’> (included), <‘data’> to <‘CS’>”

The packet messages are structured as follows:

<‘PS’><‘data’><‘CS’>, where:

<‘PS’> – Packet Size

Length: 1

Value: 0x02 to 0x63

Max packet length is 99 bytes

<‘data’> – Data

Length: 1…90 bytes

Value: 0x00 – 0xFF

The length of the data part depends on the command.

<‘CS’> – Check Sum

Length – 1 byte

Value: 0x00 – 0xFF

Example:

ACK Packet: 0x02 0x01 0x03 where 0x03 is the checksum.

So how do I compute the checksum for these bytes in C++?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T09:21:02+00:00Added an answer on May 13, 2026 at 9:21 am

    It looks like the checksum is a simple sum, modulo 256.

    int sum = 0;
    for (int j = 0;  j < number_of_bytes_in_message;  ++j)
       sum += message [j];
    
    sum %= 256;  // or, if you prefer  sum &= 255;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What is best practises for communicating events from a usercontrol to parent control/page i
I have a WCF client/service app that relies on secure communication between two machines
Let us assume I'm using communicating from my mobile device to my server via
I have an application that runs transactions spanning over multiple databases on the same
I am in the process of starting to implement some proprietary communication protocol stack
I'm working on a web-app that must handle communicating time of particular events to
How can I build a simple 2-player game, that communicates over the internet? I
I've got a machine-control application where I have a single client computer and five
I am learning inter-process communication. I want to create server that can listen to
I have developed a USB device that communicates with linux over a simple but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.