background image

                          USR-N540    User Manual                                                www.usriot.com

 

 

 

Jinan USR IOT Technology Limited                                                    30 / 73                                                              [email protected] 

3.5.

 

Modbus Gateway 

3.5.1.

 

Transmit Modbus Protocol in Transparent Mode 

  USR-N540 supports the transmission of modbus protocol in transparent mode 

3.5.2.

 

Modbus RTU to Modbus TCP 

USR-N540 support Modbus RTU to Modbus TCP, setting method as below: 
 
1.

 

Open USR-TCP232-M4,E45 Setup Software, set USR-N540 as TCP server or TCP client. 

2.

 

Select “ModbusTCP” on the red color 

3.

 

Click to save the parameter 

 

Modbus TCP Configuration

 

 
4. Check and verify Modbus RTU to Modbus TCP through modbus Poll and Modbus Slave 
5. Setting modbus software is as below: 
 

Summary of Contents for USR-N540

Page 1: ...USR N540 User Manual www usriot com Jinan USR IOT Technology Limited 1 73 inquiry usriot com USR N540 User Manual File Version V1 1 2 ...

Page 2: ...ation 14 3 1 1 TCP Client Mode 14 3 1 2 TCP Server Mode 17 3 1 3 UDP Client Mode 18 3 1 4 UDP Server Mode 21 3 1 5 TCP and UDP Comparison 24 3 1 6 HTTPD Client 24 3 2 Socket B Communication 26 3 3 Short Link 28 3 4 USR VCOM Application 28 3 5 Modbus Gateway 30 3 5 1 Transmit Modbus Protocol in Transparent Mode 30 3 5 2 Modbus RTU to Modbus TCP 30 3 5 3 Modbus Active Query Function 31 3 5 4 Modbus ...

Page 3: ... 52 3 7 16 Flow Control RTS CTS XON XoFF 52 3 7 17 Reload 52 4 Setting Protocol 53 4 1 Network Setting Protocol 53 4 1 1 Set Parameter Process 53 4 1 2 Setting Command Content 53 4 1 3 Commands Return Content 56 4 2 Serial Setting Protocol 58 4 2 1 Error Code 58 4 2 2 AT Command 58 4 2 3 Enter AT Command Mode 60 5 Parameter Configuration 60 5 1 Software Configuration 60 5 2 Webpage Configuration 6...

Page 4: ...onment Hardware Connection USR N540 connects to PC by serial port and RJ45 Port Then power on USR N540 with our AC adapter The below picture will show you the connection Notes AC adapter 12V and connection cable are provided by USR IOT RS232 is involved no connection for RS485 PCs in above picture is the same one 1 2 Network Test Environment Please check PC setting after hardware connection 1 Disa...

Page 5: ...P address 192 168 0 7 Subnet mask 255 255 255 0 Default gateway 192 168 0 1 Default work mode of port 1 TCP Server Default local port of port 1 23 Default work mode of port 2 TCP Server Default local port of port 2 26 Default work mode of port 3 TCP Server Default local port of port 3 29 Default work mode of port4 TCP Server Default local port of port 4 32 Baud Rate 115200 Parity bit Data bit Stop...

Page 6: ...ronment 2 The right side is Network Settings TCP Client IP address 192 168 0 7 port number 23 click Connect to build TCP connection The left side is Serial Settings Baud Rate 115200 Parity Data bit Stop bit None 8 1 Click Open to enable the COM Then we can test data transmission between COM and network Data from serial to network is PC COM USR N540 COM USR N540 Ethernet port PC Network Data from n...

Page 7: ... port connect to device via port number 10 Support virtual serial port and provide corresponding software USR VCOM 11 Serial baud rate from 600bps to 230 4K bps Check bit of None Odd Even Mark and Space 12 Support static IP DHCP DNS and search devices within network through UDP broadcast 13 Provide serial and network setting protocol TCP IP socket example code such as VB C Delphi Android IOS 14 Bu...

Page 8: ... 230 4K bps Software parameters Network protocol IPV4 TCP IP UDP HTTP DHCP DNS ARP ICMP Web socket Access way to IP Static IP DHCP DDNS Support User parameters Software setting webpage setting Single transparent transmission TCP Server TCP client UDP Server UDP Client Modbus Modbus gateway Webpage to serial port Support the webpage to serial port in websocket communication customize Support Synchr...

