Now You Can Have Robust Data Logging for Free – Part 11

Now You Can Have Robust Data Logging for Free – Part 11

HTML and Scripting Languages

 We have the following accomplished:
  • PLC program
  • Visual Basic Program
  • Data collected in a Database
  • IIS web service established


The IIS web service machine must have the Microsoft Access Database Engine 2010 installed. The following link can obtain this:
You can select the 32-bit or 64-bit version that matches your computer.

Microsoft Access Database Engine 2010 Redistributable
Note:  If you have office installed on your machine already, then you probably will already have this file.

ActiveX Data Objects (ADO) access databases from your web pages. ADOVBS.inc is a file that has all of the ADO constants defined. Be sure to add this file to your root web application directory. The sample code below shows how to add this code to a web page.
You can download ADOVBS.inc from this site in text format. (Just rename to ADOVBS.inc from ADOVBS.txt)
ADO Introduction:
http://www.w3schools.com/asp/ado_intro.asp

Let’s set up ASP on IIS to display error messages to our browser.
Call up Control Panel and then go to Administrative Tools. Call up the Internet Information Services (IIS) Manager.iis100

From IIS Manager, double-click on ASP under IIS. Expand Debugging Properties and change the Send Errors To Browser to True.

iis102

iis103

Let’s also ensure that your browser is set to display the error messages in internet explorer (IE). Call up Internet options from the main settings.

iis104

iis105

Click the setting for ‘Show friendly HTTP error messages.’ This will ensure that the error messages show up in your browser.

The last part of our project is to display the database information to the network. We do this by using a webpage. The HTML and VBScript can be written in any editor. (Like Notepad)

There are also many online editors so you can visually see your page’s look while developing your code.
To learn more about VBScript, follow the link below:
Let’s take a look at the AccRL.asp file:


<html>
<head>
<meta HTTP-EQUIV=”Refresh” CONTENT=”300″>
<title>ACC Automation – Robust Logger</title>
<LINK REL=”SHORTCUT ICON” HREF=”http://192.168.1.3/ACC_Do.ico”/></head>
<!– #include virtual=”/adovbs.inc” –>
<%
Dim StartTime, EndTime
StartTime = Timer

Dim OBJdbConnection
Dim rs1
Dim objCmd

Set OBJdbConnection = Server.CreateObject(“ADODB.Connection”)
OBJdbConnection.Open “Provider=Microsoft.ACE.OLEDB.12.0;DATA SOURCE=C:\AccRL\data\AccRL.accdb;Persist Security Info=False;”
set rs1 = Server.CreateObject(“ADODB.recordset”)
with rs1
 .CursorType = adOpenForwardOnly
 .LockType = adLockReadOnly
 .CursorLocation = adUseServer
 .ActiveConnection = OBJdbConnection
 .Source = “SELECT * FROM Minute_Log;”
end with

rs1.Open
arraytime = rs1.getrows()
rs1.close

Response.Write arraytime(0,0) & “<br>”
Response.Write arraytime(1,0) & “<br>”
Response.Write Year(arraytime(1,0))& “/” & Right(“0” & Month(arraytime(1,0)), 2) & “/” & Right(“0” & Day(arraytime(1,0)), 2) & “<br>”
Response.Write arraytime(2,0)& “<br>”
Response.Write arraytime(3,0)& “<br>”
Response.Write arraytime(4,0)& “<br>”

EndTime = Timer
Response.write “<p>Processing took “&(EndTime-StartTime)&” seconds<p>&nbsp;”
%>
</body>
</html>

Place this AccRL.asp file into the root directory of our web server. Call up the page through our browser (http:\\localhost\AccRL.asp), and the following output will be seen.
iis106
In part 12, we will break down and modify the ASP code. Please email me for the complete PLC program, VB source code, and web page file, and ask for the ACC Robust Logger Program. I will be happy to email you the information.
If you have any questions or need further information, please get in touch with me.
Regards,
Garry

Now You Can Have Robust Data Logging for Free – Part 1
Now You Can Have Robust Data Logging for Free – Part 2
Now You Can Have Robust Data Logging for Free – Part 3
Now You Can Have Robust Data Logging for Free – Part 4
Now You Can Have Robust Data Logging for Free – Part 5
Now You Can Have Robust Data Logging for Free – Part 6
Now You Can Have Robust Data Logging for Free – Part 7
Now You Can Have Robust Data Logging for Free – Part 8
Now You Can Have Robust Data Logging for Free – Part 9
Now You Can Have Robust Data Logging for Free – Part 10
Now You Can Have Robust Data Logging for Free – Part 11



If you’re like most of my readers, you’re committed to learning about technology. Numbering systems used in PLCs are not challenging to learn and understand. We will walk through the numbering systems used in PLCs. This includes Bits, Decimals, Hexadecimal, ASCII, and Floating Points.

To get this free article, subscribe to my free email newsletter.


Use the information to inform other people how numbering systems work. Sign up now.

The ‘Robust Data Logging for Free’ eBook is also available as a free download. The link is included when you subscribe to ACC Automation.


Leave a Comment