Hello Celso,
You actually have two choices - set the unused pin as an output, or leave as an input and enable the internal pullup for the pin. If you leave the unused pin floating, the voltage will probably float to a mid level, and the input circuitry within the device will have increased current draw. The pin will also be more susceptable to static discharge.
To retain common software with varing resources, for a single target, there could be a number of approaches, depending on the hardware external to the device, specifically the interface circuitry for the ADC inputs.
- Perhaps allow for an external pullup (or pulldown) resistor, present when the ADC input is not used. If there is already a voltage divider for ADC operation, leave the shunt resistor in place. If the input is driven by an operational amplifier or analog buffer, the permanent presence of an additional high value pullup resistor (say 100k) may not affect the measurement.
- During initialisation, is it possible to sense wnether the external hardware is present or absent?
- If you have a spare pin on the device, use a link, jumper or DIP switch to set the required operating mode.
- Use a single byte of flash for non-volatile storage the required configuration. This might be programmed from within the firmware, when it is run for the first time after programming, and a certain switch or pushbutton combination is actuated.
Unless two different targets are closely related to each other, I suspect that you will need a S19 file for each target.
Regards,
Mac