Pic mappable pins?

Thread Starter

spinnaker

Joined Oct 29, 2009
7,835
I have a Pic with mappable pins. Really cool concept in my opinion. I can imagine how useful this might be to be able to change the function of a pin with code.

I have a couple of questions.

Why do I need to unlock the configuration of these pins before I can configure their function? Why can't I just write to the control register just like any other control register? I would think that if your code is properly written the configuration won't accidentally be changed.

To configure outputs, you write the function code to a control register. There is one control register for every mappable pin.

But to configure inputs. there is one control register for every function. You write the number of the pin to the configuration register.

Why on earth would you configure the function of the pin so differently between input and output?
 

Thread Starter

spinnaker

Joined Oct 29, 2009
7,835
I noticed that several of the peripherals have this "locking" function. I wonder if it has something to do with the intended application?

But I just wonder why the output config is different from the input config.
 

thatoneguy

Joined Feb 19, 2009
6,359
All pins can be outputs rather easily, low or high.

To remap inputs, it takes a couple jumps of pointers, which is the closest word I can come up with, to make sure all the functions for an analog pin are available. ADC, comparator, Vref, etc. are still hardwired, but the rest of the silicon needs to check two lookup tables to get the right analog function to the pin.

Think of it as a LATX buffer for inputs as there is for outputs, even though it's configured.
 

Thread Starter

spinnaker

Joined Oct 29, 2009
7,835
All pins can be outputs rather easily, low or high.

To remap inputs, it takes a couple jumps of pointers, which is the closest word I can come up with, to make sure all the functions for an analog pin are available. ADC, comparator, Vref, etc. are still hardwired, but the rest of the silicon needs to check two lookup tables to get the right analog function to the pin.

Think of it as a LATX buffer for inputs as there is for outputs, even though it's configured.
So they call it "Unlock" but really it is more of an initialization?
 

ErnieM

Joined Apr 24, 2011
8,045
It's called "unlock" as it is intentionally harder to change these things. That keeps crashing code from randomly resetting pin functions.

I saw this back in '06 in some SiLabs products and have been waiting for Microchip to catch up ever since.
 
Top