Thanks for your help mate,

I tried using your code but my problem is earlier on than the number of bytes being read. I put this 'turn LED line on' line after the wait loop. The LED never comes on. My ds1820 is never being ready I guess. I have double checked wiring. I know it's an odd one. Any more ideas just to get me past the wait loop. Once I am past there I can work the rest out from your fabulous info!

If NOT DQ Then waitloop
high PORTA.5
' the LED never comes on (but of course it does if I put the line before the loop!)

Regards

Rich