Home >
Microcontroller >Microcontroller Production > Interface and program design between digital potentiometer X9241 and PIC microcontroller
Interface and program design between digital potentiometer X9241 and PIC microcontroller
Source: InternetPublisher:super_star Updated: 2013/02/19
Author: Lv Zhen, Liu Baoliang, Xu Chongli, Liaoning University of Engineering and Technology 1. Overview of X9241 X9241 is a digital potentiometer produced by XICOR Company that integrates four E2POT digital potentiometers on a single-chip CMOS integrated circuit. It contains 4 resistor arrays, each array contains 63 resistor cells, with tap points accessed by sliding cells between each cell and between the 2 endpoints. The position of the sliding unit in the array is controlled by the user via a 2-wire serial bus interface. Each resistor array is associated with a wiper count register (WCR) and four 8-bit data registers. These four data registers can be directly written and read by users. The content of WCR controls the position of the sliding end in the resistor array, and its functional block diagram is shown in Figure 1.
2. Working principle of X9241 X9241 supports the directional protocol of the bidirectional bus and is a slave device. Its upper 4-bit address is 0101 (device type identifier), and the lower 4-bit address is determined by the state of the A3 and A0 input terminals. The data on the SDA line can only change state during SCL is low. When SCL is high, The change of SDA state is used to indicate the start and stop conditions (start condition: when SCL is high, SDA jumps from high to low; stop condition: when SCL is high, SDA jumps from low to high). All commands are guided by a start condition, followed by the output of the X9241 slave device address. Including information about instructions and register pointers, the high 4 bits are instructions, and the low 4 bits are used to point out 1 of the 4 potentiometers and 1 of the 4 auxiliary registers. The format is: I3 I2 I1 I0 P1 P0 R1 R0 The command potentiometer select register selects 4 of the 9 instructions that end with sending the instruction byte. These two-byte instructions exchange data between the WCR and 1 of the data registers; 4 of the instructions are three-byte instructions. The instructions transfer data between the host and the .
X9241 includes 4 WCRs, 1 for each E2POT potentiometer. The WCR can be thought of as a 6-bit parallel and serially loaded counter with output decoding, which is used to select a 64-to-1 switch of the resistor array. WCR is a volatile memory, and its contents are lost if power is turned off. This memory is automatically loaded with the value of R0 when power is turned on, but it must be noted that this value may be different from the value in each potentiometer in WCR when power is turned off. There are 4 non-volatile data registers. These registers can be read or written directly by the host, and data can be transferred between any of the 4 data registers and the WCR. Any operation that changes these registers is non-volatile. The operation will take 10 ms (maximum). The X9241's resistor arrays can be connected in series. In a three-byte instruction, the data byte includes the 6 bits (LSB) used to define the wiper position plus the high end. Two bits: CM (series mode, when it is 0, the potentiometer works normally; when it is 1, the potentiometer is connected in series with its adjacent high-numbered potentiometer) and DW (sliding end is prohibited, when it is 0, the sliding end Enable; when it is 1, the sliding end is disabled, and the sliding end is electrically isolated and floating). When working in series mode, the three output terminals of the array, VH, VL and the sliding end, are connected in series. It must be electrically connected to the outside. Except for one sliding end, the other sliding ends must be disabled. The resistor array after series connection is shown in Figure 3.
Figure 4 shows
the interface and program list of X9241 and PIC16CXX microcontroller
. Interface Circuit. Correspondingly, a program list of all X9241 command operations is given. In this program, MAIN is a main program. In MAIN, write 43 to the WCR of E2POT#2 (that is, the sliding end position is #43). The wiper tap position is then reduced by 15 pulse positions, which reduces the selected WCR to a value of 28 (i.e. wiper position #28). Other commands issued subsequently are the same process and will not be repeated in the list. 4. Program list: Program list (the microcontroller is PIC16C72, the crystal oscillator is 4M): STATUS EQU 03H; PIC16C72 internal special C EQU 0; function register and flag bit PORTC EQU 07H TRISC EQU 87H COMMAND EQU 24H ID EQU 25H; 0 0 0 0 P1 P0 R1 R0 ADDR_BYTE EQU 26H; 0 1 0 1 A3 A2 A1 A0 DATA_BYTE EQU 27H ;CM DW D5 D4 D3 D2 D1 D0 PULSES EQU 28H ;DIR
Latest Microcontroller Circuits
- Interface circuit composed of 8255A and single chip microcomputer
- Interface circuit between CAN bus controller and single chip microcomputer
- Interface circuit between MMA1220D and microcontroller
- How to control fans using LM35 and ATTiny13
- Circuit design analysis of smart car image recognition system
- Serial debugger circuit implemented with several discrete components
- Encodable digital lock circuit diagram
- 3 IO scan 16 buttons
- Production of infrared receiving controller based on AT89C2051
- Computer remote control circuit