I am writing code for the ADS1256 A/D converter. I am a little confused about writes to registers as depicted in Tables 24 and 23 of the data sheet. In particular I am writing code to initialize the status registers (table 23). My issue is with ADCON. Following the instructions of table 24, I bring CS low, write WREG (0101 rrrr) where rrrr is the register identifier to be written to (table 23). ADCON is identified as address 02h in table 23. So I write 0x52 to the command register followed by 0x00 for the data byte.
When I do this, my readings are all 5.0V. This is perplexing because the 0x00 is supposed to be the default value. I added a RREG line and read back the ADCON register, it reads 0x00 as it should.
If I comment out the two lines of code that write to ADCON, the readings are fine. It looks like the PGA bits are being written to.
I am sending a WREG write to the command register Ored with the address of the register to be addressed followed by a byte of configuration data. I then send another WREG write to the command register Ored with the address of the next register to be addressed and so on until all desired configuration registers have been written to. The text above Table 24 says “Additional command and data bytes may be shifted in without delay after the first command byte.” Does this apply to the writing of configuration data to the Table 23 configuration registers? Can they somehow be written without additional WREG commands? If so, perhaps my repeated WREG/DATA writes are somehow being concatenated and who knows what I am writing to who?
Should I raise CS between WREG commands? Help please..