Interface Design between Digital Sensor MPXY8020A and MSP430

Publisher:cyzceeLatest update time:2012-04-23 Source: 单片机及嵌入式系统应用 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1 Overview
MPXY8020A is a tire pressure monitoring sensor for automobiles launched by Motorola in 2003. It integrates pressure sensor, temperature sensor and digital interface circuit, and is packaged in 8-pin SSOP. The maximum pressure it can withstand is 1400MPa. MPXY8020A has low power consumption and is particularly suitable for tire pressure and temperature monitoring systems. It can be integrated with Motorola's wireless remote unlocking system to form a low-cost, highly integrated system. In addition, MPXY8020A can also be used in other pressure and temperature monitoring systems.

2 On-chip structure
The functional structure of MPXY8020A is shown in Figure 1. The sampling of the air pressure signal is completed by a capacitive sensor, and the sampling of the temperature signal is completed by a thin film resistor. In addition, the digital interface circuit is integrated on the chip. The entire sensor is manufactured using silicon CMOS technology [1].


The sampling of the pressure signal is completed in two steps: first, the signal on the sampling capacitor is converted into a voltage signal, and then the signal is amplified by a switched capacitor amplifier to improve the accuracy of the sampling. The capacitor amplifier has a temperature compensation circuit, the sampling offset is adjustable, and the sampling signal can be corrected by writing a correction value in the EEPROM register. The size of the pressure signal value is determined by a voltage comparator. Before the pressure conversion, the external microcontroller inputs an 8-bit limit value through the digital interface of MPXY8020A. The on-chip 8-bit DAC (digital-to-analog converter) converts this value into a corresponding analog voltage, and the voltage comparator compares the sampled voltage value with this value, and outputs the comparison result at the OUT pin. When the sampled value is higher than the input value, the OUT pin is high; otherwise, it is low. The sampling of the temperature signal is completed by a thin film resistor with a positive temperature coefficient. As shown in Figure 1, the sensor can be selected to work in the pressure sampling state or the temperature sampling state through a 2-way switch. The sampling process of the temperature signal is similar to that of the pressure signal.

The MPXY8020A chip integrates a low-frequency, low-power 5.4 kHz crystal oscillator and a 14-level frequency divider. Through the 14-level frequency divider, a periodic (usually 3 s) output signal can be obtained at the OUT pin. This signal can also be used as an interrupt source for the microcontroller. In addition, the MPXY8020A chip also integrates a 10-level frequency divider, through which the sensor can reset the external microcontroller once every 52 minutes to prevent the program from running away for a long time. In order to save energy, the MPXY8020A can be controlled to work in different working states through its pins.

3 Pin Function and Working Mode
3.1 Pin Function
The various pins of MPXY8020A are listed in Table 1. The on-chip circuit of MPXY8020A is powered by pin VDD (positive level) and pin VSS (ground). A 0.1 μF capacitor is usually connected between VDD and VSS for power supply filtering. When the sampled value is higher than the limit value of the voltage comparator, the OUT pin outputs 1; otherwise, it outputs 0. The limit value of the voltage comparator is input into the 8-bit DAC register in the MPXY8020A chip by the external microcontroller through the digital interface. When MPXYS020A is working in the idle state, the OUT pin is set high until the 14-level divider overflows, and the pin outputs a negative pulse. The RST pin is usually set to a high level; when the 10-level divider overflows, it is set to a low level. This pin is usually used to reset the external microcontroller. The overflow period of the 10-level divider is 52 min, which has nothing to do with the working state of MPXY8020A. The S0 and S1 pins are used together to select the working mode. When setting the limit value of the voltage comparator, the DATA pin is the serial data input pin. The CLK pin is used to provide the clock for serial reading and writing data. When writing data to MPXY8020A, at the rising edge of the CLK pin signal, the serial data is sent from the DATA pin to the on-chip shift register in sequence, and at the 8th falling edge of the CLK pin signal, the data is sent to the on-chip D/A register. The four pins S0, S1, DATA and CLK all have built-in Schmitt triggers to improve the chip's anti-interference ability, and these four pins all have built-in pull-down resistors, so when they are left floating, they are all low level.

