AnsweredAssumed Answered

AD7124-main.c

Question asked by muthusms on Dec 13, 2016
Latest reply on May 22, 2018 by DragosB
Branched to a new discussion

Hello all,

I am doing a project with AD7124. Initially, I faced problem in Device ID reading, so that I have put all files that is AD7124_regs.h,AD7124.h and AD7124.C in Main.c as visible to compiler. Now I want to segregate this as AD7124_regs.h,AD7124.h and AD7124.C. For that, I used following driver usage that recommend by Analog in My main.c

 

/* Create a new driver instance */struct ad7124_device my_ad7124;struct ad7124_device *ad7124_handler = &my_ad7124; /* Other variables */long timeout = 1000;long ret;long sample;. . ./* Initialize the driver instance and let's use the ad7124_regs array defined in ad7124_regs.h */#define AD7124_INITAD7124_Setup(ad7124_handler, AD7124_SLAVE_ID, (ad7124_st_reg *)&ad7124_regs); /* Read data from the ADC */ret = AD7124_WaitForConvReady(ad7124_handler, timeout);if (ret < 0)    /* Something went wrong, check the value of ret! */  ret = AD7124_ReadData(ad7124_handler, &sample);if (ret < 0)        /* Something went wrong, check the value of ret! */

After I made My main.c same as above, I am getting ad7124_regs undeclared error and also default registers values are  not getting initialized. So, to solve this, what are all I have to include in My main.c. Please suggest a solution.

 

 

Thanks,

Muthu

Outcomes