3.1 Macro Configurations

Below are the macro configurations in the main.c file.

  • Application with four use case options, with defined values 1 to 4 respectively, as shown below:
    
    #define FREE_RUNNING                 1
    #define SINGLE_CONVERSION            2
    #define WINDOW_COMPARATOR_MODE       3
    #define SAMPLE_ACCUMULATOR           4
    
  • Which use case to run is selected by changing the value of the macro EXAMPLE_CODE:
    
    #define EXAMPLE_CODE  SAMPLE_ACCUMULATOR
  • The following macros are also used in case it can easily be changed afterward. Maximum input voltage:
    #define MAX_VOL 2.5  //VREF=2.5V

    Maximum input reference voltage is configured to 2.5V to calculate the voltage for measured ADC reading.

    Note: ADC reference (VREF) has been configured to 2.5V.
  • ADC result resolution:
    #define RES_10BIT	0x3FF

    ADC resolution has been configured to be 10 bits, with the maximum result value of 0x3FF.

  • ADC input channel:
    #define ADC_CHANNEL  5

    ADC input signal has been connected to channel 5: AIN5 (pin PA5).