Peripheral Trigger Generator (PTG)

Last modified by Microchip on 2023/11/10 11:07

Overview of the PTG

The Peripheral Trigger Generator (PTG) is a user-programmable module on dsPIC33E and PIC24E microcontrollers (MCUs). The PTG monitors peripheral activity and generates sequences of trigger signals to coordinate the operation of the peripherals. The PTG has the capability of producing a precisely-timed sequence of events that may be difficult to replicate with software.

The PTG is designed to work with the Analog-to-Digital Converter (ADC), the Output Compare/PWM module, all general-purpose timers, and the MCU's interrupt controller.

PTG operation is controlled by a set of step commands loaded by the application into the PTG's queue. The depth of the PTG queue ranges from 8-32 depending upon which MCU is being used. Each step command is 8-bits wide.

Included in the step commands are one unconditional jump and two conditional jumps. Step commands can be arranged in a single-level nested loop configuration. Using Step Commands, the PTG can be instructed to pause the operation to wait for an event to occur before proceeding.

Image Showing Single Conditional Loop and Nested Conditional Loop Flows for PTG

Once the PTG is programmed and started, no additional CPU intervention is needed.

PTG Inputs

Step commands can detect the following inputs:

  • An event trigger generated by a supported peripheral
  • An interrupt request from the PWM or the ADC
  • An external interrupt (INT2)
  • A software trigger set by the application code

PTG Outputs

Step commands are capable of:

  • Generating trigger signals for other peripheral's activity
  • Changing the values of the parameters used by the peripherals
  • Initiating a PTG interrupt request
  • Disabling the step timer (i.e., stopping PTG execution)

Parameters for Program Flow Control

Step commands have the following mechanisms to control program flow:

  • Unconditional jumps
  • Conditional jumps on input trigger levels (high or low)
  • Conditional jumps on a loop counter's value

Clock Source

The PTG's operating clock is set by the application. The options for the clock source include:

  • Fosc
  • ADC FRC
  • The input clock for timer T1, T2, or T3

Back to top

Learn More

Programming the Peripheral Trigger Generator

Peripheral Trigger Generator - Step Commands

Examples of Using the Peripheral Trigger Generator

Back to top