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.
Step Command Byte | |||
---|---|---|---|
STEPx[7:0] | |||
CMD[3:0] | OPTION[3:0] | ||
bit 7 | bit 4 | bit 3 | bit 0 |
Bits | Step Command | CMD[3:0] | Command Description |
---|---|---|---|
bits 7:4 | PTGCTRL (1) | 0000 | Execute the control command as described by the OPTION[3:0] bits. |
PTGADD (1) | 0001 | Add 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. | ||
PTGSTRB | 001x | Copy the values contained in the bits, CMD[0]:OPTION[3:0], to the strobe output bits[4:0]. | |
PTGWHI (2) | 0100 | Wait for a low-to-high edge input from a selected PTG trigger input as described by the OPTION[3:0] bits. | |
PTGWLO (2) | 0101 | Wait for a high-to-low edge input from a selected PTG trigger input as described by the OPTION[3:0] bits. | |
— | 0110 | Reserved; do not use.(1) | |
PTGIRQ (1) | 0111 | Generate an individual interrupt request as described by the OPTION[3:0] bits. | |
PTGTRIG (1) | 100x | Generate an individual trigger output as described by the 5-bit field of CMD[0]:OPTION[3:0]. | |
PTGJMP | 101x | 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. | |
PTGJMPC0 | 110x | PTGC0 = 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. | |||
PTGJMPC1 | 111x | PTGC1 = 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:
|
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))
Bits | Step Command | OPTION[3:0] | Command Description |
---|---|---|---|
bits 3:0 | PTGCTRL (1) | 0000 | NOP |
0001 | Reserved; do not use. | ||
0010 | Disable Step Delay Timer (PTGSD). | ||
0011 | Reserved; do not use. | ||
0100 | Reserved; do not use. | ||
0101 | Reserved; do not use. | ||
0110 | Enable Step Delay Timer (PTGSD). | ||
0111 | Reserved; do not use. | ||
1000 | Start PTGT0 and wait for its value to match the PTGT0LIM register. | ||
1001 | Start PTGT1 and wait for its value to match the PTGT1LIM register. | ||
1010 | Wait for the software trigger (level, PTGSWT =
1 ). | ||
1011 | Wait for the software trigger (positive edge, PTGSWT =
0 to 1 ). | ||
1100 | Copy the PTGC0LIM register contents to the strobe output. | ||
1101 | Copy the PTGC1LIM register contents to the strobe output. | ||
1110 | Copy the PTGL0 register contents to the strobe output. | ||
1111 | Generate the triggers indicated in the PTGBTE register. | ||
PTGADD (1) | 0000 | Add the PTGADJ register contents to the PTGC0LIM register. | |
0001 | Add the PTGADJ register contents to the PTGC1LIM register. | ||
0010 | Add the PTGADJ register contents to the PTGT0LIM register. | ||
0011 | Add the PTGADJ register contents to the PTGT1LIM register. | ||
0100 | Add the PTGADJ register contents to the PTGSDLIM register. | ||
0101 | Add the PTGADJ register contents to the PTGL0 register. | ||
0110 | Reserved; do not use. | ||
0111 | Reserved; do not use. | ||
Note:
|
Bits | Step Command | OPTION[3:0] | Command Description |
---|---|---|---|
PTG Command Options (Continued) | |||
bits 3:0 | PTGCOPY (1) | 1000 | Copy the PTGHOLD register contents to the PTGC0LIM register. |
1001 | Copy the PTGHOLD register contents to the PTGC1LIM register. | ||
1010 | Copy the PTGHOLD register contents to the PTGT0LIM register. | ||
1011 | Copy the PTGHOLD register contents to the PTGT1LIM register. | ||
1100 | Copy the PTGHOLD register contents to the PTGSDLIM register. | ||
1101 | Copy the PTGHOLD register contents to the PTGL0 register. | ||
1110 | Reserved; do not use. | ||
1111 | Reserved; do not use. | ||
PTGWHI (2) or
PTGWLO (2) | 0000 | PTGI0 (see Table 29-2). | |
... | ... | ||
1111 | PTGI15 (see Table 29-3). | ||
PTGIRQ (1) | 0000 | Generate PTG Interrupt 0 | |
... | ... | ||
0011 | Generate PTG Interrupt 4 | ||
PTGTRIG | 0000 | PTGO0 (see Table 29-3). | |
0001 | PTGO1 | ||
... | ... | ||
1110 | PTGO30 | ||
1111 | PTGO31 (see Table 29-3). | ||
Note:
|
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;