3.2 Working Mode
MPXY8020A has 4 working modes, which is determined by the voltage level of S1 and S0 pins, as shown in Table 2. As long as the VDD pin has sufficient supply voltage, no matter which working mode MPXY8020A is working in, its internal multiplexer, D/A register, low-frequency oscillator and output pulse divider are all in the active state. It should be noted that no matter MPXY8020A is working in the pressure sampling mode or the temperature sampling mode, all EEPROM bits are in the active state. If the VDD pin is set to a low level for energy saving, it is necessary to set the voltage level of all pins to a low level to prevent MPXY8020A from being mistakenly activated. [page]


4 Interface between MPXY8020A and MSP430F1232
4.1 Interface circuit
The interface circuit between MPXY8020A sensor and MSP430F1232 is shown in Figure 2. The serial communication SPI is realized by CLK and DATA pins. The sensor reads 1 bit of DATA data at the rising edge of the CLK pin signal, and 8 consecutive bits are 1 cycle. For microcontrollers that do not have SPI interface, communication can be realized through I/O port software simulation. In this system, the SPI is simulated by the I/O port software of MSP430F1232 to realize the setting of sampling limit value.

4.2 Software Design
4.2.1 Send 1 byte of data to MPXY8020A
When setting the pressure and temperature sampling limit values ​​for MPXY8020A, the limit values ​​are sent to MPXY8020A in bytes. We wrote a function to send 1 byte of data to MPXY8020A to facilitate repeated calls in the system. The code of this function is as follows [2]:

