22.3 PTG Step Commands
| Step Command Byte | |||||||
|---|---|---|---|---|---|---|---|
| STEPx[7:0] | |||||||
| CMD[3:0] | OPTION[3:0] | ||||||
| bit 7 | bit 6 | bit 5 | bit 4 | bit 3 | bit 2 | bit 1 | bit 0 |
| Step Command | CMD[3:0] | Command Description |
|---|---|---|
PTGCTRL | 0000 | Execute the control command as described by the OPTION[3:0] bits. |
PTGADD | 0001 | Add contents of the PTGADJ register to the target register as described by the OPTION[3:0] bits. |
PTGCOPY | 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 | 0100 | Wait for a low-to-high edge input from a selected PTG trigger input as described by the OPTION[3:0] bits. |
PTGWLO | 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 | 0111 | Generate individual interrupt request as described by the OPTION[3:0] bits. |
PTGTRIG | 100x | Generate individual trigger output as described by the bits, 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 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 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 Step queue. | ||
|
Note:
| ||
| Step Command | OPTION[3:0] | Command Description |
|---|---|---|
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 and wait for the PTG Timer0 to match the PTGT0LIM register. | |
1001 | Start and wait for the PTG Timer1 to match the PTGT1LIM register. | |
1010 |
Wait for the software trigger (level, PTGSWT = | |
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. | |
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(1) or
PTGWLO(1) | 0000 | PTGI0 (see Table 22-3 for input assignments). |
|
••• |
••• | |
1111 | PTGI15 (see Table 22-3 for input assignments). | |
PTGIRQ(1) | 0000 | Generate PTG Interrupt 0. |
|
••• |
••• | |
0111 | Generate PTG Interrupt 7. | |
1000 | Reserved; do not use. | |
|
••• |
••• | |
1111 | Reserved; do not use. | |
PTGTRIG | 0000 | PTGO0 (see Table 22-4 for input assignments). |
0001 | PTGO1 (see Table 22-4 for input assignments). | |
|
••• |
••• | |
1110 | PTGO30 (see Table 22-4 for input assignments). | |
1111 | PTGO31 (see Table 22-4 for input assignments). |
Note:
- All reserved commands or options will
execute, but they do not have any affect (i.e., execute as a
NOPinstruction).
| PTG Input Number | PTG Input Description |
|---|---|
| PTGI 0 | Trigger Input from PWM1 ADC Trigger 2 |
| PTGI 1 | Trigger Input from PWM2 ADC Trigger 2 |
| PTGI 2 | Trigger Input from PWM3 ADC Trigger 2 |
| PTGI 3 | Trigger Input from PWM4 ADC Trigger 2 |
| PTGI 4-6 | Reserved |
| PTGI 7 | Trigger Input from SCCP4 |
| PTGI 8 | Reserved |
| PTGI 9 | Trigger Input from Comparator 1 |
| PTGI 10 | Reserved |
| PTGI 11 | Reserved |
| PTGI 12 | Trigger Input from CLC1 |
| PTGI 13 | Trigger Input ADC Done Group Interrupt |
| PTGI 14 | Reserved |
| PTGI 15 | Trigger Input from INT2 PPS |
| PTG Output Number | PTG Output Description |
|---|---|
| PTGO0 to PTGO11 | Reserved |
| PTGO12 | ADC TRGSRC[30] |
| PTGO13 to PTGO23 | Reserved |
| PTGO24 | PPS Output RP46 |
| PTGO25 | PPS Output RP47 |
| PTGO26 | PPS Input RP6 |
| PTGO27 | PPS Input RP7 |
| PTGO28 to PTGO31 | Reserved |
Note: On the dsPIC33CK256MC006 family of
devices, the PTG strobe output may request the conversion of an ADC channel indicated by
the strobed data. This functionality is enabled by setting PTGEN (ADCON2L[11]) to 1 in the
ADC control registers, and operates similarly to using CNVCHSEL (ADCON3L[5:0]) and CNVRTCH
(ADCON3L[8]) to select and convert a channel. The difference is that effectively, upon each
strobe output, CNVCHSEL is written with the strobed data and CNVRTCH is automatically
asserted to request the conversion immediately. The regular functionality of CNVCHSEL and
CNVRTCH is not available when PTGEN = 1.
