Something I ran into also. Has something to do with reading state of pin for toggle, a problem if pin is set to analog, I think. Anyway, a simple reliable method to toggle a pin is to add 1 to the pin value -- portA.1=portA.1 + 1
Something I ran into also. Has something to do with reading state of pin for toggle, a problem if pin is set to analog, I think. Anyway, a simple reliable method to toggle a pin is to add 1 to the pin value -- portA.1=portA.1 + 1
There must be hundreds of posts about this across the forum by now.
Turn off any analog functions (comparator, ADC) that's on the pin(s) you're going to use as digital.
When an analog pin is read, as in myBit=PortA.1 it will always return the same value no matter what the logic state actually is. Toggle then flips the bit and writes it back to the pin. What happens next time TOGGLE executes?
On devices whit LAT registers you're better off using them instead of PORT but I don't Think Toggle works with them.
/Henrik.
Bookmarks