
USR-M300Á¬½ÓÔ¶³Ì·þÎñÆ÷JsonÏ·¢Ð´Êý¾ÝʾÀý
±¸×¢£º±¾°¸ÀýÊÇUSR-M300ÁªÍø£¬ºÍTCPÔ¶³Ì·þÎñÆ÷½¨Á¢Á¬½Ó£¬USR-M300µÄ485´®¿Ú½ÓUSR-RS485£¬µçÄÔÓÃMODBUS SLAVEÈí¼þÄ£Äâ´Ó»ú£¬TCPÔ¶³Ì·þÎñÆ÷JSONÏ·¢Ð´´Ó»ú¼Ä´æÆ÷µØÖ·Êý¾Ý¡£
Ò»¡¢×ÊÁÏÏÂÔØ
USR-M300 ˵Ã÷Ê飺/Download/1332.html
USR-M300 ¹æ¸ñÊ飺/Download/1333.html
USR-M300 Ó¦ÓÃÖ¸µ¼£º/Download/1369.html
¡¾PC¶Ëµ÷ÊÔ¹¤¾ß¡¿ÍøÂçµ÷ÊÔÖúÊÖ ´®¿Úµ÷ÊÔÖúÊÖ¶þºÏÒ»/Download/27.html
MODBUS SLAVEÈí¼þ¿ÉÒÔ×Ô¼º°Ù¶ÈÏÂÔØ¡£
¶þ¡¢Ó²¼þÁ¬½Ó
1¡¢ËùÐèÎïÆ·
USR-M300 ²úÆ· 1̨
12VµçÔ´ÊÊÅäÆ÷ 1¸ö
USR-RS485´®¿ÚÏß 1¸ö
³¬ÎåÀàÍøÏß 1¸ù
±Ê¼Ç±¾µçÄÔ 1̨
2¡¢Ó²¼þÁ¬½Ó
USR-M300 ½ÓºÃ4GÌìÏߣ¬¿ÉÒÔÄÚÖÿ¨ÉÏÍø£¬Ò²¿ÉÒÔ²åÍâÖÃSIM¿¨ÉÏÍø£¬Ò²¿ÉÒÔWAN¿ÚÓÃÍøÏß½ÓÉϼ¶Â·ÓÉÆ÷ÉÏÍø¡£
USR-M300 µÄ485´®¿Ú½ÓUSR-RS485´®¿ÚÏßµ½µçÄÔUSB¿Ú¡£
µçÔ´¶Ë×Ó½Ó12VµçÔ´ÊÊÅ䣬עÒâÕý¸º¼«²»Òª½Ó·´¡£
µçÄÔÏÂÔØ°²×°MODBUS SLAVEÈí¼þÄ£ÄâUSR-M300 485´Ó»úÉ豸¡£
3¡¢¶Ë¿ÚºÅ
µã»÷µçÄÔ¼ÆËã»ú£¬ÓÒ»÷µã»÷¹ÜÀí£¬µã»÷É豸¹ÜÀíÆ÷£¬µã»÷¶Ë¿Ú£¬È·ÈÏUSB-RS485´®¿ÚÏßµÄCOM¿ÚºÅÊÇCOM10¡£
Èý¡¢²úÆ·²ÎÊýÉèÖÃ
1¡¢µÇ½USR-M300ÍøÒ³
µçÄÔ´ò¿ªä¯ÀÀÆ÷£¬ÊäÈë192.168.1.1£¬µÇ½USR-M300ÄÚÖÃÍøÒ³£¬Óû§ÃûºÍÃÜÂ붼ÊÇadmin¡£
2¡¢Êý¾Ýµãλ£ºÌí¼Ó´Ó»úºÍµãλ
£¨1£©µã¿ªÊý¾Ýµã룬ÔÚ´Ó»úÒ»À¸£¬µã»÷Ìí¼Ó¡£
£¨2£©´Ó»úÃû³Æ£ºdevice1£¬²É¼¯ÐÒ飺Modbus_RTU£¬ÂÖѯ¼ä¸ô£º1000ms£¬´Ó»ú¿ª¹Ø´ò¿ª£¬´Ó»úµØÖ·£º1¡£µã»÷È·¶¨£¬µÈÉèÖÃÍêËùÓвÎÊý£¬×îºóÍøÒ³ÖØÆôUSR-M300¡£
£¨3£©´Ó»ú--µãλÁÐ±í£¬µã»÷Ìí¼Ó
£¨4£©µãλÃû³Æ£ºdata1(ºÍºóÃæÉϱ¨Êý¾Ý¶¼µãλÃû³Æ±£³ÖÒ»Ö£©£¬¼Ä´æÆ÷¹¦ÄÜÂë04£¬¼Ä´æÆ÷µØÖ·1£¨¶ÔӦʵ¼ÊÊ®½øÖƼĴæÆ÷µØÖ·0£©£¬¶Áд״̬¶Áд£¬µã»÷È·¶¨¡£
£¨5£©ÔÙÌí¼ÓµÚ¶þ¸öµã룬µãλÃû³Æ£ºdata2(ºÍºóÃæÉϱ¨Êý¾ÝµÄµãλÃû³Æ±£³ÖÒ»Ö£©£¬¼Ä´æÆ÷¹¦ÄÜÂë04£¬¼Ä´æÆ÷µØÖ·1£¨¶ÔӦʵ¼ÊÊ®½øÖƼĴæÆ÷µØÖ·0£©£¬¶Áд״̬¶Áд£¬µã»÷È·¶¨¡£
£¨6£©Ìí¼ÓÍ꣬¿ÉÒÔÁбí¼ì²é
3¡¢±ßÔµÍø¹Ø£ºÍ¨ÐÅÁ´Â·--Á´Â·1--TCP²ÎÊýÉèÖÃ
£¨1£©µã»÷Á´Â·1£¬´ò¿ªÁ´Â·1¿ª¹Ø¡£
£¨2£©ÔÚ»ù´¡ÉèÖã¬
ͨÐÅÐÒ飺TCP client
·þÎñÆ÷µØÖ·£ºÌîUSR-M300 Á¬½ÓµÄÔ¶³Ì·þÎñÆ÷µØÖ·IP
±¾µØ¶Ë¿Ú0£¬Ô¶³Ì¶Ë¿Ú8234£¨ºÍÔ¶³Ì·þÎñÆ÷¶Ë¿ÚºÅ±£³ÖÒ»Ö£¬ÓÃÓÚTCPÁ¬½Ó£©¡£
ÆäËû²ÎÊý±£³ÖĬÈÏ¡£
µã»÷Ó¦Óá£
4¡¢±ßÔµÍø¹Ø£ºÐÒéת»»--Json
£¨1£©µã»÷ÐÒéת»»£¬µã»÷Json,¿ªÆôJson
£¨2£©¿ªÆôJsonÖ®ºóµã»÷Ìí¼Ó
£¨3£©Á´Â·Ñ¡ÔñÁ´Â·1£¬µã»÷È·¶¨
£¨4£©µã»÷Ó¦ÓÃ
5¡¢×îºóÍøÒ³µã»÷ÖØÆô£¬µÈ´ýUSR-M300ÖØÆôÍê³É¡£
ËÄ¡¢MODBUS SLAVEÈí¼þÉèÖÃ
1¡¢MODBUS SLAVEÈí¼þÉèÖÃ
£¨1£©ÔÚµçÄÔÉÏ°²×°Modbus SlaveÈí¼þ£¬µã»÷Setup
Slave ID£º1£¨´Ó»úµØÖ·²âÊÔÓÃ1£©
Function: 03£¨¶Á¼Ä´æÆ÷¹¦ÄÜÂ룩
Address£º0£¨¼Ä´æÆ÷ÆðʼµØÖ·ÓÃ0£©
Quantity£º2£¨´ÓÆðʼµØÖ·¿ªÊ¼¼Ä´æÆ÷µØÖ·ÊýÁ¿£©
£¨2£©Modbus SlaveÈí¼þ£¬µã»÷Connection£¬Ñ¡ÔñModbus TCP/IP¡£Ñ¡ÔñPort 102£¬¶ÔÓ¦USR-M300 Ìí¼Ó´Ó»úʱÌîдµÄ¶Ë¿ÚºÅ102¡£×îºóµã»÷OK¡£
Îå¡¢µÇ½Զ³Ì×ÀÃ棬´ò¿ªÍøÂçÖúÊÖ
µÇ½Զ³Ì×ÀÃ棬´ò¿ªÍøÂçÖúÊÖ£¬ÐÒéÀàÐÍ×öTCP server£¬±¾µØÖ÷»ú¶Ë¿Ú8234£¬µã»÷´ò¿ª¡£
Áù¡¢Ô¶³Ì·þÎñÆ÷JSONÏ·¢Ð´Êý¾Ý
1¡¢Ô¶³Ì·þÎñÆ÷JSONÏ·¢Ð´¼Ä´æÆ÷µØÖ·0Êý¾Ý666£¬Ð´¼Ä´æÆ÷µØÖ·1Êý¾Ý888
·¢ËÍÇø°´ÕÕ¸ñʽÊäÈëÏ·¢JSON¸ñʽÃüÁ
{
"rw_prot": {
"Ver": "1.0.1",
"dir": "down",
"id": "12345",
"r_data": [{
"name": "data1"
},
{
"name": "data2"
}
],
"w_data": [{
"name": "data1",
"value": "666"
},
{
"name": "data2",
"value": "888"
}
]
}
}
2¡¢Ô¶³Ì·þÎñÆ÷JSONÏ·¢Ð´¼Ä´æÆ÷µØÖ·Êý¾ÝÖ®ºó£¬Ô¶³Ì·þÎñÆ÷ÊÕµ½»Ø¸´
½ÓÊջظ´Êý¾Ý¡£
{
"rw_prot": {
"dir": "up",
"Ver": "1.0.1",
"id": "12345",
"w_data": [{
"name": "data1",
"value": "666",
"err": "0"
}, {
"name": "data2",
"value": "888",
"err": "0"
}],
"r_data": [{
"name": "data1",
"value": "666",
"err": "0"
}, {
"name": "data2",
"value": "888",
"err": "0"
}]
}
}
»Ø¸´JSON¸ñʽÄÚÈÝ£º
±àдÈË£º½ðÖ¾·½ ±àдÈÕÆÚ£º2024-08-02
ÉóºËÈË£º½ðÖ¾·½ ÉóºËÈÕÆÚ£º2024-08-02
¶©Õý°æ±¾£ºV1.0 ¶©ÕýÄÚÈÝ£º³õ¸å