Abstract: Monolithic integrated circuit’s many machine serial communication application is very widespread, but when the serial port is taken must carry on many machine correspondences must adopt other measures. This article introduced one kind of use and the mouth carry on many machine correspondences the methods, in reality obtained the confirmation.
Key word: MCU, and mouth correspondence
1. Question statement
In some system has used three group serial interface sensors (GPS, pressure and wind direction) and three groups simulates the electric current (4~20mA) the connection sensor (humidity, temperature and water level). After now needing must compiles these data, through the serial port upload for PC machine, and requests each group signal data to be able the real-time independent receive.
2. system design
After the analysis, we use 2051 monolithic integrated circuits to receive each group serial port sensor’s data together separately, simultaneously uses multi-channel high accuracy ADC for to transform the voltage together the temperature equisignal sampling, system structure drawing as shown in Figure 1. Main see also Figure from machine between concrete base pin connection 2. 
Figure 1 system structure diagram
In the system 51 monolithic integrated circuits are controlling overall system’s movement as the main engine and initiate each time correspond, each 2051 take real-time completes the correspondence from the sensor gain data and under the main engine control. Main engine and respectively from machine between through and mouth connection correspondence. Main is as follows from machine the work flow:
· On after main engine electricity initialization, selects a group through the P0 mouth transmission from machine the address from machine and the wait acknowledge.
· Respectively after machine on electricity initialization receives the sensor serial data, then through P1 mouth receive host address, when the address tallies, adjusts 245 directions and by 245 to the main engine transmission sensor data, this process is responsible by the handshake line to control.
· After machine transmission all data changes once more 245 directions the receive, makes a fresh start address which receives the sensor data and the main engine transmits.
· Main engine according to similar way receive all each group 2051 data.
· After the serial port data receive finished, the main engine controlled AD to transform and to gain three group signal data.
· After the main engine will possess the data acquisition convention frames the type, through 232 transmissions for PC machine.
Main from machine work flow chart as shown in Figure 3: 
Figure 2 main from machine between base pin connection
Figure 3 main from machine work flow chart
The main program code distinction is as follows, the main engine is:
……
sbit adc_busy=P3^2;
sbit adc_hben=P3^3;
sbit hand1=P2^0; //GPS
sbit hand2=P2^1; //PRESSURE
sbit hand3=P2^2; //WIND
sbit hand4=P2^3; //BAK1
uchar idata gps[96];
uchar idata pressure[9];
uchar idata wind[26];
uchar idata tem[6];
uchar idata hum[6];
uchar idata water_tem[7];
……
P1=0×01;
for (i=0; i<96; i ) {
while (hand1! =0);
gps[i]=P1;
while(hand1==0);
}
sendbyte2pc (’# ‘);
sendbyte2pc (’# ‘);
sendbyte2pc (’1 ‘);
sendbyte2pc (”);
sendbyte2pc (”);
send2pc(gps,96);
……
From machine is:
……
sbit dir=P3^2;
sbit en=P3^3;
sbit hand=P3^4;
……
loop:
RI=0; i=0;
while (! RI); //wait for receiving ready
if (SBUF! =0×40) //data head
goto loop;
data_str[i]=0×40; i ;
RI=0;
while (! RI); //wait for receiving ready
if (SBUF! =0×40) //data head
goto loop;
data_str[i]=0×40; i ;
do {
RI=0;
while (! RI);
data_str[i]=SBUF;
i ;
}
while (i! =96);
dir=0; en=0; //enable data receiving P1=0xff;
for (i=0; i<100; i ) {
if(P1==0×01)
goto send;
}
en=1;
goto loop;
send:
for (i=0; i<96; i ) {
dir=1;
P1=data_str[i];
hand=0;
for (j=0; j<5; j ) {;}
hand=1;
}
en=1; dir=0;
goto loop;
……
3. conclusion
In this article proposed the parallel means of communication have the circuit structure simply clear, the procedure easy to realize and so on characteristics, in reality the certificate was already feasible. May borrow software receive data and so on serial port assistant in the debugging process to confirm the correspondence the reliability.
Reference
[1] Wang Jianxiao, Wang Jianguo .51 series monolithic integrated circuits and C51 programming [M]. Beijing: Scientific Publishing house, 2002.
[2] Xu Weixiang, Liu Xu is sensitive. The monolithic integrated circuit microcomputer principle and applies the [M]. Dalian: Dalian University of Science and Technology Publishing house, 2002.7.