It will be easier to assist you if you could post the entire project
File, Export Project Bundle, Minimum(Basic)
SPI can be a bit od an issue, do you have access to a logic ananlyser?
A pretty low cost logic analyzer -
Just search ebay for "Saleae logic" for other suppliers.
I bought 2, work great.
I got the converter to work with the help of a logic analyzer. I forgot I had one (it was packed away from a recent move).
Now I am confused by a few things:
1. The converter spits out a 24 bit signed integer. How should I read this properly in C? I am attempting this with a union and three bytes. I may have it right but I am also confused by equation 5.3.
2. Equation 5-3 is how a voltage count corresponds to a voltage read.
The conversion formula I use is Voltage = (ACD_Count * Ref_Voltage) / (2^Resolution). The variables may be rearragned in the datasheet as I cannot conform if DATA_CHn is the count or the analog voltage. I am using the internal 2.37 volt reference. The in- terminals are grounded, so I am just running the converters single ended. So for this converter, based on that formula, with my setup, what is theproper method to determine the voltage level based on the count?
You can store the 3 bytes received from the SPI in a 32-bit integer. Then you get the sign bit (the 24th), mask out the upper 9 bits and set the sign properly.
To get the voltage, you just need to re-arrange the formula. Since Vref- and Vin- are 0 for you, formula 5-3 reads as
so you re-arrange it as