config.php: Contains the database configuration and connection using PDO. modbus.php: Connects to the Modbus IP device and reads registers. save_data.php: Saves the data to the "data_storage" table at the user-defined interval. display_data.php: Displays the data in a table on the website at the user-defined interval. graph.php: Displays a graph of the selected registers using Chart.js. fetch_data.php: Fetches data from the "data_storage" table for use in the graph. export_excel.php: Exports the data from the "data_storage" table to an Excel file based on the user's chosen date and time. Please note that you'll need to create the "data_storage" table in your MySQL database and adjust the code according to your specific requirements. Additionally, you may need to create HTML forms and handle user input for some of the files, such as save_data.php, display_data.php, and export_excel.php. Also, don't forget to install the required libraries using Composer: "phpmodbus" library for modbus.php "phpoffice/phpspreadsheet" library for export_excel.php Once you have set up the files and made any necessary adjustments, you should have a working system to read Modbus IP device data, save it to a database, display it in a table and a graph, and export it to an Excel file.
Comments