Calcul du checksum d'une trame infra-rouge

Bonjour.

de trouver la bonne formule.

Les trames commencent par un bit de START; je ne capte pas le bit de STOP

Les 16 premiers bits sont un identifiant de constructeur; les 16 suivant

(je ne vais pas vous en fournir). Et alors le checksum est tout simplement

checsum.

Evidement, c'est du LSB.

addition, impaire en soustraction) ...

S00101000110001100000000000001000000010000111111110010000000011000000000100000000000000000000000000000000000000000000010000001100 S00101000110001100000000000001000000010000111111110010000000011000000000100000000000010000000000000000000000000000000010000000100 S00101000110001100000000000001000000010000111111110010000000011000000000100001000000000000100110000010000000000000000010001100111 S00101000110001100000000000001000000010000111111110010000000011000000001000000000000000000000000000000000000000000000010000001110 S00101000110001100000000000001000000010000111111110010000000011000000001000000000000010000000000000000000000000000000010000000110 S00101000110001100000000000001000000010000111111110010000000011000000001000001000000010000100110000010000000000000000010001101000 S00101000110001100000000000001000000010000111111110010000000011000000001100000000000000000000000000000000000000000000010000001111 S00101000110001100000000000001000000010000111111110010000000011000000001100000000000010000000000000000000000000000000010000000111 S00101000110001100000000000001000000010000111111110010000000011000000001100001000000000000100110000010000000000000000010001100101 S00101000110001100000000000001000000010000111111110010000000011000000001100001000000010000100110000010000000000000000010001101001 S00101000110001100000000000001000000010000111111110010000000011000000001100010000000000000000000000000000000000000000010000010111 S00101000110001100000000000001000000010000111111110010000000011000000001100100000000010000000000000000000000000000000010000111011 S00101000110001100000000000001000000010000111111110010000000011000000001100100000001010000000000000000000000000000000010000011011 S00101000110001100000000000001000000010000111111110010000000011000000001100100000010010000000000000000000000000000000010001011011 S00101000110001100000000000001000000010000111111110010000000011000000001100100000100010000000000000000000000000000000010011011011 S00101000110001100000000000001000000010000111111110010000000011000000001100100000110010000000000000000000000000000000010010011011 S00101000110001100000000000001000000010000111111110010000000011000000001101000000000010000000000000000000000000000000010001111011 S00101000110001100000000000001000000010000111111110010000000011000000001110000000000010000000000000000000000000000000010011111011 S00101000110001100000000000001000000010000111111110010000000011000000001110000000001010000000000000000000000000000000010011011011 S00101000110001100000000000001000000010000111111110010000000011000000001110000000010010000000000000000000000000000000010010111011 S00101000110001100000000000001000000010000111111110010000000011000000001110000000100010000000000000000000000000000000010001111011 S00101000110001100000000000001000000010000111111110010000000011000000001110000000110010000000000000000000000000000000010000111011 S00101000110001100000000000001000000010000111111110010000000011000000001111000000000010000000000000000000000000000000010010111011 S00101000110001100000000000001000000010000111111110010000000011000000001111000000001010000000000000000000000000000000010010011011 S00101000110001100000000000001000000010000111111110010000000011000000001111000000010010000000000000000000000000000000010011011011 S00101000110001100000000000001000000010000111111110010000000011000000001111000000100010000000000000000000000000000000010000111011 S00101000110001100000000000001000000010000111111110010000000011000000001111000000110010000000000000000000000000000000010001011011 S00101000110001100000000000001000000010000111111110010000000011000000010000000000000010000000000000000000000000000000010000000001 S00101000110001100000000000001000000010000111111110010000000011000000010100000000000000000000000000000000000000000000010000001000 S00101000110001100000000000001000000010000111111110010000000011000000010100000000000010000000000000000000000000000000010000000000 S00101000110001100000000000001000000010000111111110010000000011000000011000000000000000000000000000000000000000000000010000001010 S00101000110001100000000000001000000010000111111110010000000011000000011000000000000010000000000000000000000000000000010000000010 S00101000110001100000000000001000000010000111111110010000000011000000011000001000000000000100110000010000000000000000010001100000 S00101000110001100000000000001000000010000111111110010000000011000000011000001000000010000100110000010000000000000000010001101111 S00101000110001100000000000001000000010000111111110010000000011000000011100000000000000000000000000000000000000000000010000001011 S00101000110001100000000000001000000010000111111110010000000011000000011100000000000010000000000000000000000000000000010000000011 S00101000110001100000000000001000000010000111111110010000000011000000011100000000001010000000000000000000000000000000010000111101 S00101000110001100000000000001000000010000111111110010000000011000000011100000000010010000000000000000000000000000000010001111101 S00101000110001100000000000001000000010000111111110010000000011000000011100000000100010000000000000000000000000000000010011111101 S00101000110001100000000000001000000010000111111110010000000011000000011100000000110010000000000000000000000000000000010010111101 S00101000110001100000000000001000000010000111111110010000000011000000011110000000000010000000000000000000000000000000010011111101 S00101000110001100000000000001000000010000111111110010000000011000000100100000000000000000000000000000000000000000000010000000100 S00101000110001100000000000001000000010000111111110010000000011000000100100000000000010000000000000000000000000000000010000001000 S00101000110001100000000000001000000010000111111110010000000011000000100100001000000000000100110000010000000000000000010001101011 S00101000110001100000000000001000000010000111111110010000000011000000101000000000000000000000000000000000000000000000010000000110 S00101000110001100000000000001000000010000111111110010000000011000000101000000000000010000000000000000000000000000000010000001010 S00101000110001100000000000001000000010000111111110010000000011000000101100000000000000000000000000000000000000000000010000000111 S00101000110001100000000000001000000010000111111110010000000011000000101100000000000010000000000000000000000000000000010000001011 S00101000110001100000000000001000000010000111111110010000000011000000101100100000000010000000000000000000000000000000010000110011 S00101000110001100000000000001000000010000111111110010000000011000000101101000000000010000000000000000000000000000000010001110011 S00101000110001100000000000001000000010000111111110010000000011000000101110000000000010000000000000000000000000000000010011110011 S00101000110001100000000000001000000010000111111110010000000011000000101111000000000010000000000000000000000000000000010010110011 S00101000110001100000000000001000000010000111111110010000000011000000110000000000000000000000000000000000000000000000010000000001 S00101000110001100000000000001000000010000111111110010000000011000000110000000000000010000000000000000000000000000000010000001110 S00101000110001100000000000001000000010000111111110010000000011000000110100000000000000000000000000000000000000000000010000000000 S00101000110001100000000000001000000010000111111110010000000011000000110100000000000010000000000000000000000000000000010000001111 S00101000110001100000000000001000000010000111111110010000000011000000110100001000000000000100110000010000000000000000010001101101 S00101000110001100000000000001000000010000111111110010000000011000000110100010000000000000000000000000000000000000000010000011111 S00101000110001100000000000001000000010000111111110010000000011000000111000000000000000000000000000000000000000000000010000000010 S00101000110001100000000000001000000010000111111110010000000011000000111000000000000010000000000000000000000000000000010000001100 S00101000110001100000000000001000000010000111111110010000000011001000010000000000000000000000000000000000000000000000010011110001

