Thanks to all your help.

I ended up using this bit but it's still boggling my mind a bit as to how it actually works.

Code:
   for d=0 to 4
    dataword[d*2]=inbuff[d*3]*16+inbuff[d*3+1]>>4
    dataword[d*2+1]=inbuff[d*3+2]+(inbuff[d*3+1]&$f)*256
    next