3424 views|0 replies

1148

Posts

0

Resources
The OP
 

Based on RS [Copy link]

Abstract : The automobile four-wheel alignment instrument is a distributed computer measurement and control system. This paper introduces the MSComm communication control using the VB 6.0 ActiveX control via the RS-485 bus to achieve the communication function between a single PC and multiple single-chip microcomputers in the automobile four-wheel alignment instrument.
Keywords : RS-485; serial communication; four-wheel alignment; VB; detection

1. Introduction
During normal driving, the car should have the ability to steer easily and automatically maintain straight driving. At the same time, the steering wheel should be as pure rolling as possible to reduce tire wear and reduce fuel consumption. The realization of the above requirements is usually guaranteed by the four parameters of steering wheel alignment (kingpin caster angle, kingpin inclination angle, wheel camber angle and toe). Since most cars currently use front wheel steering, steering wheel alignment is usually called front wheel alignment. Modern cars not only have alignment parameters for the front wheels, but also have three alignment parameters for toe, camber and thrust angle for the rear wheels. The purpose is to make the movement trajectories of the front and rear wheels on the road overlap as much as possible, which not only ensures the stability and safety of the car's high-speed driving, but also helps to reduce the wear of tires and suspension parts.
After the car has been running for a certain period of time or some parts have been replaced, the four-wheel alignment parameters will change. Therefore, it is necessary to detect the vehicle alignment parameters in a timely or regular manner. If they exceed the standard values given by the manufacturer, they should be adjusted to restore the vehicle's driving stability, safety, fuel economy, and reduce the wear of tires and related parts.
  There are two methods for wheel alignment detection: dynamic detection and static detection. Dynamic detection uses a side-slip test bench to detect the matching of the front wheel toe value and wheel camber angle of the car during the movement of the car. It is characterized by simple operation and fast speed, which is very suitable for rapid detection, but it cannot measure the single wheel alignment value. This detection method has been widely used in automobile security inspection lines or comprehensive inspection lines. Static detection uses a four-wheel aligner, which can measure various positioning parameter values of the wheel when the car is static. It is currently the most widely used wheel alignment detection method.
At present, there are three main types of four-wheel aligners in China, namely, wire-pull type, wireless measurement wired transmission type and full wireless type. The wire-pull type four-wheel aligner has been basically eliminated because of its inconvenient operation and many factors affecting the measurement accuracy. The full wireless type is characterized by the use of optical non-contact measurement, wireless information transmission between the host and the sensor, high measurement accuracy and easy use. The main difference between the wired transmission type of wireless measurement and the full wireless type is that the signal cable is used to transmit the detection data. Although it is not as convenient as the full wireless type in use, it has the advantages of fast and reliable information transmission and detection, no battery replacement and battery charging, and low cost of use. It is also widely used at present.
Modern four-wheel alignment instruments are all controlled by microcomputers. The upper computer (PC) responsible for control and management tasks is connected to several lower computers (single-chip microcomputers) responsible for data acquisition tasks through the field bus. The two form a distributed computer control and measurement system. The design and selection of communication system hardware and software is one of the key technologies in the design of four-wheel alignment instruments, which has a great impact on the overall performance of the system. The RS-232C serial communication interface is a standard configuration of PCs. The interface is simple and programming is convenient, but it can only be used for connection between two microcomputers and cannot meet the needs of multi-point connection. We use the RS-485 communication interface, which is currently popular in industrial measurement and control systems, and conveniently realize the centralized control and data acquisition of multiple single-chip microcomputers through the communication control MSComm of VB 6.0, which better solves the communication problem in the four-wheel alignment instrument.

2. System structure of four-wheel alignment instrument
The system structure of four-wheel alignment instrument is shown in Figure 1. The whole system consists of a host computer and four slave computers. The host computer is a PC microcomputer, which is responsible for controlling the measurement process, reading the detection data of the slave computer, data processing and calculation, as well as result display, storage, printing and management. The four slave computers are all composed of single-chip microcomputer systems. The single-chip microcomputer adopts AT89C51, which is used to realize the measurement control and data upload function of each wheel alignment angle. The single-chip microcomputer is respectively located in the housing of the left front, left rear, right front and right rear machine heads. The machine heads are connected to the fixtures. When measuring, the heads are fixed to the rims of the four wheels of the car through the fixtures. The entire system uses a total of fourteen sensors, among which the measurement of angles in the vertical plane (including caster angle, kingpin inclination angle and wheel camber angle) is realized by six precision inclination sensors (two on the front nose and one on the rear nose), and eight PSD (Position Sensitive Detector) optical sensors (two groups on the front and rear noses) are used to measure the various wheel positioning angles in the horizontal plane.


Figure 1 System structure of four-wheel alignment instrument

