3448 views|1 replies

1148

Posts

0

Resources
The OP
 

Implementation of Automobile Instrument Software Based on CAN Bus [Copy link]

With more and more electronic devices in cars, car networks have emerged, and controller area networks (CAN) have begun to be widely used in cars. How to use the information in the car network to facilitate drivers and passengers to understand vehicle information is a research that needs to be carried out. This study obtains the data required by the car dashboard from the CAN bus and displays it dynamically on the LCD screen. This series of tasks is all implemented by high-level language programming under the support of hardware.
1. CAN bus technology
There are currently many car network protocols. CAN bus technology belongs to the field bus category. CAN is the abbreviation of Control Area Network. It was first introduced by BOSCH in Germany and is used for data communication between measurement and execution components inside the car. Its vertical specification has now been formulated as an international standard by the ISO International Standards Organization. With the support of Philip, Siemence, Motorola, Intel, Fusitu and other companies, it has become the most widely used field bus in the world. It effectively supports distributed control and real-time control, and uses the CSMA/CD protocol with priority to arbitrate the bus. Therefore, CAN bus allows multiple stations to send at the same time, which not only ensures the real-time nature of information processing, but also enables the CAN bus network to form a multi-master structure system, ensuring the reliability of the system. In addition, CAN adopts a short frame structure, and each frame of information has checksums and other error detection measures, which ensures the real-time nature of data and low transmission error rate. Its transmission medium can use twisted pair, coaxial cable or optical fiber.
2. The development and trend of automotive instruments
can be divided into four stages, or four generations, according to the major technological innovations achieved in the working principle of automotive instruments. The first generation of automotive instruments is a mechanical instrument based on mechanical force, and people are accustomed to calling this type of instrument a mechanical movement meter; the working principle of the second generation of automotive instruments is based on the principle of electrical measurement, that is, the non-electrical quantity to be measured is converted into an electrical signal by various sensors for measurement, and this type of instrument is usually called an electrical instrument; the third generation is an analog circuit electronic type; the fourth generation is a stepping motor type full digital automotive instrument.
With the development of computer technology, electronic technology, network technology and liquid crystal reality technology, the development trend of automotive instruments will better reflect the combination of these high-tech technologies. For example, the functions of the instrument are realized by software and hardware, and mainly by software. This is of special significance for automobile instruments that are large in quantity and extremely sensitive to cost, because the software development costs allocated to each instrument are very small. Compared with automobile instruments composed only of electronic circuit hardware, automobile instruments with ECUs have more flexible and diverse means of realizing their functions. The product is more "flexible", that is, when launching new products, the hardware and software design results of previous products can be maximized with only a small amount of modification, which is particularly important today and in the future when products are updated quickly.
3. Design of automobile instrument based on CAN bus
3.1 Design idea
This paper takes advantage of the vehicle network to collect the data required by the automobile instrument panel from the CAN bus, such as vehicle speed, water temperature, fuel, mileage, etc., and performs various real-time controls and displays after being processed by the processor. Unlike traditional instrument panels, this design uses an LCD screen to dynamically display the data collected and processed by software. In this way, the instrument panel can be expanded by software at any time as needed. The overall network has a self-diagnosis function, which reduces the failure rate of the system. At the same time, the use of the CAN bus makes the overall system work more timely and accurately, improves safety and reliability, and is more intelligent and humane.
Since this design is only an experimental study and the data encoding of each car bus is diverse, this design has developed a simple ECU to collect data such as vehicle speed, fuel, water temperature, mileage, etc. Then the CAN bus is connected to the PC through the CAN-PC interface card, and then the software programming is used to complete the dynamic display of the data collected from the CAN bus. Visual Basic programming is used here. The system shares the computer used by the entertainment system and navigation system. As an experimental study, a laptop can replace the PC. Then various experimental verifications are carried out, such as anti-interference, accuracy, working stability, vibration influence, temperature influence, etc.
3.2 System hardware structure and devices used
The test system consists of an LCD display, a PC-CAN interface card, a single-chip microcomputer, a CAN controller (SJA1000), a CAN bus send/receive driver (PCA82C250), and various data acquisition systems.
The dedicated LCD screen is used to display the speed, oil pressure, water temperature, fuel consumption, etc.; the PC is used to process the data on the CAN bus and display it on the screen through software; the PC-CAN interface card completes the communication between the PC and the CAN; the self-designed ECU completes the data collection from each sensor and is connected to the CAN bus through the CAN transceiver. The PC-CAN interface card is connected to the PC through the RS232 interface or UAB, and the PC-CAN interface card is connected to the self-designed ECU through the bus. In practice, the PC-CAN interface card is connected to the vehicle CAN bus and can collect a large amount of data information, so that this information can be dynamically displayed on the display screen at any time through software programming.
3.3 System hardware design
The PC-CAN interface card uses the CAN232 intelligent CAN interface card, which is suitable for small-flow data transmission applications of CAN-bus, with a data transmission rate of up to 500 frames/second, and provides extensive and powerful software support. It supports design in development environments such as VC++, C++Builder, Delphi and VB. The interface card provides users with three files required for programming: CAN232dll.DLL, CAN232dll.LIB, and ExportHead.H.
The CAN protocol controller uses SJA1000, which is an independent CAN controller suitable for automotive environment produced by Philips and supports CAN2.0B protocol. The CAN send/receive driver uses Philips' PCA82C250, which is the interface between the CAN controller and the physical transmission line. It can transmit data on two bus cables with differential voltage at a bit rate of up to 1Mbits/s.
3.4 System Software Design
The layered structure of CAN2.0 is a description of the CAN structure according to the ISO/OSI model. The data link layer is divided into two layers: the logical link layer (LLC) and the media access control (MAC). The LLC layer completes the following functions: providing data transmission and remote data request transmission services; judging whether to accept received data; providing recovery management and overload processing.
The MAC layer mainly defines the transmission protocol, including information frame format, arbitration mode, response signal, error detection, error signaling and fault limitation. The
physical layer realizes the transmission of physical signals between nodes and mainly defines the electrical characteristics of the network. A variety of different physical layer protocols can be used in the CAN network.
This study uses VC programming language to realize the display of automobile instrument data. The PC-CAN interface card comes with three files CAN232dll.DLL, CAN232dll.LIB, and ExportHead.H, among which ExportHead.H describes the external functions defined by the dynamic link library CAN232dll.DLL. As shown below,
void OpenSerialPort(int nPort, unsigned int Baud);
void CAN232Send(unsigned char*sdata, size_t Len);
void CAN232Setting(unsigned char*sdata, size_t Len);
char CAN232Receive(unsigned char*CANReceive);
copy the three files of the interface card to the VC directory, and fill in CAN232dll.LIB under the LINK item in PROJECT->SETTING in the VC menu. Then add "#include ExportHead.H" to the header file of the program.
4. Conclusion
This study has only one CAN node, so the data displayed on the display are only speed, oil pressure, water temperature, and fuel consumption. However, in the actual car network, through programming, we can dynamically obtain all the information on the CAN bus, and can display it with a friendly human-machine interface, making the vehicle information transparent to the driver or passengers. Therefore, the realization of automotive instrument software based on the CAN bus is a new attempt in automotive instrument design.
This post is from Automotive Electronics

Latest reply

Thank you for the post  Details Published on 2006-7-15 18:10

6

Posts

0

Resources
2
 
Thank you for the post
This post is from Automotive Electronics
 
 

Guess Your Favourite
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

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