Files
microchip-application-pec93…/Examples/adc/adc_trigger_src_io/readme.md
T

3.6 KiB

adc_trigger_src_io

This is an example to select the source (I/O) to trigger ADC start

It uses the specific pin to trigge ADC

  • Select the ADC converison channel

    // in main.c
    #define CONFIG_ADC_IO_SRC_PORT          GPIOA
    #define CONFIG_ADC_IO_SRC_PIN           GPIO_Pin_09
    #define CONFIG_TARGGET_ADC_1_CHANNEL    ADC_Channel_03
    
  • Select the specific pin to trigger ADC

    It supports PB1 (nRST) or PB2 (JTCK)

    PB1/PB2 MUST be changed to normal I/O mode

    // in main.c
    #define CONFIG_ADC_EXT_TRIG_SRC         ADC_ExtTrigSource_PB1
    
  • Select the trigger mode of the specific pin

    It supports rising or falling trigger mode

    // in main.c
    #define CONFIG_ADC_EXT_TRIG_MODE        ADC_ExtTrigMode_PinRising
    

Log

Use serial port with baudrate 115200, 8bit, no parity check.

  • Link PB1 to button

    • Trigger ADC when free button

      Oct  7 2025 15:46:32
      ADC Trigger single conversion (AIN-3) from external source (Pin: PB1 Rising)
         Button = PA2
      Press Button to setup I/O trigger ...
          PB1 (nRST) => I/O
        1-th ADC Single Conv Value = 0x77C (1916) <--- Trigger ADC when free button
        2-th ADC Single Conv Value = 0x778 (1912)
        3-th ADC Single Conv Value = 0x77A (1914)
        4-th ADC Single Conv Value = 0x77E (1918)
        5-th ADC Single Conv Value = 0x77F (1919)
      
    • Trigger ADC when press button

      Oct  7 2025 15:59:09
      ADC Trigger single conversion (AIN-3) from external source (Pin: PB1 Falling)
         Button = PA2
      Press Button to setup I/O trigger ...
          PB1 (nRST) => I/O
        1-th ADC Single Conv Value = 0x775 (1909) <--- Trigger ADC when press button
        2-th ADC Single Conv Value = 0x789 (1929)
        3-th ADC Single Conv Value = 0x78A (1930)
        4-th ADC Single Conv Value = 0x777 (1911)
      
  • Link PB2 to button

    • Trigger ADC when free button

      Oct  7 2025 16:18:35
      ADC Trigger single conversion (AIN-3) from external source (Pin: PB2 Rising)
         Button = PA2
      Press Button to setup I/O trigger ...
        1-th ADC Single Conv Value = 0x7DF (2015) <--- Link ICE handshaking
        2-th ADC Single Conv Value = 0x722 (1826)
        3-th ADC Single Conv Value = 0x6E8 (1768)
        4-th ADC Single Conv Value = 0x752 (1874)
        5-th ADC Single Conv Value = 0x748 (1864)
        6-th ADC Single Conv Value = 0x675 (1653)
          PB2 (JTCK) => I/O                       <--- disable ICE
        7-th ADC Single Conv Value = 0x789 (1929) <--- free button
        8-th ADC Single Conv Value = 0x7E5 (2021)
      ...
      
    • Trigger ADC when press button

      Oct  3 2025 16:22:41
      ADC Trigger single conversion (AIN-3) from external source (Pin: PB2 Falling)
         Button = PA2
      Press Button to setup I/O trigger ...
      ...
        31-th ADC Single Conv Value = 0x78A (1930) <--- Link ICE handshaking
        32-th ADC Single Conv Value = 0x77B (1915)
        33-th ADC Single Conv Value = 0x7A8 (1960)
        34-th ADC Single Conv Value = 0x792 (1938)
        35-th ADC Single Conv Value = 0x777 (1911) <--- Link ICE handshaking
          PB2 (JTCK) => I/O                        <--- disable ICE
        36-th ADC Single Conv Value = 0x7EC (2028) <--- press button
        37-th ADC Single Conv Value = 0x777 (1911)
        38-th ADC Single Conv Value = 0x78E (1934)
        39-th ADC Single Conv Value = 0x792 (1938)