Simulation of cam crankshaft speed based on C8051F310 single pump control system

Foreword

In the development and testing of a unit pump common rail diesel engine ECU, it is essential to excite the camshaft (or crankshaft) speed signal. Instead of using an actual engine, a speed sensor can be replaced to generate and output the required frequency signal. However, this signal is not standardized—its phase, number of cylinders, and amplitude vary, making it difficult to find a ready-made solution. Although dSPACE simulation can be used for camshaft speed signal simulation, it requires a large instrument, a computer for display, and is both expensive and inconvenient to operate. Therefore, developing a compact, portable, and cost-effective diesel engine speed generator is highly beneficial. The Hall sensor from the camshaft speed sensor outputs a square wave, while magnetic sensors produce a sine wave. Regardless of the input type, the CPU front-end processing circuit can convert the signal into a square wave that the CPU can recognize. Hence, designing the system to output a versatile square wave signal makes it adaptable for various applications. The ECU typically operates on 12V or 24V power, so the power supply circuit is designed to accept 12–24V input. The C8051F310 microcontroller is selected due to its timer, ADC, and I/O resources, which meet the system requirements. The speed output is continuously adjustable, allowing the simulation of starting, idle, and controlled speeds. Displaying engine simulation data helps developers configure settings effectively. Since the information displayed is limited, a cost-effective character LCD module like LCM1602 is used. Additionally, different toothed disc structures are stored in memory, encoded for easy selection, enabling the device to support various ECU software development tasks.

Hardware Design

The hardware architecture of the camshaft speed simulation device is illustrated in Figure 1. It consists of a microcontroller system, an LCD display circuit, a speed reference circuit, a parameter storage circuit, and a power supply circuit. The C8051F310 serves as the central processing unit. It features an internal watchdog for power-on reset and program monitoring. The device is powered by a 12–24V DC source and uses two-stage voltage regulation to provide 5V and 3.3V supplies. An IO port expansion button allows users to select the gear plate serial number, which is stored in E2PROM. The speed reference potentiometer’s output is converted by the CPU’s on-chip ADC into a digital signal proportional to the speed. Two CPU IO ports control the adjustable frequency of the camshaft square wave signal. The LCM1602 character LCD displays the rotational speed and the toothed disc structure, using an 8-bit bus mode. The housing is made from a standard plastic shell with minor modifications.


Figure 1: System Hardware Structure Diagram

1. **C8051F310 Microcontroller** The C8051F310 is a high-performance embedded microcontroller with fast instruction execution, high integration, and support for online debugging. It has 16KB FLASH memory, 25 I/O ports, four general-purpose 16-bit timers, and a 10-bit ADC. Operates at 2.7–3.6V and is packaged in a 32-pin LQFP, making it ideal for small embedded systems. 2. **LCM1602 Liquid Crystal Display Circuit** The LCM1602 character LCD module is used for displaying parameters. It supports 5×7 dot matrix characters and a cursor. The module communicates via an 8-bit data bus, connected through the P1 port. P2.0 controls read/write commands, P2.1 enables them, and P2.2 selects the register. The LCD runs on 5V, while the CPU uses 3.3V, requiring level conversion. P2.3 controls the backlight, which can be programmed to adjust brightness. 3. **Power Supply Circuit** The power supply matches the ECU's 12V or 24V DC input. First, LM7805 regulates it to 5V for the LCD and storage circuits. Then, ASM1117-3.3 provides 3.3V for the microcontroller and other components. 4. **Parameter Storage Circuit** The AT93C46 E2PROM stores configuration data. P0.0 handles serial input, P0.1 serial output, P0.5 clock signal, and P0.6 chip select. Memory allocation details are described in the software design section.

External Shower Set

External Shower Set,Square Bathroom Shower System,Modern Rain Shower Wall Mounted,Chrome External Shower Head Set

Kaiping Rainparty Sanitary Ware Technology Co.,Ltd. , https://www.rpshower.com

Posted on