29.2.1.4 Output Generation

Output generation is achieved using the PTGTRIG, PTGIRQ and PTGSTRB commands. PTGTRIG is used to select and generate an output trigger (PTGOx). PTGTRIG also uses a 5-bit OPTION field to support the 32 PTGOs’ selections. The PTGIRQ command is used to generate an interrupt request with the OPTION field specifying the interrupt (PTGxIF). See PTG Module Outputs for additional information on triggers and interrupts. The PTGSTRB command is used to generate a strobe output, which outputs 16 bits of data to another peripheral, if implemented. See Strobe Output for additional information.

Table 29-5 provides an overview of the PTG commands and Table 29-6 elaborates on the options available for each command. PTG Command Definitions, PTGCTRL Options and Options for PTGADD and PTGCOPY Commands provide C code examples for command definitions and their options. Later examples in this FRM refer back to these examples.

Table 29-5. PTG Step Command Format and Description
Step Command Byte
STEPx[7:0]
CMD[3:0]OPTION[3:0]
bit 7bit 4bit 3bit 0
BitsStep CommandCMD[3:0]Command Description
bits 7:4PTGCTRL(1)0000Execute the control command as described by the OPTION[3:0] bits.
PTGADD(1)0001Add contents of the PTGADJ register to the target register as described by the OPTION[3:0] bits.
PTGCOPY(1)Copy contents of the PTGHOLD register to the target register as described by the OPTION[3:0] bits.
PTGSTRB001xCopy the values contained in the bits, CMD[0]:OPTION[3:0], to the strobe output bits[4:0].
PTGWHI(2)0100Wait for a low-to-high edge input from a selected PTG trigger input as described by the OPTION[3:0] bits.
PTGWLO(2)0101Wait for a high-to-low edge input from a selected PTG trigger input as described by the OPTION[3:0] bits.
0110Reserved; do not use.(1)
PTGIRQ(1)0111Generate an individual interrupt request as described by the OPTION[3:0] bits.
PTGTRIG(1)100xGenerate an individual trigger output as described by the 5-bit field of CMD[0]:OPTION[3:0].
PTGJMP101xCopy the values contained in the bits, CMD[0]:OPTION[3:0], to the PTGQPTR register and jump to that position in the step queue.
PTGJMPC0110xPTGC0 = PTGC0LIM: Increment the PTGQPTR register.
PTGC0 ≠ PTGC0LIM: Increment Counter 0 (PTGC0) and copy the values contained in the bits, CMD[0]:OPTION[3:0], to the PTGQPTR register and jump to that position in the step queue.
PTGJMPC1111xPTGC1 = PTGC1LIM: Increment the PTGQPTR register.
PTGC1 ≠ PTGC1LIM: Increment Counter 1 (PTGC1) and copy the values contained in the bits, CMD[0]:OPTION[3:0], to the PTGQPTR register and jump to that position in the step queue.
Note:
  1. Reserved commands or options will execute, but they do not have any effect (i.e., they execute as a NOP instruction).
  2. Reserved input trigger options must not be used with PTGWHI/PTGWLO.

PTG Command Definitions

