Share this

Design and Implementation of Remote Input/Output Module for CNC System Based on CAN Bus

2026-04-06 05:59:42 · · #1
1 Introduction CAN, or Controller Area Network, boasts outstanding reliability, real-time performance, and flexibility in communication. Its applications extend beyond the automotive industry; in machine tool CNC systems, CAN primarily performs functions including: program management; machine tool system parameter input/output diagnosis and parameter communication; machine tool status acquisition; machine tool operating mode acquisition; and database management. Currently, the main market share of domestically produced CNC systems is in economical machine tool CNC systems. Economical CNC systems have a limited number of basic input/output interfaces with machine tools, often insufficient to meet practical operational needs. Furthermore, in actual workshops, the machine tool and CNC system may be far apart, making input/output signals highly susceptible to interference and errors during long-distance transmission. CAN bus, however, offers shorter transmission times, lower interference probability, and higher transmission speeds for long-distance signal transmission. Based on these reasons, this paper proposes a design concept for a remote input/output module for CNC systems based on the CAN bus. 2 Module Structure Design The module's structural design is as follows: CANIN and CANOUT are the input/output interfaces of the CAN bus. DI and DO are the interfaces between the module and the machine tool. DI: Machine tool information input interface; DO: Information output from the CNC system to the machine tool interface. The information received by the D1 and DO interfaces are both switch signals. 3. Module Hardware Design The microprocessor in this input/output module is the STC89C516RD+ microcontroller from Hongjing Company. In the CAN bus communication interface, the CAN communication controller is the SJA1000, and the CAN bus driver is the PCA82C250. As shown in Figure 2, the hardware schematic of the CAN remote input/output module, the circuit mainly consists of six parts: the microcontroller STC89C516RD+, the independent CAN controller, the electrical isolation device 6N137, the CAN bus driver PCA82C250, the output module, and the input module. The microprocessor STC89C516RD+ is responsible for transmitting the data to be output to the output module, scanning the input points of the input module, initializing the SJA1000, and controlling the SJA1000 to achieve communication tasks such as data reception and transmission. The AD0-AD7 pins of the SJA1000 are connected to the P0 port of the STC89C516RD+. The chip select signal CS* is controlled by P2.7; when CS* is 0, the CPU can select the SJA1000 from the external memory address, thus enabling corresponding read/write operations on the SJA1000. The RD*, WR*, and ALE pins of the SJA1000 are connected to the corresponding pins of the STC89C516RD+, and INT* is connected to the INT0* pin of the STC89C516RD+, allowing the microcontroller to access the SJA1000 in real time via interrupts. A DIP switch is connected to the three ports of port P1 to determine the module's identifier, i.e., its ID number. The DIP switch values ​​range from 000 to 111, so the ID number ranges from 0 to 7. To enhance the anti-interference capability of the CAN bus nodes, the TX0 and RX0 of the SJA1000 are not directly connected to the TXD and RXD of the PCA82C250. Instead, a high-speed optocoupler 6N137 is added in between. This effectively achieves electrical isolation between the CAN nodes on the bus. However, this requires that the two power supplies VCC and VDD used in the optocoupler circuit be completely isolated; otherwise, its response speed is simply used as a low-pass filter. Complete power supply isolation can be achieved using a low-power DC-DC converter or a switching power supply module with multiple 5V isolated outputs. While this increases the complexity and cost of the interface circuit, it improves the stability and safety of the nodes. In the output module, each output point is connected to the P0 port of the STC89C516RD+ via a latch 74ALS273, and latched by the address decoded from P2 and the write signal WR*. In the input module, each input point is connected to the P0 port via a bus buffer 74ABT245, which is selected by the address decoded from P2 and the read signal RD*. This allows the STC89C516RD+ to easily access external I/O without additional hardware or software overhead, significantly improving its execution efficiency. The software design of the CAN bus CNC system remote input/output module mainly includes six parts: STC89C516RD+ initialization, CAN controller initialization, message sending, message receiving, output access to output points, and input point scanning. This design uses the standard frame format of CAN's PELIC mode. The program flow is shown in Figure 3. SJA1000 initialization can only be performed in reset mode. Initialization mainly includes setting the module's identifier, operating mode, receive filtering mode, receive mask register (AMR) and receive code register (ACR), baud rate, and interrupt enable register (IER) by adjusting the DIP switches. Machine tool information is transmitted to the CNC system: When a level change is detected in the machine tool's input signal, the module packages its own ID information and the input signal into a standard frame and sends it to the CNC system. The CNC system transmits commands to the machine tool: The module monitors the bus in real time. When there is information from the CNC system on the bus, it starts CAN reception. It determines whether the command frame should be received based on AMR and ACR. If it should not be received, the information is discarded; if it should be received, the command is output to the machine tool. 5. Module Application In practical applications, multiple input/output modules are connected to form a CAN network. The host computer for these modules is the machine tool's CNC system. The input/output interfaces of each module are connected to the machine tool, as shown in Figure 4. Note that in this network, a terminating resistor should be connected to each end of the bus. The terminating resistor absorbs excess energy from electrical pulses on the signal line, preventing reflections and signal confusion, which will lead to communication errors. Since the ID number of each module ranges from 0 to 7, this design allows for the expansion of 8 input/output modules externally to the CNC system. The ID numbers of each module must be unique, and the smaller the station number, the higher the priority. In this design, each module has 64 input points and 64 output points, thus expanding to a total of 512 (64 * 8) input/output points. 6. Conclusion The CAN bus-based remote input/output module for CNC systems not only expands the input/output nodes of economical CNC systems but also improves the accuracy of remote input/output signal transmission. This system passed field experiments, with one module connected to the bus, two modules connected, and eight modules connected in series. The operation of each module was tested, and information between the machine tool and the CNC system was transmitted correctly. The communication rate fully met the system's real-time performance requirements, and the system operated reliably. The system features a simple structure, high integration and intelligence, good structural and functional scalability, and high safety and reliability, significantly increasing the input/output nodes for communication between the CNC system and the machine tool. With the future development of factory automation, the CAN bus will have broad application prospects.
Read next

CATDOLL 138CM Airi(TPE Body with Hard Silicone Head)

Height: 138cm Weight: 26kg Shoulder Width: 30cm Bust/Waist/Hip: 65/61/76cm Oral Depth: 3-5cm Vaginal Depth: 3-15cm Anal...

Articles 2026-02-22
CATDOLL 133CM Kiki Shota Doll

CATDOLL 133CM Kiki Shota Doll

Articles
2026-02-22
CATDOLL 150CM Sana Mini TPE Doll

CATDOLL 150CM Sana Mini TPE Doll

Articles
2026-02-22
CATDOLL CATDOLL 115CM Tina TPE

CATDOLL CATDOLL 115CM Tina TPE

Articles
2026-02-22