News:

PROTON pic BASIC Compilers for PIC, PIC24, dsPIC33

Main Menu

dsPic33CK256MP508 and ADC autosample mode

Started by Wimax, Jan 19, 2025, 10:59 PM

Previous topic - Next topic

Wimax

Hello everybody,

As I slowly become familiar with the dsPic33CK256MP508, I wonder what happened to the Autosample mode of the ADCs present in the Pic24FJ/HJ and dsPic33EP ? I do not understand if it is possible to use a simple timer to trigger the ADC.

Stephen Moss

If the device has no auto-sample mode it depends on how fast you want to sample the ADC, it has been a while since I read a data sheet for a device with an ADC that has an auto-sample feature but if memory serves as soon as one sample is completed the next begins.

I don't see why you could not use a timer, however if you want it to work as outlined above on a device that does not have auto-sampling then I think it would be better to use the ADC interrupt, that way as soon as the sample has completed you will then jump to the interrupt, where you read the result into a variable and reset the ADC Go/Done bit to start taking the next sample immediately.

Whereas if you want auto-sampling but not as fast as that then you could use Timer, you could implement that in at least two different ways...
  • Use the ADC interrupt to read the result and reset & start the Timer, then use the Timer interrupt to set the ADC Go/Done bit to take the next sample, which is a little messy or
  • Ignore the ADC interrupt and just use the Timer interrupt to read the ADC result, set the ADC Go/Done bit to start the next sample, and reset/restart the timer.

Wimax

Hello Stephen,

Many thanks for the advice. My doubt arose from the fact that in the data-sheet of the component, it doesn't seem to be clearly indicated that I can use a timer as a trigger source for the ADC. I still have to do some tests, the sample rate is a few hundred ksps, I could try to handle this with an ADC interrupt, but the rate is really high. I would like to resort to DMA as already done with the PIC24HJ series, I confess I would have liked to have an autosampling mode on the dsPIC33CK as well to make my life easier.