
How to Use A/D Converter for S6J3110/ S6J3120 Series
Document No. 002-04457 Rev. *B
14
The sample program shows in the following.
Figure 10. A/D Range Comparison Function Setting Program
3.5.1.5 A/D Converter Start Setting
The A/D Converter start sets software activation channel selection in the A/D Software Activation Channel Selection
Register (ADTSE). And, the Interrupt request enables bit sets in the A/D Activation Trigger Control Status Register
(ADTCS). Then, the A/D converter function activates by the START bit in the A/D Software Activation Register
(ADTSS).
The A/D converter start setting flow shows in the following.
void AD_RangeCompare(void)
{
// A/D Range comparison execution enable
ADC0_ADRCCS0_RCOE=1;
// A/D Upper threshold setting
ADC0_ADRCUT0_C=0x800;
// A/D Lower threshold setting
ADC0_ADRCLT0_C=0x555;
// A/D Upper and Lower threshold (ADRCUT0/ADRCLT0)
ADC0_ADRCCS0_RCOTS=0;
// A/D Inside check setting
ADC0_ADRCCS0_RCOIRS=1;
// A/D Range comparison interrupt request enable
ADC0_ADRCCS0_RCOIE=1;
// A/D Continue detection count(1)
ADC0_ADRCCS0_RCOCD=1;
}
←Range Comparison Execution
Enable setting
←Upper Threshold Setting
←
Lower Threshold Setting
←
Upper and Lower
Threshold Selection
←
Inside/outside-Range Check Selection
←Range Comparison Interrupt
Request Enable
←Continuous Detection Count Specification setting