--
If computing were an exact science, IT engineers would'nt have work \_o< 

"So all that's left, Is the proof that love's not only blind but deaf." 
 Click to see the full signature
Reply to
Benoit-Pierre DEMAINE
Loading thread data ...

Bonjour,

11010001 ?

Quelles sont les valeurs possible du 5e octet, selon que la trame est courte ou longue ? Est-ce que les 4 premiers octets sont toujours les

Du LSB ? Tu veux dire que le LSB (least significant bit) est le premier,

--
Olivier Miakinen
Reply to
Olivier Miakinen

ligne 0, somme 554, xor 04 ligne 1, somme 554, xor 04 ligne 27, somme 554, xor 04 ligne 28, somme 554, xor 04 ligne 29, somme 554, xor 04 ligne 41, somme 554, xor 04 ligne 52, somme 554, xor 04 ligne 54, somme 554, xor 04 ligne 3, somme 557, xor 05 ligne 4, somme 557, xor 05 ligne 30, somme 557, xor 05 ligne 31, somme 557, xor 05 ligne 44, somme 557, xor 05 ligne 58, somme 557, xor 05 ligne 6, somme 559, xor 05 ligne 7, somme 559, xor 05 ligne 34, somme 559, xor 05 ligne 35, somme 559, xor 05 ligne 46, somme 559, xor 05 ligne 42, somme 566, xor 00 ligne 45, somme 569, xor 01 ligne 47, somme 571, xor 01 ligne 53, somme 575, xor 03 ligne 59, somme 575, xor 03 ligne 55, somme 577, xor 03 ligne 10, somme 583, xor 0d ligne 57, somme 601, xor 0b ligne 11, somme 643, xor 19 ligne 12, somme 643, xor 19 ligne 48, somme 643, xor 19 ligne 36, somme 649, xor 1b ligne 13, somme 739, xor 39 ligne 16, somme 739, xor 39 ligne 49, somme 739, xor 39 ligne 32, somme 743, xor 3b ligne 2, somme 745, xor 3b ligne 8, somme 745, xor 3b ligne 37, somme 745, xor 3b ligne 5, somme 755, xor 3f ligne 9, somme 757, xor 3f ligne 43, somme 757, xor 3f ligne 56, somme 763, xor 3d ligne 33, somme 766, xor 3c ligne 60, somme 914, xor 7c ligne 14, somme 931, xor 79 ligne 15, somme 931, xor 79 ligne 17, somme 931, xor 79 ligne 18, somme 931, xor 79 ligne 19, somme 931, xor 79 ligne 20, somme 931, xor 79 ligne 21, somme 931, xor 79 ligne 22, somme 931, xor 79 ligne 23, somme 931, xor 79 ligne 25, somme 931, xor 79 ligne 50, somme 931, xor 79 ligne 51, somme 931, xor 79 ligne 38, somme 937, xor 7b ligne 39, somme 937, xor 7b ligne 40, somme 937, xor 7b ligne 24, somme 1027, xor 59 ligne 26, somme 1027, xor 59

