• AVR Freaks

Hot!dsPIC33 A/D conversion with special event trigger

Author
Ovollyn
New Member
  • Total Posts : 11
  • Reward points : 0
  • Joined: 2019/07/17 10:29:37
  • Location: 0
  • Status: offline
2019/07/19 07:36:52 (permalink)
0

dsPIC33 A/D conversion with special event trigger

Hello,

I'm willing to digitize and analog input on my PIC33 MCU, using the integrated A/D converter at a specific sampling rate. To get this specific sampling rate, I'm trying to use a CCP periodic Timer, that triggers my A/D conversion, but I can't figure it out.
For the moment, my A/D converter is working using the software triggr and the software level-sensitive trigger.
My device is a dsPIC33CH128MP502.

When I check the Capture/Compare/PWM/Timer manuel (http://ww1.microchip.com/...eviceDoc/30003035b.pdf p.18), they say it is possible to trigger periodicly the A/D converter using the module in timer MODE.

But when I check my device specific A/D converter manual (http://ww1.microchip.com/...-Sheet-DS70005319C.pdf p.241-242), it does not appear that I can select my CCP Timer trigger as a trigger source for conversion in the trigger source register, but mostly PVM modules.

So, my question is, is it possible with my device to trigger periodicly my A/D converter using my timer ? Or do I have to use one of the PWM module, as they expose so many ? And as I don't have any experience with PWM modules, can I get a periodic trigger as precise as the timer if I have to use them ?

I'm actually using the software trigger mode, and generating an IRQ with my timer. This way, I can trigger my A/D converter in the CCP Timer ISR. But as I have a pretty high sampling rate, I'm limited in the number of instruction between every sample, so I really want it to be all hardware, and not having to deal with any software. Furthermore, at some point, I don't want to get interrupted during a specific process. So, I really want to do this without any IRQ.

In advance, I want to thank you for your time,

M
#1

3 Replies Related Threads

    du00000001
    Just Some Member
    • Total Posts : 2887
    • Reward points : 0
    • Joined: 2016/05/03 13:52:42
    • Location: Germany
    • Status: offline
    Re: dsPIC33 A/D conversion with special event trigger 2019/07/19 09:44:02 (permalink)
    4 (1)
    What about these fancy "Master SCCPx PWM interrupt" entries ?
    ("PWM" might be misleading - I think this is what you're looking for.)
     
    BTW: the PWM modules are just like any other timer - same precision as all these fancy timers are derived from the same basic clock source (basically).

    PEBKAC / EBKAC / POBCAK / PICNIC (eventually see en.wikipedia.org)
    #2
    Ovollyn
    New Member
    • Total Posts : 11
    • Reward points : 0
    • Joined: 2019/07/17 10:29:37
    • Location: 0
    • Status: offline
    Re: dsPIC33 A/D conversion with special event trigger 2019/07/19 10:57:40 (permalink)
    0
    Hi du00000001,
     
    Thank you for your answer. I wasn't sure for this SCCP PWM. As you said, the PWM made me doubt about it. So, can I use this one without enabling the interrupt for this module (and not being interrupted) ? Like, is it just setting the interrupt flag to "1", and I just need to clean it ? Or does my interrupt still need to be enabled (not good) ?

    I'll check for the PWM on monday, thank you. I'll give an update if it worked or not.

    Best regards,

    M
    #3
    Ovollyn
    New Member
    • Total Posts : 11
    • Reward points : 0
    • Joined: 2019/07/17 10:29:37
    • Location: 0
    • Status: offline
    Re: dsPIC33 A/D conversion with special event trigger 2019/07/22 06:49:36 (permalink)
    4 (1)
    Dear all,

    I found a way to make my system work without interruption. Actually, all the credit goes to Joon, that found a solution on this thread:

    https://www.microchip.com/forums/m1086397.aspx

    According to this thread aswell, it seems like there was a "typing" error in the manual or the CK family processor. The timer mode can't trigger the A/D conversion. Sounds like more and implementation problem to me. Anyway, according to Joon, who is using a CH core aswell, those two cores could be similar, which would mean that the "typing error" is present in the CH family aswell. So, as he suggested, I used the Dual Edge compare mode (buffered), and it now works.

    Thanks to him again


    M
    #4
    Jump to:
    © 2019 APG vNext Commercial Version 4.5