That's binary correlation. Can be done many ways actually counting/changing or not sign/msb bit. Really depends what you want to get from it. "Peter L. Peres" wrote: > > Correlation: A simple way is to XOR incoming data with data-to-be-tested > and count the 1's in the result. The fewer 1's the better the correlation. > XOR is modulo-2 multiply without carry out (or in) and one (the?) > correlation function is Fc=SumOf|Ai*Bi|. XOR produces this result when Ai > and Bi are binary bits, but the sum is zero for high correlation because > the carry in the XOR multiply is lost. In this case Fc=0 means 'all bits > caused carry' (which was lost). Otherwise one would use an analog > multiplier to check for correlation with analog signals, and aim for high > Fc (not zero). Notice that in a binary XOR correlator an all 1's result > means input and reference are 180 degrees out of phase, or complementary. -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads