• AVR Freaks

Hot!dsPIC 33CK ADC "special event" triggering from CCP1

Starting Member
  • Total Posts : 44
  • Reward points : 0
  • Joined: 2018/09/14 12:03:56
  • Location: 0
  • Status: offline
2019/01/12 11:55:03 (permalink)

dsPIC 33CK ADC "special event" triggering from CCP1

I'm trying to use a dsPIC33CK128MP205 and trigger the ADC module from the general purpose timer of SCCP1.
I've configured the ADC module so it works and generates a suitable interrupt if you have
/* Configure analogue trigger source */
ADTRIG0Lbits.TRGSRC0 = 0b00001;    /* Set AN0 trigger source to Common Software trigger */

and then manually prod it with:
ADCON3Lbits.SWCTRG = 1; /* Issue common software trigger for ADC */

I've also configured the time base generator and general purpose timer of CCP1 to act as dual 16-bit timers and to generate an interrupt on "CCT1IF"  at the rate I'd like the ADC to sample.   However, what I'm struggling to do is link the two peripherals together.
Figure 22-1 on page 429 of the datasheet gives the "SCCPx Conceptual Block Diagram", and shows the output "Special Trigger (to ADC)".  I believe I've configured it to operate as per Figure 22-3, in dual 16-bit timer mode which gives the "Special Event Trigger" when timer value CCPxTMRL matches CCPxRB.  Certainly the interrupt when the timer matches CCPxPRL is fine.
I've set the auxiliary output to "Special Event Trigger Output", and set the ADC trigger source to:
/* Configure analogue trigger source */
ADTRIG0Lbits.TRGSRC0 = 0b10100; /* Set AN0 trigger source to SCCP1 */

However the ADC isn't getting triggered.
A search on "special event" only brings reference to it within the SCCP/MCCP section of the datasheet, but I assumed out of all the trigger options in the ADC section that selecting "SCCP1" would connect it through to the timer I've set up at CCP1.
What have I missed and am I doing wrong?

0 Replies Related Threads

    Jump to:
    © 2019 APG vNext Commercial Version 4.5