Enabling and Starting the PTG Module

In order for the Peripheral Trigger Generator (PTG) to begin executing step commands, two separate actions must be taken by the application:

  1. The PTG must first be enabled.
  2. Once enabled, the PTG will begin operating when it is started.

Enabling and starting the PTG are accomplished by writing to the PTG Control and Status (PTGCST) register.

PTGCST: PTG Status and Control Register

R/W-0 U-0 R/W-0 R/W-0 U-0 R/W-0 R/W-0 R/W-0
bit 15 bit 8

R/W-0 R/W0 U-0 U-0 U-0 U-0 R/W-0 R/W-0
bit 7 bit 0

bit 15

PTGEN: Module Enable bit

1 = Enables the PTG module
0 = Disables the PTG module

bit 7

PTGSTRT: Start PTG Sequencer bit

1 = Starts to sequentially execute Step commands
0 = Stops executing commands

Examples of Enabling/Starting the PTG using the MPLAB® XC16 C Compiler

Notes to remember on Enabling and Starting the PTG:

  • At reset, the PTG module is Disabled and Stopped.
  • PTGCST is the only PTG Special Function Register (SFR) which can be written while the PTG Module is enabled. To modify any other PTG SFR, you must first disable the PTG by clearing PTGEN.
  • When PTGEN is set, the PTG Queue Pointer Register (PTGQPTR) is set to point to the first entry in the Step Queue. Starting and stopping PTG execution has no effect on PTGQPTR.

 Learn More

© 2024 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.