I'm making a device that needs me to transfer some sort of initiation code like handshaking to start further communications.There is 2 inputs and 2 outputs the first output is pretty similar to a two's compliment which only works on even numbers and copy the value into the odd numbers. But the second output is more complicated it is a combination of the first input and the second one and if the second input is 0 the second output is equal to the first output, let's see some examples:Input 1          Output 1                  Input 2           Output 20- 00000000      1- 00000001     ------    8- 00001000      33- 00100001      1- 00000001      5- 00000101     ------    8- 00001000      37- 00100101      2- 00000010      5- 00000101     ------    8- 00001000      37- 00100101      3- 00000011      9- 00001001     ------    8- 00001000      57- 00111001      4- 00000100      9- 00001001     ------    8- 00001000      57- 00111001      5- 00000101      21- 00010101     ------    8- 00001000      53- 00110101      6- 00000110      21- 00010101     ------    8- 00001000      53- 00110101      7- 00000111      17- 00010001     ------    8- 00001000      49- 00110001      8- 00001000      17- 00010001     ------    8- 00001000      73- 01001001      9- 00001001      21- 00010101     ------    8- 00001000      77- 01001101      This was the outputs for input 2 equal 8Input 1           Output 1                    Input 2           Output 225- 00011001      85- 01010101   ------      31- 00011111      248- 11111000      26- 00011010      85- 01010101     ------    31- 00011111      245- 11110101      27- 00011011      73- 01001001     ------    31- 00011111      242- 11110010      28- 00011100      73- 01001001     ------    31- 00011111      239- 11101111      29- 00011101      69- 01000101     ------    31- 00011111      236- 11101100      30- 00011110      69- 01000101     ------    31- 00011111      233- 11101001      31- 00011111      65- 01000001     ------    31- 00011111      230- 11100110      32- 00100000      65- 01000001     ------    31- 00011111      195- 11000011      33- 00100001      69- 01000101     ------    31- 00011111      192- 11000000      34- 00100010      69- 01000101     ------    31- 00011111      61- 00111101      35- 00100011      73- 01001001     ------    31- 00011111      58- 00111010      36- 00100100      73- 01001001     ------    31- 00011111      55- 00110111      Here also you can find some different inputs and outputs while holding one input constant and the others change:Input2=16, Input 2=5,Input 1=2, link: pastebin.com/k5D5J1d5Any help on a way to find the protocol for the outputs or the formula between them would be highly appreciated.Thanks in advance.
Reversing a serial communication with two inputs
decryption;serial communication;protocol;packet;communication