> The actual Huffman decode algorithm is actually pretty simple. > You treat the > the compressed message as a sequence of bits and walk to the left or right > in the tree for each one. As soon as your walk encounters a link that has > the high bit on then you have found the character to output. > Yes, simple it is. Reconstructing and storing the tree is the tough part. Another alternative would be to use 6 bits to store the symbols instead of the usual 8 bits. But the savings are very minimal and probably its not worth the effort. The method I use is very simple. I use a table of strings in the program memory (using the dw directive to include packed ascii). Using 2 retlw tables, I get the 16 bit offset to the null terminated string in the program memory of the PIC. AFAIK, This is the simplest method to use. A kind of a dictionary optimized for the most frequently used technical terms (Its used in a UPS). I also made a simple stack to store all the RXed bytes from the USART. The recieve ISR keeps pushing all the recieved bytes into the stack.As soon as a '\n' is recieved, The ISR raises a flag bit to let the processing code in the main loop take over. I have a few simple subroutines to match strings(case sensitive!), numbers (decimal only) etc. With this, I could develop simple commands like. SET FREQUENCY TO 50 GET MOSFET TEMPERATURE etc. If a string is not recognized, it transmits "Unrecognized statement" I guess with simple string parsing functions, It is possible to make a simple BOT having trivial intelligence with a 16f877. A simple idiot with trivial intelligence lower than a rat. Atleast a rat learns but anything like this will be stuck with simple programmed intelligence. Anyway, the next HAL won't be made out of PICs ;-) [Ok I'm sorry, I've rolled really off topic from Huffman encoding to AI in PICs.] Reagrds, Jeethu Rao -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads