Thanks all for your comments, I have implemented a lookup table for now (with most of the values being = 0). I do want to consider the complement bit as this is a means of detecting bytes that are in error (not part of Manchester code set), I then do not = need to=20 wait for the entire packet to arrive and process CRC etc to know it is = invalid, I can reset the UART and my starte machine immediately an incorrect byte = is received. Kind Regards David Huisman -----Original Message----- From: Hulatt, Jon [mailto:jhulatt@MONSTEREUROPE.COM] Sent: Tuesday, 9 September 2003 10:01 PM To: PICLIST@MITVMA.MIT.EDU Subject: Re: [PIC]:Manchester Lookup table Here's me not being an expert at manchester encoding... But if my assumptions are correct and a 1 encodes as 10 0 encodes as 01 Then if you have two bytes of received data, you cunningly could decode = in one line like this:- char h =3D 0xAA; char l =3D 0xAA; char o ; o =3D (h & 128) + ((h << 1) & 64) + ((h << 2) & 32) + ((h << 3) = & 16) + ((l >> 4) & 8) + ((l >> 3) & 4) + ((l >> 2) & 2) + ((l >> 1) & 1); ... Because the second bit in each pair of bits is irrelevant. For = decoding purposes. jon -----Original Message----- From: Olin Lathrop [mailto:olin_piclist@EMBEDINC.COM] Sent: 09 September 2003 12:56 To: PICLIST@MITVMA.MIT.EDU Subject: Re: [PIC]:Manchester Lookup table > I am looking for a fast Manchester Encode/Decode algortithm. This is a useless question without defining "fast". I've got a PIC = decoding two "fast" received manchester streams serially bit by bit, and it's = doing a few other things at the same time. So, how fast is "fast"? ***************************************************************** Embed Inc, embedded system specialists in Littleton Massachusetts (978) 742-9014, http://www.embedinc.com -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics