.
USING PHPMYADMIN LOCALHOST TO READ DATA FROM WINCC ADVANCED_TIAPORTAL
.Contact: doantuanbkhn@gmail.com .Phone: +84984412394
.Require Softwares:
- XAMPP 8.1.25 / PHP 8.1.25 https://www.apachefriends.org/download.html
- Tiaportal and WinCC Advanced (version 15 or
more)
- Connector/ODBC 9.0.0 version for x64bit or https://dev.mysql.com/downloads/connector/odbc.html
- Connector/ODBC 8.0.37 version for x86 32bit
- Composer Using to setup export to file.xlsx function
Composer (getcomposer.org)
Note: Check folder Wincc Advanced was installed in C:\Program Files (64bit) or C:\Program Files (x86-32bit)
to install compatible Connector/ODBC
.Target: SEND Value Type: INT from Wincc Advanced to DataBase MySQL in phpMyAdmin;
.STEP BY STEP:
1. Open XAMPP to setup a localhost
Start Apache port 80, 443
. Start MySQL
. Access: localhost/phpmyAdmin/ - by your Browser
. Default IP: 127.0.0.1 - you can change IP at C:\Windows\System32\drivers\etc\hosts
. Create a Database name: wincc_database
. Create a table name: sensor_table - has 04 columns (value 1, value 2, value 3, value 4 / type Double)
value 1, 2, 3, 4 is the values you want to read from Wincc Advanced.
2. Run as Administrator ODBC Data Source 32 Bit
.My Wincc Advanced was installed in C:\Program Files (x86-32bit) > Install Connector/ODBC 8.0.37 version
for x32 bit.
.Create a New Data Source (in User DNS or System DNS) > Add
Choose MySQL ODBC 8.0 Unicode Driver
Data Source Name: WinccAdvance_MySQL
TCP/IP: 127.0.0.1 Port:3306 <IP of localhost phpmyAdmin>
User: root
Database: wincc_database <which is created in MySQL phpmyAdmin>
3. Make connection between WinCC Advanced & MySQl phpmyAdmin
Open Tiaportal -> Create a new project -> Add new HMI Wincc Advanced.
- In PLC program, create a Datablock have 4 value. Set Attributes is none Optimized Block Access
Attributes is none Optimized Block
Access
In Wincc Advande tag, create HMI_tag connect to value_tag in PLC Datablock
- Open Vbscipt, create 02 VB function
. Open_localhost : open a phpAdmin web with address: localhost/phpMyAdmin
. Send_Value_MySQL : connect with MySQL in phpmyAdmin and send value to Wincc_database >
sensor_table
In this sample, I will send 04 value from Hmi_tag to MySQL
- Open Screen
.Use a Open_localhost button to run VBscript Open_localhost function
.Use a Export_Data button to run VBscript Send_Value_MySQL function
- Run Wincc Advanced
.Online PLC and change the value of tag in DATA_MYSQL
.Click Export_Data button to send data
.Click Open_localhost to open phpAdmin website
.Check the result in phpAdmin>wincc_database>sensor_table
*NOTE: Source code in attached files!! Or you can download at link:
https://onedrive.live.com/?id=3F9D995F0DCFB09F%2140141&cid=3F9D995F0DCFB09F
You can design another php_website to take database from phpmyAdmin and export data to a csv,xlsx,pdf…
file. Let try!!