Share this

Application of Mitsubishi PLC programming port communication technology in remote control of robotic arms

2026-04-06 05:56:43 · · #1
Xu Xiading, He Ping, Shi Xu, Chen Naijian, Jinan No.2 Machine Tool Group Co., Ltd.

This paper introduces the design of a VB-based remote control program for a PC and PLC handling robot, based on the characteristics of the programming port communication technology of Mitsubishi FX series PLCs. Through the specific application of the handling robot monitoring system software, it systematically introduces the MSComm communication control in the VB environment, the programming port communication protocol between the PLC and the host computer, the system control method design, and the implementation process of the monitoring software.

1 Introduction

Programmable Logic Controllers (PLCs) are widely used in industrial control due to their high reliability, adaptability, powerful interface functions, small size, and flexible configuration. However, in practical engineering applications, PLCs are generally integrated with host computers to form distributed/hierarchical control systems to complete monitoring tasks, which requires the use of PLC communication technology. After the control program is uploaded, the PLC's programming port is generally idle. In a robotic arm monitoring system, a Mitsubishi FX1N 40MR PLC acts as the lower-level machine, using its programming port as the communication port to output control quantities and acquire sensor data. The host computer, a personal computer (PC), performs sensor data analysis, motion planning, and status display to achieve real-time monitoring of the robotic arm. To achieve data communication between the PLC and the host computer, various development platforms can be used. VB is a completely independent Windows development system, a visual, object-oriented, event-driven high-level programming language. In particular, it provides a predefined object—the MSComm communication control. By setting the object's properties, sending information to the object, and writing response code for object events, serial communication between user applications can be easily accomplished. For monitoring systems composed of PLCs and host computers that communicate data via programming ports and serial ports, it provides stable and reliable communication.

Figure 1 Mechanical structure of the handling robot Figure 2 Pneumatic principle diagram

2 System control method for handling robots

The handling robot consists of a mechanical body, a pneumatic control system, and a PC-PLC monitoring system, as shown in Figure 1. The robot comprises a base, a waist section, an arm, and grippers, which respectively perform twisting, lifting, gripper rotation, arm extension/retraction, and gripper clamping actions. These five actions are driven by cylinders, and the pneumatic principle is shown in Figure 2. The twisting cylinder, lifting cylinder, and arm extension/retraction cylinder are controlled by three-position five-way valves, while arm rotation, gripper clamping, and pneumatic system on/off are controlled by two-position five-way valves. The control of each solenoid valve is achieved remotely via PLC.

To monitor and control the working status of the robotic arm, and to fully utilize the remote control and management functions of the computer system, we have defined the control system as a two-level computer monitoring system: a PC computer at the management level and a programmable logic controller (PLC) at the control level. The system composition is shown in Figure 3: the system consists of a host computer (PC), PLC, drive circuits, actuators, sensors, and external control signals.

3. Basic Communication Protocol between PLC Programming Port and Host Computer

A PC with an asynchronous communication adapter and a PLC can only communicate with each other if the following conditions are met:

(1) The asynchronous communication interfaces of the PC and PLC adopt the same bus standard. Otherwise, they must be converted through a "bus standard conversion unit" before they can be interconnected. In the control system of the handling robot, the PC and the FX series PLC cannot be directly connected. They must be converted to RS232C/RS-422 through the FX-232AW unit. That is, the host computer and the programmable controller are connected and communicated through an RS232/422 programming cable.

(2) Initialize both sides to make the baud rate, data bits, stop bits, and parity the same. The FX series PLC adopts an asynchronous format, consisting of 1 start bit, 7 data bits, 1 parity bit, and 1 stop bit, with a baud rate of 9600bps and characters in ASCII code.

(3) Strictly follow the PLC communication protocol and frame format to write the PC communication program. The FX series PLC has 4 communication commands: read command (0), write command (1), forced communication command (7), and forced disconnection command (8). At the same time, the FX series PLC adopts a character-oriented transmission protocol, using 5 communication control characters: ENQ - Computer sends a request (05H) ACK - PLC's acknowledgment of ENQ (06H) NAK - PLC's denial of ENQ (15H) STX - Information frame start marker (02H); ETX - Information frame end marker (03H).

