├── .gitattributes ├── .gitignore ├── Arduino_ESP8266_ Modbus_Industrial_Applications ├── 1. Arduino MEGA 2560 Master Modbus │ ├── Arduino Master Modbus RTU │ │ └── Ard Master Modbus RTU │ │ │ └── Arduino_Modbus_RTU │ │ │ └── Arduino_Modbus_RTU.ino │ ├── Arduino mega modbus rtu MEJORADO.jpg │ └── Library Modbus RTU │ │ └── Modbus │ │ ├── Doxyfile │ │ ├── LICENSE.md │ │ ├── MODBUS library 0.01b.txt │ │ ├── ModbusRtu.h │ │ ├── README.md │ │ ├── config │ │ ├── documentation │ │ ├── html │ │ │ ├── _modbus_rtu_8h.html │ │ │ ├── _modbus_rtu_8h_source.html │ │ │ ├── annotated.html │ │ │ ├── bc_s.png │ │ │ ├── bdwn.png │ │ │ ├── class_modbus-members.html │ │ │ ├── class_modbus.html │ │ │ ├── classes.html │ │ │ ├── closed.png │ │ │ ├── doxygen.css │ │ │ ├── doxygen.png │ │ │ ├── dynsections.js │ │ │ ├── files.html │ │ │ ├── ftv2blank.png │ │ │ ├── ftv2cl.png │ │ │ ├── ftv2doc.png │ │ │ ├── ftv2folderclosed.png │ │ │ ├── ftv2folderopen.png │ │ │ ├── ftv2lastnode.png │ │ │ ├── ftv2link.png │ │ │ ├── ftv2mlastnode.png │ │ │ ├── ftv2mnode.png │ │ │ ├── ftv2mo.png │ │ │ ├── ftv2node.png │ │ │ ├── ftv2ns.png │ │ │ ├── ftv2plastnode.png │ │ │ ├── ftv2pnode.png │ │ │ ├── ftv2splitbar.png │ │ │ ├── ftv2vertline.png │ │ │ ├── functions.html │ │ │ ├── functions_func.html │ │ │ ├── functions_vars.html │ │ │ ├── globals.html │ │ │ ├── globals_defs.html │ │ │ ├── globals_enum.html │ │ │ ├── globals_eval.html │ │ │ ├── globals_vars.html │ │ │ ├── group__buffer.html │ │ │ ├── group__discrete.html │ │ │ ├── group__loop.html │ │ │ ├── group__register.html │ │ │ ├── group__setup.html │ │ │ ├── index.hhc │ │ │ ├── index.hhk │ │ │ ├── index.hhp │ │ │ ├── index.html │ │ │ ├── modules.html │ │ │ ├── nav_f.png │ │ │ ├── nav_g.png │ │ │ ├── nav_h.png │ │ │ ├── open.png │ │ │ ├── pages.html │ │ │ ├── structmodbus__t-members.html │ │ │ ├── structmodbus__t.html │ │ │ ├── sync_off.png │ │ │ ├── sync_on.png │ │ │ ├── tab_a.png │ │ │ ├── tab_b.png │ │ │ ├── tab_h.png │ │ │ ├── tab_s.png │ │ │ ├── tabs.css │ │ │ └── todo.html │ │ ├── latex │ │ │ ├── Makefile │ │ │ ├── _modbus_rtu_8h.tex │ │ │ ├── annotated.tex │ │ │ ├── class_modbus.tex │ │ │ ├── doxygen.sty │ │ │ ├── files.tex │ │ │ ├── group__buffer.tex │ │ │ ├── group__discrete.tex │ │ │ ├── group__loop.tex │ │ │ ├── group__register.tex │ │ │ ├── group__setup.tex │ │ │ ├── modules.tex │ │ │ ├── refman.tex │ │ │ ├── structmodbus__t.tex │ │ │ └── todo.tex │ │ └── rtf │ │ │ └── refman.rtf │ │ ├── examples │ │ ├── MODBUSslave │ │ │ └── MODBUSslave.pde │ │ ├── RS485_slave │ │ │ └── RS485_slave.ino │ │ ├── advanced_master │ │ │ └── advanced_master.ino │ │ ├── advanced_slave │ │ │ └── advanced_slave.ino │ │ ├── simple_master │ │ │ └── simple_master.ino │ │ └── simple_slave │ │ │ └── simple_slave.ino │ │ ├── keywords.txt │ │ ├── modbus.h │ │ ├── modbusDevice.cpp │ │ ├── modbusDevice.h │ │ ├── modbusRegBank.cpp │ │ ├── modbusRegBank.h │ │ ├── modbusSlave.cpp │ │ └── modbusSlave.h ├── 2. ESP8266 Slave Modbus TCP │ ├── Arduino mega modbus rtu final.jpg │ ├── ESP8266 Bridge Modbus TCP Modbus RTU FINAL.jpg │ ├── ESP8266ModbusTCPSlave │ │ └── ESP8266ModbusTCPSlave.ino │ ├── Leeme.txt │ ├── Library Modbus TCP Slave │ │ └── ModbusTCPSlave │ │ │ ├── Keywords.txt │ │ │ ├── ModbusTCPSlave.cpp │ │ │ ├── ModbusTCPSlave.h │ │ │ └── examples │ │ │ ├── ModbusCC3300Slave │ │ │ └── ModbusCC3300Slave.ino │ │ │ ├── ModbusESP8266Slave │ │ │ └── ModbusESP8266Slave.ino │ │ │ └── ModbusEthernetSlave │ │ │ └── ModbusEthernetSlave.ino │ └── Readme.txt └── 3. ESP8266BridgeMBSlaveTCP-RTU │ ├── ARDUINO ESP8266 MB TCP MB RTU FINAL.jpg │ ├── Arduino mega modbus rtu final.jpg │ ├── ESP8266 Bridge Modbus TCP Modbus RTU FINAL.jpg │ ├── ESP8266BridgeMBSlaveTCP-RTU │ └── ESP8266BridgeMBSlaveTCP-RTU.ino │ ├── Library Modbus RTU │ └── Modbus │ │ ├── Doxyfile │ │ ├── LICENSE.md │ │ ├── MODBUS library 0.01b.txt │ │ ├── ModbusRtu.h │ │ ├── README.md │ │ ├── config │ │ ├── documentation │ │ ├── html │ │ │ ├── _modbus_rtu_8h.html │ │ │ ├── _modbus_rtu_8h_source.html │ │ │ ├── annotated.html │ │ │ ├── bc_s.png │ │ │ ├── bdwn.png │ │ │ ├── class_modbus-members.html │ │ │ ├── class_modbus.html │ │ │ ├── classes.html │ │ │ ├── closed.png │ │ │ ├── doxygen.css │ │ │ ├── doxygen.png │ │ │ ├── dynsections.js │ │ │ ├── files.html │ │ │ ├── ftv2blank.png │ │ │ ├── ftv2cl.png │ │ │ ├── ftv2doc.png │ │ │ ├── ftv2folderclosed.png │ │ │ ├── ftv2folderopen.png │ │ │ ├── ftv2lastnode.png │ │ │ ├── ftv2link.png │ │ │ ├── ftv2mlastnode.png │ │ │ ├── ftv2mnode.png │ │ │ ├── ftv2mo.png │ │ │ ├── ftv2node.png │ │ │ ├── ftv2ns.png │ │ │ ├── ftv2plastnode.png │ │ │ ├── ftv2pnode.png │ │ │ ├── ftv2splitbar.png │ │ │ ├── ftv2vertline.png │ │ │ ├── functions.html │ │ │ ├── functions_func.html │ │ │ ├── functions_vars.html │ │ │ ├── globals.html │ │ │ ├── globals_defs.html │ │ │ ├── globals_enum.html │ │ │ ├── globals_eval.html │ │ │ ├── globals_vars.html │ │ │ ├── group__buffer.html │ │ │ ├── group__discrete.html │ │ │ ├── group__loop.html │ │ │ ├── group__register.html │ │ │ ├── group__setup.html │ │ │ ├── index.hhc │ │ │ ├── index.hhk │ │ │ ├── index.hhp │ │ │ ├── index.html │ │ │ ├── modules.html │ │ │ ├── nav_f.png │ │ │ ├── nav_g.png │ │ │ ├── nav_h.png │ │ │ ├── open.png │ │ │ ├── pages.html │ │ │ ├── structmodbus__t-members.html │ │ │ ├── structmodbus__t.html │ │ │ ├── sync_off.png │ │ │ ├── sync_on.png │ │ │ ├── tab_a.png │ │ │ ├── tab_b.png │ │ │ ├── tab_h.png │ │ │ ├── tab_s.png │ │ │ ├── tabs.css │ │ │ └── todo.html │ │ ├── latex │ │ │ ├── Makefile │ │ │ ├── _modbus_rtu_8h.tex │ │ │ ├── annotated.tex │ │ │ ├── class_modbus.tex │ │ │ ├── doxygen.sty │ │ │ ├── files.tex │ │ │ ├── group__buffer.tex │ │ │ ├── group__discrete.tex │ │ │ ├── group__loop.tex │ │ │ ├── group__register.tex │ │ │ ├── group__setup.tex │ │ │ ├── modules.tex │ │ │ ├── refman.tex │ │ │ ├── structmodbus__t.tex │ │ │ └── todo.tex │ │ └── rtf │ │ │ └── refman.rtf │ │ ├── examples │ │ ├── MODBUSslave │ │ │ └── MODBUSslave.pde │ │ ├── RS485_slave │ │ │ └── RS485_slave.ino │ │ ├── advanced_master │ │ │ └── advanced_master.ino │ │ ├── advanced_slave │ │ │ └── advanced_slave.ino │ │ ├── simple_master │ │ │ └── simple_master.ino │ │ └── simple_slave │ │ │ └── simple_slave.ino │ │ ├── keywords.txt │ │ ├── modbus.h │ │ ├── modbusDevice.cpp │ │ ├── modbusDevice.h │ │ ├── modbusRegBank.cpp │ │ ├── modbusRegBank.h │ │ ├── modbusSlave.cpp │ │ └── modbusSlave.h │ └── Library Modbus TCP Slave │ └── ModbusTCPSlave │ ├── Keywords.txt │ ├── ModbusTCPSlave.cpp │ ├── ModbusTCPSlave.h │ └── examples │ ├── ModbusCC3300Slave │ └── ModbusCC3300Slave.ino │ ├── ModbusESP8266Slave │ └── ModbusESP8266Slave.ino │ └── ModbusEthernetSlave │ └── ModbusEthernetSlave.ino ├── Leeme.txt └── README.md /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Windows image file caches 2 | Thumbs.db 3 | ehthumbs.db 4 | 5 | # Folder config file 6 | Desktop.ini 7 | 8 | # Recycle Bin used on file shares 9 | $RECYCLE.BIN/ 10 | 11 | # Windows Installer files 12 | *.cab 13 | *.msi 14 | *.msm 15 | *.msp 16 | 17 | # Windows shortcuts 18 | *.lnk 19 | 20 | # ========================= 21 | # Operating System Files 22 | # ========================= 23 | 24 | # OSX 25 | # ========================= 26 | 27 | .DS_Store 28 | .AppleDouble 29 | .LSOverride 30 | 31 | # Thumbnails 32 | ._* 33 | 34 | # Files that might appear in the root of a volume 35 | .DocumentRevisions-V100 36 | .fseventsd 37 | .Spotlight-V100 38 | .TemporaryItems 39 | .Trashes 40 | .VolumeIcon.icns 41 | 42 | # Directories potentially created on remote AFP share 43 | .AppleDB 44 | .AppleDesktop 45 | Network Trash Folder 46 | Temporary Items 47 | .apdisk 48 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Arduino mega modbus rtu MEJORADO.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Arduino mega modbus rtu MEJORADO.jpg -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/MODBUS library 0.01b.txt: -------------------------------------------------------------------------------- 1 | Beta 2 | Written by Jason Vreeland [CodeRage] 3 | Released 3/7/2010 under GNU license -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/README.md: -------------------------------------------------------------------------------- 1 | README.txt 2 | 3 | libmodbus is a library that provides a Serial Modbus implementation for Arduino. 4 | 5 | A primary goal was to enable industrial communication for the Arduino in order to link it to industrial devices such as HMIs, CNCs, PLCs, temperature regulators or speed drives. 6 | 7 | LIBRARY CONTENTS 8 | ================================================================= 9 | LICENSE.txt GNU Licence file 10 | keywords.txt Arduino IDE colouring syntax 11 | 12 | /documentation 13 | Library documentation generated with Doxygen. 14 | 15 | /examples 16 | Sample sketches to implement miscellaneous settings: 17 | 18 | /examples/advanced_slave Modbus slave node, which links Arduino pins to the Modbus port. 19 | /examples/RS485_slave Modbus slave adapted to the RS485 port 20 | /examples/simple_master Modbus master node with a single query 21 | /examples/simple_slave Modbus slave node with a link array 22 | 23 | INSTALLATION PROCEDURE 24 | ================================================================= 25 | Refer to this documentation to Install this library: 26 | 27 | http://arduino.cc/en/Guide/Libraries 28 | 29 | Starting with version 1.0.5, you can install 3rd party libraries in the IDE. 30 | 31 | Do not unzip the downloaded library, leave it as is. 32 | 33 | In the Arduino IDE, navigate to Sketch > Import Library. At the top of the drop down list, select the option to "Add Library". 34 | 35 | You will be prompted to select this zipped library. 36 | 37 | Return to the Sketch > Import Library menu. You should now see the library at the bottom of the drop-down menu. It is ready to be used in your sketch. 38 | 39 | The zip file will have been expanded in the libraries folder in your Arduino sketches directory. 40 | 41 | NB : the library will be available to use in sketches, but examples for the library will not be exposed in the File > Examples until after the IDE has restarted. 42 | 43 | 44 | KNOWN ISSUES 45 | ================================================================= 46 | It is not compatible with ARDUINO LEONARDO and not tested under ARDUINO DUE and newer boards. 47 | 48 | TODO List 49 | ================================================================= 50 | Common to Master and Slave: 51 | 52 | 1) Implement other Serial settings: parity, stop bits, ... 53 | 54 | 2) End frame delay, also known as T35 55 | 56 | 3) Test it with several Arduino boards: UNO, Mega, etc.. 57 | 58 | 4) Extend it to Leonardo 59 | 60 | Master: 61 | 62 | 1) Function code 1 and 2 still not implemented 63 | 64 | 2) Function code 15 still not implement 65 | 66 | 3) Other codes under development 67 | 68 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/annotated.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Modbus Master and Slave for Arduino: Class List 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 | 17 | 18 | 19 | 25 | 26 | 27 |
20 |
Modbus Master and Slave for Arduino 21 |  1.2 22 |
23 |
Arduino library for implementing a Modbus Master or Slave through Serial port
24 |
28 |
29 | 30 | 31 | 40 | 47 |
48 |
49 |
50 |
Class List
51 |
52 |
53 |
Here are the classes, structs, unions and interfaces with brief descriptions:
54 | 55 | 56 | 57 |
oCModbusArduino class library for communicating with Modbus devices over USB/RS232/485 (via RTU protocol)
\Cmodbus_tMaster query structure: This includes all the necessary fields to make the Master generate a Modbus query. A Master may keep several of these structures and send them cyclically or use them according to program needs
58 |
59 |
60 | 61 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/bc_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/bc_s.png -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/bdwn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/bdwn.png -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/classes.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Modbus Master and Slave for Arduino: Class Index 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 | 17 | 18 | 19 | 25 | 26 | 27 |
20 |
Modbus Master and Slave for Arduino 21 |  1.2 22 |
23 |
Arduino library for implementing a Modbus Master or Slave through Serial port
24 |
28 |
29 | 30 | 31 | 40 | 47 |
48 |
49 |
50 |
Class Index
51 |
52 |
53 |
M
54 | 55 | 57 | 58 | 59 | 60 |
  M  