Page 9: ...nology Limited 9 73 inquiry usriot com Stable class 2KV ESD SIZE 33 0x19 0x19 2 mm L W H Operating Temp 40 85 C Storage temp 45 105 C operating humidity 5 95 RH Storage humidity 5 95 RH Setting with delivery none Package Electrostatic bubble 2 4 Dimension ...

Page 10: ...1 It twinkles when port 1 sends data RX1 It twinkles when port 1 receive data TX2 It twinkles when port 2 sends data RX2 It twinkles when port 2 receive data TX3 It twinkles when port 3sends data RX3 It twinkles when port 3 receive data TX4 It twinkles when port 4 sends data RX4 It twinkles when port 4 receive data 2 5 2 Dial Switch N540 setting serial port can using webpage or dial switch When ch...

Page 11: ...OT Technology Limited 11 73 inquiry usriot com For RS232 port dial switch are down such as the below picture For RS485 port dial switch are up such as the below picture For RS422 port dial switch on the left are up dial switch on the light are down ...

Page 12: ...on For RS232 port pin definition is as below For RS485 port pin 3 works as B Pin 7 works as A For RS422 port 2 7 DB9 Pin board We provide DB9 pin board for user to use terminal connection Pin Definition 2 RXD pin of receives data 3 TXD 5 GND 7 RTS 8 CTS Pin Definition 2 RX pin of receives data 3 TX 5 GND 7 TX 8 RX ...

Page 13: ... B GND RS422 T T R R GND 3 Product Function USR N540 Function Diagram Each serial port corresponds to two socket socket A and socket B Socket B can be opened or closed Notes USR N540 supports double sockets It means one serial port corresponds to two sockets Socket A Supports TCP client TCP server UDP client UDP server Httpd client ...

Page 14: ...onnection built it sends keepalive searching packet every 15 seconds Once there is an interrupt it can be detected rapidly then make USR N540 disconnect from former connection and reconnect 3 It will connect to same source port when USR N540 try to connect server and local port is not 0 4 It supports USR Synchronous baud rate Similar RCF2217 which can revise USR N540 s serial parameter as baud rat...

Page 15: ...ther connection request 10 As TCP Client need to set USR N540 s local port number to be 0 then it can visit server with randomized port number so that it can solve unsuccessful re connection in case server judge connection status abnormally and shield USR N540 re connection request 11 Test Example Open USR TCP232 M4_E45 setup software Set USR N540 as TCP Client Remote IP 172 16 11 11 Remote port 8...

Page 16: ...eed to connect to PC s TCP Server its IP 172 16 11 11 Port number 8234 Click Listening TCP Client Test Screen shot USR TCP232 TEST software Configure serial parameter Click to open the port Test software network part shows connection message 192 168 0 7 49153 port assigned randomly Click send you can gain data from each side ...

Page 17: ...upports USR Synchronous baud rate Similar RCF2217 which can revise USR N540 serial parameter as baud rate accordingly This function should be combined with USR VCOM 4 Support Modbus TCP function 5 It support 8 clients connections at max 6 Under TCP Server mode USR N540 listens to local port actively and will not monitor connected IP and port When the 9th client is connected the oldest one will be ...

Page 18: ... 2 USR N540 only communicate with destination port of IP Otherwise the data cannot be received 3 Under this mode destination Address is 255 255 255 255 then it can make UDP broadcast and receive broadcast data Broadcast within segment as 192 168 0 255 it can be sent but cannot be received currently 4 Under UDP Client UDP Server mode 5 Test Example Open USR TCP232 M4 E45 Setup Software build a UDP ...

Page 19: ...uiry usriot com is 20108 Open USR TCP232 TEST Software set USR N540 as UDP Client destination port 20108 Click Send at serial side Remote IP and port becomes USR N540 s after receiving the data Then click Send in network part and send data to COM UDP Client Software Configuration ...

Page 20: ...USR N540 User Manual www usriot com Jinan USR IOT Technology Limited 20 73 inquiry usriot com UDP Client Testing Screenshot ...