The message format sent from the PC to the PLC is as follows:

For example, the message format for the PC to send a command to the PLC to read data from data register D0 is: Chr$(2) + "0" + "100001" + Chr$(3) + "55" ''' Reading data from D0, that is: ┑0100001┖55 where 1000 is the address number of D0 and 01 is the length of the data to be read. The message format sent by the PLC to the PC is as follows:

The PLC's feedback message format for PC read commands is: 9402000092

4. Write a communication program using VB.

Using the timer control and MSComm communication control provided by VB, object-oriented applications can be easily developed, and command transmission, data exchange, and graphical display can be completed in the timer control and communication control.

Figure 3 System control principle diagram

The first step in using the MSComm communication control is to establish a connection to the serial port. This is done by setting the CommPort, PortOpen, and Settings properties.

CommPort property: Sets or returns the communication port number. Note: Each MSComm control corresponds to one serial port. If the application needs to access multiple serial ports, for example, if the application needs to communicate with multiple lower-level PLCs, multiple MSComm controls must be used.

The Settings property sets or returns the serial communication protocol as a string. This property value consists of four settings in the following format: "BBBB, P, D, S", where BBBB is the baud rate, P is the parity check, D is the data bits, and S is the stop bits. In implementing communication between the host computer and the PLC, the Settings property value should be set according to the value of the D8120 unit of the slave PLC. The standard communication parameters for the Fx series are 9600, E, 7, 1.

The PortOpen property sets and returns the status of the communication port. Setting the PortOpen property to True opens the port, and setting it to False closes the port. Note: Before opening a port and establishing a connection, you must correctly specify the port number (which must be a physically or logically existing port) and the communication protocol using the CommPort and Settings properties. Once the port is opened, you cannot arbitrarily change the settings of the CommPort and Settings properties. If you must change these two properties during program execution, you should first close the port, change the settings, and then reopen the port.

When a port is opened, empty receive and send buffers are created; when the port is closed, the buffers are cleared. The MSComm control provides a series of properties to manage these buffers.

The InBufferSize and OutBufferSize properties allocate the size of the receive and send buffer memory.

The InBufferCount and OutBufferCount properties retrieve the number of bytes in the receive and transmit buffers, respectively. Setting these properties to zero during program execution clears either the receive or transmit buffer.

The Rthreshold and Sthreshold properties set the number of bytes that can be stored in the receive or send buffer before the OnComm event occurs. Setting these two properties to zero will suppress the corresponding OnComm event from occurring.

(a) Manual control interface (b) Automatic control interface Figure 4 Robot control interface

Input property: Gets the data in the input buffer and deletes the data stored in the input buffer.

Output property: Writes data to the send buffer.

The InputLen property: Sets and returns the number of characters read from the receive buffer by the Input property. If the Input property is set to zero, the MSComm control will read all the contents of the receive buffer when using the Input property. An example of a communication port initialization procedure is as follows: Private Sub Form_Load() performs communication port and initialization settings.

MSComm1.CommPort = 1 MSComm1.Settings = "9600,e,7,1" Port settings: baud rate 9600 bit/s, even parity, 7 data bits, 1 stop bit. MSComm1.InputMode = comInputModeText 'Text string reception mode' MSComm1.InBufferSize = 1024 'Input data receive buffer length' MSComm1.OutBufferSize = 512 'Output data buffer length' MSComm1.RThreshold = 0 'Generate a receive interrupt for each character received' MSComm1.SThreshold = 0 'Disable transmit interrupts, perform unconditional transmission' If MSComm1.PortOpen = False Then MSComm1.PortOpen = True 'Open serial communication interface COM1 End If End Sub

5. Implementation of Monitoring Software for Handling Robots

The monitoring program for the handling robot, written in the VB programming language, mainly consists of the following parts: a login and control mode selection screen, a manual control interface, and an automatic control interface. The manual and automatic control interfaces are shown in Figure 4.

The host computer primarily generates motion commands and, based on the sensor information acquired by the robotic arm, displays the robotic arm's movements in real-time on the computer screen. In case of a robotic arm malfunction, its movements can be remotely controlled via buttons on the manual control interface. The slave PLC controls the solenoid valves to drive the pneumatic actuators.

The manual control interface mainly consists of a status display area, a button control area, a position display area, a time display area, and various interactive control buttons, as shown in Figure 4(a). The buttons in the button control area are connected to the coils of each solenoid valve through the user program and the PLC to achieve remote control of the cylinder action. The number of control buttons for each cylinder corresponds to the number of coils in the solenoid valve; for example, a three-position five-way valve has three buttons, and a two-position five-way valve has two buttons.

The automatic cycle control interface mainly consists of a status display area, button control area, position display area, time display area, alarm area, and log report area, as shown in Figure 4(b). The status displays in the position display area are achieved through real-time communication between the PC and the PLC.

(1) Sending control commands

In both the manual and automatic cyclic control interfaces, control commands are sent via buttons in the button control area. Before sending a control command, a control command frame must first be formed. Typically, button control of the PLC controls intermediate auxiliary relays, which is a software-to-PLC command writing process. This process is implemented using the WriteToPLC() function, and its program is as follows: Public Sub WriteToPLC() Dim DUMMY As String If MSComm1.PortOpen = False Then MSComm1.PortOpen = True ''''''Open communication port Comm1 End If MSComm1.InputLen = 0 '''''Initialize communication port Comm1 MSComm1.Output = MWRITE(nCmdCounter) '''''Write data packet to communication port Comm1 End Sub All write commands in the control interface are implemented using the MWRITE() array. Its elements include, for example: MWRITE(1) = Chr$(2) + "1" + "0111011" + Chr$(3) + "89" ''' Grip M136 set to 1 MWRITE(2) = Chr$(2) + "1" + "0111010" + Chr$(3) + "88" ''''' Grip M136 set to 0

(2) Periodically read the status information of the robotic arm

The status display area shows the operating status of the solenoid valves for the gripper cylinder, arm cylinder, lifting cylinder, twisting cylinder, and wrist cylinder. When a button in the button control area is pressed, the status indicator light in the status display area will illuminate, indicating that a corresponding output terminal of the PLC is working. This signal is obtained through real-time data exchange with the PLC and represents the real-time status of the PLC terminal. Similarly, the position display area shows the position status of the piston rod of the robotic arm's movement cylinder, indicating whether it has reached its left or right limit. When the piston rod reaches its limit position, the limit alarm light in the corresponding position display area will illuminate, indicating that a corresponding input terminal of the PLC is working. This signal is also obtained through real-time data exchange with the PLC and represents the real-time status of the PLC terminal. The software obtains the status of each component of the PLC through read commands and the software's timer control Timer(). Read commands are implemented using the function Read From PLC(). The program is as follows: Public Sub ReadFromPLC() Dim DUMMY As String ''''Send read command to computer'''''''''''''' If MSComm1.PortOpen = False Then MSComm1.PortOpen = True End If ''Read data from D data register''''''' MSComm1.InputLen = 0 MSComm1.Output = ReadCmd(nCounter) '''''''Send string Do DUMMY=DoEvents() from array ReadCmd(20) from MSComm1.Output Loop Until MSComm1.InBufferCount >= 6 ReturnData(nCounter) = MSComm1.Input Store the signals received by MSComm1.Input in array ReturnData(), and then distribute them to various status displays in the user interface according to the received data.

All read commands in the manual interface are implemented through the array ReadCmd(). Its elements include, for example: ReadCmd(0) = Chr$(2) + "0" + "100001" + Chr$(3) + "55" '''Read D0 data

6. Conclusion

This paper systematically elucidates the design method of a PC-PLC programming port communication application in the VB environment through the specific program of a handling robot monitoring system. System operation demonstrates that the real-time communication program written using the PLC programming port and VB communication controls is reliable and stable, effectively meeting the application requirements of the handling robot real-time monitoring system.

Read next

CATDOLL Cici 109CM TPE (Soft Silicone Head with ivory Tone)

Height: 109cm Weight: 15.6kg Shoulder Width: 26cm Bust/Waist/Hip: 52/50/57cm Oral Depth: 3-5cm Vaginal Depth: 3-13cm An...

Articles 2026-02-22