| With the development of electronic technology, more and more electronic equipments are fixed into vehicles to make driving more comfortable. But the wiring harness which joins two different electronic equipments together also increases amazingly at the same time. It leads to many hidden troubles, such as harder to maintain and less reliability. Secondly, the communication mode of those equipments is point to point mode, which means the messages between two points can't be shared by other points and they have to be sent again whenever another point needs them. Fortunately, we can solve all of these problems mentioned above easily by using CAN (Controller Area Network) technology into car body network. Therefore, on the basis of studying and understanding the CAN bus protocol and its communication principle the following work is done in this paper.1. General designCar door control system is usually composed of door locks, windows, rear-view mirrors. In this paper, the door lock module, the window module, the rear-view mirror module and the central control module are designed and made respectively using modular design thought. According to the scheme designed for the door control system, using bus topology, every module is installed into the car body model and connected by the twisted-pair to make up of a whole door control system. In this system, every object is controled by a separate CAN node, whose circuit structure shows as follows: MCU(AT89C51)+CAN controller(SJA1000)+CAN transceiver(PCA82C250).2. Hardware design of the central control moduleThe design task in this module is to collect control signal and control the door nodes. Its hardware circuit includes the remote receiver circuit and the switch collection circuit. The remote receiver circuit will be introduced in the door lock module. The structure of the switch collection circuit is: Multiple switch detection interface (MC33993) + MCU (AT89C51) + CAN controller (SJA1000) + CAN transceiver (PCA82C250).3. Hardware design of the door lock moduleThe design task in this module is to achieve the central control and remote control function. On the basis of the remote control some functions such as searching car, automatic locking and so on are added also. The hardware circuit includes the remote module and the driver module. In addition, the buzzer circuit is also designed to display the result of the control command.The remote module is composed of the transmitting circuit and receiving circuit. The structure of the transmitting circuit is: Encoder(PT2262)+Transmitter (F05V). The structure of the receiving circuit is: Decoder(PT2272)+Receiver (J04V).The driver chip for the door lock is L298. L298 is connected to the CAN node circuit mentioned above to make up of the lock driver node. Its circuit structure is: Driver(L298)+MCU(AT89C51)+CAN controller (SJA1000) +CAN transceiver (PCA82C250).4. Hardware design of the window moduleThe design task in this module is to achieve power window with anti-squeeze function.In order to achieve the anti-squeeze function,the controller must make two judgments. First, determine whether the glass has encountered the obstacle. Second, judge whether the glass has reached the top or bottom.The current of the motor is collected to determine whether the glass has encountered the obstacle. Because the motor used in the glass lifter is a DC motor, the resistance that the glass encounters can be reflected by the current indirectly. For the specific circuit,a small resistor is fixed between the GND pin of the driver chip and the ground to collect the current of the motor. And the voltage collected by the resistor is amplified by an amplifier and converted into a digital signal by an A/D converter.The Hall sensor is used to collect the location of the glass. Its principle is: first, fix four magnets around the driving shaft and a Hall sensor near the driving shaft. When the driving shaft rotates, the Hall sensor will produce a series of pulses. Then by counting the pulses and computing the rotations of the motor, the location of the glass will be acquired.The chips used in this module are as follows: Driver(VNH3SP30), Amplifier (LM324), A/D converter(ADC0804).The structure of the main circuit for this node is: Driver(VNH3SP30) + MCU(AT89C51) + CAN controller (SJA1000) + CAN transceiver (PCA82C250).5. Hardware design of the rear-view mirror moduleThe design task in this module is to achieve power rear-view mirror with memory function.Its principle is: first, use the potentiometer to collect the location of the rear-view mirror. Namely, associate the slip part of the potentiometer with the spiral pivot of the rear-view mirror. When the rear-view mirror rotates, the spiral pivot will move front and back, and the location of the rear-view mirror will be transformed into the voltage signal outputted by the slip part of the potentiometer. Then translate the voltage signal into digital signal by an A/D converter. Because there are two voltage signals needed to convert, the analog multiplexer is used to select different channel. Finally, when it is time to memorize the location of rear-view mirror, the microcontroller will store the information into the EEPROM. In the subsequent operations, the microcontroller can use the information and make the rear-view mirror move to the stored position.The chips used in this module are as follows: Driver(L298), A/D converter (ADC0804), Analog multiplexer(CD4051), EEPROM(AT24C02). The structure of the main circuit for this node is: Driver(L298) + MCU(AT89C51)+CAN controller (SJA1000) + CAN transceiver(PCA82C250).6. Software design of the systemThe software design of this system includes the central control program module and the door node program modules. The main function of the central control program module is to collect control signals and deal with them. The main function of the door node program modules is to complete all the control commands.7. Communication ProtocolThe communication characteristics of the door control system are: basically, there are all logic state variables. The logic variables can be expressed by a few of bits, and in one byte a number of state changes can be expressed. In addition, the real-time control and data sharing is highly demanded in the door control system. It is better to send all the effective data in a frame message as far as possible.According to the communication characteristics that are mentioned above and the system control task, the communication protocol for locks, rear-view mirrors and windows is defined respectively.8. ConclusionThis designment testifies the correctness and feasibility of the scheme used in the system by experiment. And the design task based on the CAN bus for door locks, windows and rear-view mirrors is achieved.The error disposal part for CAN bus could be added in the future work, and we will put emphasis upon the research of connecting the door control system to the vehicle control network. |