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

Tamamlanmış İlan edilme: 4 yıl önce Teslim sırasında ödenir
Tamamlanmış Teslim sırasında ödenir

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 Mikrodenetleyici C Programlama Elektrik Mühendisliği

Proje NO: #21432808

Proje hakkında

20 teklif Uzak proje Aktif 4 yıl önce

Seçilen:

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 Daha Fazla

%selectedBids___i_period_sub_7% gün içinde 120%project_currencyDetails_sign_sub_9% %project_currencyDetails_code_sub_10%
(10 Değerlendirme)
3.8

Bu iş için 20 freelancer ortalamada $145 teklif veriyor

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 Daha Fazla

$250 AUD in 7 gün içinde
(23 Değerlendirme)
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 Daha Fazla

$200 AUD in 7 gün içinde
(44 Değerlendirme)
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 Daha Fazla

$140 AUD in 7 gün içinde
(14 Değerlendirme)
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 Daha Fazla

$65 AUD in 3 gün içinde
(49 Değerlendirme)
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 Daha Fazla

$200 AUD in 5 gün içinde
(42 Değerlendirme)
5.1
todool

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

$90 AUD in 7 gün içinde
(21 Değerlendirme)
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 in 5 gün içinde
(41 Değerlendirme)
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 Daha Fazla

$100 AUD in 3 gün içinde
(13 Değerlendirme)
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 Daha Fazla

$200 AUD in 7 gün içinde
(9 Değerlendirme)
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 Daha Fazla

1 gün içinde %bids___i_sum_sub_32%%project_currencyDetails_sign_sub_33% AUD
(6 Değerlendirme)
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 Daha Fazla

$40 AUD in 3 gün içinde
(1 Yorum)
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 Daha Fazla

$250 AUD in 10 gün içinde
(0 Değerlendirme)
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 in 7 gün içinde
(0 Değerlendirme)
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 Daha Fazla

$111 AUD in 4 gün içinde
(0 Değerlendirme)
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 in 3 gün içinde
(0 Değerlendirme)
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 in 7 gün içinde
(0 Değerlendirme)
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 Daha Fazla

$177 AUD in 7 gün içinde
(0 Değerlendirme)
0.0