Preface
With the improvement of automation and the networking of information, more and more measurement and control points and measurement and control parameters are required, making an automatic control system increasingly large and complex. For a system, the number of sensors required increases exponentially. In order to enable real-time, high-speed, and accurate communication between each intelligent instrument and the host machine, it is critical to select an ideal fieldbus. Fieldbus is an open control system, a fully digital, serial, two-way, multi-station communication network used between fieldbus instruments and the control room. CAN is one of the most promising fieldbuses. In the networked system, each sensor is connected to the CAN bus as an intelligent node. The entire system is shown in Figure 1.
1. Technical characteristics of CAN bus
a) The CAN communication rate is (5kB/s)/10km, (1MB/s)/40m, and the number of nodes can reach 110. The transmission medium uses twisted pairs, coaxial cables, optical fibers, etc.;
b) Use point-to-point, point-to-multipoint and global broadcast to send and receive data;
c) Use non-destructive bus priority arbitration technology. When two nodes send information to the network at the same time, the node with lower priority actively stops sending data, while the node with higher priority can continue to send information without being affected. therefore. Divided into different priorities according to node type, which can meet different real-time requirements;
d) A fully distributed multi-machine system can be realized, and there is no distinction between master and slave machines. Each node actively sends messages. This feature can be used to easily form a multi-machine backup system; e) Supports four types of message frames: Data frame, remote frame, error frame, overload frame. It adopts short frame structure, and the number of effective bytes per frame is 8. In this way, the transmission time is short, the probability of interference is low, and it has better error detection results.
In addition, CAN uses cyclic redundancy check; its nodes have automatic shutdown function. Since there are not many types of sensors with CAN bus interfaces and the prices are relatively expensive, in order to enable better real-time communication between the bus and the host computer, you can design a sensor composed of an 8051 microcontroller and SJAl000 independent CAN bus control as the core. Smart nodes. An intelligent sensor network that can receive 8 analog inputs is formed based on ordinary sensors.
2. Hardware structure and functions of SJAl000
As shown in Figure 2, SJAl000 can be logically divided into 7 parts:
a) IML (Interface Management Logic) IML is used to interpret commands from the CPU, allocate information buffers and provide interrupt and status information to the CPU;
b) Transmit buffer TXB 13-byte long memory, the external CPU writes the information to be sent into this buffer;
c) Receive buffer RXB The receive buffer is a 64-byte FIFO register for the CPU to receive information;
d) The receiving filter ACF compares the received message ID with the ACF content to decide whether to receive the message;
e) The bit stream processor BSP is used to control the data flow of the sending and receiving buffers and CAN bus;
f) Timing logic BTL is used to control the transmission rate and synchronization of data on the CAN bus;
g) Error management logic EML performs error management according to CAN protocol.
3. Application of CAN bus in intelligent sensor network
Take the signal collection of one channel as an example. Figure 3 is the interface circuit diagram of the CAN controller and transceiver with the microcontroller and ADC0809. The CAN controller uses PHILIPS SJA1000, and the microcontroller uses 89C51. It mainly completes signal acquisition and signal preprocessing, and transmits the processed data to the host computer. 82C250 is the interface device between CAN controller SJA1000 and CAN physical bus. It drives the bus differential reception or transmission. Considering that there are various interferences on site, a high-speed optocoupler isolation device (6N137) is added between the CAN controller and the driver. Since the CAN controller and the feedback controller have their own internal clock generation circuits, in order to coordinate the two, an external crystal oscillator is used as the clock of the entire system on the CAN controller, and the clock output of the CAN controller is used as the clock output of the microcontroller. Clock input; the interrupt output of SJAl000 is connected to the INT1 terminal of the CPU; the communication between the microcontroller and the CAN controller is realized through interrupts; at the same time, in order to enable the CAN controller and the microcontroller to be reset reliably at the same time, a manual reset circuit is added. In addition, since the ADC0809 converter has a three-state output latch function, it can be directly connected to the 89C51 bus, and the ADC0809 converter is treated as an external RAM unit in the system.
4. Software design
The software design of the smart sensor as a node mainly includes two parts: one part is to initialize the microcontroller and SJAl000, and the other part is the actual data collection and control functions of the actuator to be completed by the node. For the initialization of the CAN controller, different contents are written to each register respectively, and the communication between the CAN controller and the microcontroller is interrupted. The process is shown in Figure 4.
The initialization procedure of SJAl000 is:
MOVA, # 0BH 04H is the ACR register address 00H is the CR register address
MOVDPTR, #8000H
MOVX@DPTR, A open error and receive interrupt, SJA1000 enters reset mode
MOVDPTR, #8004H
MOVA, #02H
MOVX@DPTR, A
INC DPTR 05H is the AMR register address. Set to receive all
MOVA, #FFH
MOVX@DPTR, A
INC DPTR
MOVA, # 01H 06H is the register address of BTR0
MOVX@DPTR, A
INC DPTR
MOVA, # FFH 07H is the register address of BTRl, write BTR0 and BTRl, and set the baud rate to 160K
MOVX@DPTR, A
INC DPTR
MOVA, # 0AH 08H is the OCR register address, SJAl000 uses normal mode output
MOVX@DPTR, A
MOVA, #OFH
MOVDPTR, #801FH 1FH is the CDR register address, making the clock of the microcontroller and SJAl000 the same
MOVX@DPTR, A
MOVA, #0AH
MOVDPTR, #8000H
MOVX@DPTR, A writes CR register to make SJAl000 enter working mode
RET
5 Conclusion
Applying the CAN bus to smart sensors enables the signals obtained by the sensors to be transmitted through the bus in a real-time, reliable, high-speed and accurate manner. At the same time, because the entire intelligent sensor network adopts fully digital communication, the bus also has good anti-interference ability, and the network will not be paralyzed even under heavy load. These superior performances are unmatched by other field buses.
Previous article:Design of timing acquisition and storage system based on microcontroller C8051F021 and clock chip
Next article:Design of data acquisition card based on C8051F021 microcontroller and PCI interface
Recommended ReadingLatest update time:2024-11-23 05:13
- Popular Resources
- Popular amplifiers
- MCU C language programming and Proteus simulation technology (Xu Aijun)
- Principles and Applications of Single Chip Microcomputers 3rd Edition (Zhang Yigang)
- Principles and Applications of Single Chip Microcomputers and C51 Programming (3rd Edition) (Xie Weicheng, Yang Jiaguo)
- STC32G Series MCU Technical Reference Manual
- 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
- Schematic diagram - What is the significance of the position of the energy storage capacitor in the figure?
- Where is Wi-Fi going?
- Automobile air conditioning control system based on single chip microcomputer
- Hittite Launches Active x2 Frequency Multiplier with Output Frequency Range up to 46GHz
- A collection of autonomous driving technical materials, download now without any points!
- Switch OUT?! Nintendo's latest recruitment may be aimed at the next generation console
- 【ST NUCLEO-H743ZI Review】+ 3. Key input
- Introduction to constant current source and current feedback
- Welcome to join the power management section
- Award-winning live broadcast: Focus on "TI FPD-Link III automotive chipset" Ideal solution for automotive video transmission