Design of intelligent sensor network based on 8051 microcontroller and SJAl000 chip

Publisher:JoyfulSunflowerLatest update time:2024-02-26 Source: elecfans Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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.


Reference address:Design of intelligent sensor network based on 8051 microcontroller and SJAl000 chip

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

8051(1) -- Architecture and memory structure
1. Overall frame structure Access to external memory obviously requires a 16-bit address bus, but the use of external memory is very flexible: it can store program code or data. 2. Bus structure Since the storage of Program Code and Data is separate, although the same bus is used,
[Microcontroller]
8051(1) -- Architecture and memory structure
Microcontroller experience summary - c8051f microcontroller usage tips
The c8051f microcontroller is developed on the basis of the MCS51 microcontroller. It has both inheritance and great innovation. According to the function, it can be divided into special-purpose and general-purpose types. Special-purpose type: 100MHz high-speed type such as f120 chip; 24-bit high-resolution AD such as
[Microcontroller]
Memory Oscilloscope Based on STC12C5408AD
1 Introduction        The oscilloscope is a basic instrument for electronic measurement. Due to its real-time, intuitive and vivid graphic display, it is also one of the commonly used instruments in general physics laboratories. As we all know, the oscilloscope is made based on the principles of electron beam scanni
[Microcontroller]
Memory Oscilloscope Based on STC12C5408AD
ADC Application Elements in C8051F020
F020 has 8-channel 12-bit A/D conversion (ADC) interface and 8-channel 8-bit online programmable (ISP) ADC circuit. There are 15 special function registers (SFR) on the chip related to ADC control, which are: AMUX0SL——AMUX0 channel selection register, the reset value is 00000000; MAX0CF——AMUX0 configuration regist
[Microcontroller]
Design of MPPT controller for photovoltaic cells using microcontroller C8051F310
1 Introduction Energy is an important material basis for the existence and development of human society. With the development of society, energy is decreasing day by day, and as environmental problems become increasingly prominent, more and more countries are turning their attention to renewable energy. As one of the
[Microcontroller]
Design of MPPT controller for photovoltaic cells using microcontroller C8051F310
Application solution of portable electrocardiogram monitor based on C8051F020 microcontroller
At present, ECG monitoring systems, which mainly collect ECG signals, analyze and diagnose them, have been widely used and play a great role in the prevention and diagnosis of cardiac system diseases. However, this type of ECG monitor can only be used when the patient is at rest or under special circumstances. The req
[Microcontroller]
Application solution of portable electrocardiogram monitor based on C8051F020 microcontroller
Design of C8051F320 Train Safety Inspection Instrument
Design of C8051F320 Train Safety Patrol Instrument 1 Introduction With the development of science and technology, traveling by train has become one of the main modes of transportation for people. In order to ensure the safe operation of trains, regular or irregular safety inspections of trains are an extremely import
[Microcontroller]
Design of C8051F320 Train Safety Inspection Instrument
Design of Oscilloscope Monitoring Program Based on C8051F020
  The design uses the high-performance single-chip microcomputer C8051F020 as the control chip to monitor the status of 40 buttons, 3 coding switches and 4 potentiometers on the oscilloscope panel. The working principles of the keyboard, coding switch and potentiometer, as well as the hardware circuit and software pro
[Test Measurement]
Design of Oscilloscope Monitoring Program Based on C8051F020
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号