Jump to content
  • 0

MCC keeps setting my outputs to "Analog", why?



1 answer to this question

Recommended Posts

  • Member

When you make a pin a Digital Output this means that you are going to use the pin as an output and when you read data back from the pin you are expecting to read back from the LATx register the values you are using to control the port with. In most cases you do not want to actually read the pin values back or you can trip yourself up with Read-Modify-Write problems.

What MCC is doing here is simply disabling all reads from the I/O Pins. This means that when you write to the port and the pin transitions this transition is not detected by the input circuitry and this is not propagated through the device, which of course will save you some power as each time a bit flips this consumes some small amount of power, so MCC is trying to help you here.

There may be one exception where you want to go change the pin to not have "Analog" checked, and that is if you plan to read back the value of the PORT register to see if there is a short circuit on the pin or if the pin is overloaded so much that even when it is trying to drive a 1 the voltage is low enough to be detected as a 0. If you are using reads of the outputs like this to detect errors then you will want to uncheck Analog, in all other cases it is actually better to leave it checked!

Here is the pin diagram (from the Datasheet). This clearly shows that all ANSELx is doing is forcing the input to always read 0. Note that regardless of the ANSELx value, the pin voltage will always be routed to the Analog Peripherals e.g. Comparators or OpAmps, so ANSELx has no relation to Analog inputs! 


Link to comment
Share on other sites


This topic is now archived and is closed to further replies.


  • Create New...