If you use PortA = PortA - 1, you may run into issues with the PIC.
PortA=PortA - 1 will read the actual values on the pins, subtract one, and write it back.
Sounds good in theory, doesn't always work that way in practice. Might work well, might not.
I think a better way would be to read that PortA value into a temporary variable, subtract 1, then write that value back. At least then you have a copy of that value in that temporary variable to mess with, and without messing with the actual Port itself.
Bookmarks