Page 21: ...USR N540 User Manual www usriot com Jinan USR IOT Technology Limited 21 73 inquiry usriot com 3 1 4 UDP Server Mode ...

Page 22: ...destination IP to where data comes and it sends the data to the IP and port which communicate latest 2 Test Example Open USR TCP232 M4_ E45 Setup Software Set USR N540 as UDP Server local port 23 Open USR TCP232 TEST Software twice Set work mode as UDP remote IP and port same with USR N540 Click Send then the COM receive data Click Send at serial side only the software communicate latest can recei...

Page 23: ...USR N540 User Manual www usriot com Jinan USR IOT Technology Limited 23 73 inquiry usriot com UDP Server Test Screenshot UDP Server Test Screenshot ...

Page 24: ...val resulted from check and resend mechanism More less under bad network environment 3 1 6 HTTPD Client It is used to transmit data from USR N540 to HTTP server or gain data from HTTP server USR N540 can handle complex HTTP protocol so user just do programming for serial and not need to worry about HTTP When USR N540 sends data to HTTP server via serial port it only needs to send the header of req...

Page 25: ...erver POST will be available in the following GET is fixed packet header 1 php data is the visited submitted the page stands for data sent by serial Serial port does not need to send HTTP 1 1 is requested protocol Host is means requested IP address domain Enter twice 2 Save the parameters and restart USR N540 3 Open serial port to send data then the data can be submitted onto our webpage server ...

Page 26: ...f socket B Notes socket B is only used for transparent transmission and only worked as TCP client or UDP client Set USR N540 as double socket communication mode the data of serial port will be transparently transmitted to socket A and socket B at one time When data comes from socket A and socket B simultaneously USR N540 will transmit the data of socket A to serial port firstly and then transmit t...

Page 27: ...R IOT Technology Limited 27 73 inquiry usriot com 2 Set up socket A and socket B by USR TCP232 Test exe and open serial port which connects to server 3 Click Send on the software data will be transmitted from socket A and socket B to serial port ...

Page 28: ...esources to avoid maintaining too many useless connections Only for the mode of TCP client Disconnect time Only for TCP client If the network failure causes the link to break the device will actively connect to the server within fixed time 3 4 USR VCOM Application It solve the transmission problem of traditional device PC software working as COM USR VCOM Virtual com software support receiving data...

Page 29: ...logy Limited 29 73 inquiry usriot com Remote IP and port is the same one with USR N540 Remarks Can write the name of device 3 Click OK to check whether connection is built Connected sow ready for data transmission USR VCOM Add a COM USR VCOM Build Connection ...

Page 30: ...tocol in transparent mode 3 5 2 Modbus RTU to Modbus TCP USR N540 support Modbus RTU to Modbus TCP setting method as below 1 Open USR TCP232 M4 E45 Setup Software set USR N540 as TCP server or TCP client 2 Select ModbusTCP on the red color 3 Click to save the parameter Modbus TCP Configuration 4 Check and verify Modbus RTU to Modbus TCP through modbus Poll and Modbus Slave 5 Setting modbus softwar...

Page 31: ...ation finished update the data of modbus slave and modbus data will also be updated 3 5 3 Modbus Active Query Function Modbus active query function can be realized through the serial heartbeat packet function of USR N540 1 Open serial heartbeat packet function via web page query command is heartbeat packet data example ...

Page 32: ...USR N540 User Manual www usriot com Jinan USR IOT Technology Limited 32 73 inquiry usriot com 2 Set modbus slave software refer to the following ...

Page 33: ...USR N540 User Manual www usriot com Jinan USR IOT Technology Limited 33 73 inquiry usriot com 3 Return result for query command is as drawing ...

Page 34: ...4 Modbus Polling USR N540 support modbus polling function under TCP server mode Set USR N540 as Modbus Poll support multiple host polling to check parameter 1 Multiple host polling is realized through virtual com Set parameter of USR N540 via web page make sure to select Modbus TCP Poll and set time ...

Page 35: ...USR N540 User Manual www usriot com Jinan USR IOT Technology Limited 35 73 inquiry usriot com Open virtual com software to setup serial ports and connects to USR N540 ...

