Community news, upcoming events and general discussions
Threads: 31 Posts: 81
Get technical support from the community
Threads: 1084 Posts: 5978
Threads: 16 Posts: 55
Tell us how to make XDK better!
Threads: 35 Posts: 117
Share and discuss community member projects
Threads: 49 Posts: 242
I'd like to save the data from an external sensor in a additional column in the .csv file. Does anyone tried that before, or can give me a hint how to implement the data loggin of the external sensor?
thanks for your reply. Yes, i used the GPIO and ADC example from the extension bus user guide to read Pin PD5 and i am able to read values between 0 and about 4000.
Here is the code:
void appInitSystem(void * CmdProcessorHandle, uint32_t param2)
if (CmdProcessorHandle == NULL)
printf("Command processor handle is null \n\r");
GPIO_PinModeSet(gpioPortD, 5, gpioModeInputPull, 0);
ADC_InitSingle_TypeDef channelInit = ADC_INITSINGLE_DEFAULT;
channelInit.reference = adcRef2V5;
channelInit.resolution = adcRes12Bit;
channelInit.input = adcSingleInpCh5;
uint32_t AdcSample = 0;
while ((ADC0->STATUS & (ADC_STATUS_SINGLEACT)) && (BSP_UNLOCKED == ADCLock));// @suppress("Field cannot be resolved")
ADCLock = BSP_LOCKED;
// Wait while conversion is active
while (ADC0->STATUS & (ADC_STATUS_SINGLEACT));// @suppress("Field cannot be resolved")
AdcSample = 0xFFF & ADC_DataSingleGet(ADC0);
ADCLock = BSP_UNLOCKED;
printf("%d \n", AdcSample);
Next step is to use the datalogger to save the data from the external pin into the .csv file. The sensor will be a pressure sensor but it is not clear wich one i will buy.