Hello,
I am trying to connect a potentiometer to the LaunchXL board with the code of the Lab4, to make a current controller controlled by a knob.
To do that I have thought of this steps:
- Connect a potentiometer between the 3.3V and ADCINA6, SOC8
- Add a new voltage sensor to pUserParams->numCurrentSensors
- In drvsetupadcs add:
- DC_setSocChanNumber(obj->adcHandle, ADC_SocNumber_8,ADC_SocChanNumber_A6);
- ADC_setSocTrigSrc(obj->adcHandle,ADC_SocNumber_8,ADC_SocTrigSrc_EPWM1_ADCSOCA);
- ADC_setSocSampleDelay(obj->adcHandle,ADC_SocNumber_8,ADC_SocSampleDelay_7_cycles);
- In typedef struct _DRV_AdcData_t_ add:
- _iq potentiometer;
- In the DRV_readAdcData add:
- value = (_iq)ADC_readResult(obj->adcHandle,ADC_ResultNumber_8);
- value = _IQ12mpy(value,HARDCODED_SFACTOR) - HARDCODED_BIAS;
- pAdcData->potentiometer = value;
I would like to know if the steps I have taken to setup the adc and potentiometer are correct.
I would also like to know where is the Iq current updated so I can copy the value of pAdcData->potentiometer to the new Iq reference. That is the last step which I have not figured out.
Thank you in advance
Paulo Neves