Page 36: ...are choose the serial port which connected with USR N540 Run modbus Poll software and make port forwarding with this serial port The value of modbus poll will also be changed when you revise the value of modbus slave 2 Conduct Modbus Polling through Modbus TCP to Modbus RTU Set USR N540 via software select Modbus TCP ...

Page 37: ... 37 73 inquiry usriot com Open modbus slave software choose the serial port which connected with USR N540 Run modbus polling software to select network mode and connect with USR N540 The value of modbus poll will also be changed when you revise the value of modbus slave ...

Page 38: ...odbus Polling supports 8 host query for the most more in the near future Need set polling time properly when using modbus polling function If polling interval is too shot and baud rate is too low for the process of polling command which might lead to conflict between command circle and polling time ...

Page 39: ...or data transmission or monitoring remotely This function only works in TCP client mode and supports the devices with firmware 3009 and later versions Login link of USRIOT Cloud http console usriot com Remote server address clouddata usriot com Local port The port of device Remote port Cloud software s port Device ID It is assigned to device by cloud software Communications Code Pass word generate...

Page 40: ...USR N540 connected to PC directly because generally PC don t have the ability of assigning IP Otherwise USR N540 cannot transmit data normally but wait for IP 3 7 2 DNS USR N540 access the domain name or dynamic domain name when work under Client mode The length of domain name must be less than 30 bytes USR N540 will analysis the domain name constantly if cannot connect to destination server When ...

Page 41: ...ww usriot com Jinan USR IOT Technology Limited 41 73 inquiry usriot com Network heartbeat packet It used for maintaining connection Only valid at the mode of TCP client and UDP client Beat time Set the heartbeat packet time ...

Page 42: ...orts to send registration package when sending data Network registration packet includes Establish a connection to send the registry packet data carrying or both Establish a connection to send the registry packet Send the registration packet immediately after the connection is established The length of registration packet is 40 bytes Data carrying The packet header is carried uniformly when sendin...

Page 43: ...USR N540 User Manual www usriot com Jinan USR IOT Technology Limited 43 73 inquiry usriot com Testing result ...

Page 44: ...nteraction between webpage and serial 1 Set port 6432 as default 2 Open webpage and click web to serial It pops up connect success then can send receive data Open USR TCP232 TEST Software configure serial parameter and click Open 3 Click send ASCII data COM can receive data Click Send in TEST Software webpage can receive data Web to Serial Webpage ...

Page 45: ...mited 45 73 inquiry usriot com Web to serial test Web to serial needs user s webpage programming ability Design webpage request own device s data and process data then reveal the results on webpage According to chapter4 1 17 Customized Webpage can download revised ...

Page 46: ... onmessage sMessage socket onclose sClose 2 Receive Data Function function sMessage msg 3 Send data function function send 3 7 6 Customized Webpage User can make revision as LOGO NAME on the basis of USR N540 s webpage to realize the personalized applications 1 Download Upgrade 2 http www usriot com e45 m4 seriesk3 self defined webpage Different firmware version with different tool please contact ...

Page 47: ...rinting Function Network printing function is similar to printer server it can be realized by the previous serial printer through the existed printing driver Testing Method Configure the parameter set work mode as TCP Server local port number 9100 and have to choose Net Buffer and PRINT Others do not need to be chosen Set Printer Driver ...

Page 48: ...al www usriot com Jinan USR IOT Technology Limited 48 73 inquiry usriot com Click next and input the USR N540 IP address then keep clicking next til finished Serial port connects to the printer open a word file to print ...

Page 49: ...on zero one Set packaging time and length as 0 USR N540 will conduct default packaging time when packaging time is set as 0ms Namely when serial port receiving data USR N540 will package and send the data to network if interval time more than packaging time of sending 4 bytes For example baud rate 115200 packaging time for 4 bytes is T 0 4ms when the calculated value is smaller than 0 1ms packagin...

Page 50: ...ep n T under baud rate 9600 3 7 10 Synchronous baud rate RFC2217 For encryption during data transmission devices change data bytes baud rate parity and so on USR N540 supports revise serial parameter accordingly Synchronous baud rate is named RFC2217 USR Similar RFC2217 make adjustments on the basis of RFC2217 protocol to improve accuracy of transmission Protocol length is 8 bytes And values taken...

