At present, there are many kinds of a / D converters. From the form of data output, it can be divided into serial output and parallel output. The serial output AD converter is widely used because of its simple hardware interface. In addition, from the perspective of acceptable input signal polarity, a / D converter can be divided into unipolar input and bipolar input. In many data acquisition occasions, we often face analog signals with variable polarity. Of course, the signal to be converted can be potential shifted to convert it into a single polarity, but this increases the complexity of the circuit. The serial output and bipolar input a / D converter max1270 can realize the A / D conversion of bipolar analog signals without adding any hardware circuit. So far, the application of max1270 is very few, and there is no detailed introduction. This paper introduces the characteristics of max1270 in detail, and gives the simplest hardware interface, software programming and application examples.
2. Introduction to max1270 chip
Max1270 is an 8-channel, multi range bipolar input, serial output, successive approximation 12 bit AD converter. There are two packaging forms: 24 pin narrow PDIP and 28 pin SSOP. The pin arrangement of PDIP package is shown in Figure 1. The functions of each useful pin are as follows:
1 － VDD, + 5V power input terminal; 2. 4 － DGND, digital ground; 5 － SCLK, serial clock input terminal; 6 – / CS, chip selection input terminal, low level effective; 7 － DIN, serial data input, i.e. AD conversion control word input terminal; 8-sstrb, serial data output strobe output terminal; 10 － dout, serial data output terminal; 11 – / SHDN, power down mode control input,
Low level active; 12 － agnd, analog ground; 13 ~ 20 － CH0 ~ ch7, analog signal input terminal; 21 － refadj, reference voltage output / external regulation input; 23 － ref, reference voltage buffer output / reference input of ADC.
2.1 control word of max1270
The 8-bit control word of max1270 and its functions are shown in Table 1. The highest bit start is the start bit (high level), marking the beginning of the control word/ When CS is low level, the control word is input through the din terminal from high to low under the action of clock pulse SCLK.
Table 1 format of control word
2.2 clock mode and conversion rate
Pd1pd0 is the power down / clock mode selection bit. When pd1pd0 = 10 and 11, it is the power saving mode. During normal operation, the max1270 has two working modes: external clock and internal clock. When pd1pd0 = 01, it is the external clock mode. The moving in and out of serial data, data acquisition and conversion are controlled by the input pulse of slck terminal. When pd1pd0 = 00, it is the internal clock mode. The data conversion clock is generated by the chip itself, which reduces the burden of the microprocessor, so that the converted data can be read at any convenient time of the microprocessor, which is conducive to improving the working efficiency of the microprocessor. The external clock mode is divided into two modes: 25sclk / S (25 clock cycles are required for each data conversion) and 18 SCLK / s. The reason why the conversion rate of the latter is slightly faster is that / CS always maintains the effective level during all data conversion. The internal clock mode also has different conversion modes such as 20, 16 and 13 SCLK / s. Different clock modes and conversion modes have different conversion rates. In the external clock mode, when the SCLK rate is 2MHz and 18 SCLK / s, the conversion rate of max1270 can reach 110ksps.
2.3 channel selection and input range
Sel2 ~ sel0 are channel selection bits, 000 ~ 111 respectively select input channels CH0 ~ ch7. RNG ~ BiP is the input range selection bit, and max1270 has four input ranges. 0 ~ 5V unipolar input when RNG ~ BiP is set to 00 and 0 ~ + 10V unipolar input when RNG ~ BiP is set to 01; When set to 10, – 5 ~ + 5V bipolar input; When set to 11, – 10 ~ + 10V bipolar input.
2.4 transfer function and output data format
For unipolar input, 1lsb = FS / 4096, and the output data is 12 bit binary code. For bipolar input, 1lsb = FS / 2048, and the output data is 12 bit binary complement.
2.5 reference voltage
Max1270 can use 4.096V reference voltage in the chip or external reference. Figure 2 shows the connection method of relevant pins when using off chip reference and on-chip reference.
Figure 2 pin connection diagram (a) using on-chip reference voltage (b) and (c) using off chip reference voltage
3. Circuit hardware connection and software programming
The connection method between max1270 and AT89S52 is shown in Figure 3. The following is a channel AD conversion subroutine written in assembly language , adconversion, external clock mode, conversion mode 25sclk / s. The control word is in R1. The converted 12 bit data is put into R3 with 4 high bits and R4 with 8 low bits.
adconversion： CLR P1. 0
MOV A，R1 ； Send control word to a
LCALL INPUT ； Control word input subroutine
CLR P1. 1 ； Falling edge of the 8th clock of SCLK
CLR P1. two
SETB P1. one
CLR P1. 1 ； Falling edge of the 9th clock of SCLK
SETB P1. 1 ； Rising edge of the 13th clock of SCLK
ACALL OUTPUT ； Output ad converted data
CLR P1. one
SETB P1. 0
INPUT： NOP ； Max1270 control word input subroutine
MOV R2，#08H ； The control word has 8 bits
LOOP3： CLR P1. one
RLC A ； Control word in a
MOV P1. 2， C
SETB P1. one
DJNZ R2， LOOP3
RET ； SCLK is at the high level of the 8th pulse
OUTPUT： NOP ； 12 bit data output subroutine
MOV R2，#04H ； High 4 bits of output data
MOV R3， A ； High 4 bits send R3
MOV R2，#08H ； Output data low 8 bits
MOV R4， A ； Low 8-bit send R4
OUTPUT1： CLR A
LOOP8： SETB P1. 3 ； Set P1 3 is input
CLR P1. one
NOP ； Wait for sstrb to change from high to low, at least 200ns
MOV C， P1. three
SETB P1. one
DJNZ R2， LOOP8
4. Application examples
Max1270 data acquisition circuit is applied to capillary electrophoresis conductivity detection system. The detection system needs 4 bipolar data acquisition channels, of which 3 are electrophoresis channel current and 1 is conductivity detection current. The channel current is used to monitor the working state of the system, and the detection current is the key information to mark the content of the measured substance. Adjust and convert the collected current signal into – 10 ~ + 10V voltage signal, and then send it to PC for storage and display through MCU serial port after analog-to-digital conversion by max1270. The oscillation frequency of single chip microcomputer is 12Mhz and the baud rate of serial port is 62.5khz. The program block diagram is shown in Figure 4. PC data receiving and display are written in other high-level languages. The operation results of the detection system show that the acquisition rate and conversion accuracy of the data acquisition circuit fully meet the requirements.
This paper introduces the characteristics of max1270, and gives the AD conversion program under external clock and 25sclk / s conversion mode for the first time on the basis of analyzing the working timing. We are willing to communicate with our peers. The practical application shows that max1270 fully meets the requirements of conversion rate and conversion accuracy, and is a reasonable choice for bipolar and multi-channel data acquisition.
The author’s innovations are as follows:
① The simplest interface between max1270 and MCU is realized. Only 4 connecting wires (SCLK, DIN, dout, / CS) are needed to start the output of data without sstrb.
② Ad converted data is sent to PC immediately, and MCU does not need external data memory.
These two points simplify the hardware circuit to a certain extent.
Responsible editor: GT