22.3 PTG Step Commands

Table 22-1. PTG Step Command Format and Description
Step Command Byte
STEPx[7:0]
CMD[3:0]OPTION[3:0]
bit 7bit 6bit 5bit 4bit 3bit 2bit 1bit 0
Step CommandCMD[3:0]Command Description
PTGCTRL0000Execute the control command as described by the OPTION[3:0] bits.
PTGADD0001Add contents of the PTGADJ register to the target register as described by the OPTION[3:0] bits.
PTGCOPYCopy 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].
PTGWHI0100Wait for a low-to-high edge input from a selected PTG trigger input as described by the OPTION[3:0] bits.
PTGWLO0101Wait 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)
PTGIRQ0111Generate individual interrupt request as described by the OPTION[3:0] bits.
PTGTRIG100xGenerate individual trigger output as described by the bits, 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 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 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 Step queue.
Note:
  1. In general, reserved commands or options will execute, but they do not have any effect (i.e., execute as a NOP instruction).
  2. Reserved options must not be used with the PTGWHI/PTGWLO commands.
Table 22-2. PTG Command Options
Step CommandOPTION[3:0]Command Description
PTGCTRL(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 and wait for the PTG Timer0 to match the PTGT0LIM register.
1001Start and wait for the PTG Timer1 to match the PTGT1LIM register.
1010

Wait 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.
PTGCOPY(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(1) or PTGWLO(1)0000PTGI0 (see Table 22-3 for input assignments).

•••

•••

1111PTGI15 (see Table 22-3 for input assignments).
PTGIRQ(1)0000Generate PTG Interrupt 0.

•••

•••

0111Generate PTG Interrupt 7.
1000Reserved; do not use.

•••

•••

1111Reserved; do not use.
PTGTRIG0000PTGO0 (see Table 22-4 for input assignments).
0001PTGO1 (see Table 22-4 for input assignments).

•••

•••

1110PTGO30 (see Table 22-4 for input assignments).
1111PTGO31 (see Table 22-4 for input assignments).
Note:
  1. All reserved commands or options will execute, but they do not have any affect (i.e., execute as a NOP instruction).
Table 22-3. PTG Input Descriptions
PTG Input NumberPTG Input Description
PTGI 0Trigger Input from PWM1 ADC Trigger 2
PTGI 1Trigger Input from PWM2 ADC Trigger 2
PTGI 2Trigger Input from PWM3 ADC Trigger 2
PTGI 3Trigger Input from PWM4 ADC Trigger 2
PTGI 4-6Reserved
PTGI 7Trigger Input from SCCP4
PTGI 8Reserved
PTGI 9Trigger Input from Comparator 1
PTGI 10Reserved
PTGI 11Reserved
PTGI 12Trigger Input from CLC1
PTGI 13Trigger Input ADC Done Group Interrupt
PTGI 14Reserved
PTGI 15Trigger Input from INT2 PPS
Table 22-4. PTG Output Descriptions
PTG Output NumberPTG Output Description
PTGO0 to PTGO11Reserved
PTGO12ADC TRGSRC[30]
PTGO13 to PTGO23Reserved
PTGO24PPS Output RP46
PTGO25PPS Output RP47
PTGO26PPS Input RP6
PTGO27PPS Input RP7
PTGO28 to PTGO31Reserved
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.