Page 51: ...Enable Parity 5 4 Parity Type 00 ODD 01 EVEN 10 Mark 11 Clear 8 6 NC 000 0 Using methods 1 USR TCP232 M4 E45 Setup software click Synchronous baud rate RFC2217 2 When serial parameter changes is needed it send RFC 2217 packet USR N540 receive the command from network and revise serial parameter accordingly do not transmit the RFC2217 command transparently 3 7 11 Keep Alive When USR N540 s network ...

Page 52: ...031 and the later version enable 485 mode if you do not choose the hardware control None default serial port mode In this mode enable the control for 485 in 3031 and the later mode RTS CTS Hardware flow control function It is disabled by default Don t enable it if device doesn t support Hardware flow control Notes It is only run under RS232 port XoN XoFF Software flow control function It is disabl...

Page 53: ...mand process The network send searching command USR N540 returns IP address and MAC The network read USR N540 s parameter Organize setting command according to MAC known user name password and parameter to be configured Send setting command USR N540 returns correct setting Host PC send save setting command USR N540 returns correct Restart command USE N540 returns correct setting 4 1 2 Setting Comm...

Page 54: ...tarts from length byte including length to adding before checking not including checking result is check value only low byte is remained 1 Command examples Search command example Search command is set to FF 01 01 02 Sum check 02 01 01 Reset command example FF 13 02 d8 b0 4c 00 04 c9 61 64 6d 69 6e 00 61 64 6d 69 6e 00 c8 Sum check C8 13 02 6E 00 User name and password both are 5 bytes 00 bits 0 fo...

Page 55: ...lSubnetMask 4 00 FF FF FF Subnet Mask ucModName 16 55 53 52 2D 54 43 50 32 33 32 2D 45 00 00 00 00 USR N540 name username 6 61 64 6D 69 6E 00 username password 6 61 64 6D 69 6E 00 password ucNetSendTime 1 Write the read values uiId 2 01 00 Device ID ucIdType 1 0 Device ID type 0 3 0 no use 1 send id when connect 2 send id when send data 3 both ucUserMAC 6 FF FF FF FF FF FF MAC ucReserved 8 Unused ...

Page 56: ...00 IP address send in ASCII Example 192 168 0 1 ulTelnetIPAddr 4 00 00 00 00 Not adopted ucFlags 1 02 Enable MODBUSTCP 0x010 bit2 Enable 2217 0x08 bit3 Enable USR cloud 0x010 bit4 ucWorkMode 1 03 Working mode 0 UDP 1 TCP Client 2 UDP Server 3 TCP Server 4 HTTPD Client uiPackLen 4 C8 00 00 00 COM pack length ucPackTime 1 0A COM pack time ucTimeCount 1 91 Write the read values TCP server type 1 1 Wr...

Page 57: ...d 36 bytes FF 24 01 00 4B C0 A8 00 4D D8 B0 4C 00 04 C9 DD 07 01 00 55 53 52 2D 54 43 50 32 33 32 2D 34 30 31 00 00 EF The method of the check is as follow 0xEF 00 FF 24 01 00 4B 31 00 00 2 Return results of reset command Response 4 bytes FF 01 02 4B if user name and password are right 4B K FF 01 02 45 if user name and password are wrong 45 E 3 Return results of read command Description Return all...

Page 58: ...R4 Invalid Parameters ERR5 Operation not allowed ERR6 No operation permission 4 2 2 AT Command Details of AT command refer to https www usriot com download M4 USR N50 AT Command Set_V1 0 0 pdf AT Command List Command Instruction E Open close display function Z Reboot device VER Query version number ENTM Enter to transparent transmission mode MAC Query MAC USERMAC Set customize MAC RELD Restore to ...

Page 59: ...connection time of UARTn MODTCPn Query set Mudbus TCP function of UARTn MODPOLLn Query set Modbus poll function of the UARTn MODBTO Query set Modbus poll time function of the UARTn NETPRn Query set network printing function of UARTn WEBSOCKPORTn Query set websocket port of UARTn REGENn Query set registration package of UARTn REGTCPn Query set the type of send registration package of UARTn REGUSRn ...

