PORTA analog / digital select

Some PICs are configured to use some of the PORTA pins as analog inputs when they are powered up. Setting the Data Direction Register (DDR) of PORTA via the TRISA register does not change the function of these pins to digital I/O. This can be confusing.

The XCSB compiler has two build options which are designed to force the programmer to be aware of the potential analog / digital I/O conflict.

These are

One of these build options must be specified by the programmer near the start of his/her program. The syntax for this is:
pragma build_config BLD_OPT_PORTA_DIGITAL_IO
or
pragma build_config BLD_OPT_PORTA_ANALOG_IO

The value of the analog / digital selection is made available to the programmer through the BLD_OPT_PORTA_INIT manifest constant. This constant may be accessed by the programmer like any other constant.

BLD_OPT_PORTA_INIT is used within the startup macro (in startup.asm) to configure PORTA during startup for analog or digital I/O

Some PICs do not have analog I/O capabilities and consequently the BLD_OPT_PORTA_ANALOG_IO build option is not available for them. Trying to use this option will result in a failure.

The programmer may extend the BLD_OPT_PORTA_INIT capabilities to include new types of PICs and also other PORTs or initialisation or build perculiarities.

user definable build options