03-05-2007 08:31 AM
03-06-2007 03:17 PM
03-07-2007 09:55 AM
This question would better be posed in the LabVIEW forum instead of Field Point.
There are probably many different ways to solve this problem in LabVIEW, but here are a couple of solutions. I have only tested it in LabVIEW Windows, but it can be adapted to LabVIEW FPGA with some changes.
The basic idea is to process the Huffman Tree, converting the path to each leaf into a numeric value, and then sorting all leaves (paths) from shortest to longest (lowest to highest value). Once you have this processed and sorted Huffman Tree you can walk through the data bits and match them up to the values in the processed tree, looking for matches between the sequence of bits in the binary data stream and the available leaves in the tree. Whenever you find a match between a bit sequence and leaf value you return the corresponding character and start the next bit sequence. As you search for valid bit sequences you start with one bit and keep adding additional bits until you find a valid sequence.