Page 60: ...nfiguration How to configure Revise user name password set IP access method serial parameter USR N540 work mode work mode related parameter 5 1 Software Configuration To make sure setup software normal running please check the below firstly 1 USR N540 and setup software PC are within same LAN 2 Disable the anti virus software and firewall on PC 3 Disable network card nothing to do with this testin...

Page 61: ...inquiry usriot com Software Configuration Search 1 Click Device on the top of the program and then check user name password via User config If it is correct it reveals USR N540 information If not it pops up retype window click Confirm User name and password is admin by default ...

Page 62: ...n USR IOT Technology Limited 62 73 inquiry usriot com Software Configuration Password 2 Basic parameter configuration Click Full Show and all basic parameter is revealed Set the parameter as needs and click Base Save then can set successfully ...

Page 63: ...USR N540 User Manual www usriot com Jinan USR IOT Technology Limited 63 73 inquiry usriot com Software Configuration Full Show ...

Page 64: ...hapter 4 1 8 6 Device ID Device ID type sending ID type User name Authentication Code for revising parameter to avoid other users within same LAN revising it Password same as user name Device Name USR N540 s name an be revised MAC address USR N540 MAC IP address type Static and DHCP USR N540 static IP same segment with router Subnet Mask 255 255 255 0 by default Gateway it is router IP generally c...

Page 65: ...re hardware flow Work Mode TCP Server TCP Client HTTPD Client UDP Client UDP Server Destination IP Port IP connected when USR N540 works as client TCP Client HTTPD Client UDP Client Local Port port USR N540 to connect Advice to set it to 0 when USR N540 works under TCP Client for connection with Random port TCP Server Type No Modbus TCP set this when Modbus TCP to Modbus RTU is needed Serial pack ...

Page 66: ...com During firmware upgrade USR N540 connects to PC directly PC Upgrade via Wi Fi is prohibited Firmware Upgrade 5 2 Webpage Configuration User can login web page by N540 s IP address Example Open browser and type in USR N540 IP 192 168 0 7 by default Then user name admin and password admin ...

Page 67: ...USR N540 User Manual www usriot com Jinan USR IOT Technology Limited 67 73 inquiry usriot com Webpage Log In ...

Page 68: ... Total running time from be powered Count of data sending how many data sent from powered Count of data receiving how many data received from powered USR N540 connection status check whether connection is built 2 Local IP Config Save configuration after revising the parameters Then restart Webpage Configuration Local IP Configuration IP setting 3 PORT1 Basic Parameter as below ...

Page 69: ...ernet port of device fails to receive the data or no data transmission within the specified time the device will re connect server to avoid the abnormal situation affecting the communication Disconnect time Only for TCP client If the network failure causes the link to break the device will actively connect to the server within fixed time Print Function for network printing ModbusTCP Poll Function ...

Page 70: ...Mode Only supports TCP Client UDP Client 4 Web to serial Click web to serial and connect success pops up Confirm then send data Web to Serial 5 Misc Config This part refers to the parameters of the device itself User can modify them according to the application Module Name USR N540 User can modify it Websocket port Webserver port 80 ...

Page 71: ...be revised User Name Password Used for login web page user can modify it Buffer data before connected whether serial and network data are cached if disconnection Reset timeout how long USR N540 reset when no data from COM or Network Set to 0 then no rest 6 Reboot Save all data then click restart to take effect ...

Page 72: ...efer to this documents 6 Company Jinan USR IOT Technology Limited Address Floor 11 Building1 No 1166 Xinluo Street Gaoxin Distric Jinan Shandong 250101 China Tel 86 531 55507297 86 531 88826739 Web http www usriot com Support http h usriot com Email sales usriot com 7 Disclaimer This document provide the information of USR N540 products it hasn t been granted any intellectual property license ...

Page 73: ... particular purpose merchantability and marketability the tort liability of any other patent right copyright intellectual property right We may modify specification and description at any time without prior notice 8 Update History 2015 10 22 V1 0 1 Established 2015 11 24 V1 0 6 Add the connection diagram 2015 11 24 V1 0 7 Modify the instr of HTTPD 2019 5 9 V1 1 0 Using new hardware type cover pict...

Reviews: