Adjust, Hold, and Limit Registers

Initializing the Limit, Hold, and Adjust Registers

Limit Registers

Limit registers are used by step commands to control sequence timing.

PTGT0LIM and PTGT1LIM are used to insert one-time pauses into a sequence. The Peripheral Trigger Generator Control (PTGCTRL) step command has an option that will start either PTG Timer0 or PTG Timer1, then wait until the value of the timer equals the value of its Limit register. When the values are equal to each other, control is passed to the next step command in the queue.

The Step Delay Limit (PTGSDLIM) register is used to insert a temporary and repeatable delay for every step command in a sequence. The value loaded into PTGSDLIM is the number of PTG clocks needed to execute a single step command. When enabled, PTGSDLIM will cause the time period between successive step commands to be longer. When this register is disabled, all step commands will execute at the speed of the designated PTG clock. PTGSDLIM can be enabled or disabled using an option of the PTGCTRL step command.

PTGC0LIM and PTGC1LIM are loop counters for the conditional jump commands (PTGJMPC0 and PTGJMPC1). Using two loop counters allows a single level of nesting.

Example Of a Nested Loop Using the PTGCxLIM Registers

In this example, if PTGC0LIM = 3 and PTGC1LIM = 8, then the following commands would be executed before control is passed to the command in Step 5:

  • The step command loaded into Step 1 will execute 24 (3 x 8) times.
  • The step command loaded into Step 3 will execute 8 times.

  • All Limit registers can be initialized with a simple assignment statement when the PTG is disabled. For example, PTGSDLIM = 7.

  • During run-time, the value of any Limit register can be modified by the use of PTGCOPY or PTGADD step commands.

Adjust Register

The PTGADD step command will add the value of the literal stored in PTGADJ to a Limit register. The particular Limit register to be modified is passed in the command's OPTION field. Modifying the Limit registers allows sequences to incrementally adjust the timing of generated triggers.

Hold Register

The PTGCOPY step command moves the content of PTGHOLD into any of the Limit registers. PTGCOPY is typically used to reset a Limit register to its initial value after the register has been modified by PTGADD.

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