引言
随着汽车拥有量的增加,发生交通事故的概率也随之增加,发生事故后用传统的方法进行分析、判断、维修有一定的困难。这样,就给人们提出了一个问题,怎样及时、准备地分析故障的存在,客观地分析事故的责任。由此联系到飞机上装的“黑匣子”,一旦飞机失事,“黑匣子”里的资料是判断失事原因的重要依据。因为它的造价高、技术复杂,在普通汽车上使用有一定的难。本文介绍一种价格低,功能较齐全且能扩展的汽车行驶记录仪。 本记录仪采用带ARM7内核的LPC2104型CPU作为主控机,大容量闪速存储器作为存储载体,带有精确的时钟电路,利用高精度A/D转换器采集汽车传感器转换的模拟量,并直接记录汽车信号灯等的各种开关量。同时利用串口实现与微机的数据通信,把汽车行驶记录低度的信息以二进制文件的形式存储到硬盘上。
1 系统的硬件设计 系统的总体框架如图1所示。带ARM7内核的LPC2104型CPU是汽车行驶记录仪的核心,整个系统由信息采集模块、信息处理及存储模块和串口通信模块组成。 LPC2104是Philips公司生产的一款支持实时仿真和跟踪的ARM7TDMI-S CPU,内部集成有与片内存储器控制器接口的ARM7局部总线、与中断控制器接口的AMBA高性能总线(AHB)和连接片内外设功能的VLSI外设总线(VPB,ARM,AMBA总线的兼容超大规模集成电路),并嵌入了128KB高速Flash存储器。LPC2104将ARM7TDMI-S配置为小端(Iittle-endian)字节顺序,具有封装小、功耗低、多个32位定时器、多种总线接口及多达9个外部中断等优点,非常适合作为汽车行驶记录仪的主控CPU。同时,LPC2104还具有128位宽度的存储器接口和独特的加速结构,从而使得32位代码能够在最大时钟频率下运行。 2 信息采集模块设计 汽车行驶记录仪要求实时记录车辆行驶的各种状态信息,因此本系统将信息采集模块分为开关量数据采集模块、模拟量数据采集模块、时钟数据采集模块。
2.1 开关量数据采集模块 该模块利用74LS165型并行输入8位移位寄存器扩展16位并行输入口,其硬件电路如图2所示。其中利用LPC2104的3根I/O口线扩展为16位的输入口线,图中由2片74LS165串接扩展16位的输入线,CLK为时钟脉冲输入端,D0-D7为并行输入端,前级的数据输出端QH与后级的信号输入端 SIN相连,S/L为低电平时,允许并行置入数据,S/L为高电平时允许串行移位。这样左右方向灯、前车灯、开门信号、刹车灯信号等16路开关量经过光电耦合器隔离后并行输入到2片74LS165中,再经74LS165转换后,串行输出给LPC2104进行处理。 2.2 模拟量数据采集模块 在进行模拟数据采集时,水温、水位等8路传感器采集的信号先经过模拟信号调理环节,将其整定在A/D转换器参考电压Vref决定的满量程输入电压信号以内,然后经过A/D转换器进行A/D转换。该模块采用美国德州仪器公司推出的TLC0838型8路8位逐次逼近型模、数转换器,采样频率为100kHz,与外部通信采用SPI总线接口。LPC2104通过其内嵌的SPI总线接口与TLC0838进行通信,其硬件电路如图3所示。其中SCK为SPI主机输入或从机输入的时钟,MOSI为SPI主机到从机的数据传输,MISO为SPI从机到主机的数据传输,SSEL为SPI从机选择。
汽车速度的测量是通过计数速度传感器产生的脉冲信号实现的。本系统利用AT89C2051型单片机来计数速度脉冲信号。该单片机可设定一个守量器来计数速度脉冲信号,并将其转换成汽车的实际量程。同时根据行程和时间可计算汽车的速度,并通过串口UART0将数据传送给LPC2104。 2.3 时钟数据采集模块 为了记录行车的时间,使行驶记录仪能够实时记录汽车状态,采用专门的时钟模块提供时间信号,本系统选用DS12887时钟电路。DS12887是跨越 2000年的时钟电路,采用4位数表示年度的日历系统。电路的晶体振荡器、振荡电路、充电电路和可充电锂电池等一起封装在芯片的止方,组成一个加厚的集成电路模块。DS12887能够自动存取并更新当前的时间,LPC2104可通过读DS12887的内部时标寄存器得到当前的时间和日历,也可通过选择二进 进码或BCD码初始化电路的10个时标寄存器。 3 信息处理及存储模块设计 由于Flash的存储结构适宜是固态存储,EPROM的存储结构适宜于动态存储,因此,本系统根据实际需要,有用Flash固态存储和EPROM动态存储相结合的方式进行数据存储和记忆,即用Flash固态存储采集的汽车状态数据,用EPROM动态存储Flash最新存储的扇区号和存储地址。闪速存储器选用美信公司生产的MX29F800BTC型,EPROM选用MICroChip公司的24C32型,同时利用LPC2104内嵌的I2C总线接口与 24C32进行通信。 本系统工作时,首先由LPC2104主控CPU从24C32中读取Flash最近存储的扇区号和存储地址,然后以此地址为参照,以这个地址的一个地址值为 Flash的起点地址,以这个地址的下一个地址值为Flash的起点地址,按顺序进行存储。Flash需要存储的数据有16路开关量信息、8路模拟量信息有及时钟信息。本系统利用二字节(共16位)存储16路开关量信息,利用8个字节的存储空间存储8路模拟量信息。为了节省存储空间,系统并非每次存储采集数据时都存储时间标志。由于数据采集以固定的秒间隔来进行,因此,系统只是在刚开始运行时和每个扇区的起始位置采集并存储时钟信号作为时间标记,而后面数据的采集时间则以这些时间标记为参照。
The software flow of system storage is shown in Figure 4. When the system is reinstalled and powered on, it is necessary to record the time information of the start of acquisition. Since the system power is provided by the car power supply, the time of starting acquisition is also the time when the car starts, which is used as the time mark of the car starting to run. During the program running, the main program sets a car start flag. The car start flag is valid before the first data is written. Then, it is first determined whether the current storage address has the first address of a sector. If so, the current clock signal is stored at the beginning of the seventh byte according to the requirements of writing the sector. Otherwise, 10 bytes are used to store the current clock signal at the current storage address, and the start time of the car starting to run is recorded, and then the car start flag is cleared. Whether the time information recorded at the start address of the sector is the start time of the car starting to run can be judged based on the time information recorded in the previous sector. If the data recorded in the two sectors before and after are continuous, the time information recorded in the header of the latter sector does not indicate the start time of the car starting to run, otherwise the situation is the opposite. 4 Serial communication module design The computer can read the data stored in the driving recorder at any time through the serial port. The serial communication between the driving recorder and the computer follows the RS232 protocol. During serial communication, LPC2104 reads the data stored in Flash and sends it out through UART0 serial port, then sends it to the computer through MAX232 level converter , and then the computer receives the data through the serial port. Figure 5 5
Conclusion
The car driving recorder uses a microcomputer to receive the car driving data through the serial port and analyzes and processes the data; Visual C++ 6.0 is used as a development tool to write a microcomputer data analysis and processing program to simulate and display the state of the car when it is running; the waveform of each component is displayed using graphics, such as the forward light switch status, the left and right direction light switch status, the door opening information, the brake signal, the water temperature change (range 0℃"100℃), etc. The driving recorder was installed on the car for testing, and the results were also ideal and could meet the design requirements. The test results are shown in Figure 5.
Previous article:Introduction to ARM program optimization and its application in embedded TCP/IP protocol implementation
Next article:ARM9 processor LPC3250 embedded with Linux and 16-bit AD sampling chip
Recommended ReadingLatest update time:2024-11-24 00:20
- Popular Resources
- Popular amplifiers
- Siemens PLC Programming Technology and Application Cases (Edited by Liu Zhenquan, Wang Hanzhi, Yang Kun, etc.)
- Siemens PLC from Beginner to Mastery with Color Illustrations (Yang Rui)
- Experience and skills in using Siemens S7-200PLC (Shang Baoxing)
- Siemens S7-1200-PLC Programming and Application Tutorial (3rd Edition) (Edited by Shi Shouyong)
- Naxin Micro and Xinxian jointly launched the NS800RT series of real-time control MCUs
- How to learn embedded systems based on ARM platform
- Summary of jffs2_scan_eraseblock issues
- Application of SPCOMM Control in Serial Communication of Delphi7.0
- Using TComm component to realize serial communication in Delphi environment
- Bar chart code for embedded development practices
- Embedded Development Learning (10)
- Embedded Development Learning (8)
- Embedded Development Learning (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Intel promotes AI with multi-dimensional efforts in technology, application, and ecology
- ChinaJoy Qualcomm Snapdragon Theme Pavilion takes you to experience the new changes in digital entertainment in the 5G era
- Infineon's latest generation IGBT technology platform enables precise control of speed and position
- Two test methods for LED lighting life
- Don't Let Lightning Induced Surges Scare You
- Application of brushless motor controller ML4425/4426
- Easy identification of LED power supply quality
- World's first integrated photovoltaic solar system completed in Israel
- Sliding window mean filter for avr microcontroller AD conversion
- What does call mean in the detailed explanation of ABB robot programming instructions?
- STMicroelectronics discloses its 2027-2028 financial model and path to achieve its 2030 goals
- 2024 China Automotive Charging and Battery Swapping Ecosystem Conference held in Taiyuan
- State-owned enterprises team up to invest in solid-state battery giant
- The evolution of electronic and electrical architecture is accelerating
- The first! National Automotive Chip Quality Inspection Center established
- BYD releases self-developed automotive chip using 4nm process, with a running score of up to 1.15 million
- GEODNET launches GEO-PULSE, a car GPS navigation device
- Should Chinese car companies develop their own high-computing chips?
- Infineon and Siemens combine embedded automotive software platform with microcontrollers to provide the necessary functions for next-generation SDVs
- Continental launches invisible biometric sensor display to monitor passengers' vital signs
- November 10th prize-winning live broadcast: Protecting clean water sources - ADI water quality monitoring program registration is open~
- Talk about the MSP430 interrupt nesting mechanism
- Thermal fatigue analysis of power modules
- FOC sensorless motor control video
- Implementation of a sensorless, low-cost, high-speed, low- and medium-power BLDC controller
- Z-Wave Single-Chip Solution (ZW0201)
- Design of embedded network interface controller based on FPGA
- SHT31 Review Summary
- The differential voltage measured by the oscilloscope when the RS485 bus is idle is ±3.7V, and the periodic waveform with a frequency of 50hz
- What are the functions of magnetic beads and capacitors? How to choose the impedance of magnetic beads and the size of capacitors?