Sat, February 18, 2006 8:53 PM
I2C ADC Works!
I was able to do some basic (read: synchronous) TWI/I2C communication with the AD7993-0 4-channel ADC we have on the Power Board. In the process, I discovered that it has a really stupid limitation, but we can work around that in software. In any case, I'm pretty stoked about this. Now I have to do a little work on the telemetry app to actually put that data to use (it's damn hard to read hex streaming in a terminal window). I used a synchronous TWI library from Peter Fleury. However, the site appears to be in Switzerland, and stopped responding shortly after I downloaded the code.
The AD7993 has a mode of operation where it will cycle through any combination of the 4 analog input channels, automatically converting. However (stupidly), it only has one conversion result register, so each new channel conversion result overwrites the previous channel's conversion result. This makes the automatic cycling mode much less useful. To use it, you have to synchronize reading the ADC with its notion of which channel is in place (or just get the values randomly, as your reads at a frequency different from the conversion cycle).
The workaround will be to use Mode 2, Command Mode, and explicitly request each channel's conversion. It may be sufficient (although less elegant) to do this synchronously (that is, without relying on TWI interrupts), because the rate at which we want to send telemetry is pretty low.