Hi, all
i have using adxl335 sensor interfacing ADC ;i have done code ,i wanted to know is it correct or the way i have developed the code can any one suggest me.
How can i print those x,y,z value on UART and send via BLE.
Hi, all
i have using adxl335 sensor interfacing ADC ;i have done code ,i wanted to know is it correct or the way i have developed the code can any one suggest me.
How can i print those x,y,z value on UART and send via BLE.
simultaneous ADC sampling is not possible in Nrf51822. You will always have to sample only one analog pin . if you want to make it simultaneous, you would required two ADC peripherals, and the nRF51 only has one ADC peripheral.
u need to wait for some microseconds between two analog input events around 100us something.
Please try following example of scanning three analog input pins..
while (true)
{
adc_config();
nrf_adc_start();
uint32_t adc = adc_sample;
nrf_delay_ms(1); // wait for some time
adc1_config();
nrf_adc_start();
uint32_t adc1 = adc_sample;
nrf_delay_ms(1); // wait for some time
adc2_config();
nrf_adc_start();
uint32_t adc2 = adc_sample;
nrf_delay_ms(1); // wait for some time
printf("%d\r\n", adc); // out ADC result
printf("%d\r\t", adc1); // out ADC result
printf("%d\r\t", adc2); // out ADC result
__SEV();
__WFE();
__WFE();
}
Please try following example of scanning three analog input pins..
while (true)
{
adc_config();
nrf_adc_start();
uint32_t adc = adc_sample;
nrf_delay_ms(1); // wait for some time
adc1_config();
nrf_adc_start();
uint32_t adc1 = adc_sample;
nrf_delay_ms(1); // wait for some time
adc2_config();
nrf_adc_start();
uint32_t adc2 = adc_sample;
nrf_delay_ms(1); // wait for some time
printf("%d\r\n", adc); // out ADC result
printf("%d\r\t", adc1); // out ADC result
printf("%d\r\t", adc2); // out ADC result
__SEV();
__WFE();
__WFE();
}