23.4 Operation
23.4.1 Single Reading
The following steps must be taken to operate the multiplexed A/D converter in the single-read mode:
1. Select the clock source and enable the multiplexed A/D converter by writing to ADCCR.
2. Select the multiplexer channel and desired reference in ADCCSR, but do not start the conversion
yet. This provides greater settle time for the multiplexer switchover.
3. Enable a conversion by setting bit 0 of ADCCSR.
4. Wait for the conversion to complete by monitoring bits 0-1 of ADCLR. When complete, read the
rest of the A/D converter result in ADCMR.
23.4.2 Continuous Read
The following steps must be taken to operate the multiplexed A/D converter in the continuous-read mode:
1. Select the clock source and enable the multiplexed A/D converter by writing to ADCCR.
2. Enable the continuous read mode by setting bit 7 of ADCCSR.
3. To get a particular channel reading, check bits 0–1 of the ADCxLR that corresponds to that channel.
If the conversion is complete, read ADCxMR as well to get the full reading.
23.4.3 Handling Interrupts
The following steps explain how an interrupt is used.
1. Write the vector to the interrupt service routine to the internal interrupt table
2. Configure ADCR to select the interrupt priority (note that interrupts will be enabled once this value
is set; this step should be done last).
The following actions occur within the interrupt service routine.
•
Read ADCLR to get the 4 least-significant bits of the result and clear the interrupt flag.
•
Read ADCMR to get the 8 most-significant bits of the result.
Rabbit 6000 User's Manual
digi.com
243
Need help?
Do you have a question about the 6000 and is the answer not in the manual?