Thanks. That works great.

To find the port pin state using this, you would just need to decrement the return value by 1 if the value is >0 ( same for NCD).

When I get some time I will run this against NCD and check the instruction cycles to see which is quicker.

Thanks again.