On Fri, 21 Jun 2002, Richards, Justin P wrote: >That's a great idea. > >Pulse widths I have measured are like 10, 0E, 3E,3F etc. So I guess >'nearest' would be perhaps (+/- 2) and the decoders would have a tolerance >range. I will experiment to see how far out a pulse width can actually be. > >Thanks > >Justin Usually you have at most 4 pulse widths in a IR word. One is for the 'zeros' one for the 'ones', the third for the start pulse and the fourth for a sometimes different start gap. You could actively correct the values in the bins to match the actual value of the measured pulse. Like say, you find 3E, the difference vs. the bin containing 3F is smallest, so you write down the code of that bin in the stream and then bin = (bin+new)/2. If you start with 4 bins containing values spaced out a little, say, 10, 40, 80, c0 and apply this algorythm for several words then the bins should converge to the real values after a while. You could measure errors (err=[bin-new]) and consider the code learned when the errors become smaller than a certain margin (say +/- 2 counts). Peter -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads