This worked a treat! just had to make a couple of changes, I was getting a compilation error - That the I/O item was not supported for target. Options were either to replace with while loop or remove I/O from loop. The timing worked a treat (ms). oh and just needed to run on false not true.
I checked the timing results in comparision to a scope and they were within a few ms of eachother which was more than adequate for tests.
Thanks!