--
Olivier Miakinen
Reply to
Olivier Miakinen

- j'avais plusieurs coquilles dans mon calcul de CRC (comme mon but est

- il fallait bien faire la somme de tous les octets

MSB-LSB)

--
If computing were an exact science, IT engineers would'nt have work \_o< 

"So all that's left, Is the proof that love's not only blind but deaf." 
 Click to see the full signature
Reply to
Benoit-Pierre DEMAINE

oui.

Et en fait, c'est le plus grand des hasard ... parce qu'il se trouve que la somme des 4 premiers octets plus 111, moins 4, donne 0. Une petite erreur de conception du protocole, qui m'a induit en erreur; car j'ai

portait que sur le 5e octet.

centaines de combinaisons possibles, voir milliers au total)

little endian.

--
If computing were an exact science, IT engineers would'nt have work \_o< 

"So all that's left, Is the proof that love's not only blind but deaf." 
 Click to see the full signature
Reply to
Benoit-Pierre DEMAINE

Fait.

qu'elles sont identiques en ignorant les retenues du 8e au 9e bit quand on fait la somme.

little-endian, et sans tenir compte de la retenue.

soustraire la somme.

--
Olivier Miakinen
Reply to
Olivier Miakinen

ce que tu explique fonctionne probablement dans 99% des cas; mon

- faire la somme des octets

trames courtes)

- modulo 256

contenus originaux, au lieu de modifier des copies.

--
If computing were an exact science, IT engineers would'nt have work \_o< 

"So all that's left, Is the proof that love's not only blind but deaf." 
 Click to see the full signature
Reply to
Benoit-Pierre DEMAINE

Pour moi, il faut soustraire la somme de 10011110 en binaire,

=============================================================

=============================================================

(je suppose que tu ne le fais pas au 1er octet)

--
Olivier Miakinen
Reply to
Olivier Miakinen

et MSBR ...

communication avec autruit".

octet ... et y a encore pire (le processeur Saturn de la HP48 utilise des

prend 4 mots, soit 16 quartets pour la valeur significative, et 4 pour l'exposant ... et quand on travaille dans le bon mode, et qu'on lit des

ans.

--
If computing were an exact science, IT engineers would'nt have work \_o< 

"So all that's left, Is the proof that love's not only blind but deaf." 
 Click to see the full signature
Reply to
Benoit-Pierre DEMAINE

Pour ne pas avoir d'effet de bord, il est vital de:

sont nuls

- ne pas faire de modulo 256 avant la fin.

--
If computing were an exact science, IT engineers would'nt have work \_o< 

"So all that's left, Is the proof that love's not only blind but deaf." 
 Click to see the full signature
Reply to
Benoit-Pierre DEMAINE

Ah, ok, du coup je comprends mieux pourquoi tu tiens compte du nombre

bien avec les trames courtes qu'avec les trames longues.

deviner.

Bon, tu as finalement la solution, c'est l'essentiel.

--
Olivier Miakinen
Reply to
Olivier Miakinen

courte, et un second fonctionnant pour 80% des trames longues.

Ca m'a repris 3h ce matin pour comprendre qu'il pouvait exister une solution commune.

--
If computing were an exact science, IT engineers would'nt have work \_o< 

"So all that's left, Is the proof that love's not only blind but deaf." 
 Click to see the full signature
Reply to
Benoit-Pierre DEMAINE

Oui, tu as absolument raison.

--
Olivier Miakinen
Reply to
Olivier Miakinen

Si tu programmes en C, le plus simple est d'utiliser un type unsigned char pour stocker toutes les valeurs, auquel cas il suffit d'additionner

--
Olivier Miakinen
Reply to
Olivier Miakinen

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.