基于LPC2104型CPU的汽车行使记录仪分析

Publisher:三青Latest update time:2018-03-16 Source: 21icKeywords:LPC2104型  CPU  汽车行使记录仪 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

引言


随着汽车拥有量的增加,发生交通事故的概率也随之增加,发生事故后用传统的方法进行分析、判断、维修有一定的困难。这样,就给人们提出了一个问题,怎样及时、准备地分析故障的存在,客观地分析事故的责任。由此联系到飞机上装的“黑匣子”,一旦飞机失事,“黑匣子”里的资料是判断失事原因的重要依据。因为它的造价高、技术复杂,在普通汽车上使用有一定的难。本文介绍一种价格低,功能较齐全且能扩展的汽车行驶记录仪。 本记录仪采用带ARM7内核的LPC2104型CPU作为主控机,大容量闪速存储器作为存储载体,带有精确的时钟电路,利用高精度A/D转换器采集汽车传感器转换的模拟量,并直接记录汽车信号灯等的各种开关量。同时利用串口实现与微机的数据通信,把汽车行驶记录低度的信息以二进制文件的形式存储到硬盘上。

1.png

    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.png

    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从机选择。

3.png

    汽车速度的测量是通过计数速度传感器产生的脉冲信号实现的。本系统利用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路模拟量信息。为了节省存储空间,系统并非每次存储采集数据时都存储时间标志。由于数据采集以固定的秒间隔来进行,因此,系统只是在刚开始运行时和每个扇区的起始位置采集并存储时钟信号作为时间标记,而后面数据的采集时间则以这些时间标记为参照。

4.png

    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.


Keywords:LPC2104型  CPU  汽车行使记录仪 Reference address:基于LPC2104型CPU的汽车行使记录仪分析

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

Renesas is the first in the industry to launch a general-purpose 32-bit RISC-V MCU using its own CPU core
RISC-V MCUs bring developers new options for low power, high performance and comprehensive tool chain support March 26, 2024, Beijing, China - Renesas Electronics, a global supplier of semiconductor solutions, today announced that it is the first in the industry to launch a general-purpose 32-bit
[Embedded]
Renesas is the first in the industry to launch a general-purpose 32-bit RISC-V MCU using its own CPU core
Murata launches DC-DC modules for CPU/communication system load points
Murata has launched the MonoBK DC-DC converter series. The first product in the series, the MYWGC3R53FFW92RAE, features over-current (OCP), over-voltage (OVP), under-voltage (UVP), and over-temperature (OTP) protections. Target application markets include FPGA, CPU and datacom/telecom systems. According to the compa
[Power Management]
Why do we design CPUs and ICs?
There was a comment in an article before that is very thought-provoking: (China) has too many companies trying to come up with their own CPU design, but few have enough reasons to explain why they need it. In fact, as far as I know, this is an old problem that has plagued Chinese IC design for more than 20 years, but f
[Microcontroller]
Research on Dual-CPU Servo Controller Based on AT89C51+DSP
1 Introduction In recent years, with the continuous progress of manufacturing industry, modern manufacturing industry has higher and higher requirements for precision, accuracy, high speed and automation. Most of the traditional motion controllers use 8051 series 8-bit single-chip microcomputers. Although this singl
[Microcontroller]
Research on Dual-CPU Servo Controller Based on AT89C51+DSP
The world's fastest LPDDR5T memory debuts, full-core CPU architecture Dimensity 9300 completes performance verification
SK Hynix announced that it has completed the performance verification of LPDDR5T memory with MediaTek’s next-generation Dimensity flagship mobile platform. The next-generation Dimensity flagship mobile chip of MediaTek mentioned here should be the Dimensity 9300, which is rumored to use a full-core CPU architecture.
[Semiconductor design/manufacturing]
The world's fastest LPDDR5T memory debuts, full-core CPU architecture Dimensity 9300 completes performance verification
Allwinner Technology: 12nm CPU related products are in the R&D stage, no detailed plans yet
On January 11, Allwinner Technology stated on the investor interaction platform that 12nm CPU-related products are in the R&D stage, and there is no detailed timetable at present. In addition, Allwinner Technology also stated that the company's chip products are universal, and downstream customers generally have multi
[Mobile phone portable]
Intel CPU process performs miracle: "1.8nm" mass production achieved in 6 quarters
In terms of advanced technology, Intel has been ahead of Samsung and TSMC in the past two years. However, under the leadership of CEO Kissinger, Intel aims to become the semiconductor leader again in 2025, and has also set an ambitious goal of mastering the fifth generation of CPU technology within four years. The goa
[Semiconductor design/manufacturing]
Intel CPU process performs miracle:
Apple's new CPU exposed: The materials and process make Intel/AMD uneasy
      Apple is making every effort to develop its own desktop processors, and they are already preparing the M3 series, as well as the M2 series.   According to DigiTimes, Apple's chip foundry partner TSMC is trial-producing the 3nm process, also known as N3. TSMC plans to start mass production of 3nm process products
[Mobile phone portable]
Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号