This paper introduces the hardware and software design of embedded CAN intelligent node based on PIC16F874 single chip microcomputer, and uses PCL-841 CAN interface card to realize communication between embedded CAN intelligent node and PC, completes the real-time acquisition, reliable transmission and real-time display of voltage, current, temperature and other signals, and realizes the control of pulse width of PWM wave output of embedded CAN intelligent node by PC.
Introduction
CAN bus is a serial data communication protocol. Its communication interface integrates the physical layer and data link layer functions of CAN protocol, which can complete the framing of data. One of the biggest features of CAN protocol is that it abolishes the traditional station address coding and replaces it with communication data block coding. This method can make the number of nodes in the network theoretically unlimited, and different nodes can receive the same data at the same time.
This paper introduces the embedded CAN intelligent node, and uses PC and embedded CAN intelligent node to form a CAN communication system, which completes the real-time acquisition, reliable transmission and real-time display of voltage, current, temperature and other signals, and realizes the control of the pulse width of the PWM wave output of the embedded CAN intelligent node by the PC.
Design of embedded CAN intelligent node based on PIC microcontroller
The embedded CAN intelligent node uses PIC16F874 microcontroller as embedded microcontroller, MCP2510 as CAN controller, PCA82C250 as CAN transceiver, and has field/remote control function. According to user needs, the embedded CAN intelligent node can complete the real-time acquisition, reliable transmission and real-time display of various signals by connecting corresponding sensors, and the PWM wave output can be used to control the corresponding load. The embedded CAN intelligent node can realize circuit protection, field configuration, automatic adjustment, fault diagnosis alarm, status detection and other functions through external circuits, and complete the drive and intelligent control of electrical appliances such as motors, valves, and pumps.
Hardware Design
Microchip's PIC16F874 microcontroller uses RISC instruction system, Harvard bus structure, low power consumption, high speed. It integrates ADC, serial peripheral interface (SPI) and flash program memory, etc., and has functions such as PWM output and LCD drive. PIC16F874 can achieve seamless connection with CAN controller MCP2510 through SPI interface. PIC16F874 has rich I/O resources, with five I/O ports A, B, C, D, and E. Each I/O port has some special functions in addition to basic uses.
CAN communication module
The CAN communication module of the embedded CAN intelligent node consists of CAN controller MCP2510 and CAN transceiver PCA82C250. MCP2510 can complete all functions of the physical layer and data link layer of the CAN bus, support high-speed SPI interface (the maximum data transmission rate can reach 5MB/s), and support CAN2.0A/CAN2.0B protocol. CAN transceiver PCA82C250 is the interface between CAN controller and physical bus, providing differential transmission capability for physical bus and differential reception capability for CAN controller. At the same time, it can increase communication distance and improve the anti-interference capability of embedded CAN intelligent node.
PIC16F874 is connected to CAN controller MCP2510 through SPI, its serial data input (SDI) pin is connected to MCP2510's SO pin, its serial data output (SDO) pin is connected to MCP2510's SI pin, and its serial clock (SCK) pin is connected to MCP2510's SCK pin. The reset signal and chip select signal of MCP2510 are provided by RA5 and RA2 of microcontroller A port, and the interrupt signal and receive buffer full interrupt signal of MCP2510 are output to RB0 and RB5 of microcontroller B port.
The SPI interface works in active mode by setting the SPI interface status register and control register of PIC16F874. The timing of communication between PIC16F874 and MCP2510 is very important. When sending data, first send the write instruction, then send the register address, and finally send the data. When MCP2510 receives data from the bus, an interrupt will be generated, and the microcontroller responds to the interrupt. When reading data, first send the read instruction, then send the register address, and the data will be automatically written into the buffer of the microcontroller SPI interface.
Display module
The embedded CAN intelligent node uses the OCMJ4χ8 display module, which can display Chinese characters, ASCII codes, etc. All its settings and initialization work can be automatically completed when powered on.
The data lines DB0~DB7 of the OCMJ4χ8 display module are connected to the D port of the microcontroller, and the request (REQ) pin and the response (BUSY) pin are connected to the RB4 of the B port and the RE2 of the E port of the microcontroller respectively. The RT1 and RT2 pins of the display module are connected to external adjustable resistors to adjust the brightness of the LCD.
The interface protocol of the display module is a request/response (REQ/BUSY) handshake mode. When busy is high, it means that the display module is busy; when busy is low, it means that the display module is idle and waiting to receive commands. The microcontroller first sends commands or data to the display module, and then sends a request signal to request the display module to process. The display module sets busy to a high level and processes the command or data. After the processing is completed, it sets busy to a low level.
Analog acquisition module
RA0, RA1, and RA3 of port A of PIC16F874 microcontroller are used for analog input. The main function of the analog acquisition module of the embedded CAN intelligent node is to convert the current signal to be collected into a voltage signal through a current transformer, and to convert the temperature signal to be collected into a voltage signal through a temperature sensor AD590.
Switching input/output modules
The embedded CAN intelligent node provides 4 switch inputs and 7 switch outputs through I/O expansion. The switch input is used for circuit protection, fault alarm, status detection, etc. As long as the controlled object has the corresponding detection element, it can be connected to the corresponding interface. The switch output is used to drive the relay. It can determine whether to connect the contactor to control the motor, valve, pump and other electrical actuators according to the load size. According to the needs of the user, this part of the circuit can be changed accordingly.
Previous article:CAN bus expansion technology based on dsPIC30F6011 microcontroller
Next article:Application of single chip microcomputer in permanent magnet brushless DC motor drive system of electric golf cart
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Error handling in C programming for embedded systems
- RF calculation formula backup one
- How to Redefine the Size of Information Memory and Persistent Memory in FRAM
- 38 electromagnetic compatibility design standard reference circuits
- I want to ask if it is a lot of work to implement a calculator with a decimal formula
- PCB board_production process_material_design
- [GD32L233C-START Review] - 6. SPI drives RC522 card swiping
- [TI star product limited time purchase] + IWR6843 ISK EVM board unboxing and initial review
- Add instructions about littlefs in MicroPython's uos documentation
- MSP430F5529 general I/O port settings