Design of CAN communication for analytical instruments

The multi-component gas analyzer based on single chip microcomputer (80C196) or microprocessor (DSP, ARM, etc.) uses a powerful CPU, which can quickly measure various thermal parameters of various combustion equipment in real time. According to the measurement data, the air volume is adjusted by the automatic adjustment device to maintain an appropriate air / fuel ratio, so that the fuel system reaches the optimal operating state to obtain the highest combustion efficiency and the lowest fuel consumption. The instrument can also measure CO, SO2, NO, NO2, smoke blackness and other parameters, and is equipped with LCD screen, keyboard and other peripherals.

CAN (CONtroll Area Network) is one of the most widely used field buses in the world. It uses a serial multi-controller communication protocol that can effectively support distributed real-time control, and has high security and up to 1Mbps Communication rate.

A CAN bus network structure diagram including a PC and n-1 (n≤110) intelligent nodes is shown in Figure 1.

Figure 1 CAN network structure diagram of n nodes

The transmission of information adopts CAN communication protocol, and the transmission medium uses twisted pair. If it is necessary to further improve the anti-interference ability of the system, optical isolation can be added between the controller and the transmission medium. The power supply adopts DC-DC converter and other measures.

1 Development of CAN network application layer protocol for analytical instruments

The international standards of CAN only define the specifications of the physical layer and the data link layer. Since the number of CAN bus network nodes constructed by this project is not large, all nodes are designed by the project team and do not need to interface with international standard equipment, so Here, according to the specific situation of this project, a simple CAN application layer protocol is formulated.

According to the requirements of the factory, the initial network planning should accommodate at least 16 nodes. The host computer collects the information of each analysis instrument, including the analysis content of gas components, error information and some parameters of the measured gas, such as temperature, pressure, flow rate, etc., and also returns some control information to the intelligent node. In each analysis cycle, the gas component analysis result of the slave node is sent to the master node. After receiving the content of all the components to be measured, the master node sends all the information to the host computer. Any analysis instrument in the network can be used as a master node or slave node, even in the absence of a host computer can also be used as a host computer.

In the CAN system, the 11-bit (standard frame) or 29-bit (extended frame) identifier is used to identify the meaning of the data. The identifier determines the priority and waiting time of the information, and also affects the applicability of information filtering. Therefore, a reasonable and efficient information identifier ID allocation scheme is a prerequisite for giving full play to the performance of the CAN bus.

There are 32 mailboxes on the F2812 DSP chip, one of the main controllers of the analysis instrument. In SCC mode, 0-15 mailboxes are available. In eCAN mode, all 32 mailboxes are available. It is convenient for the master node to receive and receive information from the slave nodes. storage. Therefore, it is recommended to use the analytical instrument whose main controller is F2812 as the main node in the network, select the eCAN mode, use the standard identifier (11 bits), and perform the static allocation strategy shown in Table 1 to meet the host computer. And the master node to identify the source and meaning of the frame.

2 Network communication program

2.1 Initialization of upper computer

The upper computer side mainly completes the collection and display of the analysis results of each analysis platform, using a PC and a CAN communication card KPCI-8110. The independent CAN controller SJA1000 is integrated on the KPCI-8110. SJA1000 is used for moving target and area network control (CAN) in general industrial environment. It must be initialized before use.

The host computer display interface is written in VB, a visual object-oriented high-level language suitable for rapid development. The KPCI-8110CAN adapter card provides .dll drivers and .lib library functions. The configuration and data reading and writing of the CAN adapter card can be realized by calling related driver functions in the VB program.

The process of receiving data from the host computer is shown in Figure 2.

Figure 2 Flow chart of the host computer interface functions

After the data is received by the host computer, it is stored in a large-capacity memory buffer pool. The user only needs to query the amount of data in the buffer pool in real time through the function CAN_ReadDataNum (mindex), and then read and save it in time through the function CAN_ReadBlockData (mindex, num, obyte) . Where obyte is the start pointer of the received data.

CAN_ClearBlock (mindex, num, obyte) is to clear the buffer pool space starting from obyte pointer.

Note: Since the SJA1000 CAN controller stores 8 bits of data per address, and the F2812 built-in CAN controller stores 16 bits of data per address, and the identifier of the standard data frame does not start from the beginning of the byte, so define The identifier should be defined according to the requirements of different controllers. For example, the F2812 built-in CAN controller defines the data frame identifier as 344 0000 (bit28-bit18 is the identifier bit), and the corresponding identifier of the SJA1000 independent controller should be 1A20 (bit15-bit5 is the identifier bit).

Portable Solar Panels

Home Solar Energy Power System,Monocrystalline Solar Panel,Mini Solar Panel Generator,Solar Panels For Outdoor

Guangzhou Fengjiu New Energy Technology Co.,Ltd , https://www.flashfishbatteries.com

This entry was posted in on