CAN bus-based monitoring system for high and low temperature test chambers
2026-04-06 06:37:26··#1
Abstract: This paper introduces a high and low temperature test chamber monitoring system based on CAN bus, characterized by the use of CAN bus for information transmission. The paper details the CAN bus interface board with the MCP2510 bus controller as its core, including both hardware and software design. The hardware section focuses on the structural features and interface design of the MCP2510, while the software section focuses on the programming design of the MCP2510 and the microcontroller. Keywords: CAN bus; MCP2510; programming The high and low temperature test chamber is mainly used to assess the high and low temperature performance of products and is an indispensable piece of equipment for enterprises to conduct environmental testing. It mainly consists of a chamber, a refrigeration unit, and a heating unit, and includes a temperature display and a simple control system. Due to the long duration of high and low temperature tests, the noise and vibration during operation, and the harsh environment, computer monitoring of the high and low temperature test chamber is of practical significance. Traditional equipment monitoring systems mostly use serial communication methods such as RS232 and RS485, which have poor real-time performance, scalability, and reliability. CAN bus is a type of fieldbus that effectively supports distributed and real-time control. It is an open, digital, multi-point serial communication network. This paper designs a distributed high and low temperature test chamber monitoring system based on CAN bus. The system has a simple structure, low cost, and good real-time performance, scalability, and reliability, making it highly practical. 1 System Overall Structure The system includes a main controller (industrial control computer, including a PC-CAN interface card) and multiple node controllers (CAN interface control boards), adopting a bus network topology with passive tap connections, thus ensuring high system reliability. Information transmission uses the CAN communication protocol, and the communication medium is twisted-pair cable. The system composition is shown in Figure 1. In the figure, the industrial control computer (including the PC-CAN interface card) is installed in the control room, and the high and low temperature test chamber is placed in the work area. The two locations are connected by a twisted-pair cable, with a distance of approximately 50m. A 120Ω terminating resistor needs to be shorted at both ends of the twisted-pair cable. The industrial control computer used is the Advantech IPC610 from Taiwan, which has good hardware and software compatibility. A PCL-841 CAN-PC interface card is inserted into the ISA slot of this industrial control computer, allowing it to be connected to the CAN bus. The control software of the industrial control computer can set the operating modes of the high and low temperature test chamber: high temperature test, low temperature test, temperature shock test, and custom mode. Each mode allows setting a preset temperature and holding time. The temperature shock test also allows setting the number of cycles. The custom mode consists of the above three basic modes arranged in a certain process, and each node can independently set its operating parameters. [align=center] Figure 1 Composition of the high and low temperature test chamber monitoring system[/align] The CAN interface control board is the core of the system. It is responsible for communicating with the CAN bus and also performs functions such as temperature signal acquisition and control of heating and cooling devices. It contains a CAN bus transceiver and controller, a microcontroller, and a temperature sensor interface. After power-on, the CAN interface control board periodically collects the temperature data of the high and low temperature test chamber through the temperature sensor and uploads it to the industrial control computer for display and storage. The industrial control computer sends specific commands to the CAN bus according to the user-set working mode. After receiving the command, the CAN interface control board controls the start and stop of the heating and cooling devices according to the predetermined algorithm, completing the corresponding operations. The following will focus on the hardware and software design of the CAN interface control board. 2 Hardware Design of CAN Interface Control Board The CAN interface control board consists of components such as the MCP2551 bus transceiver, the MCP2510 bus controller, and the PIC12C672 microcontroller. Its circuit principle is shown in Figure 2. The MCP2551 bus transceiver is connected to the system physical bus and has differential transmission and reception capabilities, allowing many nodes to be connected to the same network. It serves as the interface between the MCP2510 bus controller and the system physical bus. The MCP2510 bus controller is responsible for sending, receiving, and filtering messages, and is the core component of the CAN bus interface control board. It supports the CAN bus V2.0A/B technical specification, can send and receive standard and extended messages, and also has acceptance filtering and message management functions. This device includes three transmit buffers and two receive buffers, reducing the management burden on the MCU. The MCP2510 communicates with the MCU via an SPI interface, with a data transfer rate of up to 5Mb/s. To simplify circuit design and reduce costs, we chose the PIC12C672 microcontroller as the control MCU for the MCP2510. The PIC12C672 is a RISC microcontroller manufactured by Microchip Technology, Inc. It has only 35 instructions, with an instruction cycle as short as 1µs. Except for jump instructions, all instructions are single-cycle instructions, resulting in high operating efficiency. Internally, it integrates 2K (14-bit wide) of programming space and 128 bytes of RAM, as well as a 4-channel 8-bit A/D converter, a 4MHz RC oscillator, a power-on reset circuit, and a watchdog circuit. With only 8 pins, it is small in size, requires simple peripheral circuitry, and offers high cost-effectiveness. The MCP2510 communicates with the MCU via an SPI interface. However, the PIC12C672 itself does not have an SPI interface. Therefore, four ordinary I/O lines, GP5, GP4, GP1, and GP2, are connected to the CS, SO, SI, and SCK pins of the MCP2510, respectively, and the SPI interface protocol is implemented using a software algorithm. The timing sequence for the SPI interface read command is shown in Figure 3. At the start of the read operation, the CS pin is set to a low level. Subsequently, the read command and the 8-bit address code (A7 to A0) are sequentially sent to the MCP2510, and each data bit is indented on the rising edge of SCK. After receiving the read command and address code, the data in the designated address register of the MCP2510 is output to the SO pin on the falling edge of SCK. Pulling the CS pin high ends the read operation. An external 8MHz crystal is connected to the MCP2510 as an oscillator, and the CAN bus speed is configured to 125kbps. The MCP2510 has three pins (TX0RTS, TX1RTS, TX2RTS) that can be configured as general-purpose input pins, and two pins (RX0BF, RX1BF) that can be configured as digital output pins. These pins are controlled by the PIC12C672 microcontroller through the MCP2510's SPI interface. In this application, TX0RTS, TX1RTS, and TX2RTS are configured as input pins and connected to three-position DIP switches to set the ID address of the CAN interface board. RX0BF and RX1BF are configured as digital output pins, controlling the heating and cooling devices of the high and low temperature chamber through drive circuits and relays, respectively. 3. Software Design of the CAN Interface Control Board The main functions of the CAN interface control board are: periodically collecting temperature data and sending it to the industrial computer via the CAN bus; and controlling the start and stop of the heating and cooling devices according to a predetermined algorithm after receiving heating and cooling commands from the industrial computer. Therefore, in addition to hardware design, we also need to write a program for the PIC12C672 microcontroller to implement the functions of the CAN interface control board. The microcontroller was programmed in assembly language, developed and debugged using the PICRICE emulator from Fuzhou Beineng, and programmed using the PICSTART PLUS programmer. The main program flowchart of the microcontroller is shown in Figure 4: [align=center] Figure 4 Main Program Flowchart of the Microcontroller[/align] The initialization of the PIC12C672 mainly involves configuring the I/O pins, setting the timer interrupts, and configuring the A/D conversion module. The initialization of the MCP2510 mainly involves setting the bus clock frequency to 125kbps, configuring the interrupt signals, configuring TX0RTS, TX1RTS, and TX2RTS as general-purpose input pins, and configuring RX0BF and RX1BF as digital output pins. The MCP2510's transmit operation is implemented through three transmit buffers, each occupying 14 bytes of SRAM. The first byte is the control register TXBNCTRL, which sets the conditions for information transmission and provides the transmission status. The second to sixth bytes are used to store standard and extended identifiers and arbitration information, and the last eight bytes are used to store the data to be transmitted. The MCP2510's receive operation is implemented through three receive buffers. Among the three receive buffers, the MAB (Message Integration Buffer) can always receive the next message from the bus, while the other two receive buffers, RXB0 and RXB1, receive complete messages from the protocol engine. The MAB combines the received messages and sends the messages that meet the acceptance filter conditions to the RXBN buffer. The corresponding CANINTF.RXNIF bit of the receive buffer will be set to 1, and the device will generate an interrupt on the INT pin to indicate that a valid message has been received. References [1] MCP2510 - Independent CAN Controller with SPI™ Interface. Microchip Technology Inc, 2004. [2] A Simple CAN Node Using the MCP2510 and PIC12C67X. Microchip Technology Inc, 2002. [3] Wu Kuanming. CAN Bus Principles and Application System Design. Beijing University of Aeronautics and Astronautics Press, 1996. [4] Yu Yongquan. FALSH Microcontroller Principles and Applications. Electronic Industry Press, 1997.