This is an extract from the code I use:<div><br></div><div><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; ">
<div>unpack(UD) -></div><div> septets(list_to_binary([ flip(X) || X <- binary_to_list(UD) ])).</div><div><br></div><div>septets(T) -></div><div> [ flipx(X) || <<X:7>> <= T].</div><div><br></div>
<div>% Flips the bits in an octet/septet for easy unpacking</div><div><br></div><div>flip(Octet) -></div><div> <<B8:1,B7:1,B6:1,B5:1,B4:1,B3:1,B2:1,B1:1>> = <<Octet>>,</div><div> <<B1:1,B2:1,B3:1,B4:1,B5:1,B6:1,B7:1,B8:1>>.</div>
</blockquote><div> </div><div>There is probably a better way of doing it but I was in a rush at the time :-)</div><div><br></div><div><br></div><div><br></div><div><br></div></div>