void MPXY8020A_sendByte(uchar MPXY8020A_data){

uchar i;
P3DIR |=mpxy8020_clk+mpxy8020_dat;
//CLK and DAT pins are output
Delay650us();
P30UT&=~mpxy8020_clk; //CLK pin is cleared to 0
for(i=0;i<8;i++){
if((MPXY8020A_data&BIT7)=BIT7)f
//High bit first
P3OUT |=mpxy8020_dat; //OUT pin is set to 1
else{
P3OUT &= ~mpxy8020_dat //OUT pin is cleared to 0
}
P3OUT |=mpxy8020_clk; //CLK pin is set to 1
Dday20us(1);
P30UT&=~mpxy8020_clk; //CLK pin is cleared to 0
Delay20us(1).
MPXY8020A_data=MPXY8020A_data<<1;
//Left shift 1 bit
}

4. 2. 2 Reading temperature and pressure data
The methods for obtaining MPXY8020A sensor pressure and temperature data include successive approximation method and alarm value check method. Successive approximation method can obtain 8-bit precision conversion results, but it takes a long time to convert and consumes more power. The alarm value check method is to pre-set an alarm value for pressure or temperature, and then monitor the level of the OUT pin to determine whether the pressure and temperature values ​​exceed the alarm value. This is a low-power mode, which can be used when the exact pressure/temperature value is not needed. The successive approximation method is used in this system.

The MPXYS020A sensor uses an external MSP430F1232 as the controller of the successive approximation program. The MSP430F1232 sends the guessed limit value serially to the sensor's DAR (digital/analog conversion register) through the SPI interface. The DAR in the device converts this guess value into an analog value, and compares it with the pressure value to be measured, and gives the result of the comparison through the OUT pin. Each comparison requires 64 clock cycles. For example: the first guess value is 0x80. If the OUT pin is detected to be high, it means that the pressure value is greater than 0x80. The MSP430F1232 sends 0xC0 through SPI again and detects the state of the OUT pin. If the OUT pin is low this time, it means that the pressure is between 0x80 and 0xC0. Repeat this process until the approximate value is approached. The whole process is similar to a binary search. First, half of the full-scale value is taken as the first guess value and sent to the human/analog conversion register, and then the output state of the sensor OUT pin is monitored. If the output of the OUT pin is "low", it means that the guess value is too large or close to the sampled value; if the output of the OUT pin remains "high", it means that the guess value is too small. The conversion result register is modified in real time by the MSP430F135 as a variable. If the guess value is too small, the lowest position of the result register is "1"; if the guess value is too large, the lowest position of the result register is "0", and the new guess value is used to continue approximating until the final result is obtained.

The program code for reading the temperature data of MPXY8020A using the successive approximation method is as follows:
void MPXY8020A_temperature_sample(void){
uchar MPXY8020A_temp=0;
P3D1R&=~mpxy8020_ut; //INPUT
MPXY8020A_temp=BIT7; //The initial value of N is 128, that is, bit 7=1
MPXY8020A_standby_state(); //Standby mode
MPXY8020A__sendByte(MPXY8020A_Xemp);
//Send limit value
MPXYS020A_temperature_state(); //Measurement temperature mode
MPXY8020A_output_state(); //Read data modeif
((P31N&mpxy8020_out)==mpxy8020_out){
//Compare whether the OUT pin is 1
MPXYS020A_temp |=BIT6; //Bit 6=1
}
else{
MPXY8020A_temp&=~B1T7; //Bit 7=0
MPXY8020A_temp |=BIT6; //Bit 6=1
: //The omitted part is the repeated approximation procedure from bit 6 to bit 1, and its c
//code is similar to that of bit 7
MPXY8020A_standby_state(); //Standby mode
MPXY8020A_sendByte(MPXY8020A_temp);
//Send limit value
MPXY8020A_temperature_state(); //Measure temperature mode
MPXY8020A_output_state(); //Read data mode
if((P3IN&mpxy8020_out)==mpxy8020_out)
//Compare whether the OUT pin is 1
{}
else{
MPXY8020A_temp&=~BITO;//Bit 0=0
}
temperature=MPXY8020A_temp;
//Use global variables to store sampled values

The function code for reading MPXY8020A pressure data is similar to the function for reading temperature. Due to space limitations, this article will not go into detail. [page]

4.2.3 Conversion of temperature and pressure data
(1) Conversion of temperature data
According to Table 3, the temperature sampled value can be converted to the actual temperature value. The unit of the actual temperature value is ℃. As we all know, the microcontroller has poor processing capabilities for floating-point numbers. Therefore, in order to facilitate the microcontroller to perform calculations and retain higher accuracy, the converted actual temperature value is amplified by 100 times. For example, 1501 corresponds to 15.01℃.

When the sampled temperature value is less than the value corresponding to -40℃, the calculation is performed at a change rate of 0.8℃/bit. When the temperature sampled value is less than the sampled value corresponding to 25℃, the calculation is performed based on the upper limit, because the probability of the upper limit appearing is greater, so the error of the result will be smaller; when the sampled temperature value is greater than the sampled value corresponding to 25℃, the calculation is performed based on the lower limit, because the probability of the lower limit appearing is greater. For example, if the sampled value is between the sampled value corresponding to 25℃ and the sampled value corresponding to 70℃, 25℃ is used as the reference.


(2) Conversion of air pressure data
The air pressure range measured by MPXY8020A is approximately 0 to 600 kPa. The conversion relationship between the measured value and the air pressure is given by the following formula: P = 2.5 × Output ± air pressure error Wherein, Output is the measured value (between 0 and 255), the air pressure error is given by the MPXY8020A data sheet (to be discussed in the next section); P is the converted air pressure value in kPa.

4.2.4 Error processing of air pressure data
The air pressure measured by MPXY8020A has errors, and the errors are different in different temperature ranges, different operating voltages, and different air pressures. The air pressure error of MPXY8020A is given by its data sheet. Table 4 lists its error values ​​in the air pressure range of 250 kPa to 450 kPa.

As can be seen from Table 4, the error of the shaded part is small. When the voltage is lower than 2.5 V or the temperature is too low or too high, the measured temperature difference is relatively large. In order to reduce the measurement error, MPXY8020A should work in the voltage range of 2.5 to 3.3 V.

Since the errors of each sensor are different, the specific air pressure error can be obtained through actual measurement, and then the error value can be added or subtracted in the program, so that the obtained air pressure value is closer to the true value. In addition, better measurement results can be obtained by segmenting and measuring multiple times.


Conclusion
MPXY8020A is a digital air pressure and temperature sensor with small size, simple interface, stable and reliable operation, and low power consumption. It is suitable for air pressure and temperature measurement systems with high volume requirements, especially for wireless automobile tire pressure monitoring systems. This design has been applied to a wireless automobile tire pressure monitoring system, and practice has proved that the use effect is good.

Reference address:Interface Design between Digital Sensor MPXY8020A and MSP430

Previous article:Design of programmable filter based on MSP430 and MAX262
Next article:Design of deep sea environment data acquisition system based on MSP430F169

Recommended ReadingLatest update time:2024-11-16 15:42

MSP430 basic timer basic timer interrupt time calculation
I recently worked with 430 and was troubled by the BT timer. The BT timer is different from the ordinary timer of AVR that I have used before. The previous timer counted to FF and then generated an overflow interrupt. But the BT timer is different. The BT timer generates an interrupt when the corresponding selectio
[Microcontroller]
MSP430 basic timer basic timer interrupt time calculation
ADS7841 driver based on MSP430
My senior sister (PhD) reverse-designed the ADS7841 chip. In order to test its stability and accuracy, she helped write this driver. My senior brother originally wrote it with FPGA, but the data read out was too different, so I used a 430 microcontroller to help me make one! But the debugging of this program was not sm
[Microcontroller]
UART mode of USART0 of MSP430F149
      The UART mode of USART0 of MSP430F149 (SYNC bit in UCTL0 is cleared to 0) is used for serial communication. The following is an initialization process: P3SEL |= 0x30;  P3DIR |= BIT4; ME1 |= UTXE0 + URXE0; // Allow USART0 to receive and send UCTL0 |= CHAR; U0TCTL|=SSEL1; UBR00 = 0x68; // Baud rate 9600
[Microcontroller]
Design of wireless remote control pointer based on MSP430F149
  In traditional teaching, teachers use blackboard and chalk as the main teaching tools. This teaching method is single, the classroom efficiency is low, and it cannot arouse students' interest in learning. The rise of multimedia-assisted teaching mode makes up for the shortcomings of traditional teaching. In actual o
[Microcontroller]
Design of wireless remote control pointer based on MSP430F149
MSP430F5438 Study Notes UART ACLK 9600-8-N-1
1. Before initializing UART0, you need to initialize ACLK, SMCLK and MCLK. In the sample code, XT1 is used, ACLK is 32768, and SMCLK and MCLK are about 8MHZ. 2. The UART clock can refer to ACLK or SMCLK. In this example, ACLK is used. Since the ACLK clock is used, the serial port rate cannot exceed 32768. 9600 is a mo
[Microcontroller]
TI launches MSP430AFE2xx series of metering analog front-end 16-bit MCUs
21ic News Texas Instruments (TI) announced the launch of the MSP430AFE2xx series of metering analog front-end (AFE) ultra-low-power 16-bit microcontrollers for metering and smart grid applications. The low-cost MSP430AFE series is part of TI's leading embedded processing product line, providing the industr
[Industrial Control]
MSP430 clock setting program
void main (void) { unsigned int i; WDTCL = WDTPW+WDTHOLD; //Stop watchdog P5DIR = 0x10; //Set P5.4 output P5SEL = 0x10; //Set P5.4 port as peripheral module for MCLK signal output BCSCTL1 &= ~XT2OFF; //Enable TX2, TX2 is disabled by default when powered on. do { IFG1 &= ~OFIFG; //Clear oscillator failure flag for(i= 0
[Microcontroller]
MSP430 clock setting program
MSP430 and TDC-GP2 pulse laser ranging routine code
Routine code: The following is the routine code + comments of some control functions for gp2 control of MSP430F135 series microcontroller written in C language, which describes some control on gp2 functions. The communication is the microcontroller using ordinary io port to simulate spi communication operation. It is
[Microcontroller]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components
Guess you like

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号