/* PTG Commands */
#define PTGCTRL(x)     ((0b00000000) 	| ((x) & 0b00001111))
#define PTGADD(x)      ((0b00010000) 	| ((x) & 0b00000111))
#define PTGCOPY(x)     ((0b00011000) 	| ((x) & 0b00000111))
#define PTGSTRB(x)     ((0b00100000) 	| ((x) & 0b00011111))
#define PTGWHI(x)      ((0b01000000) 	| ((x) & 0b00001111))
#define PTGWLO(x)      ((0b01010000) 	| ((x) & 0b00001111))
#define PTGIRQ(x)      ((0b01110000) 	| ((x) & 0b00001111))
#define PTGTRIG(x)     ((0b10000000) 	| ((x) & 0b00011111))
#define PTGJMP(x)      ((0b10100000) 	| ((x) & 0b00011111))
#define PTGJMPC0(x)    ((0b11000000) 	| ((x) & 0b00011111))
#define PTGJMPC1(x)    ((0b11100000) 	| ((x) & 0b00011111))
Table 29-6. PTG Command Options
BitsStep CommandOPTION[3:0]Command Description
bits 3:0PTGCTRL(1)0000NOP
0001Reserved; do not use.
0010Disable Step Delay Timer (PTGSD).
0011Reserved; do not use.
0100Reserved; do not use.
0101Reserved; do not use.
0110Enable Step Delay Timer (PTGSD).
0111Reserved; do not use.
1000Start PTGT0 and wait for its value to match the PTGT0LIM register.
1001Start PTGT1 and wait for its value to match the PTGT1LIM register.
1010Wait for the software trigger (level, PTGSWT = 1).
1011Wait for the software trigger (positive edge, PTGSWT = 0 to 1).
1100Copy the PTGC0LIM register contents to the strobe output.
1101Copy the PTGC1LIM register contents to the strobe output.
1110Copy the PTGL0 register contents to the strobe output.
1111Generate the triggers indicated in the PTGBTE register.
PTGADD(1)0000Add the PTGADJ register contents to the PTGC0LIM register.
0001Add the PTGADJ register contents to the PTGC1LIM register.
0010Add the PTGADJ register contents to the PTGT0LIM register.
0011Add the PTGADJ register contents to the PTGT1LIM register.
0100Add the PTGADJ register contents to the PTGSDLIM register.
0101Add the PTGADJ register contents to the PTGL0 register.
0110Reserved; do not use.
0111Reserved; do not use.
Note:
  1. All reserved options for this command will execute, but they do not have any effect (i.e., they execute as a NOP instruction).
  2. Reserved input trigger options must not be used with PTGWHI/PTGWLO.
BitsStep CommandOPTION[3:0]Command Description
PTG Command Options (Continued)
bits 3:0PTGCOPY(1)1000Copy the PTGHOLD register contents to the PTGC0LIM register.
1001Copy the PTGHOLD register contents to the PTGC1LIM register.
1010Copy the PTGHOLD register contents to the PTGT0LIM register.
1011Copy the PTGHOLD register contents to the PTGT1LIM register.
1100Copy the PTGHOLD register contents to the PTGSDLIM register.
1101Copy the PTGHOLD register contents to the PTGL0 register.
1110Reserved; do not use.
1111Reserved; do not use.
PTGWHI(2) or PTGWLO(2)0000PTGI0 (see Table 29-2).
......
1111PTGI15 (see Table 29-3).
PTGIRQ(1)0000Generate PTG Interrupt 0
......
0011Generate PTG Interrupt 4
PTGTRIG0000PTGO0 (see Table 29-3).
0001PTGO1
......
1110PTGO30
1111PTGO31 (see Table 29-3).
Note:
  1. All reserved options for this command will execute, but they do not have any effect (i.e., they execute as a NOP instruction).
  2. Reserved input trigger options must not be used with PTGWHI/PTGWLO.

PTGCTRL Options

// Used with PTGCTRL command
typedef    enum
{
           stepDelayDisable = 0b0010,
           ptgNop = 0b0000;
           stepDelayEnable = 0b0110,
           t0Wait = 0b1000,
           t1Wait = 0b1001,
           softTriggerLevelWait = 0b1010,
           softTriggerEdgeWait = 0b1011,
           c0Strobe = 0b1100,
           c1Strobe = 0b1101,
           l0Strobe = 0b1110,
           triggerGenerate = 0b1111,
} CTRL_T;

Options for PTGADD and PTGCOPY Commands

// Used with PTGADD and PTGCOPY commands
typedef    enum
{
           c0Limit = 0b0000,
           c1Limit = 0b0001,
           t0Limit = 0b0010,
           t1Limit = 0b0011,
           stepDelay = 0b0100,
           literal0 = 0b0101,
} ADD_COPY_T;