56 |
modbus_t   
Modbus   
61 |
M
62 |
63 | 64 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/closed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/closed.png -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/doxygen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/doxygen.png -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/dynsections.js: -------------------------------------------------------------------------------- 1 | function toggleVisibility(linkObj) 2 | { 3 | var base = $(linkObj).attr('id'); 4 | var summary = $('#'+base+'-summary'); 5 | var content = $('#'+base+'-content'); 6 | var trigger = $('#'+base+'-trigger'); 7 | var src=$(trigger).attr('src'); 8 | if (content.is(':visible')===true) { 9 | content.hide(); 10 | summary.show(); 11 | $(linkObj).addClass('closed').removeClass('opened'); 12 | $(trigger).attr('src',src.substring(0,src.length-8)+'closed.png'); 13 | } else { 14 | content.show(); 15 | summary.hide(); 16 | $(linkObj).removeClass('closed').addClass('opened'); 17 | $(trigger).attr('src',src.substring(0,src.length-10)+'open.png'); 18 | } 19 | return false; 20 | } 21 | 22 | function updateStripes() 23 | { 24 | $('table.directory tr'). 25 | removeClass('even').filter(':visible:even').addClass('even'); 26 | } 27 | function toggleLevel(level) 28 | { 29 | $('table.directory tr').each(function(){ 30 | var l = this.id.split('_').length-1; 31 | var i = $('#img'+this.id.substring(3)); 32 | var a = $('#arr'+this.id.substring(3)); 33 | if (l 2 | 3 | 4 | 5 | 6 | 7 | Modbus Master and Slave for Arduino: File List 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 | 17 | 18 | 19 | 25 | 26 | 27 |
20 |
Modbus Master and Slave for Arduino 21 |  1.2 22 |
23 |
Arduino library for implementing a Modbus Master or Slave through Serial port
24 |
28 |
29 | 30 | 31 | 40 | 46 |
47 |
48 |
49 |
File List
50 |
51 |
52 |
Here is a list of all files with brief descriptions:
53 | 54 | 55 |
\*ModbusRtu.h
56 |
57 |
58 | 59 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/ftv2blank.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/ftv2blank.png -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/ftv2cl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/ftv2cl.png -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/ftv2doc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/ftv2doc.png -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/ftv2folderclosed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/ftv2folderclosed.png -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/ftv2folderopen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/ftv2folderopen.png -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/ftv2lastnode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/ftv2lastnode.png -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/ftv2link.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/ftv2link.png -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/ftv2mlastnode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/ftv2mlastnode.png -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/ftv2mnode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/ftv2mnode.png -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/ftv2mo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/ftv2mo.png -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/ftv2node.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/ftv2node.png -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/ftv2ns.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/ftv2ns.png -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/ftv2plastnode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/ftv2plastnode.png -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/ftv2pnode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/ftv2pnode.png -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/ftv2splitbar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/ftv2splitbar.png -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/ftv2vertline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/ftv2vertline.png -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/functions_vars.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Modbus Master and Slave for Arduino: Class Members - Variables 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 | 17 | 18 | 19 | 25 | 26 | 27 |
20 |
Modbus Master and Slave for Arduino 21 |  1.2 22 |
23 |
Arduino library for implementing a Modbus Master or Slave through Serial port
24 |
28 |
29 | 30 | 31 | 40 | 47 | 54 |
55 |
56 |   73 |
74 | 75 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/globals_defs.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Modbus Master and Slave for Arduino: File Members 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 | 17 | 18 | 19 | 25 | 26 | 27 |
20 |
Modbus Master and Slave for Arduino 21 |  1.2 22 |
23 |
Arduino library for implementing a Modbus Master or Slave through Serial port
24 |
28 |
29 | 30 | 31 | 40 | 46 | 55 |
56 |
57 |   65 |
66 | 67 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/globals_enum.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Modbus Master and Slave for Arduino: File Members 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 | 17 | 18 | 19 | 25 | 26 | 27 |
20 |
Modbus Master and Slave for Arduino 21 |  1.2 22 |
23 |
Arduino library for implementing a Modbus Master or Slave through Serial port
24 |
28 |
29 | 30 | 31 | 40 | 46 | 55 |
56 |
57 |   71 |
72 | 73 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/globals_vars.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Modbus Master and Slave for Arduino: File Members 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 | 17 | 18 | 19 | 25 | 26 | 27 |
20 |
Modbus Master and Slave for Arduino 21 |  1.2 22 |
23 |
Arduino library for implementing a Modbus Master or Slave through Serial port
24 |
28 |
29 | 30 | 31 | 40 | 46 | 55 |
56 |
57 |   62 |
63 | 64 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/group__discrete.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Modbus Master and Slave for Arduino: Modbus Function Codes for Discrete Coils/Inputs 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 | 17 | 18 | 19 | 25 | 26 | 27 |
20 |
Modbus Master and Slave for Arduino 21 |  1.2 22 |
23 |
Arduino library for implementing a Modbus Master or Slave through Serial port
24 |
28 |
29 | 30 | 31 | 40 |
41 |
42 |
43 |
Modbus Function Codes for Discrete Coils/Inputs
44 |
45 |
46 |

Detailed Description

47 |
48 | 49 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/group__register.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Modbus Master and Slave for Arduino: Modbus Function Codes for Holding/Input Registers 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 | 17 | 18 | 19 | 25 | 26 | 27 |
20 |
Modbus Master and Slave for Arduino 21 |  1.2 22 |
23 |
Arduino library for implementing a Modbus Master or Slave through Serial port
24 |
28 |
29 | 30 | 31 | 40 |
41 |
42 |
43 |
Modbus Function Codes for Holding/Input Registers
44 |
45 |
46 |

Detailed Description

47 |
48 | 49 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/index.hhp: -------------------------------------------------------------------------------- 1 | [OPTIONS] 2 | Compatibility=1.1 3 | Full-text search=Yes 4 | Contents file=index.hhc 5 | Default Window=main 6 | Default topic=index.html 7 | Index file=index.hhk 8 | Language=0x409 English (United States) 9 | Title=Modbus Master and Slave for Arduino 10 | 11 | [WINDOWS] 12 | main="Modbus Master and Slave for Arduino","index.hhc","index.hhk","index.html","index.html",,,,,0x23520,,0x10387e,,,,,,,,0 13 | 14 | [FILES] 15 | _modbus_rtu_8h_source.html 16 | _modbus_rtu_8h.html 17 | todo.html 18 | group__setup.html 19 | group__loop.html 20 | group__buffer.html 21 | group__discrete.html 22 | group__register.html 23 | class_modbus.html 24 | class_modbus-members.html 25 | structmodbus__t.html 26 | structmodbus__t-members.html 27 | index.html 28 | pages.html 29 | modules.html 30 | annotated.html 31 | classes.html 32 | functions.html 33 | functions_func.html 34 | functions_vars.html 35 | files.html 36 | globals.html 37 | globals_vars.html 38 | globals_enum.html 39 | globals_eval.html 40 | globals_defs.html 41 | tab_a.png 42 | tab_b.png 43 | tab_h.png 44 | tab_s.png 45 | nav_h.png 46 | nav_f.png 47 | bc_s.png 48 | doxygen.png 49 | closed.png 50 | open.png 51 | bdwn.png 52 | sync_on.png 53 | sync_off.png 54 | ftv2blank.png 55 | ftv2doc.png 56 | ftv2folderclosed.png 57 | ftv2folderopen.png 58 | ftv2ns.png 59 | ftv2mo.png 60 | ftv2cl.png 61 | ftv2lastnode.png 62 | ftv2link.png 63 | ftv2mlastnode.png 64 | ftv2mnode.png 65 | ftv2node.png 66 | ftv2plastnode.png 67 | ftv2pnode.png 68 | ftv2vertline.png 69 | ftv2splitbar.png 70 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Modbus Master and Slave for Arduino: Main Page 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 | 17 | 18 | 19 | 25 | 26 | 27 |
20 |
Modbus Master and Slave for Arduino 21 |  1.2 22 |
23 |
Arduino library for implementing a Modbus Master or Slave through Serial port
24 |
28 |
29 | 30 | 31 | 40 |
41 |
42 |
43 |
Modbus Master and Slave for Arduino Documentation
44 |
45 |
46 |
47 | 48 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/modules.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Modbus Master and Slave for Arduino: Modules 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 | 17 | 18 | 19 | 25 | 26 | 27 |
20 |
Modbus Master and Slave for Arduino 21 |  1.2 22 |
23 |
Arduino library for implementing a Modbus Master or Slave through Serial port
24 |
28 |
29 | 30 | 31 | 40 |
41 |
42 |
43 |
Modules
44 |
45 |
46 |
Here is a list of all modules:
55 |
56 | 57 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/nav_f.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/nav_f.png -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/nav_g.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/nav_g.png -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/nav_h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/nav_h.png -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/open.png -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/pages.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Modbus Master and Slave for Arduino: Related Pages 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 | 17 | 18 | 19 | 25 | 26 | 27 |
20 |
Modbus Master and Slave for Arduino 21 |  1.2 22 |
23 |
Arduino library for implementing a Modbus Master or Slave through Serial port
24 |
28 |
29 | 30 | 31 | 40 |
41 |
42 |
43 |
Related Pages
44 |
45 |
46 |
Here is a list of all related documentation pages:
47 | 48 | 49 |
\Todo List
50 |
51 |
52 | 53 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/structmodbus__t-members.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Modbus Master and Slave for Arduino: Member List 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 | 17 | 18 | 19 | 25 | 26 | 27 |
20 |
Modbus Master and Slave for Arduino 21 |  1.2 22 |
23 |
Arduino library for implementing a Modbus Master or Slave through Serial port
24 |
28 |
29 | 30 | 31 | 40 | 47 |
48 |
49 |
50 |
modbus_t Member List
51 |
52 |
53 | 54 |

This is the complete list of members for modbus_t, including all inherited members.

55 | 56 | 57 | 58 | 59 | 60 | 61 |
au16regmodbus_t
u16CoilsNomodbus_t
u16RegAddmodbus_t
u8fctmodbus_t
u8idmodbus_t
62 | 63 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/sync_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/sync_off.png -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/sync_on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/sync_on.png -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/tab_a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/tab_a.png -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/tab_b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/tab_b.png -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/tab_h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/tab_h.png -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/tab_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/tab_s.png -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/tabs.css: -------------------------------------------------------------------------------- 1 | .tabs, .tabs2, .tabs3 { 2 | background-image: url('tab_b.png'); 3 | width: 100%; 4 | z-index: 101; 5 | font-size: 13px; 6 | font-family: 'Lucida Grande',Geneva,Helvetica,Arial,sans-serif; 7 | } 8 | 9 | .tabs2 { 10 | font-size: 10px; 11 | } 12 | .tabs3 { 13 | font-size: 9px; 14 | } 15 | 16 | .tablist { 17 | margin: 0; 18 | padding: 0; 19 | display: table; 20 | } 21 | 22 | .tablist li { 23 | float: left; 24 | display: table-cell; 25 | background-image: url('tab_b.png'); 26 | line-height: 36px; 27 | list-style: none; 28 | } 29 | 30 | .tablist a { 31 | display: block; 32 | padding: 0 20px; 33 | font-weight: bold; 34 | background-image:url('tab_s.png'); 35 | background-repeat:no-repeat; 36 | background-position:right; 37 | color: #283A5D; 38 | text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); 39 | text-decoration: none; 40 | outline: none; 41 | } 42 | 43 | .tabs3 .tablist a { 44 | padding: 0 10px; 45 | } 46 | 47 | .tablist a:hover { 48 | background-image: url('tab_h.png'); 49 | background-repeat:repeat-x; 50 | color: #fff; 51 | text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0); 52 | text-decoration: none; 53 | } 54 | 55 | .tablist li.current a { 56 | background-image: url('tab_a.png'); 57 | background-repeat:repeat-x; 58 | color: #fff; 59 | text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0); 60 | } 61 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/html/todo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Modbus Master and Slave for Arduino: Todo List 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 | 17 | 18 | 19 | 25 | 26 | 27 |
20 |
Modbus Master and Slave for Arduino 21 |  1.2 22 |
23 |
Arduino library for implementing a Modbus Master or Slave through Serial port
24 |
28 |
29 | 30 | 31 | 40 |
41 |
42 |
43 |
Todo List
44 |
45 |
46 |
47 |
Member Modbus::query (modbus_t telegram)
48 |
finish function 15
49 |
50 |
51 | 52 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/latex/Makefile: -------------------------------------------------------------------------------- 1 | all: refman.pdf 2 | 3 | pdf: refman.pdf 4 | 5 | refman.pdf: clean refman.tex 6 | pdflatex refman 7 | makeindex refman.idx 8 | pdflatex refman 9 | latex_count=5 ; \ 10 | while egrep -s 'Rerun (LaTeX|to get cross-references right)' refman.log && [ $$latex_count -gt 0 ] ;\ 11 | do \ 12 | echo "Rerunning latex...." ;\ 13 | pdflatex refman ;\ 14 | latex_count=`expr $$latex_count - 1` ;\ 15 | done 16 | makeindex refman.idx 17 | pdflatex refman 18 | 19 | 20 | clean: 21 | rm -f *.ps *.dvi *.aux *.toc *.idx *.ind *.ilg *.log *.out *.brf *.blg *.bbl refman.pdf 22 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/latex/annotated.tex: -------------------------------------------------------------------------------- 1 | \section{Class List} 2 | Here are the classes, structs, unions and interfaces with brief descriptions\-:\begin{DoxyCompactList} 3 | \item\contentsline{section}{\hyperlink{class_modbus}{Modbus} \\*Arduino class library for communicating with \hyperlink{class_modbus}{Modbus} devices over U\-S\-B/\-R\-S232/485 (via R\-T\-U protocol) }{\pageref{class_modbus}}{} 4 | \item\contentsline{section}{\hyperlink{structmodbus__t}{modbus\-\_\-t} \\*Master query structure\-: This includes all the necessary fields to make the Master generate a \hyperlink{class_modbus}{Modbus} query. A Master may keep several of these structures and send them cyclically or use them according to program needs }{\pageref{structmodbus__t}}{} 5 | \end{DoxyCompactList} 6 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/latex/files.tex: -------------------------------------------------------------------------------- 1 | \section{File List} 2 | Here is a list of all files with brief descriptions\-:\begin{DoxyCompactList} 3 | \item\contentsline{section}{\hyperlink{_modbus_rtu_8h}{Modbus\-Rtu.\-h} }{\pageref{_modbus_rtu_8h}}{} 4 | \end{DoxyCompactList} 5 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/latex/group__discrete.tex: -------------------------------------------------------------------------------- 1 | \hypertarget{group__discrete}{\section{Modbus Function Codes for Discrete Coils/\-Inputs} 2 | \label{group__discrete}\index{Modbus Function Codes for Discrete Coils/\-Inputs@{Modbus Function Codes for Discrete Coils/\-Inputs}} 3 | } 4 | 5 | 6 | \subsection{Detailed Description} 7 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/latex/group__register.tex: -------------------------------------------------------------------------------- 1 | \hypertarget{group__register}{\section{Modbus Function Codes for Holding/\-Input Registers} 2 | \label{group__register}\index{Modbus Function Codes for Holding/\-Input Registers@{Modbus Function Codes for Holding/\-Input Registers}} 3 | } 4 | 5 | 6 | \subsection{Detailed Description} 7 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/latex/modules.tex: -------------------------------------------------------------------------------- 1 | \section{Modules} 2 | Here is a list of all modules\-:\begin{DoxyCompactList} 3 | \item \contentsline{section}{Modbus Object Instantiation/\-Initialization}{\pageref{group__setup}}{} 4 | \item \contentsline{section}{Modbus Object Management}{\pageref{group__loop}}{} 5 | \item \contentsline{section}{Modbus Buffer Management}{\pageref{group__buffer}}{} 6 | \item \contentsline{section}{Modbus Function Codes for Discrete Coils/\-Inputs}{\pageref{group__discrete}}{} 7 | \item \contentsline{section}{Modbus Function Codes for Holding/\-Input Registers}{\pageref{group__register}}{} 8 | \end{DoxyCompactList} 9 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/documentation/latex/todo.tex: -------------------------------------------------------------------------------- 1 | 2 | \begin{DoxyRefList} 3 | \item[\label{todo__todo000001}% 4 | \hypertarget{todo__todo000001}{}% 5 | Member \hyperlink{group__loop_ga19398cabed57b6d085d014af6c149f54}{Modbus\-:\-:query} (\hyperlink{structmodbus__t}{modbus\-\_\-t} telegram)]finish function 15 6 | \end{DoxyRefList} -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/examples/RS485_slave/RS485_slave.ino: -------------------------------------------------------------------------------- 1 | /** 2 | * Modbus slave example 3: 3 | * The purpose of this example is to link a data array 4 | * from the Arduino to an external device through RS485. 5 | * 6 | * Recommended Modbus Master: QModbus 7 | * http://qmodbus.sourceforge.net/ 8 | */ 9 | 10 | #include 11 | 12 | // assign the Arduino pin that must be connected to RE-DE RS485 transceiver 13 | #define TXEN 4 14 | 15 | // data array for modbus network sharing 16 | uint16_t au16data[16] = { 17 | 3, 1415, 9265, 4, 2, 7182, 28182, 8, 0, 0, 0, 0, 0, 0, 1, -1 }; 18 | 19 | /** 20 | * Modbus object declaration 21 | * u8id : node id = 0 for master, = 1..247 for slave 22 | * u8serno : serial port (use 0 for Serial) 23 | * u8txenpin : 0 for RS-232 and USB-FTDI 24 | * or any pin number > 1 for RS-485 25 | */ 26 | Modbus slave(1,0,TXEN); // this is slave @1 and RS-485 27 | 28 | void setup() { 29 | slave.begin( 19200 ); // baud-rate at 19200 30 | } 31 | 32 | void loop() { 33 | slave.poll( au16data, 16 ); 34 | } 35 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/examples/advanced_master/advanced_master.ino: -------------------------------------------------------------------------------- 1 | /** 2 | * Modbus master example 2: 3 | * The purpose of this example is to query several sets of data 4 | * from an external Modbus slave device. 5 | * The link media can be USB or RS232. 6 | * 7 | * Recommended Modbus slave: 8 | * diagslave http://www.modbusdriver.com/diagslave.html 9 | * 10 | * In a Linux box, run 11 | * "./diagslave /dev/ttyUSB0 -b 19200 -d 8 -s 1 -p none -m rtu -a 1" 12 | * This is: 13 | * serial port /dev/ttyUSB0 at 19200 baud 8N1 14 | * RTU mode and address @1 15 | */ 16 | 17 | #include 18 | 19 | uint16_t au16data[16]; //!< data array for modbus network sharing 20 | uint8_t u8state; //!< machine state 21 | uint8_t u8query; //!< pointer to message query 22 | 23 | /** 24 | * Modbus object declaration 25 | * u8id : node id = 0 for master, = 1..247 for slave 26 | * u8serno : serial port (use 0 for Serial) 27 | * u8txenpin : 0 for RS-232 and USB-FTDI 28 | * or any pin number > 1 for RS-485 29 | */ 30 | Modbus master(0,0,0); // this is master and RS-232 or USB-FTDI 31 | 32 | /** 33 | * This is an structe which contains a query to an slave device 34 | */ 35 | modbus_t telegram[2]; 36 | 37 | unsigned long u32wait; 38 | 39 | void setup() { 40 | // telegram 0: read registers 41 | telegram[0].u8id = 1; // slave address 42 | telegram[0].u8fct = 3; // function code (this one is registers read) 43 | telegram[0].u16RegAdd = 0; // start address in slave 44 | telegram[0].u16CoilsNo = 4; // number of elements (coils or registers) to read 45 | telegram[0].au16reg = au16data; // pointer to a memory array in the Arduino 46 | 47 | // telegram 1: write a single register 48 | telegram[1].u8id = 1; // slave address 49 | telegram[1].u8fct = 6; // function code (this one is write a single register) 50 | telegram[1].u16RegAdd = 4; // start address in slave 51 | telegram[1].u16CoilsNo = 1; // number of elements (coils or registers) to read 52 | telegram[1].au16reg = au16data+4; // pointer to a memory array in the Arduino 53 | 54 | master.begin( 19200 ); // baud-rate at 19200 55 | master.setTimeOut( 5000 ); // if there is no answer in 5000 ms, roll over 56 | u32wait = millis() + 1000; 57 | u8state = u8query = 0; 58 | } 59 | 60 | void loop() { 61 | switch( u8state ) { 62 | case 0: 63 | if (millis() > u32wait) u8state++; // wait state 64 | break; 65 | case 1: 66 | master.query( telegram[u8query] ); // send query (only once) 67 | u8state++; 68 | u8query++; 69 | if (u8query > 2) u8query = 0; 70 | break; 71 | case 2: 72 | master.poll(); // check incoming messages 73 | if (master.getState() == COM_IDLE) { 74 | u8state = 0; 75 | u32wait = millis() + 1000; 76 | } 77 | break; 78 | } 79 | 80 | au16data[4] = analogRead( 0 ); 81 | 82 | } 83 | 84 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/examples/advanced_slave/advanced_slave.ino: -------------------------------------------------------------------------------- 1 | /** 2 | * Modbus slave example 2: 3 | * The purpose of this example is to link the Arduino digital and analog 4 | * pins to an external device. 5 | * 6 | * Recommended Modbus Master: QModbus 7 | * http://qmodbus.sourceforge.net/ 8 | */ 9 | 10 | #include 11 | #define ID 1 12 | 13 | Modbus slave(ID, 0, 0); // this is slave ID and RS-232 or USB-FTDI 14 | boolean led; 15 | int8_t state = 0; 16 | unsigned long tempus; 17 | 18 | // data array for modbus network sharing 19 | uint16_t au16data[9]; 20 | 21 | /** 22 | * Setup procedure 23 | */ 24 | void setup() { 25 | io_setup(); // I/O settings 26 | 27 | // start communication 28 | slave.begin( 19200 ); 29 | tempus = millis() + 100; 30 | digitalWrite(13, HIGH ); 31 | } 32 | 33 | /** 34 | * Loop procedure 35 | */ 36 | void loop() { 37 | // poll messages 38 | // blink led pin on each valid message 39 | state = slave.poll( au16data, 9 ); 40 | 41 | if (state > 4) { 42 | tempus = millis() + 50; 43 | digitalWrite(13, HIGH); 44 | } 45 | if (millis() > tempus) digitalWrite(13, LOW ); 46 | 47 | // link the Arduino pins to the Modbus array 48 | io_poll(); 49 | } 50 | 51 | /** 52 | * pin maping: 53 | * 2 - digital input 54 | * 3 - digital input 55 | * 4 - digital input 56 | * 5 - digital input 57 | * 6 - digital output 58 | * 7 - digital output 59 | * 8 - digital output 60 | * 9 - digital output 61 | * 10 - analog output 62 | * 11 - analog output 63 | * 14 - analog input 64 | * 15 - analog input 65 | * 66 | * pin 13 is reserved to show a successful query 67 | */ 68 | void io_setup() { 69 | // define i/o 70 | pinMode(2, INPUT); 71 | pinMode(3, INPUT); 72 | pinMode(4, INPUT); 73 | pinMode(5, INPUT); 74 | pinMode(6, OUTPUT); 75 | pinMode(7, OUTPUT); 76 | pinMode(8, OUTPUT); 77 | pinMode(9, OUTPUT); 78 | pinMode(10, OUTPUT); 79 | pinMode(11, OUTPUT); 80 | pinMode(13, OUTPUT); 81 | 82 | digitalWrite(6, LOW ); 83 | digitalWrite(7, LOW ); 84 | digitalWrite(8, LOW ); 85 | digitalWrite(9, LOW ); 86 | digitalWrite(13, HIGH ); // this is for the UNO led pin 87 | analogWrite(10, 0 ); 88 | analogWrite(11, 0 ); 89 | } 90 | 91 | /** 92 | * Link between the Arduino pins and the Modbus array 93 | */ 94 | void io_poll() { 95 | // get digital inputs -> au16data[0] 96 | bitWrite( au16data[0], 0, digitalRead( 2 )); 97 | bitWrite( au16data[0], 1, digitalRead( 3 )); 98 | bitWrite( au16data[0], 2, digitalRead( 4 )); 99 | bitWrite( au16data[0], 3, digitalRead( 5 )); 100 | 101 | // set digital outputs -> au16data[1] 102 | digitalWrite( 6, bitRead( au16data[1], 0 )); 103 | digitalWrite( 7, bitRead( au16data[1], 1 )); 104 | digitalWrite( 8, bitRead( au16data[1], 2 )); 105 | digitalWrite( 9, bitRead( au16data[1], 3 )); 106 | 107 | // set analog outputs 108 | analogWrite( 10, au16data[2] ); 109 | analogWrite( 11, au16data[3] ); 110 | 111 | // read analog inputs 112 | au16data[4] = analogRead( 0 ); 113 | au16data[5] = analogRead( 1 ); 114 | 115 | // diagnose communication 116 | au16data[6] = slave.getInCnt(); 117 | au16data[7] = slave.getOutCnt(); 118 | au16data[8] = slave.getErrCnt(); 119 | } 120 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/examples/simple_master/simple_master.ino: -------------------------------------------------------------------------------- 1 | /** 2 | * Modbus master example 1: 3 | * The purpose of this example is to query an array of data 4 | * from an external Modbus slave device. 5 | * The link media can be USB or RS232. 6 | * 7 | * Recommended Modbus slave: 8 | * diagslave http://www.modbusdriver.com/diagslave.html 9 | * 10 | * In a Linux box, run 11 | * "./diagslave /dev/ttyUSB0 -b 19200 -d 8 -s 1 -p none -m rtu -a 1" 12 | * This is: 13 | * serial port /dev/ttyUSB0 at 19200 baud 8N1 14 | * RTU mode and address @1 15 | */ 16 | 17 | #include 18 | 19 | // data array for modbus network sharing 20 | uint16_t au16data[16]; 21 | uint8_t u8state; 22 | 23 | /** 24 | * Modbus object declaration 25 | * u8id : node id = 0 for master, = 1..247 for slave 26 | * u8serno : serial port (use 0 for Serial) 27 | * u8txenpin : 0 for RS-232 and USB-FTDI 28 | * or any pin number > 1 for RS-485 29 | */ 30 | Modbus master(0,0,0); // this is master and RS-232 or USB-FTDI 31 | 32 | /** 33 | * This is an structe which contains a query to an slave device 34 | */ 35 | modbus_t telegram; 36 | 37 | unsigned long u32wait; 38 | 39 | void setup() { 40 | master.begin( 19200 ); // baud-rate at 19200 41 | master.setTimeOut( 2000 ); // if there is no answer in 2000 ms, roll over 42 | u32wait = millis() + 1000; 43 | u8state = 0; 44 | } 45 | 46 | void loop() { 47 | switch( u8state ) { 48 | case 0: 49 | if (millis() > u32wait) u8state++; // wait state 50 | break; 51 | case 1: 52 | telegram.u8id = 1; // slave address 53 | telegram.u8fct = 3; // function code (this one is registers read) 54 | telegram.u16RegAdd = 1; // start address in slave 55 | telegram.u16CoilsNo = 4; // number of elements (coils or registers) to read 56 | telegram.au16reg = au16data; // pointer to a memory array in the Arduino 57 | 58 | master.query( telegram ); // send query (only once) 59 | u8state++; 60 | break; 61 | case 2: 62 | master.poll(); // check incoming messages 63 | if (master.getState() == COM_IDLE) { 64 | u8state = 0; 65 | u32wait = millis() + 100; 66 | } 67 | break; 68 | } 69 | } 70 | 71 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/examples/simple_slave/simple_slave.ino: -------------------------------------------------------------------------------- 1 | /** 2 | * Modbus slave example 1: 3 | * The purpose of this example is to link a data array 4 | * from the Arduino to an external device. 5 | * 6 | * Recommended Modbus Master: QModbus 7 | * http://qmodbus.sourceforge.net/ 8 | */ 9 | 10 | #include 11 | 12 | // data array for modbus network sharing 13 | uint16_t au16data[16] = { 14 | 3, 1415, 9265, 4, 2, 7182, 28182, 8, 0, 0, 0, 0, 0, 0, 1, -1 }; 15 | 16 | /** 17 | * Modbus object declaration 18 | * u8id : node id = 0 for master, = 1..247 for slave 19 | * u8serno : serial port (use 0 for Serial) 20 | * u8txenpin : 0 for RS-232 and USB-FTDI 21 | * or any pin number > 1 for RS-485 22 | */ 23 | Modbus slave(1,0,0); // this is slave @1 and RS-232 or USB-FTDI 24 | 25 | void setup() { 26 | slave.begin( 19200 ); // baud-rate at 19200 27 | } 28 | 29 | void loop() { 30 | slave.poll( au16data, 16 ); 31 | } 32 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For Modbus-Master-Slave 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | modbus_t KEYWORD1 9 | 10 | ####################################### 11 | # Methods and Functions (KEYWORD2) 12 | ####################################### 13 | begin KEYWORD2 14 | poll KEYWORD2 15 | getInCnt KEYWORD2 16 | getOutCnt KEYWORD2 17 | getErrCnt KEYWORD2 18 | getID KEYWORD2 19 | getState KEYWORD2 20 | query KEYWORD2 21 | setTimeOut KEYWORD2 22 | 23 | ####################################### 24 | # Instances (KEYWORD2) 25 | ####################################### 26 | Modbus KEYWORD2 27 | 28 | ####################################### 29 | # Constants (LITERAL1) 30 | ####################################### 31 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/modbus.h: -------------------------------------------------------------------------------- 1 | #include 2 | #ifndef _MODBUSPROTOCOL 3 | #define _MODBUSPROTOCOL 4 | 5 | //Maximum device list for network 6 | #define DEVMAX 10 7 | //Maximum control register que size 8 | #define QUEMAX 10 9 | //Maximum serial wait in micro seconds 10 | #define SERIALMAXDELAY 100 11 | #define SERIALBAUD 9600 12 | //the total silence time needed to signify an EOM or SOM in RTU mode 13 | 14 | //Modbus function codes 15 | #define READ_DO 0x01 16 | #define READ_DI 0x02 17 | #define READ_AO 0x03 18 | #define READ_AI 0x04 19 | 20 | #define WRITE_DO 0x05 21 | #define WRITE_AO 0x06 22 | 23 | #define RTU 0x01 24 | #define ASCII 0x02 25 | 26 | #define MASTER 0x01 27 | #define SLAVE 0x02 28 | 29 | #define DO 0x00 30 | #define DI 0x01 31 | #define AI 0x03 32 | #define AO 0x04 33 | 34 | #endif -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/modbusDevice.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | modbusDevice::modbusDevice(void) 4 | { 5 | _id=NULL; 6 | } 7 | 8 | void modbusDevice::setId(byte id) 9 | { 10 | _id=id; 11 | } 12 | 13 | byte modbusDevice::getId(void) 14 | { 15 | return(_id); 16 | } 17 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/modbusDevice.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #ifndef _MODBUSDEVICE 5 | #define _MODBUSDEVICE 6 | 7 | #include 8 | #include 9 | //#include 10 | 11 | class modbusDevice:public modbusRegBank 12 | { 13 | public: 14 | modbusDevice(void); 15 | void setId(byte id); 16 | byte getId(void); 17 | 18 | private: 19 | byte _id; 20 | }; 21 | #endif 22 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/modbusRegBank.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | modbusRegBank::modbusRegBank(void) 5 | { 6 | _digRegs = 0; 7 | _lastDigReg = 0; 8 | _anaRegs = 0; 9 | _lastAnaReg = 0; 10 | } 11 | 12 | 13 | void modbusRegBank::add(word addr) 14 | { 15 | if(addr<20000) 16 | { 17 | modbusDigReg *temp; 18 | 19 | temp = (modbusDigReg *) malloc(sizeof(modbusDigReg)); 20 | temp->address = addr; 21 | temp->value = 0; 22 | temp->next = 0; 23 | 24 | if(_digRegs == 0) 25 | { 26 | _digRegs = temp; 27 | _lastDigReg = _digRegs; 28 | } 29 | else 30 | { 31 | //Assign the last register's next pointer to temp; 32 | _lastDigReg->next = temp; 33 | //then make temp the last register in the list. 34 | _lastDigReg = temp; 35 | } 36 | } 37 | else 38 | { 39 | modbusAnaReg *temp; 40 | 41 | temp = (modbusAnaReg *) malloc(sizeof(modbusAnaReg)); 42 | temp->address = addr; 43 | temp->value = 0; 44 | temp->next = 0; 45 | 46 | if(_anaRegs == 0) 47 | { 48 | _anaRegs = temp; 49 | _lastAnaReg = _anaRegs; 50 | } 51 | else 52 | { 53 | _lastAnaReg->next = temp; 54 | _lastAnaReg = temp; 55 | } 56 | } 57 | } 58 | 59 | word modbusRegBank::get(word addr) 60 | { 61 | if(addr < 20000) 62 | { 63 | modbusDigReg * regPtr; 64 | regPtr = (modbusDigReg *) this->search(addr); 65 | if(regPtr) 66 | return(regPtr->value); 67 | else 68 | return(NULL); 69 | } 70 | else 71 | { 72 | modbusAnaReg * regPtr; 73 | regPtr = (modbusAnaReg *) this->search(addr); 74 | if(regPtr) 75 | return(regPtr->value); 76 | else 77 | return(NULL); 78 | } 79 | } 80 | 81 | void modbusRegBank::set(word addr, word value) 82 | { 83 | //for digital data 84 | if(addr < 20000) 85 | { 86 | modbusDigReg * regPtr; 87 | //search for the register address 88 | regPtr = (modbusDigReg *) this->search(addr); 89 | //if a pointer was returned the set the register value to true if value is non zero 90 | if(regPtr) 91 | if(value) 92 | regPtr->value = 0xFF; 93 | else 94 | regPtr->value = 0x00; 95 | } 96 | else 97 | { 98 | modbusAnaReg * regPtr; 99 | //search for the register address 100 | regPtr = (modbusAnaReg *) this->search(addr); 101 | //if found then assign the register value to the new value. 102 | if(regPtr) 103 | regPtr->value = value; 104 | } 105 | } 106 | 107 | void * modbusRegBank::search(word addr) 108 | { 109 | //if the requested address is 0-19999 110 | //use a digital register pointer assigned to the first digital register 111 | //else use a analog register pointer assigned the first analog register 112 | 113 | if(addr < 20000) 114 | { 115 | modbusDigReg *regPtr = _digRegs; 116 | 117 | //if there is no register configured, bail 118 | if(regPtr == 0) 119 | return(0); 120 | 121 | //scan through the linked list until the end of the list or the register is found. 122 | //return the pointer. 123 | do 124 | { 125 | if(regPtr->address == addr) 126 | return(regPtr); 127 | regPtr = regPtr->next; 128 | } 129 | while(regPtr); 130 | } 131 | else 132 | { 133 | modbusAnaReg *regPtr = _anaRegs; 134 | 135 | //if there is no register configured, bail 136 | if(regPtr == 0) 137 | return(0); 138 | 139 | //scan through the linked list until the end of the list or the register is found. 140 | //return the pointer. 141 | do 142 | { 143 | if(regPtr->address == addr) 144 | return(regPtr); 145 | regPtr = regPtr->next; 146 | } 147 | while(regPtr); 148 | } 149 | return(0); 150 | } 151 | 152 | 153 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/modbusRegBank.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | 5 | #ifndef _MODBUSREGBANK 6 | #define _MODBUSREGBANK 7 | 8 | #include 9 | //#include 10 | 11 | 12 | struct modbusDigReg 13 | { 14 | word address; 15 | byte value; 16 | 17 | modbusDigReg *next; 18 | }; 19 | 20 | struct modbusAnaReg 21 | { 22 | word address; 23 | word value; 24 | 25 | modbusAnaReg *next; 26 | }; 27 | 28 | class modbusRegBank 29 | { 30 | public: 31 | 32 | modbusRegBank(void); 33 | 34 | void add(word); 35 | word get(word); 36 | void set(word, word); 37 | 38 | private: 39 | void * search(word); 40 | 41 | modbusDigReg *_digRegs, 42 | *_lastDigReg; 43 | 44 | modbusAnaReg *_anaRegs, 45 | *_lastAnaReg; 46 | }; 47 | #endif 48 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/modbusSlave.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/1. Arduino MEGA 2560 Master Modbus/Library Modbus RTU/Modbus/modbusSlave.h -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/2. ESP8266 Slave Modbus TCP/Arduino mega modbus rtu final.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/2. ESP8266 Slave Modbus TCP/Arduino mega modbus rtu final.jpg -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/2. ESP8266 Slave Modbus TCP/ESP8266 Bridge Modbus TCP Modbus RTU FINAL.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/2. ESP8266 Slave Modbus TCP/ESP8266 Bridge Modbus TCP Modbus RTU FINAL.jpg -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/2. ESP8266 Slave Modbus TCP/ESP8266ModbusTCPSlave/ESP8266ModbusTCPSlave.ino: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * More information about projects PDAControl 4 | * Mas informacion sobre proyectos PDAControl 5 | * Blog PDAControl English http://pdacontrolenglish.blogspot.com.co/ 6 | * Blog PDAControl Espa?ol http://pdacontrol.blogspot.com.co/ 7 | * Channel Youtube https://www.youtube.com/c/JhonValenciaPDAcontrol/videos 8 | * 9 | */ 10 | #include 11 | #include 12 | 13 | ModbusTCPSlave Mb; 14 | 15 | unsigned long timer; 16 | unsigned long checkRSSIMillis; 17 | void setup() 18 | { 19 | //Mb.begin("SSID", "PASSWORD", "IP", "GATEWAY", "SUBNET"); 20 | Mb.begin("1503523", "D2E7D32DBC883"); 21 | delay(1000); 22 | 23 | Serial.begin(115200); 24 | } 25 | 26 | void loop() 27 | { 28 | 29 | Mb.Run(); 30 | 31 | //Random Value 1 - 100 32 | Mb.MBHoldingRegister[0] = (random(1, 100)); 33 | //Print Serial Holding Register [0] 34 | Serial.println(Mb.MBHoldingRegister[0]); 35 | 36 | } 37 | 38 | /*****FUNZIONI*****/ 39 | 40 | byte checkRSSI() { 41 | byte quality; 42 | long rssi = WiFi.RSSI(); 43 | if (rssi <= -100) 44 | quality = 0; 45 | else if (rssi >= -50) 46 | quality = 100; 47 | else 48 | rssi = rssi + 100; 49 | quality = byte(rssi * 2); 50 | 51 | return quality; 52 | } 53 | 54 | 55 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/2. ESP8266 Slave Modbus TCP/Leeme.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/2. ESP8266 Slave Modbus TCP/Leeme.txt -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/2. ESP8266 Slave Modbus TCP/Library Modbus TCP Slave/ModbusTCPSlave/Keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For Mudbus 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | ModbusTCPSlave KEYWORD1 10 | 11 | ####################################### 12 | # Methods and Functions (KEYWORD2) 13 | ####################################### 14 | 15 | Run KEYWORD2 16 | MBInputRegister KEYWORD2 17 | MBHoldingRegister KEYWORD2 18 | 19 | ####################################### 20 | # Constants (LITERAL1) 21 | ####################################### 22 | 23 | MBDebug LITERAL1 24 | MB_PORT LITERAL1 25 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/2. ESP8266 Slave Modbus TCP/Library Modbus TCP Slave/ModbusTCPSlave/ModbusTCPSlave.h: -------------------------------------------------------------------------------- 1 | /* 2 | ModbusTCPSlave.h - an Arduino library for a Modbus TCP slave. 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | // Note: The Arduino IDE does not respect conditional included 19 | // header files in the main sketch so you have to select your 20 | // here. 21 | // 22 | #ifndef ModbusTCPSlave_h 23 | #define ModbusTCPSlave_h 24 | 25 | #define MB_PORT 502 26 | 27 | //#define MB_ETHERNET 28 | //#define MB_CC3000 29 | #define MB_ESP8266 30 | 31 | #define MBDebug //Serial1 debug enable 32 | 33 | #include "Arduino.h" 34 | 35 | #ifdef MB_ETHERNET 36 | #include 37 | #define LED_PIN 13 38 | #endif 39 | #ifdef MB_CC3000 40 | #define LED_PIN 13 41 | #include 42 | #include 43 | #define ADAFRUIT_CC3000_IRQ 3 44 | #define ADAFRUIT_CC3000_VBAT 5 45 | #define ADAFRUIT_CC3000_CS 10 46 | #endif 47 | #ifdef MB_ESP8266 48 | #define LED_PIN 5 49 | #include 50 | #endif 51 | 52 | #define maxInputRegister 20 53 | #define maxHoldingRegister 20 54 | 55 | // 56 | // MODBUS Function Codes 57 | // 58 | #define MB_FC_NONE 0 59 | #define MB_FC_READ_COILS 1 60 | #define MB_FC_READ_DISCRETE_INPUT 2 61 | #define MB_FC_READ_REGISTERS 3 //implemented 62 | #define MB_FC_READ_INPUT_REGISTERS 4 //implemented 63 | #define MB_FC_WRITE_COIL 5 64 | #define MB_FC_WRITE_REGISTER 6 //implemented 65 | #define MB_FC_WRITE_MULTIPLE_COILS 15 66 | #define MB_FC_WRITE_MULTIPLE_REGISTERS 16 //implemented 67 | // 68 | // MODBUS Error Codes 69 | // 70 | #define MB_EC_NONE 0 71 | #define MB_EC_ILLEGAL_FUNCTION 1 72 | #define MB_EC_ILLEGAL_DATA_ADDRESS 2 73 | #define MB_EC_ILLEGAL_DATA_VALUE 3 74 | #define MB_EC_SLAVE_DEVICE_FAILURE 4 75 | // 76 | // MODBUS MBAP offsets 77 | // 78 | #define MB_TCP_TID 0 79 | #define MB_TCP_PID 2 80 | #define MB_TCP_LEN 4 81 | #define MB_TCP_UID 6 82 | #define MB_TCP_FUNC 7 83 | #define MB_TCP_REGISTER_START 8 84 | #define MB_TCP_REGISTER_NUMBER 10 85 | 86 | class ModbusTCPSlave 87 | { 88 | public: 89 | ModbusTCPSlave(void); 90 | #ifdef MB_ETHERNET 91 | void begin(); 92 | void begin(uint8_t ip[4],uint8_t gateway[4],uint8_t subnet[4]); 93 | #endif 94 | #ifdef MB_CC3000 95 | void begin(const char *ssid, const char *key, uint8_t secmode); 96 | #endif 97 | #ifdef MB_ESP8266 98 | void begin(const char *ssid, const char *key); 99 | void begin(const char *ssid, const char *key,uint8_t ip[4],uint8_t gateway[4],uint8_t subnet[4]); 100 | #endif 101 | void Run(); 102 | void Stop(); 103 | unsigned int MBInputRegister[maxInputRegister]; 104 | unsigned int MBHoldingRegister[maxHoldingRegister]; 105 | 106 | private: 107 | byte ByteArray[260]; 108 | bool ledPinStatus = LOW; 109 | 110 | 111 | #ifdef MB_ETHERNET 112 | EthernetServer MBServer; 113 | #endif 114 | 115 | #ifdef MB_CC3000 116 | Adafruit_CC3000 MBClient; 117 | Adafruit_CC3000_Server MBServer; 118 | #endif 119 | 120 | #ifdef MB_ESP8266 121 | WiFiServer MBServer; 122 | #endif 123 | }; 124 | 125 | #endif 126 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/2. ESP8266 Slave Modbus TCP/Library Modbus TCP Slave/ModbusTCPSlave/examples/ModbusCC3300Slave/ModbusCC3300Slave.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | unsigned long timer = 0; 6 | 7 | ModbusTCP Mb; 8 | //Function codes 1(read coils), 3(read registers), 5(write coil), 6(write register) 9 | //signed int Mb.R[0 to 125] and bool Mb.C[0 to 128] MB_N_R MB_N_C 10 | //Port 502 (defined in ModbusTCPSlave.h) MB_PORT 11 | 12 | void setup() 13 | { 14 | 15 | Mb.begin("myssid", "mypass", WLAN_SEC_WPA2); 16 | 17 | delay(5000); 18 | 19 | } 20 | 21 | void loop() 22 | { 23 | 24 | } 25 | 26 | 27 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/2. ESP8266 Slave Modbus TCP/Library Modbus TCP Slave/ModbusTCPSlave/examples/ModbusESP8266Slave/ModbusESP8266Slave.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | ////https://forums.adafruit.com/viewtopic.php?f=31&t=61774&sid=06d9885dcf852259d1f568fa96e40265&start=15 5 | 6 | ////WIFI Settings 7 | ///* 8 | //byte ip[] = { 192, 168, 1, 126}; 9 | //byte gateway[] = { 192, 168, 1, 1 }; 10 | //byte subnet[] = { 255, 255, 255, 0 }; 11 | //*/ 12 | ModbusTCPSlave Mb; 13 | 14 | unsigned long timer; 15 | unsigned long checkRSSIMillis; 16 | 17 | void setup() 18 | { 19 | 20 | //Mb.begin("Telecom-28778737", "passwordwificasa47893000", ip, gateway, subnet); 21 | Mb.begin("1503523", "D2E7D32DBC883"); 22 | 23 | delay(1000); 24 | Mb.MBInputRegister[0] = 100; 25 | Mb.MBInputRegister[1] = 65500; 26 | Mb.MBInputRegister[2] = 300; 27 | Mb.MBInputRegister[3] = 400; 28 | Mb.MBInputRegister[4] = 500; 29 | 30 | Mb.MBHoldingRegister[0] = 1; 31 | Mb.MBHoldingRegister[1] = 2; 32 | Mb.MBHoldingRegister[2] = 3; 33 | Mb.MBHoldingRegister[3] = 4; 34 | Mb.MBHoldingRegister[4] = 5; 35 | 36 | } 37 | 38 | void loop() 39 | { 40 | Mb.Run(); 41 | delay(10); 42 | 43 | if (millis() - timer >= 1000) { 44 | timer = millis(); 45 | Mb.MBInputRegister[1]++; 46 | } 47 | 48 | if (millis() - checkRSSIMillis >= 10000) { 49 | checkRSSIMillis = millis(); 50 | Mb.MBInputRegister[0] = checkRSSI(); 51 | } 52 | } 53 | 54 | /*****FUNZIONI*****/ 55 | 56 | byte checkRSSI() { 57 | byte quality; 58 | long rssi = WiFi.RSSI(); 59 | if (rssi <= -100) 60 | quality = 0; 61 | else if (rssi >= -50) 62 | quality = 100; 63 | else 64 | rssi = rssi + 100; 65 | quality = byte(rssi * 2); 66 | 67 | return quality; 68 | } 69 | 70 | 71 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/2. ESP8266 Slave Modbus TCP/Library Modbus TCP Slave/ModbusTCPSlave/examples/ModbusEthernetSlave/ModbusEthernetSlave.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | // Ethernet settings (depending on MAC and Local network) 6 | byte ip[] = { 192, 168, 1, 127}; 7 | byte gateway[] = { 192, 168, 1, 1 }; 8 | byte subnet[] = { 255, 255, 255, 0 }; 9 | 10 | unsigned long timer = 0; 11 | 12 | ModbusTCPSlave Mb; 13 | //Port 502 (defined in ModbusTCPS.h) MB_PORT 14 | 15 | void setup() 16 | { 17 | Mb.begin(ip, gateway, subnet); 18 | 19 | delay(1000); 20 | Mb.MBInputRegister[0] = 100; 21 | Mb.MBInputRegister[1] = 65500; 22 | Mb.MBInputRegister[2] = 300; 23 | Mb.MBInputRegister[3] = 400; 24 | Mb.MBInputRegister[4] = 500; 25 | 26 | Mb.MBHoldingRegister[0] = 1; 27 | Mb.MBHoldingRegister[1] = 2; 28 | Mb.MBHoldingRegister[2] = 3; 29 | Mb.MBHoldingRegister[3] = 4; 30 | Mb.MBHoldingRegister[4] = 5; 31 | } 32 | 33 | void loop() 34 | { 35 | Mb.Run(); 36 | 37 | if (millis() - timer >= 1000) { 38 | timer = millis(); 39 | Mb.MBInputRegister[1]++; 40 | } 41 | } 42 | 43 | 44 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/2. ESP8266 Slave Modbus TCP/Readme.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/2. ESP8266 Slave Modbus TCP/Readme.txt -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/ARDUINO ESP8266 MB TCP MB RTU FINAL.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/ARDUINO ESP8266 MB TCP MB RTU FINAL.jpg -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Arduino mega modbus rtu final.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Arduino mega modbus rtu final.jpg -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/ESP8266 Bridge Modbus TCP Modbus RTU FINAL.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/ESP8266 Bridge Modbus TCP Modbus RTU FINAL.jpg -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/ESP8266BridgeMBSlaveTCP-RTU/ESP8266BridgeMBSlaveTCP-RTU.ino: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * More information about projects PDAControl 4 | * Mas informacion sobre proyectos PDAControl 5 | * Blog PDAControl English http://pdacontrolenglish.blogspot.com.co/ 6 | * Blog PDAControl Espa?ol http://pdacontrol.blogspot.com.co/ 7 | * Channel Youtube https://www.youtube.com/c/JhonValenciaPDAcontrol/videos 8 | * 9 | */ 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | //Setup the brewtrollers register bank 17 | //All of the data accumulated will be stored here 18 | modbusDevice regBank; 19 | //Create the modbus slave protocol handler 20 | modbusSlave slave; 21 | 22 | 23 | 24 | #include 25 | #include 26 | ModbusTCPSlave Mb; 27 | unsigned long timer; 28 | unsigned long checkRSSIMillis; 29 | 30 | 31 | void setup() 32 | { 33 | 34 | /// Config Modbus TCP Slave 35 | Mb.begin("1503523", "D2E7D32DBC883"); 36 | 37 | // Config Modbus RTU Slave 38 | //Assign the modbus device ID. 39 | regBank.setId(1); 40 | // Añade Salida analógica registra 40.001-40.020 al banco de registros 41 | 42 | regBank.add(40001); 43 | regBank.add(40002); 44 | regBank.add(40003); 45 | regBank.add(40004); 46 | regBank.add(40005); 47 | regBank.add(40006); 48 | regBank.add(40007); 49 | regBank.add(40008); 50 | regBank.add(40009); 51 | regBank.add(40010); 52 | regBank.add(40011); 53 | regBank.add(40012); 54 | regBank.add(40013); 55 | regBank.add(40014); 56 | regBank.add(40015); 57 | regBank.add(40016); 58 | regBank.add(40017); 59 | regBank.add(40018); 60 | regBank.add(40019); 61 | regBank.add(40020); 62 | 63 | slave._device = ®Bank; 64 | 65 | /// speed 19200 None 66 | slave.setBaud(19200); 67 | } 68 | 69 | void loop() 70 | { 71 | while(1) 72 | { 73 | 74 | 75 | //// Write Modbus TCP in Modbus RTU 10 Holding Registers 76 | //// Escritura de Modbus TCP en Registros 10 Modbus RTU 77 | 78 | regBank.set(40001, Mb.MBHoldingRegister[0]); 79 | regBank.set(40002, Mb.MBHoldingRegister[1]); 80 | regBank.set(40003, Mb.MBHoldingRegister[2]); 81 | regBank.set(40004, Mb.MBHoldingRegister[3]); 82 | regBank.set(40005, Mb.MBHoldingRegister[4]); 83 | regBank.set(40006, Mb.MBHoldingRegister[5]); 84 | regBank.set(40007, Mb.MBHoldingRegister[6]); 85 | regBank.set(40008, Mb.MBHoldingRegister[7]); 86 | regBank.set(40009, Mb.MBHoldingRegister[8]); 87 | regBank.set(40010, Mb.MBHoldingRegister[9]); 88 | 89 | //// Write Modbus RTU in Modbus TCP 10 Holding Registers 90 | //// Escritura de Modbus RTU en Registros 10 Modbus TCP 91 | 92 | Mb.MBHoldingRegister[10] = regBank.get(40011); 93 | Mb.MBHoldingRegister[11] = regBank.get(40012); 94 | Mb.MBHoldingRegister[12] = regBank.get(40013); 95 | Mb.MBHoldingRegister[13] = regBank.get(40014); 96 | Mb.MBHoldingRegister[14] = regBank.get(40015); 97 | Mb.MBHoldingRegister[15] = regBank.get(40016); 98 | Mb.MBHoldingRegister[16] = regBank.get(40017); 99 | Mb.MBHoldingRegister[17] = regBank.get(40018); 100 | Mb.MBHoldingRegister[18] = regBank.get(40019); 101 | Mb.MBHoldingRegister[19] = regBank.get(40020); 102 | 103 | 104 | delay(10); 105 | 106 | slave.run(); /// Run Slave Modbus RTU 107 | Mb.Run(); /// Run Slave Modbus TCP 108 | } 109 | } 110 | 111 | byte checkRSSI() { 112 | byte quality; 113 | long rssi = WiFi.RSSI(); 114 | if (rssi <= -100) 115 | quality = 0; 116 | else if (rssi >= -50) 117 | quality = 100; 118 | else 119 | rssi = rssi + 100; 120 | quality = byte(rssi * 2); 121 | 122 | return quality; 123 | } 124 | 125 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/MODBUS library 0.01b.txt: -------------------------------------------------------------------------------- 1 | Beta 2 | Written by Jason Vreeland [CodeRage] 3 | Released 3/7/2010 under GNU license -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/README.md: -------------------------------------------------------------------------------- 1 | README.txt 2 | 3 | libmodbus is a library that provides a Serial Modbus implementation for Arduino. 4 | 5 | A primary goal was to enable industrial communication for the Arduino in order to link it to industrial devices such as HMIs, CNCs, PLCs, temperature regulators or speed drives. 6 | 7 | LIBRARY CONTENTS 8 | ================================================================= 9 | LICENSE.txt GNU Licence file 10 | keywords.txt Arduino IDE colouring syntax 11 | 12 | /documentation 13 | Library documentation generated with Doxygen. 14 | 15 | /examples 16 | Sample sketches to implement miscellaneous settings: 17 | 18 | /examples/advanced_slave Modbus slave node, which links Arduino pins to the Modbus port. 19 | /examples/RS485_slave Modbus slave adapted to the RS485 port 20 | /examples/simple_master Modbus master node with a single query 21 | /examples/simple_slave Modbus slave node with a link array 22 | 23 | INSTALLATION PROCEDURE 24 | ================================================================= 25 | Refer to this documentation to Install this library: 26 | 27 | http://arduino.cc/en/Guide/Libraries 28 | 29 | Starting with version 1.0.5, you can install 3rd party libraries in the IDE. 30 | 31 | Do not unzip the downloaded library, leave it as is. 32 | 33 | In the Arduino IDE, navigate to Sketch > Import Library. At the top of the drop down list, select the option to "Add Library". 34 | 35 | You will be prompted to select this zipped library. 36 | 37 | Return to the Sketch > Import Library menu. You should now see the library at the bottom of the drop-down menu. It is ready to be used in your sketch. 38 | 39 | The zip file will have been expanded in the libraries folder in your Arduino sketches directory. 40 | 41 | NB : the library will be available to use in sketches, but examples for the library will not be exposed in the File > Examples until after the IDE has restarted. 42 | 43 | 44 | KNOWN ISSUES 45 | ================================================================= 46 | It is not compatible with ARDUINO LEONARDO and not tested under ARDUINO DUE and newer boards. 47 | 48 | TODO List 49 | ================================================================= 50 | Common to Master and Slave: 51 | 52 | 1) Implement other Serial settings: parity, stop bits, ... 53 | 54 | 2) End frame delay, also known as T35 55 | 56 | 3) Test it with several Arduino boards: UNO, Mega, etc.. 57 | 58 | 4) Extend it to Leonardo 59 | 60 | Master: 61 | 62 | 1) Function code 1 and 2 still not implemented 63 | 64 | 2) Function code 15 still not implement 65 | 66 | 3) Other codes under development 67 | 68 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/annotated.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Modbus Master and Slave for Arduino: Class List 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 | 17 | 18 | 19 | 25 | 26 | 27 |
20 |
Modbus Master and Slave for Arduino 21 |  1.2 22 |
23 |
Arduino library for implementing a Modbus Master or Slave through Serial port
24 |
28 |
29 | 30 | 31 | 40 | 47 |
48 |
49 |
50 |
Class List
51 |
52 |
53 |
Here are the classes, structs, unions and interfaces with brief descriptions:
54 | 55 | 56 | 57 |
oCModbusArduino class library for communicating with Modbus devices over USB/RS232/485 (via RTU protocol)
\Cmodbus_tMaster query structure: This includes all the necessary fields to make the Master generate a Modbus query. A Master may keep several of these structures and send them cyclically or use them according to program needs
58 |
59 |
60 | 61 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/bc_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/bc_s.png -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/bdwn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/bdwn.png -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/classes.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Modbus Master and Slave for Arduino: Class Index 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 | 17 | 18 | 19 | 25 | 26 | 27 |
20 |
Modbus Master and Slave for Arduino 21 |  1.2 22 |
23 |
Arduino library for implementing a Modbus Master or Slave through Serial port
24 |
28 |
29 | 30 | 31 | 40 | 47 |
48 |
49 |
50 |
Class Index
51 |
52 |
53 | 54 | 55 | 57 | 58 | 59 | 60 |
  M  
56 |
modbus_t   
Modbus   
61 | 62 |
63 | 64 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/closed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/closed.png -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/doxygen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/doxygen.png -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/dynsections.js: -------------------------------------------------------------------------------- 1 | function toggleVisibility(linkObj) 2 | { 3 | var base = $(linkObj).attr('id'); 4 | var summary = $('#'+base+'-summary'); 5 | var content = $('#'+base+'-content'); 6 | var trigger = $('#'+base+'-trigger'); 7 | var src=$(trigger).attr('src'); 8 | if (content.is(':visible')===true) { 9 | content.hide(); 10 | summary.show(); 11 | $(linkObj).addClass('closed').removeClass('opened'); 12 | $(trigger).attr('src',src.substring(0,src.length-8)+'closed.png'); 13 | } else { 14 | content.show(); 15 | summary.hide(); 16 | $(linkObj).removeClass('closed').addClass('opened'); 17 | $(trigger).attr('src',src.substring(0,src.length-10)+'open.png'); 18 | } 19 | return false; 20 | } 21 | 22 | function updateStripes() 23 | { 24 | $('table.directory tr'). 25 | removeClass('even').filter(':visible:even').addClass('even'); 26 | } 27 | function toggleLevel(level) 28 | { 29 | $('table.directory tr').each(function(){ 30 | var l = this.id.split('_').length-1; 31 | var i = $('#img'+this.id.substring(3)); 32 | var a = $('#arr'+this.id.substring(3)); 33 | if (l 2 | 3 | 4 | 5 | 6 | 7 | Modbus Master and Slave for Arduino: File List 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 | 17 | 18 | 19 | 25 | 26 | 27 |
20 |
Modbus Master and Slave for Arduino 21 |  1.2 22 |
23 |
Arduino library for implementing a Modbus Master or Slave through Serial port
24 |
28 |
29 | 30 | 31 | 40 | 46 |
47 |
48 |
49 |
File List
50 |
51 |
52 |
Here is a list of all files with brief descriptions:
53 | 54 | 55 |
\*ModbusRtu.h
56 |
57 |
58 | 59 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/ftv2blank.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/ftv2blank.png -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/ftv2cl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/ftv2cl.png -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/ftv2doc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/ftv2doc.png -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/ftv2folderclosed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/ftv2folderclosed.png -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/ftv2folderopen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/ftv2folderopen.png -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/ftv2lastnode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/ftv2lastnode.png -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/ftv2link.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/ftv2link.png -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/ftv2mlastnode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/ftv2mlastnode.png -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/ftv2mnode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/ftv2mnode.png -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/ftv2mo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/ftv2mo.png -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/ftv2node.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/ftv2node.png -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/ftv2ns.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/ftv2ns.png -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/ftv2plastnode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/ftv2plastnode.png -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/ftv2pnode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/ftv2pnode.png -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/ftv2splitbar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/ftv2splitbar.png -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/ftv2vertline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/ftv2vertline.png -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/functions_vars.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Modbus Master and Slave for Arduino: Class Members - Variables 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 | 17 | 18 | 19 | 25 | 26 | 27 |
20 |
Modbus Master and Slave for Arduino 21 |  1.2 22 |
23 |
Arduino library for implementing a Modbus Master or Slave through Serial port
24 |
28 |
29 | 30 | 31 | 40 | 47 | 54 |
55 |
56 |   73 |
74 | 75 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/globals_defs.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Modbus Master and Slave for Arduino: File Members 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 | 17 | 18 | 19 | 25 | 26 | 27 |
20 |
Modbus Master and Slave for Arduino 21 |  1.2 22 |
23 |
Arduino library for implementing a Modbus Master or Slave through Serial port
24 |
28 |
29 | 30 | 31 | 40 | 46 | 55 |
56 |
57 |   65 |
66 | 67 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/globals_enum.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Modbus Master and Slave for Arduino: File Members 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 | 17 | 18 | 19 | 25 | 26 | 27 |
20 |
Modbus Master and Slave for Arduino 21 |  1.2 22 |
23 |
Arduino library for implementing a Modbus Master or Slave through Serial port
24 |
28 |
29 | 30 | 31 | 40 | 46 | 55 |
56 |
57 |   71 |
72 | 73 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/globals_vars.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Modbus Master and Slave for Arduino: File Members 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 | 17 | 18 | 19 | 25 | 26 | 27 |
20 |
Modbus Master and Slave for Arduino 21 |  1.2 22 |
23 |
Arduino library for implementing a Modbus Master or Slave through Serial port
24 |
28 |
29 | 30 | 31 | 40 | 46 | 55 |
56 |
57 |   62 |
63 | 64 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/group__discrete.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Modbus Master and Slave for Arduino: Modbus Function Codes for Discrete Coils/Inputs 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 | 17 | 18 | 19 | 25 | 26 | 27 |
20 |
Modbus Master and Slave for Arduino 21 |  1.2 22 |
23 |
Arduino library for implementing a Modbus Master or Slave through Serial port
24 |
28 |
29 | 30 | 31 | 40 |
41 |
42 |
43 |
Modbus Function Codes for Discrete Coils/Inputs
44 |
45 |
46 |

Detailed Description

47 |
48 | 49 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/group__register.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Modbus Master and Slave for Arduino: Modbus Function Codes for Holding/Input Registers 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 | 17 | 18 | 19 | 25 | 26 | 27 |
20 |
Modbus Master and Slave for Arduino 21 |  1.2 22 |
23 |
Arduino library for implementing a Modbus Master or Slave through Serial port
24 |
28 |
29 | 30 | 31 | 40 |
41 |
42 |
43 |
Modbus Function Codes for Holding/Input Registers
44 |
45 |
46 |

Detailed Description

47 |
48 | 49 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/index.hhp: -------------------------------------------------------------------------------- 1 | [OPTIONS] 2 | Compatibility=1.1 3 | Full-text search=Yes 4 | Contents file=index.hhc 5 | Default Window=main 6 | Default topic=index.html 7 | Index file=index.hhk 8 | Language=0x409 English (United States) 9 | Title=Modbus Master and Slave for Arduino 10 | 11 | [WINDOWS] 12 | main="Modbus Master and Slave for Arduino","index.hhc","index.hhk","index.html","index.html",,,,,0x23520,,0x10387e,,,,,,,,0 13 | 14 | [FILES] 15 | _modbus_rtu_8h_source.html 16 | _modbus_rtu_8h.html 17 | todo.html 18 | group__setup.html 19 | group__loop.html 20 | group__buffer.html 21 | group__discrete.html 22 | group__register.html 23 | class_modbus.html 24 | class_modbus-members.html 25 | structmodbus__t.html 26 | structmodbus__t-members.html 27 | index.html 28 | pages.html 29 | modules.html 30 | annotated.html 31 | classes.html 32 | functions.html 33 | functions_func.html 34 | functions_vars.html 35 | files.html 36 | globals.html 37 | globals_vars.html 38 | globals_enum.html 39 | globals_eval.html 40 | globals_defs.html 41 | tab_a.png 42 | tab_b.png 43 | tab_h.png 44 | tab_s.png 45 | nav_h.png 46 | nav_f.png 47 | bc_s.png 48 | doxygen.png 49 | closed.png 50 | open.png 51 | bdwn.png 52 | sync_on.png 53 | sync_off.png 54 | ftv2blank.png 55 | ftv2doc.png 56 | ftv2folderclosed.png 57 | ftv2folderopen.png 58 | ftv2ns.png 59 | ftv2mo.png 60 | ftv2cl.png 61 | ftv2lastnode.png 62 | ftv2link.png 63 | ftv2mlastnode.png 64 | ftv2mnode.png 65 | ftv2node.png 66 | ftv2plastnode.png 67 | ftv2pnode.png 68 | ftv2vertline.png 69 | ftv2splitbar.png 70 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Modbus Master and Slave for Arduino: Main Page 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 | 17 | 18 | 19 | 25 | 26 | 27 |
20 |
Modbus Master and Slave for Arduino 21 |  1.2 22 |
23 |
Arduino library for implementing a Modbus Master or Slave through Serial port
24 |
28 |
29 | 30 | 31 | 40 |
41 |
42 |
43 |
Modbus Master and Slave for Arduino Documentation
44 |
45 |
46 |
47 | 48 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/modules.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Modbus Master and Slave for Arduino: Modules 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 | 17 | 18 | 19 | 25 | 26 | 27 |
20 |
Modbus Master and Slave for Arduino 21 |  1.2 22 |
23 |
Arduino library for implementing a Modbus Master or Slave through Serial port
24 |
28 |
29 | 30 | 31 | 40 |
41 |
42 |
43 |
Modules
44 |
45 | 56 | 57 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/nav_f.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/nav_f.png -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/nav_g.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/nav_g.png -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/nav_h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/nav_h.png -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/open.png -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/pages.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Modbus Master and Slave for Arduino: Related Pages 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 | 17 | 18 | 19 | 25 | 26 | 27 |
20 |
Modbus Master and Slave for Arduino 21 |  1.2 22 |
23 |
Arduino library for implementing a Modbus Master or Slave through Serial port
24 |
28 |
29 | 30 | 31 | 40 |
41 |
42 |
43 |
Related Pages
44 |
45 |
46 |
Here is a list of all related documentation pages:
47 | 48 | 49 |
\Todo List
50 |
51 |
52 | 53 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/structmodbus__t-members.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Modbus Master and Slave for Arduino: Member List 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 | 17 | 18 | 19 | 25 | 26 | 27 |
20 |
Modbus Master and Slave for Arduino 21 |  1.2 22 |
23 |
Arduino library for implementing a Modbus Master or Slave through Serial port
24 |
28 |
29 | 30 | 31 | 40 | 47 |
48 |
49 |
50 |
modbus_t Member List
51 |
52 |
53 | 54 |

This is the complete list of members for modbus_t, including all inherited members.

55 | 56 | 57 | 58 | 59 | 60 | 61 |
au16regmodbus_t
u16CoilsNomodbus_t
u16RegAddmodbus_t
u8fctmodbus_t
u8idmodbus_t
62 | 63 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/sync_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/sync_off.png -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/sync_on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/sync_on.png -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/tab_a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/tab_a.png -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/tab_b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/tab_b.png -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/tab_h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/tab_h.png -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/tab_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/tab_s.png -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/tabs.css: -------------------------------------------------------------------------------- 1 | .tabs, .tabs2, .tabs3 { 2 | background-image: url('tab_b.png'); 3 | width: 100%; 4 | z-index: 101; 5 | font-size: 13px; 6 | font-family: 'Lucida Grande',Geneva,Helvetica,Arial,sans-serif; 7 | } 8 | 9 | .tabs2 { 10 | font-size: 10px; 11 | } 12 | .tabs3 { 13 | font-size: 9px; 14 | } 15 | 16 | .tablist { 17 | margin: 0; 18 | padding: 0; 19 | display: table; 20 | } 21 | 22 | .tablist li { 23 | float: left; 24 | display: table-cell; 25 | background-image: url('tab_b.png'); 26 | line-height: 36px; 27 | list-style: none; 28 | } 29 | 30 | .tablist a { 31 | display: block; 32 | padding: 0 20px; 33 | font-weight: bold; 34 | background-image:url('tab_s.png'); 35 | background-repeat:no-repeat; 36 | background-position:right; 37 | color: #283A5D; 38 | text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); 39 | text-decoration: none; 40 | outline: none; 41 | } 42 | 43 | .tabs3 .tablist a { 44 | padding: 0 10px; 45 | } 46 | 47 | .tablist a:hover { 48 | background-image: url('tab_h.png'); 49 | background-repeat:repeat-x; 50 | color: #fff; 51 | text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0); 52 | text-decoration: none; 53 | } 54 | 55 | .tablist li.current a { 56 | background-image: url('tab_a.png'); 57 | background-repeat:repeat-x; 58 | color: #fff; 59 | text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0); 60 | } 61 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/html/todo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Modbus Master and Slave for Arduino: Todo List 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 | 17 | 18 | 19 | 25 | 26 | 27 |
20 |
Modbus Master and Slave for Arduino 21 |  1.2 22 |
23 |
Arduino library for implementing a Modbus Master or Slave through Serial port
24 |
28 |
29 | 30 | 31 | 40 |
41 |
42 |
43 |
Todo List
44 |
45 |
46 |
47 |
Member Modbus::query (modbus_t telegram)
48 |
finish function 15
49 |
50 |
51 | 52 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/latex/Makefile: -------------------------------------------------------------------------------- 1 | all: refman.pdf 2 | 3 | pdf: refman.pdf 4 | 5 | refman.pdf: clean refman.tex 6 | pdflatex refman 7 | makeindex refman.idx 8 | pdflatex refman 9 | latex_count=5 ; \ 10 | while egrep -s 'Rerun (LaTeX|to get cross-references right)' refman.log && [ $$latex_count -gt 0 ] ;\ 11 | do \ 12 | echo "Rerunning latex...." ;\ 13 | pdflatex refman ;\ 14 | latex_count=`expr $$latex_count - 1` ;\ 15 | done 16 | makeindex refman.idx 17 | pdflatex refman 18 | 19 | 20 | clean: 21 | rm -f *.ps *.dvi *.aux *.toc *.idx *.ind *.ilg *.log *.out *.brf *.blg *.bbl refman.pdf 22 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/latex/annotated.tex: -------------------------------------------------------------------------------- 1 | \section{Class List} 2 | Here are the classes, structs, unions and interfaces with brief descriptions\-:\begin{DoxyCompactList} 3 | \item\contentsline{section}{\hyperlink{class_modbus}{Modbus} \\*Arduino class library for communicating with \hyperlink{class_modbus}{Modbus} devices over U\-S\-B/\-R\-S232/485 (via R\-T\-U protocol) }{\pageref{class_modbus}}{} 4 | \item\contentsline{section}{\hyperlink{structmodbus__t}{modbus\-\_\-t} \\*Master query structure\-: This includes all the necessary fields to make the Master generate a \hyperlink{class_modbus}{Modbus} query. A Master may keep several of these structures and send them cyclically or use them according to program needs }{\pageref{structmodbus__t}}{} 5 | \end{DoxyCompactList} 6 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/latex/files.tex: -------------------------------------------------------------------------------- 1 | \section{File List} 2 | Here is a list of all files with brief descriptions\-:\begin{DoxyCompactList} 3 | \item\contentsline{section}{\hyperlink{_modbus_rtu_8h}{Modbus\-Rtu.\-h} }{\pageref{_modbus_rtu_8h}}{} 4 | \end{DoxyCompactList} 5 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/latex/group__discrete.tex: -------------------------------------------------------------------------------- 1 | \hypertarget{group__discrete}{\section{Modbus Function Codes for Discrete Coils/\-Inputs} 2 | \label{group__discrete}\index{Modbus Function Codes for Discrete Coils/\-Inputs@{Modbus Function Codes for Discrete Coils/\-Inputs}} 3 | } 4 | 5 | 6 | \subsection{Detailed Description} 7 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/latex/group__register.tex: -------------------------------------------------------------------------------- 1 | \hypertarget{group__register}{\section{Modbus Function Codes for Holding/\-Input Registers} 2 | \label{group__register}\index{Modbus Function Codes for Holding/\-Input Registers@{Modbus Function Codes for Holding/\-Input Registers}} 3 | } 4 | 5 | 6 | \subsection{Detailed Description} 7 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/latex/modules.tex: -------------------------------------------------------------------------------- 1 | \section{Modules} 2 | Here is a list of all modules\-:\begin{DoxyCompactList} 3 | \item \contentsline{section}{Modbus Object Instantiation/\-Initialization}{\pageref{group__setup}}{} 4 | \item \contentsline{section}{Modbus Object Management}{\pageref{group__loop}}{} 5 | \item \contentsline{section}{Modbus Buffer Management}{\pageref{group__buffer}}{} 6 | \item \contentsline{section}{Modbus Function Codes for Discrete Coils/\-Inputs}{\pageref{group__discrete}}{} 7 | \item \contentsline{section}{Modbus Function Codes for Holding/\-Input Registers}{\pageref{group__register}}{} 8 | \end{DoxyCompactList} 9 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/latex/structmodbus__t.tex: -------------------------------------------------------------------------------- 1 | \hypertarget{structmodbus__t}{\section{modbus\-\_\-t Struct Reference} 2 | \label{structmodbus__t}\index{modbus\-\_\-t@{modbus\-\_\-t}} 3 | } 4 | 5 | 6 | Master query structure\-: This includes all the necessary fields to make the Master generate a \hyperlink{class_modbus}{Modbus} query. A Master may keep several of these structures and send them cyclically or use them according to program needs. 7 | 8 | 9 | 10 | 11 | {\ttfamily \#include $<$Modbus\-Rtu.\-h$>$} 12 | 13 | \subsection*{Public Attributes} 14 | \begin{DoxyCompactItemize} 15 | \item 16 | uint8\-\_\-t \hyperlink{structmodbus__t_af78ad11f93e63022a1c279de7206358c}{u8id} 17 | \item 18 | uint8\-\_\-t \hyperlink{structmodbus__t_a57d1630d4548e5d50d79e206a48b09bc}{u8fct} 19 | \item 20 | uint16\-\_\-t \hyperlink{structmodbus__t_a224ead9ff72467696e94fba9cf06bd3c}{u16\-Reg\-Add} 21 | \item 22 | uint16\-\_\-t \hyperlink{structmodbus__t_a5b9cee9c1a9415d927543f6cf054eb43}{u16\-Coils\-No} 23 | \item 24 | uint16\-\_\-t $\ast$ \hyperlink{structmodbus__t_a36212dd6316cbffb8ea31b2a2f5ae1be}{au16reg} 25 | \end{DoxyCompactItemize} 26 | 27 | 28 | \subsection{Detailed Description} 29 | Master query structure\-: This includes all the necessary fields to make the Master generate a \hyperlink{class_modbus}{Modbus} query. A Master may keep several of these structures and send them cyclically or use them according to program needs. 30 | 31 | Definition at line 48 of file Modbus\-Rtu.\-h. 32 | 33 | 34 | 35 | \subsection{Member Data Documentation} 36 | \hypertarget{structmodbus__t_a36212dd6316cbffb8ea31b2a2f5ae1be}{\index{modbus\-\_\-t@{modbus\-\_\-t}!au16reg@{au16reg}} 37 | \index{au16reg@{au16reg}!modbus_t@{modbus\-\_\-t}} 38 | \subsubsection[{au16reg}]{\setlength{\rightskip}{0pt plus 5cm}uint16\-\_\-t$\ast$ modbus\-\_\-t\-::au16reg}}\label{structmodbus__t_a36212dd6316cbffb8ea31b2a2f5ae1be} 39 | Pointer to memory image in master 40 | 41 | Definition at line 53 of file Modbus\-Rtu.\-h. 42 | 43 | \hypertarget{structmodbus__t_a5b9cee9c1a9415d927543f6cf054eb43}{\index{modbus\-\_\-t@{modbus\-\_\-t}!u16\-Coils\-No@{u16\-Coils\-No}} 44 | \index{u16\-Coils\-No@{u16\-Coils\-No}!modbus_t@{modbus\-\_\-t}} 45 | \subsubsection[{u16\-Coils\-No}]{\setlength{\rightskip}{0pt plus 5cm}uint16\-\_\-t modbus\-\_\-t\-::u16\-Coils\-No}}\label{structmodbus__t_a5b9cee9c1a9415d927543f6cf054eb43} 46 | Number of coils or registers to access 47 | 48 | Definition at line 52 of file Modbus\-Rtu.\-h. 49 | 50 | \hypertarget{structmodbus__t_a224ead9ff72467696e94fba9cf06bd3c}{\index{modbus\-\_\-t@{modbus\-\_\-t}!u16\-Reg\-Add@{u16\-Reg\-Add}} 51 | \index{u16\-Reg\-Add@{u16\-Reg\-Add}!modbus_t@{modbus\-\_\-t}} 52 | \subsubsection[{u16\-Reg\-Add}]{\setlength{\rightskip}{0pt plus 5cm}uint16\-\_\-t modbus\-\_\-t\-::u16\-Reg\-Add}}\label{structmodbus__t_a224ead9ff72467696e94fba9cf06bd3c} 53 | Address of the first register to access at slave/s 54 | 55 | Definition at line 51 of file Modbus\-Rtu.\-h. 56 | 57 | \hypertarget{structmodbus__t_a57d1630d4548e5d50d79e206a48b09bc}{\index{modbus\-\_\-t@{modbus\-\_\-t}!u8fct@{u8fct}} 58 | \index{u8fct@{u8fct}!modbus_t@{modbus\-\_\-t}} 59 | \subsubsection[{u8fct}]{\setlength{\rightskip}{0pt plus 5cm}uint8\-\_\-t modbus\-\_\-t\-::u8fct}}\label{structmodbus__t_a57d1630d4548e5d50d79e206a48b09bc} 60 | Function code\-: 1, 2, 3, 4, 5, 6, 15 or 16 61 | 62 | Definition at line 50 of file Modbus\-Rtu.\-h. 63 | 64 | \hypertarget{structmodbus__t_af78ad11f93e63022a1c279de7206358c}{\index{modbus\-\_\-t@{modbus\-\_\-t}!u8id@{u8id}} 65 | \index{u8id@{u8id}!modbus_t@{modbus\-\_\-t}} 66 | \subsubsection[{u8id}]{\setlength{\rightskip}{0pt plus 5cm}uint8\-\_\-t modbus\-\_\-t\-::u8id}}\label{structmodbus__t_af78ad11f93e63022a1c279de7206358c} 67 | Slave address between 1 and 247. 0 means broadcast 68 | 69 | Definition at line 49 of file Modbus\-Rtu.\-h. 70 | 71 | 72 | 73 | The documentation for this struct was generated from the following file\-:\begin{DoxyCompactItemize} 74 | \item 75 | \hyperlink{_modbus_rtu_8h}{Modbus\-Rtu.\-h}\end{DoxyCompactItemize} 76 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/documentation/latex/todo.tex: -------------------------------------------------------------------------------- 1 | 2 | \begin{DoxyRefList} 3 | \item[\label{todo__todo000001}% 4 | \hypertarget{todo__todo000001}{}% 5 | Member \hyperlink{group__loop_ga19398cabed57b6d085d014af6c149f54}{Modbus\-:\-:query} (\hyperlink{structmodbus__t}{modbus\-\_\-t} telegram)]finish function 15 6 | \end{DoxyRefList} -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/examples/RS485_slave/RS485_slave.ino: -------------------------------------------------------------------------------- 1 | /** 2 | * Modbus slave example 3: 3 | * The purpose of this example is to link a data array 4 | * from the Arduino to an external device through RS485. 5 | * 6 | * Recommended Modbus Master: QModbus 7 | * http://qmodbus.sourceforge.net/ 8 | */ 9 | 10 | #include 11 | 12 | // assign the Arduino pin that must be connected to RE-DE RS485 transceiver 13 | #define TXEN 4 14 | 15 | // data array for modbus network sharing 16 | uint16_t au16data[16] = { 17 | 3, 1415, 9265, 4, 2, 7182, 28182, 8, 0, 0, 0, 0, 0, 0, 1, -1 }; 18 | 19 | /** 20 | * Modbus object declaration 21 | * u8id : node id = 0 for master, = 1..247 for slave 22 | * u8serno : serial port (use 0 for Serial) 23 | * u8txenpin : 0 for RS-232 and USB-FTDI 24 | * or any pin number > 1 for RS-485 25 | */ 26 | Modbus slave(1,0,TXEN); // this is slave @1 and RS-485 27 | 28 | void setup() { 29 | slave.begin( 19200 ); // baud-rate at 19200 30 | } 31 | 32 | void loop() { 33 | slave.poll( au16data, 16 ); 34 | } 35 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/examples/advanced_master/advanced_master.ino: -------------------------------------------------------------------------------- 1 | /** 2 | * Modbus master example 2: 3 | * The purpose of this example is to query several sets of data 4 | * from an external Modbus slave device. 5 | * The link media can be USB or RS232. 6 | * 7 | * Recommended Modbus slave: 8 | * diagslave http://www.modbusdriver.com/diagslave.html 9 | * 10 | * In a Linux box, run 11 | * "./diagslave /dev/ttyUSB0 -b 19200 -d 8 -s 1 -p none -m rtu -a 1" 12 | * This is: 13 | * serial port /dev/ttyUSB0 at 19200 baud 8N1 14 | * RTU mode and address @1 15 | */ 16 | 17 | #include 18 | 19 | uint16_t au16data[16]; //!< data array for modbus network sharing 20 | uint8_t u8state; //!< machine state 21 | uint8_t u8query; //!< pointer to message query 22 | 23 | /** 24 | * Modbus object declaration 25 | * u8id : node id = 0 for master, = 1..247 for slave 26 | * u8serno : serial port (use 0 for Serial) 27 | * u8txenpin : 0 for RS-232 and USB-FTDI 28 | * or any pin number > 1 for RS-485 29 | */ 30 | Modbus master(0,0,0); // this is master and RS-232 or USB-FTDI 31 | 32 | /** 33 | * This is an structe which contains a query to an slave device 34 | */ 35 | modbus_t telegram[2]; 36 | 37 | unsigned long u32wait; 38 | 39 | void setup() { 40 | // telegram 0: read registers 41 | telegram[0].u8id = 1; // slave address 42 | telegram[0].u8fct = 3; // function code (this one is registers read) 43 | telegram[0].u16RegAdd = 0; // start address in slave 44 | telegram[0].u16CoilsNo = 4; // number of elements (coils or registers) to read 45 | telegram[0].au16reg = au16data; // pointer to a memory array in the Arduino 46 | 47 | // telegram 1: write a single register 48 | telegram[1].u8id = 1; // slave address 49 | telegram[1].u8fct = 6; // function code (this one is write a single register) 50 | telegram[1].u16RegAdd = 4; // start address in slave 51 | telegram[1].u16CoilsNo = 1; // number of elements (coils or registers) to read 52 | telegram[1].au16reg = au16data+4; // pointer to a memory array in the Arduino 53 | 54 | master.begin( 19200 ); // baud-rate at 19200 55 | master.setTimeOut( 5000 ); // if there is no answer in 5000 ms, roll over 56 | u32wait = millis() + 1000; 57 | u8state = u8query = 0; 58 | } 59 | 60 | void loop() { 61 | switch( u8state ) { 62 | case 0: 63 | if (millis() > u32wait) u8state++; // wait state 64 | break; 65 | case 1: 66 | master.query( telegram[u8query] ); // send query (only once) 67 | u8state++; 68 | u8query++; 69 | if (u8query > 2) u8query = 0; 70 | break; 71 | case 2: 72 | master.poll(); // check incoming messages 73 | if (master.getState() == COM_IDLE) { 74 | u8state = 0; 75 | u32wait = millis() + 1000; 76 | } 77 | break; 78 | } 79 | 80 | au16data[4] = analogRead( 0 ); 81 | 82 | } 83 | 84 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/examples/advanced_slave/advanced_slave.ino: -------------------------------------------------------------------------------- 1 | /** 2 | * Modbus slave example 2: 3 | * The purpose of this example is to link the Arduino digital and analog 4 | * pins to an external device. 5 | * 6 | * Recommended Modbus Master: QModbus 7 | * http://qmodbus.sourceforge.net/ 8 | */ 9 | 10 | #include 11 | #define ID 1 12 | 13 | Modbus slave(ID, 0, 0); // this is slave ID and RS-232 or USB-FTDI 14 | boolean led; 15 | int8_t state = 0; 16 | unsigned long tempus; 17 | 18 | // data array for modbus network sharing 19 | uint16_t au16data[9]; 20 | 21 | /** 22 | * Setup procedure 23 | */ 24 | void setup() { 25 | io_setup(); // I/O settings 26 | 27 | // start communication 28 | slave.begin( 19200 ); 29 | tempus = millis() + 100; 30 | digitalWrite(13, HIGH ); 31 | } 32 | 33 | /** 34 | * Loop procedure 35 | */ 36 | void loop() { 37 | // poll messages 38 | // blink led pin on each valid message 39 | state = slave.poll( au16data, 9 ); 40 | 41 | if (state > 4) { 42 | tempus = millis() + 50; 43 | digitalWrite(13, HIGH); 44 | } 45 | if (millis() > tempus) digitalWrite(13, LOW ); 46 | 47 | // link the Arduino pins to the Modbus array 48 | io_poll(); 49 | } 50 | 51 | /** 52 | * pin maping: 53 | * 2 - digital input 54 | * 3 - digital input 55 | * 4 - digital input 56 | * 5 - digital input 57 | * 6 - digital output 58 | * 7 - digital output 59 | * 8 - digital output 60 | * 9 - digital output 61 | * 10 - analog output 62 | * 11 - analog output 63 | * 14 - analog input 64 | * 15 - analog input 65 | * 66 | * pin 13 is reserved to show a successful query 67 | */ 68 | void io_setup() { 69 | // define i/o 70 | pinMode(2, INPUT); 71 | pinMode(3, INPUT); 72 | pinMode(4, INPUT); 73 | pinMode(5, INPUT); 74 | pinMode(6, OUTPUT); 75 | pinMode(7, OUTPUT); 76 | pinMode(8, OUTPUT); 77 | pinMode(9, OUTPUT); 78 | pinMode(10, OUTPUT); 79 | pinMode(11, OUTPUT); 80 | pinMode(13, OUTPUT); 81 | 82 | digitalWrite(6, LOW ); 83 | digitalWrite(7, LOW ); 84 | digitalWrite(8, LOW ); 85 | digitalWrite(9, LOW ); 86 | digitalWrite(13, HIGH ); // this is for the UNO led pin 87 | analogWrite(10, 0 ); 88 | analogWrite(11, 0 ); 89 | } 90 | 91 | /** 92 | * Link between the Arduino pins and the Modbus array 93 | */ 94 | void io_poll() { 95 | // get digital inputs -> au16data[0] 96 | bitWrite( au16data[0], 0, digitalRead( 2 )); 97 | bitWrite( au16data[0], 1, digitalRead( 3 )); 98 | bitWrite( au16data[0], 2, digitalRead( 4 )); 99 | bitWrite( au16data[0], 3, digitalRead( 5 )); 100 | 101 | // set digital outputs -> au16data[1] 102 | digitalWrite( 6, bitRead( au16data[1], 0 )); 103 | digitalWrite( 7, bitRead( au16data[1], 1 )); 104 | digitalWrite( 8, bitRead( au16data[1], 2 )); 105 | digitalWrite( 9, bitRead( au16data[1], 3 )); 106 | 107 | // set analog outputs 108 | analogWrite( 10, au16data[2] ); 109 | analogWrite( 11, au16data[3] ); 110 | 111 | // read analog inputs 112 | au16data[4] = analogRead( 0 ); 113 | au16data[5] = analogRead( 1 ); 114 | 115 | // diagnose communication 116 | au16data[6] = slave.getInCnt(); 117 | au16data[7] = slave.getOutCnt(); 118 | au16data[8] = slave.getErrCnt(); 119 | } 120 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/examples/simple_master/simple_master.ino: -------------------------------------------------------------------------------- 1 | /** 2 | * Modbus master example 1: 3 | * The purpose of this example is to query an array of data 4 | * from an external Modbus slave device. 5 | * The link media can be USB or RS232. 6 | * 7 | * Recommended Modbus slave: 8 | * diagslave http://www.modbusdriver.com/diagslave.html 9 | * 10 | * In a Linux box, run 11 | * "./diagslave /dev/ttyUSB0 -b 19200 -d 8 -s 1 -p none -m rtu -a 1" 12 | * This is: 13 | * serial port /dev/ttyUSB0 at 19200 baud 8N1 14 | * RTU mode and address @1 15 | */ 16 | 17 | #include 18 | 19 | // data array for modbus network sharing 20 | uint16_t au16data[16]; 21 | uint8_t u8state; 22 | 23 | /** 24 | * Modbus object declaration 25 | * u8id : node id = 0 for master, = 1..247 for slave 26 | * u8serno : serial port (use 0 for Serial) 27 | * u8txenpin : 0 for RS-232 and USB-FTDI 28 | * or any pin number > 1 for RS-485 29 | */ 30 | Modbus master(0,0,0); // this is master and RS-232 or USB-FTDI 31 | 32 | /** 33 | * This is an structe which contains a query to an slave device 34 | */ 35 | modbus_t telegram; 36 | 37 | unsigned long u32wait; 38 | 39 | void setup() { 40 | master.begin( 19200 ); // baud-rate at 19200 41 | master.setTimeOut( 2000 ); // if there is no answer in 2000 ms, roll over 42 | u32wait = millis() + 1000; 43 | u8state = 0; 44 | } 45 | 46 | void loop() { 47 | switch( u8state ) { 48 | case 0: 49 | if (millis() > u32wait) u8state++; // wait state 50 | break; 51 | case 1: 52 | telegram.u8id = 1; // slave address 53 | telegram.u8fct = 3; // function code (this one is registers read) 54 | telegram.u16RegAdd = 1; // start address in slave 55 | telegram.u16CoilsNo = 4; // number of elements (coils or registers) to read 56 | telegram.au16reg = au16data; // pointer to a memory array in the Arduino 57 | 58 | master.query( telegram ); // send query (only once) 59 | u8state++; 60 | break; 61 | case 2: 62 | master.poll(); // check incoming messages 63 | if (master.getState() == COM_IDLE) { 64 | u8state = 0; 65 | u32wait = millis() + 100; 66 | } 67 | break; 68 | } 69 | } 70 | 71 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/examples/simple_slave/simple_slave.ino: -------------------------------------------------------------------------------- 1 | /** 2 | * Modbus slave example 1: 3 | * The purpose of this example is to link a data array 4 | * from the Arduino to an external device. 5 | * 6 | * Recommended Modbus Master: QModbus 7 | * http://qmodbus.sourceforge.net/ 8 | */ 9 | 10 | #include 11 | 12 | // data array for modbus network sharing 13 | uint16_t au16data[16] = { 14 | 3, 1415, 9265, 4, 2, 7182, 28182, 8, 0, 0, 0, 0, 0, 0, 1, -1 }; 15 | 16 | /** 17 | * Modbus object declaration 18 | * u8id : node id = 0 for master, = 1..247 for slave 19 | * u8serno : serial port (use 0 for Serial) 20 | * u8txenpin : 0 for RS-232 and USB-FTDI 21 | * or any pin number > 1 for RS-485 22 | */ 23 | Modbus slave(1,0,0); // this is slave @1 and RS-232 or USB-FTDI 24 | 25 | void setup() { 26 | slave.begin( 19200 ); // baud-rate at 19200 27 | } 28 | 29 | void loop() { 30 | slave.poll( au16data, 16 ); 31 | } 32 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For Modbus-Master-Slave 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | modbus_t KEYWORD1 9 | 10 | ####################################### 11 | # Methods and Functions (KEYWORD2) 12 | ####################################### 13 | begin KEYWORD2 14 | poll KEYWORD2 15 | getInCnt KEYWORD2 16 | getOutCnt KEYWORD2 17 | getErrCnt KEYWORD2 18 | getID KEYWORD2 19 | getState KEYWORD2 20 | query KEYWORD2 21 | setTimeOut KEYWORD2 22 | 23 | ####################################### 24 | # Instances (KEYWORD2) 25 | ####################################### 26 | Modbus KEYWORD2 27 | 28 | ####################################### 29 | # Constants (LITERAL1) 30 | ####################################### 31 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/modbus.h: -------------------------------------------------------------------------------- 1 | #include 2 | #ifndef _MODBUSPROTOCOL 3 | #define _MODBUSPROTOCOL 4 | 5 | //Maximum device list for network 6 | #define DEVMAX 10 7 | //Maximum control register que size 8 | #define QUEMAX 10 9 | //Maximum serial wait in micro seconds 10 | #define SERIALMAXDELAY 100 11 | #define SERIALBAUD 9600 12 | //the total silence time needed to signify an EOM or SOM in RTU mode 13 | 14 | //Modbus function codes 15 | #define READ_DO 0x01 16 | #define READ_DI 0x02 17 | #define READ_AO 0x03 18 | #define READ_AI 0x04 19 | 20 | #define WRITE_DO 0x05 21 | #define WRITE_AO 0x06 22 | 23 | #define RTU 0x01 24 | #define ASCII 0x02 25 | 26 | #define MASTER 0x01 27 | #define SLAVE 0x02 28 | 29 | #define DO 0x00 30 | #define DI 0x01 31 | #define AI 0x03 32 | #define AO 0x04 33 | 34 | #endif -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/modbusDevice.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | modbusDevice::modbusDevice(void) 4 | { 5 | _id=NULL; 6 | } 7 | 8 | void modbusDevice::setId(byte id) 9 | { 10 | _id=id; 11 | } 12 | 13 | byte modbusDevice::getId(void) 14 | { 15 | return(_id); 16 | } 17 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/modbusDevice.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #ifndef _MODBUSDEVICE 5 | #define _MODBUSDEVICE 6 | 7 | #include 8 | #include 9 | //#include 10 | 11 | class modbusDevice:public modbusRegBank 12 | { 13 | public: 14 | modbusDevice(void); 15 | void setId(byte id); 16 | byte getId(void); 17 | 18 | private: 19 | byte _id; 20 | }; 21 | #endif 22 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/modbusRegBank.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | modbusRegBank::modbusRegBank(void) 5 | { 6 | _digRegs = 0; 7 | _lastDigReg = 0; 8 | _anaRegs = 0; 9 | _lastAnaReg = 0; 10 | } 11 | 12 | 13 | void modbusRegBank::add(word addr) 14 | { 15 | if(addr<20000) 16 | { 17 | modbusDigReg *temp; 18 | 19 | temp = (modbusDigReg *) malloc(sizeof(modbusDigReg)); 20 | temp->address = addr; 21 | temp->value = 0; 22 | temp->next = 0; 23 | 24 | if(_digRegs == 0) 25 | { 26 | _digRegs = temp; 27 | _lastDigReg = _digRegs; 28 | } 29 | else 30 | { 31 | //Assign the last register's next pointer to temp; 32 | _lastDigReg->next = temp; 33 | //then make temp the last register in the list. 34 | _lastDigReg = temp; 35 | } 36 | } 37 | else 38 | { 39 | modbusAnaReg *temp; 40 | 41 | temp = (modbusAnaReg *) malloc(sizeof(modbusAnaReg)); 42 | temp->address = addr; 43 | temp->value = 0; 44 | temp->next = 0; 45 | 46 | if(_anaRegs == 0) 47 | { 48 | _anaRegs = temp; 49 | _lastAnaReg = _anaRegs; 50 | } 51 | else 52 | { 53 | _lastAnaReg->next = temp; 54 | _lastAnaReg = temp; 55 | } 56 | } 57 | } 58 | 59 | word modbusRegBank::get(word addr) 60 | { 61 | if(addr < 20000) 62 | { 63 | modbusDigReg * regPtr; 64 | regPtr = (modbusDigReg *) this->search(addr); 65 | if(regPtr) 66 | return(regPtr->value); 67 | else 68 | return(NULL); 69 | } 70 | else 71 | { 72 | modbusAnaReg * regPtr; 73 | regPtr = (modbusAnaReg *) this->search(addr); 74 | if(regPtr) 75 | return(regPtr->value); 76 | else 77 | return(NULL); 78 | } 79 | } 80 | 81 | void modbusRegBank::set(word addr, word value) 82 | { 83 | //for digital data 84 | if(addr < 20000) 85 | { 86 | modbusDigReg * regPtr; 87 | //search for the register address 88 | regPtr = (modbusDigReg *) this->search(addr); 89 | //if a pointer was returned the set the register value to true if value is non zero 90 | if(regPtr) 91 | if(value) 92 | regPtr->value = 0xFF; 93 | else 94 | regPtr->value = 0x00; 95 | } 96 | else 97 | { 98 | modbusAnaReg * regPtr; 99 | //search for the register address 100 | regPtr = (modbusAnaReg *) this->search(addr); 101 | //if found then assign the register value to the new value. 102 | if(regPtr) 103 | regPtr->value = value; 104 | } 105 | } 106 | 107 | void * modbusRegBank::search(word addr) 108 | { 109 | //if the requested address is 0-19999 110 | //use a digital register pointer assigned to the first digital register 111 | //else use a analog register pointer assigned the first analog register 112 | 113 | if(addr < 20000) 114 | { 115 | modbusDigReg *regPtr = _digRegs; 116 | 117 | //if there is no register configured, bail 118 | if(regPtr == 0) 119 | return(0); 120 | 121 | //scan through the linked list until the end of the list or the register is found. 122 | //return the pointer. 123 | do 124 | { 125 | if(regPtr->address == addr) 126 | return(regPtr); 127 | regPtr = regPtr->next; 128 | } 129 | while(regPtr); 130 | } 131 | else 132 | { 133 | modbusAnaReg *regPtr = _anaRegs; 134 | 135 | //if there is no register configured, bail 136 | if(regPtr == 0) 137 | return(0); 138 | 139 | //scan through the linked list until the end of the list or the register is found. 140 | //return the pointer. 141 | do 142 | { 143 | if(regPtr->address == addr) 144 | return(regPtr); 145 | regPtr = regPtr->next; 146 | } 147 | while(regPtr); 148 | } 149 | return(0); 150 | } 151 | 152 | 153 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/modbusRegBank.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | 5 | #ifndef _MODBUSREGBANK 6 | #define _MODBUSREGBANK 7 | 8 | #include 9 | //#include 10 | 11 | 12 | struct modbusDigReg 13 | { 14 | word address; 15 | byte value; 16 | 17 | modbusDigReg *next; 18 | }; 19 | 20 | struct modbusAnaReg 21 | { 22 | word address; 23 | word value; 24 | 25 | modbusAnaReg *next; 26 | }; 27 | 28 | class modbusRegBank 29 | { 30 | public: 31 | 32 | modbusRegBank(void); 33 | 34 | void add(word); 35 | word get(word); 36 | void set(word, word); 37 | 38 | private: 39 | void * search(word); 40 | 41 | modbusDigReg *_digRegs, 42 | *_lastDigReg; 43 | 44 | modbusAnaReg *_anaRegs, 45 | *_lastAnaReg; 46 | }; 47 | #endif 48 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/modbusSlave.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus RTU/Modbus/modbusSlave.h -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus TCP Slave/ModbusTCPSlave/Keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For Mudbus 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | ModbusTCPSlave KEYWORD1 10 | 11 | ####################################### 12 | # Methods and Functions (KEYWORD2) 13 | ####################################### 14 | 15 | Run KEYWORD2 16 | MBInputRegister KEYWORD2 17 | MBHoldingRegister KEYWORD2 18 | 19 | ####################################### 20 | # Constants (LITERAL1) 21 | ####################################### 22 | 23 | MBDebug LITERAL1 24 | MB_PORT LITERAL1 25 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus TCP Slave/ModbusTCPSlave/ModbusTCPSlave.h: -------------------------------------------------------------------------------- 1 | /* 2 | ModbusTCPSlave.h - an Arduino library for a Modbus TCP slave. 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | // Note: The Arduino IDE does not respect conditional included 19 | // header files in the main sketch so you have to select your 20 | // here. 21 | // 22 | #ifndef ModbusTCPSlave_h 23 | #define ModbusTCPSlave_h 24 | 25 | #define MB_PORT 502 26 | 27 | //#define MB_ETHERNET 28 | //#define MB_CC3000 29 | #define MB_ESP8266 30 | 31 | #define MBDebug //Serial1 debug enable 32 | 33 | #include "Arduino.h" 34 | 35 | #ifdef MB_ETHERNET 36 | #include 37 | #define LED_PIN 13 38 | #endif 39 | #ifdef MB_CC3000 40 | #define LED_PIN 13 41 | #include 42 | #include 43 | #define ADAFRUIT_CC3000_IRQ 3 44 | #define ADAFRUIT_CC3000_VBAT 5 45 | #define ADAFRUIT_CC3000_CS 10 46 | #endif 47 | #ifdef MB_ESP8266 48 | #define LED_PIN 5 49 | #include 50 | #endif 51 | 52 | #define maxInputRegister 20 53 | #define maxHoldingRegister 20 54 | 55 | // 56 | // MODBUS Function Codes 57 | // 58 | #define MB_FC_NONE 0 59 | #define MB_FC_READ_COILS 1 60 | #define MB_FC_READ_DISCRETE_INPUT 2 61 | #define MB_FC_READ_REGISTERS 3 //implemented 62 | #define MB_FC_READ_INPUT_REGISTERS 4 //implemented 63 | #define MB_FC_WRITE_COIL 5 64 | #define MB_FC_WRITE_REGISTER 6 //implemented 65 | #define MB_FC_WRITE_MULTIPLE_COILS 15 66 | #define MB_FC_WRITE_MULTIPLE_REGISTERS 16 //implemented 67 | // 68 | // MODBUS Error Codes 69 | // 70 | #define MB_EC_NONE 0 71 | #define MB_EC_ILLEGAL_FUNCTION 1 72 | #define MB_EC_ILLEGAL_DATA_ADDRESS 2 73 | #define MB_EC_ILLEGAL_DATA_VALUE 3 74 | #define MB_EC_SLAVE_DEVICE_FAILURE 4 75 | // 76 | // MODBUS MBAP offsets 77 | // 78 | #define MB_TCP_TID 0 79 | #define MB_TCP_PID 2 80 | #define MB_TCP_LEN 4 81 | #define MB_TCP_UID 6 82 | #define MB_TCP_FUNC 7 83 | #define MB_TCP_REGISTER_START 8 84 | #define MB_TCP_REGISTER_NUMBER 10 85 | 86 | class ModbusTCPSlave 87 | { 88 | public: 89 | ModbusTCPSlave(void); 90 | #ifdef MB_ETHERNET 91 | void begin(); 92 | void begin(uint8_t ip[4],uint8_t gateway[4],uint8_t subnet[4]); 93 | #endif 94 | #ifdef MB_CC3000 95 | void begin(const char *ssid, const char *key, uint8_t secmode); 96 | #endif 97 | #ifdef MB_ESP8266 98 | void begin(const char *ssid, const char *key); 99 | void begin(const char *ssid, const char *key,uint8_t ip[4],uint8_t gateway[4],uint8_t subnet[4]); 100 | #endif 101 | void Run(); 102 | void Stop(); 103 | unsigned int MBInputRegister[maxInputRegister]; 104 | unsigned int MBHoldingRegister[maxHoldingRegister]; 105 | 106 | private: 107 | byte ByteArray[260]; 108 | bool ledPinStatus = LOW; 109 | 110 | 111 | #ifdef MB_ETHERNET 112 | EthernetServer MBServer; 113 | #endif 114 | 115 | #ifdef MB_CC3000 116 | Adafruit_CC3000 MBClient; 117 | Adafruit_CC3000_Server MBServer; 118 | #endif 119 | 120 | #ifdef MB_ESP8266 121 | WiFiServer MBServer; 122 | #endif 123 | }; 124 | 125 | #endif 126 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus TCP Slave/ModbusTCPSlave/examples/ModbusCC3300Slave/ModbusCC3300Slave.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | unsigned long timer = 0; 6 | 7 | ModbusTCP Mb; 8 | //Function codes 1(read coils), 3(read registers), 5(write coil), 6(write register) 9 | //signed int Mb.R[0 to 125] and bool Mb.C[0 to 128] MB_N_R MB_N_C 10 | //Port 502 (defined in ModbusTCPSlave.h) MB_PORT 11 | 12 | void setup() 13 | { 14 | 15 | Mb.begin("myssid", "mypass", WLAN_SEC_WPA2); 16 | 17 | delay(5000); 18 | 19 | } 20 | 21 | void loop() 22 | { 23 | 24 | } 25 | 26 | 27 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus TCP Slave/ModbusTCPSlave/examples/ModbusESP8266Slave/ModbusESP8266Slave.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | ////https://forums.adafruit.com/viewtopic.php?f=31&t=61774&sid=06d9885dcf852259d1f568fa96e40265&start=15 5 | 6 | ////WIFI Settings 7 | ///* 8 | //byte ip[] = { 192, 168, 1, 126}; 9 | //byte gateway[] = { 192, 168, 1, 1 }; 10 | //byte subnet[] = { 255, 255, 255, 0 }; 11 | //*/ 12 | ModbusTCPSlave Mb; 13 | 14 | unsigned long timer; 15 | unsigned long checkRSSIMillis; 16 | 17 | void setup() 18 | { 19 | 20 | //Mb.begin("Telecom-28778737", "passwordwificasa47893000", ip, gateway, subnet); 21 | Mb.begin("1503523", "D2E7D32DBC883"); 22 | 23 | delay(1000); 24 | Mb.MBInputRegister[0] = 100; 25 | Mb.MBInputRegister[1] = 65500; 26 | Mb.MBInputRegister[2] = 300; 27 | Mb.MBInputRegister[3] = 400; 28 | Mb.MBInputRegister[4] = 500; 29 | 30 | Mb.MBHoldingRegister[0] = 1; 31 | Mb.MBHoldingRegister[1] = 2; 32 | Mb.MBHoldingRegister[2] = 3; 33 | Mb.MBHoldingRegister[3] = 4; 34 | Mb.MBHoldingRegister[4] = 5; 35 | 36 | } 37 | 38 | void loop() 39 | { 40 | Mb.Run(); 41 | delay(10); 42 | 43 | if (millis() - timer >= 1000) { 44 | timer = millis(); 45 | Mb.MBInputRegister[1]++; 46 | } 47 | 48 | if (millis() - checkRSSIMillis >= 10000) { 49 | checkRSSIMillis = millis(); 50 | Mb.MBInputRegister[0] = checkRSSI(); 51 | } 52 | } 53 | 54 | /*****FUNZIONI*****/ 55 | 56 | byte checkRSSI() { 57 | byte quality; 58 | long rssi = WiFi.RSSI(); 59 | if (rssi <= -100) 60 | quality = 0; 61 | else if (rssi >= -50) 62 | quality = 100; 63 | else 64 | rssi = rssi + 100; 65 | quality = byte(rssi * 2); 66 | 67 | return quality; 68 | } 69 | 70 | 71 | -------------------------------------------------------------------------------- /Arduino_ESP8266_ Modbus_Industrial_Applications/3. ESP8266BridgeMBSlaveTCP-RTU/Library Modbus TCP Slave/ModbusTCPSlave/examples/ModbusEthernetSlave/ModbusEthernetSlave.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | // Ethernet settings (depending on MAC and Local network) 6 | byte ip[] = { 192, 168, 1, 127}; 7 | byte gateway[] = { 192, 168, 1, 1 }; 8 | byte subnet[] = { 255, 255, 255, 0 }; 9 | 10 | unsigned long timer = 0; 11 | 12 | ModbusTCPSlave Mb; 13 | //Port 502 (defined in ModbusTCPS.h) MB_PORT 14 | 15 | void setup() 16 | { 17 | Mb.begin(ip, gateway, subnet); 18 | 19 | delay(1000); 20 | Mb.MBInputRegister[0] = 100; 21 | Mb.MBInputRegister[1] = 65500; 22 | Mb.MBInputRegister[2] = 300; 23 | Mb.MBInputRegister[3] = 400; 24 | Mb.MBInputRegister[4] = 500; 25 | 26 | Mb.MBHoldingRegister[0] = 1; 27 | Mb.MBHoldingRegister[1] = 2; 28 | Mb.MBHoldingRegister[2] = 3; 29 | Mb.MBHoldingRegister[3] = 4; 30 | Mb.MBHoldingRegister[4] = 5; 31 | } 32 | 33 | void loop() 34 | { 35 | Mb.Run(); 36 | 37 | if (millis() - timer >= 1000) { 38 | timer = millis(); 39 | Mb.MBInputRegister[1]++; 40 | } 41 | } 42 | 43 | 44 | -------------------------------------------------------------------------------- /Leeme.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/93b2f149df79f256bf9ba05a8bcbc076ed5da12f/Leeme.txt -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | #Arduino ESP8266 Modbus Industrial Applications TCP IP - Modbus RTU 2 | 3 | Arduino ESP8266 Modbus Industrial Applications 4 | 5 | Welcome to this space learning automation technology applied to industry and everyday life. 6 | If you like electronics, home automation, automation, programming, PLC, microcontrollers, 7 | Arduino, Python, Open source .... my blog will be a great help ... 8 | if you need help and information do not hesitate to consult. 9 | 10 | # Arduino Mega Master Modbus RTU 11 | ![Portada](https://github.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/blob/master/Arduino_ESP8266_%20Modbus_Industrial_Applications/1.%20Arduino%20MEGA%202560%20Master%20Modbus/Arduino%20mega%20modbus%20rtu%20MEJORADO.jpg) 12 | 13 | #ESP8266 Modbus TCP IP 14 | ![Portada](https://github.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/blob/master/Arduino_ESP8266_%20Modbus_Industrial_Applications/3.%20ESP8266BridgeMBSlaveTCP-RTU/Arduino%20mega%20modbus%20rtu%20final.jpg) 15 | 16 | # ESP8266 Bridge Modbus TPC IP - Modbus RTU 17 | ![Portada](https://github.com/JhonControl/Arduino_ESP8266_Modbus_Industrial_Applications/blob/master/Arduino_ESP8266_%20Modbus_Industrial_Applications/2.%20ESP8266%20Slave%20Modbus%20TCP/ESP8266%20Bridge%20Modbus%20TCP%20Modbus%20RTU%20FINAL.jpg) 18 | 19 | #Hi .... More information Proyects PDAControl 20 | 21 | Blog PDAControl English http://pdacontrolenglish.blogspot.com.co/ 22 | 23 | Blog PDAControl Español http://pdacontrol.blogspot.com.co/ 24 | 25 | Channel Youtube https://www.youtube.com/c/JhonValenciaPDAcontrol/videos 26 | 27 | Twitter Spanish https://twitter.com/PDAControl 28 | 29 | Twitter Enghish: https://twitter.com/Jhon_Control 30 | --------------------------------------------------------------------------------