
How to Use A/D Converter for S6J3110/ S6J3120 Series
Document No. 002-04457 Rev. *B
12
The sample program shows in the following.
Figure 8. Setting Program from Analog Input to Activation Factor Setting
void AD_Init(void)
{
// KEYCode Register
ADER_KEYCDR=0x20000804;
ADER_KEYCDR=0x60000804;
ADER_KEYCDR=0xA0000804;
ADER_KEYCDR=0xE0000804;
ADER_ADER0=0x00004000;//Analog input (AN14)
//All Channel Sampling time common
ADC0_ADMD0_STPCEN=0;
//Sampling time setting
ADC0_ADMD0_ST=3;
//Compare time setting
ADC0_ADMD0_CT=0;
// A/D Activation Trigger Extended Control Resgister
// Analog Channel select
ADC0_ADTECS0_CHSEL=14;
// Activation factor setting (Software trigger)
ADC0_ADTCS0_STS=0;
ADC0_ADTECS0_STS2=0;
// A/D Interrupt request disable
ADC0_ADTCS0_INTE=0;
//Repeat conversion
ADC0_ADTCS0_RPT=1;
// A/D data register protection disable
ADC0_ADTCS0_PRT=0;
}
←Analog input enable setting
←Sampling time setting
←Compare time setting
←
Sampling time setting common to all
channels
←Activation channel selection
←A/D activation factor setting
←A/D Interrupt request disable
←Repeat conversion mode setting
←A/D data register protection disable