I am writing a driver for the AD7799. All my get/set methods are working fine until I get to data capture. I am finding difficulting understanding the usage of the CREAD bit in the Comm register. Here are my specific questions/probems (in some places I use the names of higher level set/get functions; consider it pseudo-code):
- After setting the mode register to single mode (setMode(AD7799_MODE_SINGLE)), I have no problem retrieving the data register. If however, before setting to single mode, I clear the CREAD bit (setRegisterValue(AD7799_REG_COMM, AD7799_COMM_READ | AD7799_COMM_ADDR(AD7799_REG_DATA), 1)). When I do so, the capture still works, but the update rate is changed to 0 after setting the CREAD bit.
- I don't know when I am supposed to set/clear the CREAD bit. It appears clearing it changes the update rate to 0. Is this normal? When should this bit be set or cleared when changing between single mode and continuous mode?
- Is the CREAD bit & set automatically when the mode is changed? If not, what is the proper order for setting a new mode and the CREAD bit state.
- Are there other side effects of setting/clearing the CREAD bit such as the one observed in item 1?
Example code for setting up for single conversion and continous conversion along with fetching data would be helpful. Unfortunately, the example driver provided ignores this most important part of interfacing with the chip. I know my questions overlap, but they should give an idea of what I need to know. Any guidance will be appreciated.