Research on the Application of CAN Bus Network in Television Surveillance System
2026-04-06 09:05:48··#1
Abstract: This paper addresses the real-time communication problem in multi-channel, multi-microcomputer television monitoring systems. Utilizing microcontroller technology and local area network (LAN) principles, a multi-master fieldbus LAN was developed, employing the SJA1000 as the CAN controller and the microcontroller as the core network node device. Practice has proven that the application of CAN bus technology solves the system's real-time communication problem, demonstrating the superiority of CAN bus technology. Keywords: Real-time communication, SJA1000, CAN bus Abstract: Based on the problem in the multichannel and multicomputer TV supervisory system, this article discusses how to use the Single-Chip Microcomputer and the theory of area networks to investigate the CAN industrial network with SJA1000 and the Single-Chip Microcomputer. Facts show that it solves the real-time problem of the system and also demonstrates the superiority of the CAN bus as one of the field buses. Keywords: real-time, SJA1000, CAN industrial network With the development of computer technology, communication technology, and television technology, in many situations, in order to monitor and control the operation of the site, TV monitoring systems have been proposed for centralized control, especially when the control point is far from the site and a large number of monitoring points are required, forming a multi-microcomputer system with the control point and each monitoring point. With the development of fieldbus technology, the CAN bus, with its unique advantages, has begun to emerge. The CAN bus can achieve a transmission distance of up to 10km and a data transmission rate of up to 1Mbit/s, effectively solving the problems of long transmission distance and high real-time performance required in this TV monitoring system. Meanwhile, the CAN bus does not contain the destination address in the message transmission. Based on the whole network broadcast, each receiving station filters the message according to the identifier reflecting the data nature in the message [1]. This message format without the destination address shortens the frame length, reduces the trouble of address matching in the transmission, and improves the transmission rate. This whole network broadcast form makes each node station without master and slave distinction, and can send messages to other nodes equally, reducing the burden on the node that will be the master node, and also avoiding communication between master and slave. This multi-master bus LAN realizes the real-time and high data requirements of the system functions of this TV monitoring system. 1 Introduction to the multi-channel multi-microcomputer TV monitoring system As shown in Figure 1, this system is equipped with 64 color cameras. Each camera is equipped with an automatically adjustable lens and pan-tilt unit. Each unit is a node of the CAN bus network, and the 64 nodes constitute the controlled unit. These 64 devices are distributed in outdoor, indoor, square, platform and other places. Each node is centered on the main control room and is connected to the host computer in the main control room through the CAN bus and 64 video cables. [align=center]Figure 1 Composition of a Multi-Channel Multi-Microcomputer Television Monitoring System[/align] The main control room serves as the system control center, acting as the host computer in the CAN bus network. Although this system is a multi-master control system, it requires a central control room to coordinate and manage the various sub-control rooms. The main control room mainly consists of a host computer with a CAN interface and a television screen wall composed of color monitors, serving as the overall monitoring of the system. The remaining control consoles are equipped with one color monitor for auxiliary monitoring. This system can connect to four independent control console terminals. Each control console terminal plays the same role as a color camera and pan-tilt unit, forming a CAN bus network node. The four control consoles form a master control unit, but must obey the coordination of the host computer main control room. It is the command terminal for programming and setting camera control. The four control consoles are located in the relevant departments of each building, with the furthest distance from the main control room reaching 1km. 2 Communication Circuit Design Principles 2.1 Gimbal and Lens Controller The gimbal has up, down, left, and right rotation control, which is achieved by controlling the forward and reverse rotation of two motors. The lens has six power-on and breakpoint switches for aperture (large/small), focal length (long/short), and zoom (large/small). In addition, there is wiper action control. As shown in Figure 2, the 89C51 is used as the CPU controller. The TXD and RXD communication lines are connected to the optical isolator and CAN controller respectively, and connected to the CAN bus via the CAN bus transceiver to complete the connection circuit with the host computer with a CAN interface card, using the CAN bus protocol. In addition, the 2732 is an EPROM that stores the control program. Ports P1 and P3 are used as 11 switch inputs. In addition to serving as 8 switch inputs and outputs, port P1 also uses two 74LS244s to implement 8-bit DIP switches as inputs for setting the hardware serial numbers of 64 controllers. [align=center] Figure 2 Schematic diagram of gimbal and lens controller circuit[/align] 2.2 Control Console Circuit Design The control console circuit basically consists of the following three parts: 1. Keyboard interface. A real-time scanning scheme with row output and column input is adopted. The 74LS373 is used as the row output interface, and the 74LS244 as the column input interface. The buttons are divided into three categories: numeric keys (0-9); function keys including actions, execution, left shift, right shift, lock, cycle, mode, readout, and time functions; and camera action control keys including up, down, left, right, aperture (large/small), focal length (large/small), zoom (large/small), and wiper operation. 2. LED digital display interface. 3. DIP switch interface. Refer to Figure 2. 4. LED indicator. Used as an indicator of operating status. 5. CAN control unit interface. This is an interface with the same function as the pan/tilt/lens control circuit. 2.3 Main Control Room Circuit Design As shown in Figure 1, the network structure formed by this system is a distributed network. There are two types of interfaces: a video matrix switching control circuit and a serial interface for multi-channel control—the CAN bus. The host computer in the main control room connects to the lower-level nodes via a CAN interface card (using an SJA1000 controller). The video matrix switching control circuit mainly receives video images transmitted from cameras and pan-tilt units (PTZs) and outputs them to each sub-control room. Since the video signal needs to be transmitted through the digital channel of the CAN bus, it must undergo A/D and D/A conversion, increasing the overall system complexity. Therefore, a dedicated analog channel—video cable—is used for video signal transmission. To improve efficiency, a DS87C520 microcontroller is used to control the DG884 chip for image signal switching. 1. CAN Interface Card This is an interface card located on the host computer, used to connect the lower-level microcontroller to the host PC. The controller transceiver used in this card is the same as those used in the pan-tilt unit, lens controller circuit, and other controller circuits. The typical circuit of this interface is described in detail below. This interface circuit mainly consists of an 89C52 microcontroller, a PHILIPS SJA1000 CAN controller, and a PCA82C250 transceiver. The CAN controller function is like a clock source reset signal, generated by an external reset circuit. The chip select of the SJA1000 is controlled by the P2.7 port of the microcontroller [3]. [align=center] Figure 3 CAN controller interface connection diagram[/align] The PCA82C250 and CAN bus interface adopt certain safety and anti-interference measures. The CANH and CANL pins of the 82C250 are each connected to the CAN bus through a 5-ohm resistor. The resistor can play a certain current limiting role and protect the 82C250 from overcurrent impact. Two 30pF small capacitors are connected in parallel between CANL and CANH and ground, which can filter out high-frequency interference on the bus and have a certain ability to discharge electromagnetic radiation. In addition, a protection diode is connected in reverse between the two CAN bus access terminals and ground. When the CAN bus has a high negative voltage, the short circuit of the diode plays a certain overvoltage protection role. A slope resistor is connected to the RS pin of the 82C250. The size of the slope resistor can be adjusted appropriately according to the communication speed, generally between 16K and 140K. 2. Video Switching Matrix Circuit Design The main control room can connect 64 video channels with 16 video output channels, and each output channel can be connected to any one of the 64 input channels. This matrix is divided into 8 standard 8-input 16-output switching boards, requiring only one 8-to-1 board number. Each board has 4 DG884 circuits. The video input signals IN1~IN8 of each DG884 constitute 8 video input signals; the video output signals OU1~OUT4 of each DG884 are output independently, forming 16 output channels per board. The 16 channels of the 8 input switching boards are connected to the corresponding output channels, thus forming a 64-input 16-channel output switching matrix. [align=center] Figure 4 DG884 Logic Diagram[/align] The DG884 is a digitally selectable 8-input 4-output monolithic matrix switcher integrated circuit, and its internal function is shown in Figure 4. The signal channels consist of T-shaped switches in the matrix and additional low-resistance switches connected in series with each output. In the digital signals of the DG884 and DS87C520 microcontroller interface, RESET is used for power reset. It removes the data from the existing item latches and turns off all outputs. RESET is only effective for existing item address latches and has no effect on latches storing other set of setting data. A2A1A0 are 8-channel input addresses; A3=1 enables them, and A3=0 disables them. B1B0 are output channel selection addresses; WR is the write signal. Setting it low and then back high repeats this action 3 times, allowing 4 channels to be set. However, the internal logic prohibits connecting two different inputs to the same output address. After storing the data for the 4 input/output channels, simply setting SALVO low and then back high will remove the old data from the existing item latches and load the new setting information. 3 Software Design The software design of this system mainly focuses on information transmission. Based on the CAN2.0 protocol, a custom communication protocol is defined, and a modular design is adopted. 3.1 User Protocol In the action frame, 000 is the frame number, used to identify the type of frame. The destination of the transmitted frame is selected according to the contents of the acceptance filter. This utilizes the characteristics of the CAN2.0 protocol. Actions include control commands for camera action and control commands for image switching, depending on the preceding content. In the switching frame, 001 is the frame number. There are four working modes: 00 for fixed point; 01 for loop; 10 for four-screen loop [4]. [align=center] Figure 5 User Protocol [/align] The data part mainly determines the channel number, fixed point number, loop number, etc. of the transmission according to the different working modes. In the time frame, 010 is the frame number. Loop time refers to the loop time of the image [4]. In the CAN system, data is sent and received between nodes in four different types of frames, of which: data frames transmit data from the transmitter to the receiver; remote frames are sent by the node to request the transmission of data frames with the same identifier; error frames can be sent by any node to detect bus errors, and overload frames are used to provide additional delay between previous and subsequent data frames or remote frames. In addition, data frames and remote frames are separated from previous frames by inter-frame space. With the complete underlying and upper-layer protocols, the software part of this system can be designed. It mainly focuses on information transmission and adopts a modular design. The following describes the program design for information transmission in detail. For other parts, readers can refer to the relevant papers in the references [4]. 3.2 Software block diagram 1. Main program module The main program module is shown in Figure 6, which performs unified management and scheduling of the system. [align=center] Figure 6 Main program block diagram[/align] 2. Initialization module This module mainly initializes the system, including the initialization of CAN controller SJA1000, DG884, etc. The initialization program flow of SJA1000 is described in detail here. The independent CAN controller SJA1000 has two different operating modes: BasicCan mode and PeliCan mode. BasicCan mode is the default operating mode upon power-up. PeliCan is the new operating mode, capable of handling all frame types defined by CAN 2.0. It also provides some enhanced functions; this system uses PeliCan mode. Before transmitting information, the SJA1000 must be initialized, which is a crucial step. Its mode register, clock divider register, receive code register, receive mask register, bus timing registers 0 and 1, output control register, transmit error counter, error code capture register, and interrupt enable register are initialized according to PeliCan mode. Only then can information reception and transmission proceed. 3. Transmitting and Receiving Information Modules According to the CAN protocol, information transmission and reception are completed by the SJA1000 initialization. See Figures 7 and 8. [align=center] Figure 7 Transmitting Information Module Figure 8 Receiving Information Module[/align] After the SJA1000 initialization is complete, it enters its operating mode. The contents of the status register can be read to determine whether the transmission completion status bit, the reception status bit, and the transmission buffer status bit meet the prerequisites for transmission. When the contents of the status register fully meet the requirements for sending data, the data to be sent is put into the transmission buffer, and then the "transmission request" flag in the command register is set to control the transmission. In this system, interrupt transmission is used. The received information is put into the receive buffer. The information that can be sent to the main controller is marked by the status register's receive buffer status flag "RBS" and the receive interrupt flag "RI". The main controller will send this information to the local information memory, then release the receive buffer and operate on the information. The receiving process adopts the polling reception method. 4. Frame information processing module [2] mainly stores the information of each frame from the buffer. As can be seen from the user protocol, there are three types of frames: action frames, switching frames, and time frames. Therefore, in this module, the corresponding content is executed according to the type of frame received. 5. Image switching module [2] switches one by one in the channel order. 4 Conclusion This system truly realizes real-time communication using CAN industrial network, giving full play to the advantages of CAN bus. As a multi-master bus, CAN can achieve a transmission rate of 1Mbps[1], which well meets the needs of industrial control and improves the overall performance of this system. At the same time, CAN network nodes are unlimited, and up to 110 nodes can be connected[1], which facilitates the construction of large-scale industrial control networks. In terms of transmission distance, the longest transmission distance can reach 10Km[1], meeting the requirements of long-distance transmission. Practice has proven that CAN bus network communication has high efficiency and high accuracy, and is worth promoting in industrial control systems. References [1] Wu Kuanming. CAN bus principle and application system design. Beijing University of Aeronautics and Astronautics Press. 1996 [2] Ma Chongliang and Wang Jinhai. Multi-channel multi-microcomputer television monitoring system. Journal of Tianjin Textile Institute, 1997, Vol. 16, No. 4 [3] SJA1000 User Guide. Philips.com. [4] Wang Jinhai and Ma Chongliang. Research on computer control of multi-channel video signal cross-point switch. Journal of Tianjin Textile Institute, 1997, Vol. 16, No. 4