Other Parts Discussed in Thread: MSP430AFE253, MSP430I2040
I have an MSP430i2041 board using the first 3 A/D channels, with
the 4th channel's inputs shorted together and grounded.
I need a simultaneous sample from all three channels 5000 times
per second, so I am constrained to use Oversampling Ratio 32.
This results in 8000 sample-set results per second. This is
fine with me, because I actually WANT to sample faster than I use
without averaging. (Yes, this is unusual, but I want to do this
to be less susceptible to periodic noise.)
What I DON'T want to do is suffer an interrupt for each A/D sample
set. I want the ONLY interrupt in my system to be the periodic
timer that tells me to return a sample every 1/5000th of a second.
How to do this? One surefire way would be to start a single A/D
conversion (on the group of three channels) every 1/5000th of a
second and then just poll for the IFG bit on the Master Channel
and then read and report the results (via UART). This would
introduce a latency of 125 microseconds (1/8000th of a second)
waiting for the A/D conversion but I could live with that.
A better way might be to run continuous conversions on the A/D
converter, and just "grab" a sample set every 1/5000th of a
second. The problem with this is that I cannot tell from the
documentation how to GUARANTEE that I get a simultaneous set
of three samples every time (short of suffering an interrupt
and reading/storing the samples 8000 times per second, and
locking out interrupts 5000 times per second while I read the
stored conversion from memory). I see a pathological scenario
where the A/D converter updates one of the SD24MEMx result
registers WHILE I am trying to read the last SET of results.
Since Plan A above really is surefire, that's what I'm going to
implement and just suffer the 125 uS latency. However, I thought
I'd run this by y'all to gather some opinions.
-eNick