An ADC, short for Analog-to-Digital Converter, refers to a circuit or a device used for converting analog signals
into digital circuit signals. Through an ADC, the time-and-amplitude constant analog variables such as
temperature and sound can be converted into time-and-amplitude discrete digital signals. Meanwhile it is
convenient for computer to memorize and process.
For AM4KD~AM4KG series, al ICs are integrated with 8-bit ADC circuits and one 1.25V of voltage regulator
circuit for 4 channels of A/D conversion and absolute value measurement of reference voltage.
AM4K ADC Description
When using ADC for measurement, a reference signal must be provided firstly. And the ADC value will be
measured after comparison between signal under test and reference signal.
For AM4KD~AM4KG series, all ICs are provided with Vref pins for connecting to the reference voltage that is
generally connected with working voltage of ICs.
AM4K includes 4 channels of input pins of A/D signals under test as below: PRE0, PRE1, PRE2 and PRE3.
In addition, a voltage regulator circuit is provided with 1.25V internal fixed voltage in AM4KD~AM4KG for
measuring reference voltage of Vref. Therefore, for the application in need, it is very convenient to measure
battery capacity.
ADC Function Description in EzCode4K
ReadADC (channel, R_H, R_L)
Channel: (PRE.3, PRE.2, PRE.1, PRE.0, Vconst)
R_H, R_L: valid registers
The function is invalidly enabled before selecting the desired ADC Channel necessarily on Option page
beforehand. The execution of the function will read back AD value of specified Channel into R_H or R_L.
Wherein R_H is a high 4bit while R_L is a low 4bit. The execution time is within 0.35ms.
The following is the formula of rate of R_H and R_L:
R_H :R_L = (ADC_Channel / ADC_VRef)*0xFF
Wherein ADC_Channel can be any one among PRE.3, PRE.2, PRE.1, PRE.0, and Vconst.
Ex.
ReadADC (PRE.3, R43, R10): Obtain rate of signal under test and reference signal through channel PRE.3.
ReadADC(Vconst, R43, R10): Obtain rate of fixed voltage and reference voltage.
1 Rev 1.0x 2010/01/11
1. Build up a project file, add some necessary information and set IO Pin and In State.
2. Confirm the number of A/D channels to be used and whether to apply 1.25V of internal voltage. On
Option page in EzCode4K, it is easy to find ADC Channel row and then you can tick the A/D input port
to be used. See figure 1 as below:
Figure 1
Wherein if Pre0-3 are all ticked, 4 channels of A/D inputs are selected; Vconst ticked means that 1.25V
of internal fixed voltage wil be used.
3. Set In State and Out State. See figure 2 and figure 3 as below.
Figure 2
Figure 3
2 Rev 1.0x 2010/01/11
In the abovementioned example program, ReadPE0~ReadPE3 refer to obtaining AD values of four AD
channels. ReadVconst means the rate between Vconst and supply voltage, and the rate will be
played in voice. Prf.0 is used for switching the circuit. When Prf.0=0, the circuits are connected
whereas when Prf.0=1, the circuits are shut down. In order to avoid deadweight loss, the circuits will
be connected at the moment of reading AD values, or the circuits will be disconnected in normal times.
(Refer to the example circuit diagram on the next page.)