Code:
<font color="#000080"><b>WHILE </b></font>Counter1 < <font color="#FF0000">200
</font><font color="#000080"><b>IF </b></font>PORTA = <font color="#FF0000">11 </font><font color="#000080"><b>THEN </b></font>PORTB.<font color="#FF0000">0 </font>= PORTB.<font color="#FF0000">0 </font>^<font color="#FF0000">1
</font><font color="#000080"><b>IF </b></font>PORTA = <font color="#FF0000">12 </font><font color="#000080"><b>THEN </b></font>PORTB.<font color="#FF0000">1 </font>= PORTB.<font color="#FF0000">1 </font>^<font color="#FF0000">1
</font><font color="#000080"><b>IF </b></font>PORTA = <font color="#FF0000">13 </font><font color="#000080"><b>THEN </b></font>PORTB.<font color="#FF0000">2 </font>= PORTB.<font color="#FF0000">2 </font>^<font color="#FF0000">1
</font>Counter1 = Counter1 + <font color="#FF0000">1
</font><font color="#000080"><b>WEND
</b></font>
I think that the issue is not with the pic being faster; but with the logic flow of this code.
IF PORTA does not change, it will continue to toggle the pin anyway.
You should save the initial value first, and then if the new value is different then toggle the pin.
----------------------
"If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte
Bookmarks