Here is an idea: 1: Create a data structure, called 'dictionary' of 16 bytes. Initialize it to all zeros 2. Assume you won't see more than 16 different pulse widths 2. Measure each mark and space as you do now 3. Compare the time of the mark or space to the entries in the dictionary. Find the 'nearest' value in the dictionary. If there is an entry 'close' to this value then: Modify the dictionary entry to be ( 3 * dict_entry + new_value) / 4. This step will hopefully help the dictionary entry be closer to the exact correct time. otherwise allocate an unused dictionary entry and store this time in it. 4. Record the three-bit index (0..15) of the dictionary entry that was found or added. Now you can store 2 times (one mark, one space) in each byte of memory. Now, for a 34 bit code you will need: 16 bytes for the dictionary 34 bytes for the time codes --- 50 bytes total Bob Ammerman RAm Systems -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu