With the development of automotive electronics technology, more and more electronic products are loaded into automobiles, which greatly improves the power and comfort of the car, and also increases the difficulty and cost of wiring in the car. As a serial data communication bus, CAN (Controller Area Network) has become an international standard (ISO11898) [1] because of its good reliability, real-time and flexibility. It has been widely used in automotive electronic systems.
At present, in the CAN system design, the most used ones are independent CAN controllers such as PCA82C200 and SJA1000 of Philips, and 82526 and 82527 of Intel Corporation. However, the design of such a chip is not conducive to system integration. This paper introduces the hardware circuit structure and software design flow of CAN bus power window control system with Microchip's integrated CAN module PIC18F258 microcontroller as the core. Since the PIC 18F258 MCU only needs TXD and RXD data lines for data operation of the CAN transceiver PCA82C250, this greatly simplifies the design of the hardware circuit and improves the reliability of the system.
1 The structure of the communication window of the electric window control system <br> The communication window of the electric window control system has four CAN node electronic controllers: the left front door main controller, the right front door sub controller, the left rear door sub controller, and the right Rear door controller. The CAN bus communication technology can realize the communication between the four door controllers, as shown in Figure 1.

This article refers to the address: http://

In addition to controlling the driver's window glass lifting, the main controller can also control the lifting of the remaining passenger window glass through the CAN bus, and the sub-controller can also control the lifting and lowering of the window glass at each position. The main controller consists of three main parts: Microchip's PIC 18F258 microcontroller with integrated CAN module, 6N137 high-speed optocoupler and PCA82C250 bus transceiver. Considering the design cost and the convenience of software programming, the sub-controller selects the same chip as the main controller and has the same hardware circuit structure.
2 Power driver chip and its application circuit Motorola's power driver chip MC33486 has been widely used in automotive electronics with its powerful functions and excellent performance. The application mode of this chip is bridge structure [2] . There are two high-end MOSFET drive tubes MOS1 and MOS2 inside the chip. Two low-side MOSFET drive tubes MOS3 and MOS4 are connected to form a complete H-bridge to realize the positive of the window motor. Reverse control. At the same time, the current mirroring function of the Cur R terminal can easily realize the overcurrent protection and the anti-trap function of the window, as shown in Fig. 2.

OUT1 and OUT2 are the two high-side output pins of the MC33486 that directly drive the window motor M. IN1 and IN2 are controlled by the microcontroller. When IN1 is high level '1' and IN2 is low level '0', the corresponding GLS1 outputs a low level, and GLS2 outputs a high level. At this time, MOS1 and MOS4 are turned on, and MOS2 and MOS3 are turned off. OUT1 outputs a positive voltage and OUT2 is grounded, and the window motor runs in a certain direction. Conversely, when IN1 is low level '0' and IN2 is high level '1', the corresponding GLS2 outputs a low level, and GLS1 outputs a high level. At this time, MOS2 and MOS3 are turned on, and MOS1 and MOS4 are turned off. OUT2 output is positive, OUT1 is grounded, and the window motor is reversed to achieve the purpose of lifting the window glass. In addition, the MC33486 has a very low quiescent current in standby mode. The output current is 10 A during normal operation, the maximum peak current is 35 A, and the DC input voltage range is wide, up to 8 V to 28 V. The chip has overvoltage protection when the voltage is higher than 28 V. Due to the perfect performance of the device, the size of the power window controller can be reduced and the EMS (electromagnetic compatibility) characteristics can be improved.
3 CAN controller hardware circuit design <br> The overall requirements for the hardware window design of the power window controller are simple, easy to implement, stable and reliable performance, and minimize the cost if the requirements are met.
CAN communication system hardware circuit is mainly composed of three parts [3]: PIC18F258 microcontroller, 6N137 high speed optocoupler, PCA82C250 bus transceiver. The circuit principle is shown in Figure 3.