3. Implementation of system communication hardware
The standard RS-232 interface can only be used to connect two computers. The two RS-232 interfaces COM1 and COM2 of a PC can only connect two microcontrollers at most. If a serial communication card is added to connect four serial ports to four slave computers, the price will be high and the structure will be complicated. For this reason, the RS-485 bus, which is currently popular in distributed industrial measurement and control systems, is adopted. Compared with RS-232, the RS-485 interface has the following characteristics:
(1) The interface level is lower than that of the RS-232 C interface, which is not easy to damage the chip of the interface circuit. The level is compatible with the TTL level and can be easily connected to the TTL circuit. (2
) The data transmission rate is high, with a baud rate of up to 10Mbps.
(3) It uses a balanced driver and a differential receiver, which has strong common mode interference resistance, that is, good noise interference resistance.
(4) The transmission distance is long, with a maximum transmission distance of 4000 feet.
(5) Up to 256 transceivers can be connected to the bus, that is, it has multi-station capability. Users can easily establish a communication network using a single RS-485 interface.
In this system, the PC is connected to the four heads through the RS-232 interface and the RS-232/RS-485 conversion module. The microcontroller of each head is also hung on the bus through the RS-485 interface module, and each is assigned a communication address code for identification. The RS-485 transceiver used by the microcontroller is Maxim's MAX3082, which is a high-speed transceiver chip with failure protection and slew rate limiting functions. In this way, the upper PC can communicate with the microcontroller of each head through the RS-485 bus to realize data collection and process control of positioning parameters.

4. Implementation of system communication function software
4.1 System communication mode

The communication between the PC and each machine head adopts half-duplex mode, the communication baud rate is 9600bps, and the communication format is: 1 start bit, 8 data bits, no parity check, 1 stop bit, and each machine head is assigned a unique local address. The host starts communication and data acquisition by sending a command frame. After receiving the command frame, the slave determines whether the call address is the same as the local address. If the same, it executes the corresponding data acquisition according to the command word and transmits the detection results to the host through the data frame; if different, it determines whether to emit infrared measurement light based on the address and command word. The format of the command frame is as follows:


The first item is the frame header (STX), which marks the beginning of a frame; the second item is the slave address code (ADDR); the third item is the command word, which indicates the data content sent back by the machine head or the content of this detection; the fourth item is the XOR checksum, which is the XOR checksum of the previous data and is used for communication error correction.
The format of the data frame is as follows:

The data frame and the command frame have the same meaning except for the third item. The third part of the data frame is the positioning parameter detection data sent by the slave to the host according to the command frame sent by the host.

4.2 Implementation of MSComm control and serial communication control in VB6.0
VB6.0 provides an ActiveX control - Microsoft Communication Control, Version 6.0, called MSComm control, which can be used to conveniently manage the communication of the computer serial port. The MSComm control has many properties related to the serial port, which will not be introduced in detail here.
When the serial port receives information, the MSComm control provides two processing methods, one is the query method, and the other is the event response method, that is, the serial port response event is set using the SetCommEvent() function. When the response event occurs, the system will activate the OnComm() event. By adding user processing code to the OnComm() event, serial port event processing similar to interruption can be implemented. This system adopts the event response method.
The task of the PC communication software is to control the detection process and read and process the real-time data of the wheel alignment parameters. The receiving and sending data are in text format. When the host calls the slave without a response, an alarm prompt function is provided. The following is a partial source code for the control initialization and sending commands.
(1) Initialization of the control:
MSComm1.CommPort=2 'Select COM2 port for
communicationMSComm1.Setting=“9600, N, 8, 1” 'Set communication parametersMSComm1.Inputlen
=0 'Read all buffer contentsMSComm1.InBufferSize
=50 'Set the receiving buffer sizeMSComm1.OutBufferSize
=20 'Set the sending buffer sizeMSComm1.InputMode
=comInputModeText 'Receive data in text formMSComm1.PortOpen
=True 'Open the communication portMSComm1.InBufferCount
=0 'Clear the receiving bufferMSComm1.OutbufferCount
=0 'Clear the sending buffer

(2) Sending of commands (taking front wheel toe as an example):
Dim Command, node, c, f As string
Dim i, fcs As integer
node=”01” 'Node number, indicating the right front noseCommand
=”FT” 'Front wheel toe detectionc
=”@”+node+Command
fcs=0
For i=1 To Len(c)
fcs=fcs Xor Asc(Mid$(c,i,1)) ' Frame check code FCS
Next i
f=Hex$(fcs)
if Len(f)=1 Then f="0"+f
MSComm1.Output=c+f

5. Conclusion
The communication between the host PC and multiple slaves in the automobile four-wheel alignment instrument is realized through the RS-485 bus and using the ActiveX control under VB6.0. Practice has proved that the communication function of this system is reliable and the design is reasonable.

This post is from Automotive Electronics

Find a datasheet?

EEWorld Datasheet Technical Support

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list