The pin function of TLC2543 and the interface programming of the microcontroller

TLC2543 is a 12-bit analog-to-digital converter with 11 input terminals. It has the advantages of fast conversion, good stability, simple interface with microprocessor and low price, and has good application prospects. Since it has a serial peripheral interface (SPI, Seri-al PeripheralInterface), and the 51 series microcontroller does not have SPI, it is very meaningful to study its interface with the 51 microcontroller.

TLC2543 is a 12-bit analog-to-digital converter with 11 input terminals. It has the advantages of fast conversion, good stability, simple interface with microprocessor and low price, and has good application prospects. Since it has a serial peripheral interface (SPI, Seri-al PeripheralInterface), and the 51 series microcontroller does not have SPI, it is very meaningful to study its interface with the 51 microcontroller.

1. TLC2543 pins and functions

TLC2543 is a 12-bit switched capacitor successive approximation analog-to-digital converter. The functions of the pins are briefly classified as follows.

 The pin function of TLC2543 and the interface programming of the microcontroller

The pin function of TLC2543 and the interface programming of the microcontroller

DATAINPUT: Control word input, used to select conversion and output data format.

DATAOUT: The output terminal of the A/D conversion result.

2. How to use TLC2543

2.1 Format of the control word

The control word is the 8-bit data serially input from the DATAINPUT end, which specifies the analog channel to be converted by the TLC2543, the converted output data length, and the output data format. Among them, the upper 4 bits (D7~D4) determine the channel number. For channel 0 to channel 10, the 4 bits are 0000~1010H respectively. When it is 1011~1101, it is used for self-checking of TLC2543 and testing respectively (VREF++VREF-) /2, the value of VREF-, VREF+, when it is 1110, TLC2543 enters the sleep state. The lower 4 bits determine the output data length and format, among which D3 and D2 determine the output data length, 01 means the output data length is 8 bits, 11 means the output data length is 16 bits, and the others are 12 bits. D1 determines whether the high-order bits are sent out first, or the low-order bits are sent first. A value of 0 means that the high-order bits are sent first. D0 determines whether the output data is unipolar (binary) or bipolar (2’s complement), if it is unipolar, the bit is 0, otherwise it is 1.

2.2 Conversion process

After power-on, the chip select CS must go from high to low to start a working cycle. At this time, EOC is high, the input data register is set to 0, and the content of the output data register is random.

At the beginning, CS chip selection is high, I/O CLOCK and DATA INPUT are prohibited, DATA OUT is high impedance, and EOC is high. Make CS low, I/OCLOCK and DATAINPUT are enabled, and DATAOUT is released from the high-impedance state. 12 clock signals are added in sequence from the I/OCLOCK terminal. With the addition of the clock signal, the control word is sent to the TLC2543 from the DATAINPUT bit by bit at the rising edge of the clock signal (the high bit is sent first), while the previous cycle The converted A/D data, that is, the data in the output data register, is shifted out bit by bit from DATAOUT. After TLC2543 receives the 4th clock signal, the channel number has also been received. At this time, TLC2543 starts to sample the analog quantity of the selected channel and keeps it until the falling edge of the 12th clock. At the falling edge of the 12th clock, EOC becomes low, and the A/D conversion of the sampled analog quantity starts. The conversion time is about 10μs. After the conversion is completed, EOC becomes high, and the converted data is in the output data register. One duty cycle output. After that, a new duty cycle can be performed.

3. Interface and acquisition program between TLC2543 and MCU

The 51 series single chip microcomputer currently used has no SPI interface. In order to interface with the TLC2543, the software function can be used to realize the SPI function. The hardware interface is shown in Figure 2. This example uses delay for acquisition, so the interface of the EOC pin is omitted.

 The pin function of TLC2543 and the interface programming of the microcontroller

The following is the A/D conversion program written by C51. Where port is the analog channel number to be collected, and ad_data is the sampled value. delay() is the delay function, about 20 microseconds.

The pin function of TLC2543 and the interface programming of the microcontroller

The Links:   PM150CVA120 RM500DZ-24 LCD-STOCK

“TLC2543 is a 12-bit analog-to-digital converter with 11 input terminals. It has the advantages of fast conversion, good stability, simple interface with microprocessor and low price, and has good application prospects. Since it has a serial peripheral interface (SPI, Seri-al PeripheralInterface), and the 51 series microcontroller does not have SPI, it is very meaningful to…