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 Register PTGCST.

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
PTGEN PTGSIDL PTGTOGL PTGSWT PTGSSEN PTGVIS
bit 15 bit 8

R/W-0 R/W0 U-0 U-0 U-0 U-0 R/W-0 R/W-0
PTGSTRT PTGWDT0 PTGITM1 PTGITM0
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 = Start to sequentially execute Step commands
0 = Stop 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

 
Programming the PTG
Learn more >
 
Establishing Step Command Timing
Learn more >
 
Initializing the PTG
Learn more >
 
Example PTG Code
Learn more >
© 2016 Microchip Technology, Inc.
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.