Mel,
Loooking at your code I'm a bit stumped.

How is each BIT in the MyData referenced to CounterA?

Also.... It looks like you are shifting through each BIT on Mydata on the last line:
MyData=MyData>1

But shouldn't it be: MyData=MyData>>1

I have read your FAQ on Bits, bytes and Words, but I can't relate your code here to the examples given in the FAQ.

But otherwise, the code looks like it should work.

Cheers
J