Peripheral Trigger Generator (PTG)


The Peripheral Trigger Generator (PTG) is a user-programmable module on dsPIC33E/PIC24E Microcontrollers (MCUs). The PTG monitors peripheral activity and generates sequences of trigger signals to coordinate operation of the peripherals. The PTG is capability of producing a precisely-timed sequence of events which 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 to 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 operation to wait for an event to occur before proceeding.

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
  • The input clock for timer T1, T2, or T3

 Learn More

Programming the PTG
Learn more >
PTG Step Commands
Learn more >
PTG Usage Examples
Learn more >
© 2017 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.