ARDUINO: Receive a serial data string, break down into HEX pairs, calculate checksum

Selesai Dipasang 4 tahun yang lalu Dibayar saat pengiriman
Selesai Dibayar saat pengiriman

Hi,

I require an Arduino sketch to receive a string on Serial(1), calculate the checksum and validate the checksum against the data. I also need a function to calculate the checksum of data I would like to send.

This is an example of a received data string:

056F3800792Fzz<cr>

- Where <cr> is a carriage return character

- Where zz is the checksum of the preceeding bytes

The checksum is calculated as the 2 ’s complement of the modulo 256 sum of the preceding bytes.

In other words:

a) Sum all of the bytes (the hex character pairs);

b) Find the remainder when the sum is divided by 256;

c) Take the 2’s complement (invert the bits and then add 1) of the remainder.

This checksum has the property that when the bytes including the checksum are

summed modulo 256, the result will always be zero if the check passes, and non-zero

indicates the presence of an error in the data stream. The checksums are performed on the hexadecimal data (the ASCII character

pairs).

For example, suppose the following command is to be sent:

\0538007988

Summing the bytes: $05 + $38 + $79 + $88 = $13E. Modulo 256 ($100), this is $3E.

The checksum (2’s complement and add 1) = $C2.

Checking: $05 + $38 + $79 + $88 + $C2 = $200, which is $00 modulo 256 ($100).

This command would be sent as:

\0538007988C2g<cr>

So in summary, there are two parts to this project:

RECEIVING DATA:

- Receive the string

- Calculate the checksum of the preceeding bytes

- Compare it to the received checksum (which is at the end of the data string)

- Discard the message if the checksum does not match

- If the checksum matches (data is okay), print the data to Serial(0) in its individual hex pairs, comma deliminated (EG: [login to view URL](05,38,00,79,88,C2)

- I need to be able to query each hex pair of the received data. This could be done by storing the received data in an array, which is wiped each time a new piece of data is received.

TRANSMITTING DATA:

- I also need to send similar formatted data strings.

- To aid in this I need to calculate the checksum of my bytes and append it to the data string before it is sent.

- This could be implemented as a function?

- The checksum is appended to the end of the data I am trying to send

- An additional ASCII character needs to be appended AFTER the checksum. EG (seen here as a 'g'): 0538007988C2g<cr>

SERIAL PORT MAPPINGS:

Send/Receive is on Serial(1)

Console output for diagnostics is on Serial(0)

Arduino Microcontroller Pemrograman C Teknik Elektro

ID Proyek: #21432808

Tentang proyek

20 proposal Proyek online Aktif 4 tahun yang lalu

Diberikan kepada:

AbdouSam

Hi, I have worked on a similar project, on a microcontroller, to upload a hex file using bootloader. the code sends and receive hex strings, with checksum verification upon receiving and sending. This project was done Lebih banyak

$120 AUD dalam 7 hari
(10 Ulasan)
3.8

20 freelancer rata-rata menawar $145 untuk pekerjaan ini

SPARKtechBD

I have read your description and understood. I am good in coding on Arduino by using Arduino IDE on C Language. I have build lots of digital device by using Arduino UNO/MEGA board. Have more than 15 years experience on Lebih banyak

$250 AUD dalam 7 hari
(23 Ulasan)
5.9
Manoj3050

Hi, I am an electronic engineer with more than 6 years of experience in Arduino programming and embedded systems development. I read your project description carefully and I understand that you need to implement a fai Lebih banyak

$200 AUD dalam 7 hari
(44 Ulasan)
5.8
ayowealth

Hello there! You're in the right place for your ELECTRONIC project. I graduated as an electronic student from one of the prestigious universities in West Africa. I have assisted several individuals with their PCB rela Lebih banyak

$140 AUD dalam 7 hari
(14 Ulasan)
5.4
ganapathi92

Hi, I'm Ganapathy, I have rich experience in various embedded microcontrollers like AVR, MIPS, PIC, ARM, ESP and IDEs like arduino, winAVR, gcc etc. I understand your project I can able to solve this project. If you Lebih banyak

$65 AUD dalam 3 hari
(49 Ulasan)
5.4
ManormaShehzadi

Hi Sir! I am student of MSc MEchatronics and Control Engineering. I have done BSc Electrical Engineering. I am very expert in Arduino included its all module.I read carefully your description, i am 100% confident that Lebih banyak

$200 AUD dalam 5 hari
(42 Ulasan)
5.1
todool

dear Employer, I am an experienced programmer especial for Arduino so I can implement your desired functionality, greetings, Tobie

$90 AUD dalam 7 hari
(21 Ulasan)
5.2
Valuesolutions

Hello, i have read the details provided..please contact me to discuss more on the project deadline and some other few things

$180 AUD dalam 5 hari
(41 Ulasan)
6.1
edi45

Hi, I have a lot of experience in data integrity on smart card. I can do checksum with ease. Parsing string is straight forward. I can show you much better way to properly send data with error checking mechanism if you Lebih banyak

$100 AUD dalam 3 hari
(13 Ulasan)
4.6
sinany1

Hello, I am an embedded systems engineer experienced in microcontrollers such as pic, stm32, avr(arduino). your project seems pretty straightforward. I have developed lots of industrial systems with arduino. I can help Lebih banyak

$200 AUD dalam 7 hari
(9 Ulasan)
4.3
samuelrvw

It looks simple enough. Read data do a checksum, compare checksum and if its wrong do nothing. If its correct put them in an array and print out in SERIAL(0 ) All data received from Serial(1) ...OK, Checksum with 2's c Lebih banyak

$50 AUD dalam 1 hari
(6 Ulasan)
1.8
junxinxinxijishu

After three years of embedded development, microcontroller-related research and development of this area is also my relatively good. Two years of Python research One year's raspberry pie, Self-taught mqtt development T Lebih banyak

$40 AUD dalam 3 hari
(1 Ulasan)
0.4
dilichan

Hi, I read through the project details and I understand the project up to a good extent. I will go through the details thoroughly again. I am a first class honors graduate in electronics engineering, with experience i Lebih banyak

$250 AUD dalam 10 hari
(0 Ulasan)
0.3
digixbartar

Hi, THis is simple to do, I will make a new sketch file by Arduino IDE and deliver code as simple as possible

$200 AUD dalam 7 hari
(0 Ulasan)
0.0
kvenky9

hey, I have recently developed an entire plc to pc interface through RS232 and have done quite few projects in different communication interfaces like wiki, Bluetooth, serial, I2C, ethernet etc with plc as well as mic Lebih banyak

$111 AUD dalam 4 hari
(0 Ulasan)
0.0
RedCow

Hi, I have gone through the project description. It looks good. However I have a question about checksum creation function. Will it be OK If I create another sketch for sending data? Thanks, Kamran

$120 AUD dalam 3 hari
(0 Ulasan)
0.0
emetians

Hey! I have a experience for communication protocols and i have a many arduino projects. I can help you, please write me.

$90 AUD dalam 7 hari
(0 Ulasan)
0.0
ronney1

I bring More than 7 years of microcontroller programing, pcb circuit design and implementation and advanced knowledge in both electrical and digital electronic engineering and Relevant Skills and Experience Engineerin Lebih banyak

$177 AUD dalam 7 hari
(0 Ulasan)
0.0