Hi Hamid,
Engineering is fun, right? It is stressful trying to get things to work the way we want, but then it is a great feeling of accomplishment when it is finished.
Here is the total process:
- Poll DRDY (better to use a controller interrupt, but we can work with polling) and wait until it goes low
- Write the register to change the MUX to the next input
- Wait 4 tosc periods
- Send RDATA command
- Wait 50 tosc periods for results to be placed in the output register
- Read three bytes of the result data
- Loop back to item 1
What needs to happen as soon as possible at the end of the conversion cycle is the MUX change so that the next conversion is accurate.
I hope that explains the process a little better.
Best regards,
Bob B