Programming the Step Queue

Loading Step Commands into the Queue

Step commands are executed from the Peripheral Trigger Generator (PTG) Step queue. The Step queue is a set of 16-bit wide special function registers (SFRs). The number of entries in the queue varies depending upon which MCU is being used. The SFRs in the queue are PTGQUE0 through PTGQUEn (where n = ( # of Step commands/2 ) - 1). Two 8-bit wide Step Commands are loaded into each 16-bit wide Step queue SFR.

Compiler Supplied #defines

The Step queue is loaded with a series of assignment statements. When <xc.h> is included in a project the MPLAB® XC16 compiler provides easy-to-read definitions for the individual queue entries (e.g., _STEP0, _STEP1, etc..). The compiler definitions ensure the proper placement of Step Commands.

Application #defines

A common mechanism used in application programs is to #define the commands in such a way as to make the loading of the queue more readable. Using this mechanism the #define includes the numeric opcode left shifted by 4 bits. Combined with the numeric for the OPTION field, this mechanism allows you to easily see what has been loaded into the queue.

loading-the-queue.png
© 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.