thanx for the comment skimask.but i don't clearly understand about your comment on:

"PortA = PortA -1, although I don't think I'd use this method. I'd use another variable to do the counting and then copy that variable into portA"

what method do you prefer to use???what is the meaning of PortA = PortA -1 in this case???sory to ask,i'm a newbie in this thing.thanx once again for your reply...