MediaCupPacket1_3 Version 1.3 I) Changes to 1.2: state is now 1 byte to 1.1: packet end byte: 192 II) packet format [0] syncronizing character 0, at least 1x l length of packet, including this byte, without sync and CRC a1 4 adress bytes IPv4 / only a1 is used by WebVis a2 a3 a4 [ ... data bytes] CRC checksum 192 end byte III) Escaping The len byte does not consider extra byte from the escaping function Escaping: The following characters are escaped: 0 with 219,1 219 with 219,220 192 with 219,193 IV) CRC-Algorithm: CRC-calculation including the l byte. CRC-calculation takes place before escaping CRC8 must be preset to 0. unsigned int crc_bestimmen( unsigned int wert) { unsigned int i, f; for (i = 0; i < 8; ++i) { f = (wert ^ CRC8) & 1; CRC8 >>= 1; wert >>= 1; if (f) CRC8 ^= 0x8c; } return CRC8; } V) Data format Set of 2 or 3 byte packets, depending of the data that should be send. Lo byte is first with 2 byte data. Description Bytecode followed by data: #define temp_data 1 // 2 Byte data, signed short int #define temp_data_b 2 // 1 Byte data, signed char #define accel_actual 10 // 2 Byte data, V1.2, not V1.3 Cup #define accel_avg 11 // 2 Byte data, V1.2, not V1.3 Cup #define accel_max 12 // 2 Byte data, V1.2, not V1.3 Cup #define accel_min 13 // 2 Byte data, V1.2, not V1.3 Cup #define accel_delta 14 // 2 Byte data, V1.2, not V1.3 Cup #define accel_sum 15 // 2 Byte data, V1.2, not V1.3 Cup #define state 16 // 1 Byte data, unsigned char #define accel_delta_b 17 // 1 Byte data, V1.2, not V1.3 Cup #define accel_actual_b 18 // 1 Byte data, V1.2, not V1.3 Cup #define switch 20 // 1 Byte data, unsigned char temp_data : value in Grad Celsius *10 temp_data_b: value in Grad Celsius state : #define desk 1 #define drink 2 #define play 3 #define dont know 4 switch : Meaning (Bit set means switch closed) Bit 7 : bottom switch Bit 6-3: reserved Bit 2 : inclination switch near IR diode Bit 1 : inclination switch near Pic Bit 0 : inclination switch near power switch