Other Parts Discussed in Thread: MOTORWARE, TMS320F28069F
I am using TMS320F28069F controller and motorware example.
How can use analog ADC pin as a analog input or output configuration. I am not able to see any function in motorware files.
Suprit
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Other Parts Discussed in Thread: MOTORWARE, TMS320F28069F
I am using TMS320F28069F controller and motorware example.
How can use analog ADC pin as a analog input or output configuration. I am not able to see any function in motorware files.
Suprit
Hello Suprit,
To setup ADC:
hal.c
void HAL_setupAdcs(HAL_Handle handle)
To read ADC values:
hal.h
static inline void HAL_readAdcData(HAL_Handle handle,HAL_AdcData_t *pAdcData)
And you can see in main file, this function is called:
// convert the ADC data
HAL_readAdcData(halHandle, &gAdcData);
And it is used for example:
// Get the DC buss voltage
gMotorVars.VdcBus_kV =
_IQmpy(gAdcData.dcBus,_IQ(USER_IQ_FULL_SCALE_VOLTAGE_V/1000.0));
That you can add the variables of gAdcData in hal_obj.h (typedef struct _HAL_AdcData_t_)
Best regards,
Maria
Hello maria,
Thank you for your reply.
I think you there is some miss understanding.
My question is how to use ADC pin as a GPIO in motorware. There is no any function like GPIO MUX and DIR resistor setting.
Regards,
Suprit
Aha, I see. Sorry for the misunderstanding.
I think indeed there is no ready APIs for this.
But I think you can make it by yourself, the AIO register (ADC as Analog IO) has been mentioned in GPIO_Obj in gpio,h.
You can follow how GPIO APIs are made.
For example for GPADIR register, there is API GPIO_setDirection().
You can copy and modify this for AIODIR to become AIO_setDirection(), and follow the datasheet which AIO numbers are available.
Good luck!
Best regards,
Maria