Preface
Communication often occurs during development. Today, I would like to share with you how a robot can achieve TCP communication with a visual host computer.
Connected Robot
The robot used here is a Scara robot from the EPSON T3 series.
The robot software uses EPSON R V7.4.5. If you need the software, +V: thingerzj
First, you need to establish a connection with the robot. Generally, there are two ways to connect to the robot, one is the serial port and the other is the Ethernet interface. The Ethernet interface is used here.
SPEL+ Commands
EPSON robot programming uses SPEL+ language, and you need to refer to SPEL+ related commands for programming.
Here are some key commands for EPSON Ethernet programming.
1. SetNet command
Parameter list:
Communication port number: Specify the TCP/IP port number for which you want to set parameters. The range is 201 to 216.
Host Address: Specify the IP address of the host.
TCP/IP Port Number: Specify the TCP/IP port number.
Terminator: Specify a line end character among CR, LF, and CRLF.
Flow control: refers to software flow control, the default is NONE.
Timeout: Specify the maximum time for sending and receiving in seconds. If you specify 0, the timeout becomes infinite.
Communication protocol: Specify the communication protocol (TCP/UDP) type.
Example of use:
SetNet #201, "192.168.0.1", 2001, CRLF, NONE, 0
2. OpenNet Commands
Format:
OpenNet #Port Number As Client/Server
Parameter list:
Port Number: An integer value that specifies the TCP/IP port number to be opened. The port number range is 201 to 216.
Example of use:
Funcon tcpip String data$ OpenNet #201 As Client WtNet #201 Input #201, data$ Print "received '", data$, "' from host 1" Fend
3. ChkNet Command
Format:
ChkNet (communication port number)
Parameter list:
Communication port number: Specify the TCP/IP port number (201 to 216).
Return Value
Returns the number of characters received (an integer value).
If there is no receive data, the following negative value returns the port status.
-1 The port is open, but communication is not established
-2 Another task is using the port
-3 Port not open
Usage Examples
Integer numChars numChars = ChkNet(201)
4. Line Input Command
Format:
Line Input #Port number, string variable name$
Parameter list:
Port number: an ID number that indicates a file, communication port, database, or device.
String variable name$: Specifies the string variable name.
EPSON Programming
1. TCP sub-function
'Define receiving and output variables Global String ReceiveData$, SendData$ Function ASTCPClient 'Set IP address, port number, end character, etc. SetNet #201, "192.168.1.100", 2000, CRLF, NONE, 0 'The robot acts as a client and opens the port OpenNet #201 As Client 'Wait for connection WaitNet #201 'Connection successful display Print "TCP ConnectOK....." Do 'Reconnect after disconnection If ChkNet(201) = -3 Then 'Check the port status (>0 is the number of buffered characters. <0 is an abnormal state) CloseNet #201 'Close the port and reconnect Wait 0.2 OpenNet #201 As Client 'Open the client WaitNet #201 'Waiting for connection EndIf 'Receive data from host computer If ChkNet(201) > 0 Then Line Input #201, ReceiveData$ Print "【" + Da$ + " " + TIme$ + "】" + "Received data from the host computer: " + ReceiveData$ EndIf 'Send data If SendData$ <> "" Then Print #201, SendData$ Print "【" + Date$ + " " + TIme$ + "】" + "Send to host computer:" + SendData$ SendData$ = "" EndIf Loop Fend
2. Main function call
Function main 'Multi-threaded execution Xqt ASTCPClient Fend
Communication test
1. First use the network debugging assistant to open a TCPServer, the IP address is 192.168.1.100, here you can set it according to your computer IP, the port number is 2000.
2. Select Run in the menu bar of the EPSON robot to directly load the program into the robot.
3. After the download is complete, click Start to achieve communication.
4. You can send instructions to the robot through the network debugging assistant.
Review editor: Tang Zihong
Previous article:The global robot market is expected to exceed US$65 billion in 2024
Next article:5G+AI: The future of the robotics industry
- Popular Resources
- Popular amplifiers
- Using IMU to enhance robot positioning: a fundamental technology for accurate navigation
- Researchers develop self-learning robot that can clean washbasins like humans
- Universal Robots launches UR AI Accelerator to inject new AI power into collaborative robots
- The first batch of national standards for embodied intelligence of humanoid robots were released: divided into 4 levels according to limb movement, upper limb operation, etc.
- New chapter in payload: Universal Robots’ new generation UR20 and UR30 have upgraded performance
- Humanoid robots drive the demand for frameless torque motors, and manufacturers are actively deploying
- MiR Launches New Fleet Management Software MiR Fleet Enterprise, Setting New Standards in Scalability and Cybersecurity for Autonomous Mobile Robots
- Nidec Drive Technology produces harmonic reducers for the first time in China, growing together with the Chinese robotics industry
- DC motor driver chip, low voltage, high current, single full-bridge driver - Ruimeng MS31211
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Problems with current sinking and current sourcing of the I/O port of the msp430 microcontroller
- Newbie help, how to modify the contents of a file with the suffix bin
- From fail to pass, what does DDR debugging go through?
- [Mil MYS-8MMX] Part 1: Unboxing~
- How to keep one decimal place in C language
- Common problems and solutions in CCS compilation
- First week of SensorTile.box initial experiment
- [Fudan Micro FM33LC046N] FLASH basic time simple test
- EEWORLD University Hall----POS Printer/Printer Special
- High-performance C6000 DSP architecture