This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

ADXl335 with nRF51822 interfacing

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.

  • I couldn't find anything wrong in the code simply by looking at it.

    I don't have the accelerometer that you are writing code for, so I'm not able to test this.

    If you face any issues when running the code, you should try debugging.
    When debugging you might be able to find what part of you application is causing trouble.

    Best regards.

  • 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();

    }

Related