PIC18F258 is a high-performance PIC series microcontroller with embedded CAN bus controller built by Microchip in the United States. Due to its ultra-small size, low power consumption, low cost and variety, its application range is very wide. PIC18F258 is a microcontroller integrated with CAN module, with advanced reduced instruction set architecture, enhanced core, 32-level stack, on-chip Flash program memory, EEROM data memory, self programming function, in-circuit debugger (ICD) and more An internal and external interrupt source, and a Harvard structure in which the program and data space are completely separated. This architecture greatly reduces the overall cost of the PIC microcontroller while increasing operational efficiency. In the circuit, PIC18F258 MCU is the core of CAN bus interface circuit, which mainly completes the transmission and reception of data on CAN bus, realizes the decomposition and combination of serial data, and ensures the normal and smooth communication.
The PCA82C250 is a CAN bus interface chip from Philips. It is the interface between the CAN controller and the physical bus. It provides differential transmission and reception of the bus. It is fully compatible with the ISO11898 standard and has three different modes of operation, namely high speed. Slope control and standby can be selected according to the actual situation. In this scheme, the high speed working mode is selected. The chip has few pins and is easy to use. The CAN bus uses the PCA82C250 chip as the interface between the bus and the bus. The CANH and CANL pins of the PCA82C250 are connected to the CAN bus through a resistor. The resistor can play a certain current limiting function to protect the PCA82C250 from overcurrent. In addition, two small capacitors are connected in parallel between CANH and CANL and ground to filter out high frequency interference and electromagnetic radiation on the bus. The optocoupler uses the high-speed logic gate output optocoupler 6N137 produced by General Instrument. Its maximum propagation delay time is 75 ns, and the typical value is 46 ns. The 6N137 high-speed optocoupler circuit can achieve good connection between nodes on the bus. Electrical isolation, while improving the system's anti-interference ability and ability to transmit signals. In use, the two power supplies VCC and V'CC of the optocoupler must be completely isolated using a power isolation circuit.
4 CAN communication system software design process <br> Software design is the key to system design. Use the development software MPLAB IDE, emulator ICD 2, and the flexible and simple C language. In order to improve reliability and comprehensibility [4], the internal software design adopts a module structure, which mainly includes a main program, a system initialization subroutine, a data transmission subroutine, a data receiving subroutine, and a motor control subroutine. In addition, there should be interrupt service subroutine, A/D sampling subroutine, fault diagnosis subroutine, and terminal subroutine. The system initialization subroutine and motor control subroutine are mainly discussed here.
The system initialization subroutine is an extremely important part of the system design work. It is the premise of the normal operation of the CAN bus system, and it is related to whether the entire CAN system can work normally. Therefore, the initial design is an important point, mainly including the configuration of the CAN module working mode, the setting of the receiving filter, the setting of the receiving mask register, the setting of the baud rate parameter, the setting of the transmission priority, and the setting of the interrupt enable register. The initialization subroutine flow is shown in Figure 4.

The control of the electric window can be divided into four stages: soft start, full PWM output, freewheeling and stop. These include the judgment and processing of the “manual/automatic” control of the electric window, the judgment and processing of the window rising to the top or the bottom, the judgment and processing of the window anti-pinch [5], and the working flow is shown in Figure 5. . After the initialization of the program is completed, after the button port scans the control command with the rising or falling button input, the main program calls the motor control subroutine, and the window motor enters the PWM soft start phase. The PWM soft start is divided into 10 steps, each step is 20 ms, and the duty cycle is gradually increased from 10% to 100%. The motor then enters a rising or falling operating state [6]. After the power window adopts the PWM control mode, the startup is relatively stable and the startup speed is good.

The anti-trap function of the window is realized by the linear mirroring function of the load current of the Cur R output of the power chip MC33486. The Cur R terminal can output a monitoring current I Cur R proportional to the window motor load current I load , which has the following mathematical relationship:

This current is converted into a voltage input to the A/D sampling end of the PIC microcontroller, which can complete the control of the window motor and realize the anti-trap function of the electric window.
Networked control is the development trend of modern automotive electronic control. Compared with the traditional control method, the electric window control system using the CAN bus can reduce the wiring harness inside the vehicle. At the same time, many functions can be added through software programming without changing the original network hardware structure. The PIC18F258 microcontroller integrates a CAN controller that can be programmed online. The electric window control system designed by the chip has stable performance and reliable work. After the actual loading test, the functions of the system have been well realized, which laid a foundation for the industrial implementation of the system.
references
[1] Rao Yuntao, Zou Jijun, Wang Jinhong, et al. Fieldbus CAN Principles and Application Technology (Second Edition) [M]. Beijing: Beijing University of Aeronautics and Astronautics Press, 2007.
[2] Du Lin, Jiang Jiuchun, Pan Lei. Application of double high-end switching device MC33486 in body electronic control system[J].Electrical Applications,2005,24(7):122-124.
[3] Wang Wei, Zhang Fan. Application of CAN Bus Technology in Intelligent Vehicle System[J]. Microcomputer Information, 2005, 21(7): 48-50.
[4] Xiao Zhaohui, Tan Jin, Li Shan. Application of CAN Bus Technology in Hybrid Electric Vehicles[J].Journal of Chongqing University(Natural Science Edition),
2005, 28 (6): 68-70.
[5] Zhao Peng, Wang Xudong. Design of Vehicle Door Control System Based on CAN Bus[J]. Journal of Harbin University of Science and Technology, 2008, 13(2): 77-85.
[6] Wu Zhihong, Lu Ke, Zhu Yuan. A Cost-effective Design of Electric Window Controller[J].Microcontroller and Embedded System Design.2009(1):43-45.

Kirisun portable radio

Guangzhou Etmy Technology Co., Ltd. , https://www.gzdigitaltalkie.com