With the improvement of automation and the process of information networking, more and more measurement and control points and parameters are needed, which makes an automatic control system increasingly large and complex. For a system, the number of sensors required increases exponentially. In order to make each intelligent instrument communicate with the upper function in real time, high speed and accurately, it is very important to choose an ideal fieldbus. Fieldbus is an open control system. It is a fully digital, serial, bidirectional and multi station communication network between fieldbus instrument and control room. Can is one of the most promising fieldbus. In the networked system, each sensor is connected to the CAN bus as an intelligent node. The whole system is shown in Figure 1.

Design of intelligent sensor network based on 8051 single chip microcomputer and sjal000 chip

1. Technical characteristics of CAN bus

a) The can communication rate is (5KB / s) / 10km, (1MB / s) / 40m, the number of nodes can reach 110, and the transmission medium adopts twisted pair, coaxial cable and optical fiber;

b) Point to point, point to multipoint and global broadcasting are adopted to send and receive data;

c) Non destructive bus priority arbitration technology is adopted. When two nodes send information to the network at the same time, the node with low priority actively stops sending data, while the node with high priority can continue to send information unaffected. Therefore. It is divided into different priorities according to the node type, which can meet different real-time requirements;

d) The fully distributed multi machine system can be realized, and there is no distinction between master and slave. Each node actively sends messages, which can easily form a multi machine backup system; e) Four types of message frames are supported: data frame, remote frame, error frame and 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 has better error detection results.

In addition, can adopts cyclic redundancy check; Its node has the function of automatic shutdown. Because there are not many kinds of sensors with CAN bus interface and the price is expensive, in order to make the bus better communicate with the host computer in real time, we can design an intelligent node composed of 8051 single chip microcomputer and sjal000 independent can bus control as the core. An intelligent sensor network that can receive 8 analog inputs is formed on the basis of ordinary sensors.

2. Hardware structure and function of sjal000

As shown in Figure 2, sjal000 can be logically divided into seven parts:

a) IML (interface management logic) IML is used to interpret commands from CPU, allocate information buffer, and provide interrupt and status information to CPU;

b) The transmission buffer TXB is a 13 byte long memory, and the external CPU writes the information to be transmitted to this buffer;

c) Receive buffer rxb receives the FIFO register of CPU receiving information with 64 bytes of receive buffer;

d) The receiving filter ACF compares the received information ID with the ACF content to determine whether to receive the information;

e) The bit stream processor BSP is used to control the data stream of transmit and receive buffer and can bus;

f) Timing logic BTL is used to control the transmission rate and synchronization of data on CAN bus;

g) Error management logic EML performs error management according to can protocol.

3. Application of CAN bus in intelligent sensor network

Take one channel signal acquisition as an example. Fig. 3 is the interface circuit diagram of CAN controller and transceiver with MCU and ADC0809. The CAN controller adopts Philips SJA1000 and the single chip microcomputer adopts 89C51. It mainly completes the signal acquisition and signal preprocessing, and transmits the processed data to the upper computer. 82C250 is the interface device between CAN controller SJA1000 and can physical bus, which drives bus differential reception or transmission. Considering various disturbances on site, a high-speed optocoupler isolation device (6n137) is added between the CAN controller and the driver. Since both can controller and feedback controller have their own clock generation circuit, in order to coordinate them, the additional crystal oscillator is used as the clock of the whole system on the CAN controller, and the clock output of the CAN controller is used as the clock input of the microcontroller; The interrupt output of sjal000 is connected to the INT1 terminal of CPU; The communication between MCU and can controller is realized by interrupt; At the same time, in order to make the CAN controller and microcontroller reset reliably at the same time, a manual reset circuit is added. In addition, because ADC0809 converter has three state output latch function, it can be directly connected with 89C51 bus. ADC0809 converter is treated as an external RAM unit in the system.

4. Software design

The software design of intelligent sensor as a node mainly includes two parts: one part is to initialize MCU and sjal000, and the other part is the actual data acquisition and control function of the node. For the initialization of CAN controller, different contents are written to each register, in which the communication between CAN controller and MCU is interrupted. The process is shown in Figure 4.

The initialization procedure of sjal000 is:

Mova, # 0Bh 04H is the address of ACR register, and 00h is the address of Cr register

MOVDPTR , # 8000H

[email protected] A, open error and receive interrupt, SJA1000 enters reset mode

MOVDPTR , # 8004H

MOVA , # 02H

[email protected] , A

Inc dptr 05H is the AMR register address. Set to receive all


[email protected] , A


Mova, # 01h 06h is the register address of btr0

[email protected] , A


Mova, # FFH 07h is the register address of btrl, write btr0 and btrl, and set the baud rate to 160K

[email protected] , A


Mova, # 0ah and 08h are OCR register addresses, and sjal000 is output in normal mode

[email protected] , A


Movdptr, # 801fh, 1fh is the CDR register address, so that the microcontroller is the same as the clock of sjal000

[email protected] , A

MOVA , # 0AH

MOVDPTR , # 8000H

[email protected] , a writes CR register to make sjal000 enter working mode


5. Conclusion

The CAN bus is applied to the intelligent sensor, so that the signal obtained by the sensor can be transmitted in real time, reliably, high speed and accurately through the bus. At the same time, because the whole intelligent sensor network adopts full digital communication, the bus also has good anti-interference ability, and there will be no network paralysis even under heavy load. These superior performances are inferior to other fieldbuses.

Responsible editor: GT

Leave a Reply

Your email address will not be published. Required fields are marked *