shared adc component

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

shared adc component

Jump to solution
870 Views
bataliero
Contributor III

Hi ,

Is it possible to create shared ADC component on Kinetis K60 ? I have to get values from 4 pins on ADC0 and ADC1 . It would be more elegant to do not have duplicated code like

LDD_TError Adc0_GetMeasuredValues(LDD_TDeviceData *DeviceDataPtr, LDD_TData *BufferPtr)

{

  uint8_t Sample;

  AdConv0_TResultData *pBuffer = (AdConv0_TResultData *)BufferPtr;

  /* Copy values from result registers defined in the active sample

     group to the user supplied buffer */

  for (Sample = 0U; Sample < ((AdConv0_TDeviceDataPtr)DeviceDataPtr)->SampleCount; Sample++) {

    pBuffer[Sample] = (uint16_t)(ADC_PDD_GetResultValueRaw(ADC0_BASE_PTR, Sample));

  }

  return ERR_OK;                       /* OK */

}

LDD_TError Adc1_GetMeasuredValues(LDD_TDeviceData *DeviceDataPtr, LDD_TData *BufferPtr)

{

  uint8_t Sample;

  AdConv1_TResultData *pBuffer = (AdConv1_TResultData *)BufferPtr;

  /* Copy values from result registers defined in the active sample

     group to the user supplied buffer */

  Sample = ((AdConv1_TDeviceDataPtr)DeviceDataPtr)->SampleCount;

  for (Sample = 0U; Sample < ((AdConv1_TDeviceDataPtr)DeviceDataPtr)->SampleCount; Sample++) {

    pBuffer[Sample] = (uint16_t)(ADC_PDD_GetResultValueRaw(ADC1_BASE_PTR, Sample));

  }

  return ERR_OK;                       /* OK */

}

0 Kudos
1 Solution
521 Views
ProcessorExpert
Senior Contributor III

Hello,

as far as I know that this is not currently supported in ADC. Anyway I have passed this as feature request to developers.

best regards

Vojtech Filip

Processor Expert Support Team


View solution in original post

0 Kudos
2 Replies
522 Views
ProcessorExpert
Senior Contributor III

Hello,

as far as I know that this is not currently supported in ADC. Anyway I have passed this as feature request to developers.

best regards

Vojtech Filip

Processor Expert Support Team


0 Kudos
521 Views
elisamejia
Contributor III

Hello!

Is it possible to do it now using the K70 tower module? I have to digitize 3 different signals and show them in a TWR-LCD-RGB. I want to use the tower elevator connections so I have no access to ADC2 or ADC3. When I create my first ADC0 and ADC1 objects in ProcessorExpert, it works fine; however, when I create the other one, using ADC0 or ADC1 in a different pin, it says that AD converter is already used by the other component, and if I enable the sharing option it says that this mode isn't supported on this version of module.

How can I accomplish my 3 simultaneous ADC reads?

Best regards,

Elisa

0 Kudos