Adjusting Daylight Savings Time In Do-More

Adjusting for daylight saving time in Do-More PLC.

When does it start and end?
Canada Daylight Saving Time begins at 2:00 am local time on the second Sunday in March. On the first Sunday in November areas on Daylight Saving Time return to Standard Time at 2:00 am local time. When Daylight Saving Time begins turn your clocks ahead one hour. This is what happens in most parts of Canada.



There are several methods in the Do-More PLC to account for Daylight Savings Time. You can use the internet time clock, manual adjustment or use an internal bit to set daylight savings time. Since websites for internet time may not always be reliable and we do not want to wake up at 2 am in the morning to set the real time clock, we will use the internal bit method.

ST768 $SummerTime Configuration
Set this bit ON to add one hour to LocalTime to account for Daylight Savings Time.

The first line of code will check for the 3rd month (March). Then ensure that the day is between 8 and 14 so that we are viewing the second week. Next make sure the day of the week is 0 (Sunday). Finally it will check to make sure the hour is 2 (2am). The ST768 $SummerTime will then be turned on to add one hour to the real time clock in the PLC.

The second line of code will check for the 11th month (November). Then ensure that the day is less than 8 first week. Next make sure the day of the week is 0 (Sunday). Finally it will check to make sure the hour is 2 (2am). The ST768 $SummerTime will then be turned off to subtract one hour to the real time clock in the PLC.

Adding this code to your existing logging information in the PLC can be helpful when determining the correct time.

If you have any questions or need further information, please contact me.
Regards,
Garry

P.S. In the contact section, send me a email and I will send you a link for the download of this code.



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

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.

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

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

HTML and Scripting Languages

 We have the following accomplished:
  • PLC program
  • Visual Basic Program
  • Data collected in a Database
  • IIS web service established
  • ASP Script Written
Lets take a closer look at the ASP Script ( AccRL.asp) that was written in part 11:
The <html> is at the start of the file and the </head> is at the end of the file. These tags all have to have a start and end.  The ‘/’ indicates the end of the tag.
The <head> is used to place the information for the web page. The refresh will load the page after 300 seconds (5 minutes). This way the information will always be the latest. Title is used to label the page. This is the information at the top of the browser. The SHORTCUT ICON is used for the icon at the top of the browser near the page address.
<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>

ActiveX Data Objects (ADO) is used to 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 in your root web application directory.
<!– #include virtual=”/adovbs.inc” –>

The <% and %> symbols indicate the start and finish of VBScript in the page. We dimension our variables for StartTime and EndTime. These will be used to determine how long our script took to execute.
<%
Dim StartTime, EndTime
StartTime = Timer

We dimension the variables that are used for the connection to the database file.
Dim OBJdbConnection
Dim rs1
Dim objCmd

We set up the connection to the database and determine what information we need to retrieve.
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

Using getrows will allow us to execute the Select command and retrieve all of the information in one pass from the database.  This is the quickest method to get the information out quickly.
rs1.Open

arraytime = rs1.getrows()
rs1.close

We now write the information from the database to the page.
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>”

The EndTime is now set and the total time it took for the process is displayed.
EndTime = Timer

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

Now that you have information into the database and IIS running, you can display the data in various ways.
Charts:
Graphs:
 Gauges:
This ends our robust logger design. For the complete PLC program, VB source code and web page file please send me an email 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 contact 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
Now You Can Have Robust Data Logging for Free – Part 12




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

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.

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 machine that has the IIS web service must have the Microsoft Access Database Engine 2010 installed. This can be obtained by the following link:
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) is used to 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 in your root web application directory. How to add this code to a web page is shown in the sample code below .
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

Lets set up ASP on IIS to display any error messages to our browser.
Call up Control Panel and then goto Administrative Tools. Call up Internet Information Services (IIS) Manger.

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

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

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 writing in any editor. (Like Notepad)

There are also a great number of online editors that you can visual see what your page will look like while developing your code.
To learn more about VBScript following the link below:
Lets 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 though our browser (http:\\localhost\AccRL.asp) and the following output will be seen.
In part 12 we will break down the ASP code and modify. For the complete PLC program, VB source code and web page file please send me an email 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 contact 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 PLC’s are not difficult to learn and understand. We will walk through the numbering systems used in PLCs. This includes Bits, Decimal, Hexadecimal, ASCII and Floating Point.

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.

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

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

Computer Web Server (IIS)

 We have come a long way. The PLC program has been written. The visual basic program has been written. Information is now being collected from the Do-more PLC via Modbus TCP and stored in a database using visual basic.
The next step is to deliver the information on the network. We will do this by installing the Internet Information Services. (IIS) This is a group of internet servers that include a Web or Hypertext Transfer Protocol server (HTTP) and a File Transfer Protocol server (FTP). IIS will allow us to connect the physical hardware to the data. This could be desktop computers, laptops, tablets, cell phones, watches etc. The advantage of using HTTP is that we can share the information to all of these devices without having to be concerned over the operating system of each of them. As long as they can display a web page we are good to go.
Active Service Pages (ASP) will be installed at the same time. This is a program that will run scrips at the server before delivering the HTML code to the browser. It is similar to CGI and Perl but is simpler and faster.
ASP.Net Tutorial
We will install this on a Windows 8.1 machine.
Call up the Control Panel.
  • Swiping in from the right and searching for “control panel”.
  • Win + x will call a menu to select the control panel.
Select Programs and Features
Select Turn Windows features on or off
Select ASP after expanding Internet Information Services / World Wide Web Services / Application Development Features. This will select all of the other options.
Hit OK to install the services.
We now have IIS installed.
Under the following default directory you will find the location to put your web pages.
C:\inetpub\wwwroot\
If you call up the iisstart.htm file in this directory it will call up a page from Microsoft to explain the IIS web service.
Installing IIS on windows 7 and XP is very similar to the above procedure. Windows 98 you had to install a personal web service (PWS) and then ASP separately.
Further information on ASP can be obtained from the following website:
This site will walk you through ASP.
In part 11 we will  look at HTML and scripting languages like JavaScript or VBScript.
If you have any questions or need further information, please contact 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




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

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.

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

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

Computer Program Visual Basic (VB6) Continue

 

The final code will be completed for the program. If you want a link to download the complete code then go to the contact page and put Robust Logger Program in the description.

The actual code that will be seen will be in Italic. This way you can pick out the code from the commentary.

Private Sub Form_Load()
MbusStatus = 0
ProductionPointerNow = 10
MinutePointerNow = 660
End Sub
 
When our form loads, the MbusStatus will be set to 0. This will control all of the communications to the Do-More PLC. The ProductionPointerNow and the MinutePointerNow will be used to determine where we are in getting data.
Here are our declarations for the program.
Dim MbusQuery
Public MbusResponse As String
Dim MbusByteArray(255) As Byte
Public MbusStatus As Integer
Public ProductionPointer As Integer
Public ProductionPointerNow As Integer
Public MinutePointer As Integer
Public MinutePointerNow As Integer
Start Logging Button:
We will stop or ensure the timer between reads has been disabled.
We will then check the status of the winsock. If it is not opened and ready to send then change the background colour to indicate to the operator what is going on.
Note:  Winsock RemotePort = 502
Private Sub Command1_Click()
Timer1.Enabled = False ‘ Stop the interval between reads to the PLC
Dim StartTime
If Winsock1.State <> 7 Then
If (Winsock1.State <> sckClosed) Then
Winsock1.Close
End If
Winsock1.RemoteHost = Text1.Text ‘ Set IP Address
Winsock1.Connect
StartTime = Timer ‘ Use the timer to determine if a connection cannot be made
Do While ((Timer < StartTime + 2) And (Winsock1.State <> 7))
DoEvents
Loop
If (Winsock1.State = 7) Then
Text1.BackColor = &HFF00& ‘ Change background colour to green
Else
Text1.BackColor = &HFF ‘ Change background colour to red
Exit Sub
End If
End If
Check the status of the Winsock. If we are good to go then determine the MbusStatus (0 to 9) and either send a read or write string out to the PLC.
If (Winsock1.State = 7) Then
Select Case MbusStatus
Case 0, 2
‘Read all the Daily Production Values
MbusQuery = Chr(0) + Chr(0) + Chr(0) + Chr(0) + Chr(0) + Chr(6) + Chr(0) + Chr(3) + Chr((Val(ProductionPointerNow) \ 256)) + Chr(((Val(ProductionPointerNow) Mod 256) – 1)) + Chr(0) + Chr(20)
Case 3
‘Reset Daily Production Pointer to 30 (Write)
MbusQuery = Chr(0) + Chr(0) + Chr(0) + Chr(0) + Chr(0) + Chr(9) + Chr(1) + Chr(16) + Chr(0) + Chr(0) + Chr(0) + Chr(1) + Chr(2) + Chr(0) + Chr(30)
Winsock1.SendData MbusQuery
Case 4, 6
‘Read the Minute Log Pointer
MbusQuery = Chr(0) + Chr(0) + Chr(0) + Chr(0) + Chr(0) + Chr(6) + Chr(0) + Chr(3) + Chr(0) + Chr(1) + Chr(0) + Chr(1)
Case 5
‘Read all the Minute Log Values
MbusQuery = Chr(0) + Chr(0) + Chr(0) + Chr(0) + Chr(0) + Chr(6) + Chr(0) + Chr(3) + Chr((Val(MinutePointerNow) \ 256)) + Chr(((Val(MinutePointerNow) Mod 256) – 1)) + Chr(0) + Chr(20)
Case 7
‘Reset Minute Log Pointer to 670 (Write)
MbusQuery = Chr(0) + Chr(0) + Chr(0) + Chr(0) + Chr(0) + Chr(9) + Chr(1) + Chr(16) + Chr(0) + Chr(1) + Chr(0) + Chr(1) + Chr(2) + Chr(2) + Chr(158)
Winsock1.SendData MbusQuery
Case 8
‘Read the current Daily Production Values
MbusQuery = Chr(0) + Chr(0) + Chr(0) + Chr(0) + Chr(0) + Chr(6) + Chr(0) + Chr(3) + Chr(0) + Chr(9) + Chr(0) + Chr(20)
Case 9
‘Read the current Minute Log Values
MbusQuery = Chr(0) + Chr(0) + Chr(0) + Chr(0) + Chr(0) + Chr(6) + Chr(0) + Chr(3) + Chr(2) + Chr(147) + Chr(0) + Chr(10) End Select
Winsock1.SendData MbusQuery ‘Send out the Modbus Information
Timer2.Enabled = True ‘Set the timeout timer for communications
Else
MsgBox (“Device not connected via TCP/IP”)
Exit Sub
End If
End Sub
 Retrieving the information from Winsock
 We first get all of the bytes of data from winsock. Then we determine the MbusStatus and then handle the data appropriately.
Private Sub Winsock1_DataArrival(ByVal datalength As Long)
Timer2.Enabled = False ‘Stop communications timeout timer
‘Get all the inforamtion from the data arriving
Dim B As Byte
Dim j As Byte
returnInfo = “”
For i = 1 To datalength
Winsock1.GetData B
MbusByteArray(i) = B
returnInfo = returnInfo & B
Next
j = 0
On Error Resume Next
Select Case MbusStatus
Case 0
‘Read the Daily Production Pointer
ProductionPointer = Val(Str((MbusByteArray(10) * 256) + MbusByteArray(11)))
If ProductionPointer <> 30 Then
ProductionPointerNow = ProductionPointerNow + 20
MbusStatus = 1
Else
MbusStatus = 4
End If
Case 1
With Adodc1
.CommandType = adCmdTable
.RecordSource = “Production_Log”
.Refresh
.Recordset.AddNew
End With
‘Read all the Daily Production Values
Label18.Caption = Format$((Str((MbusByteArray(10) * 256) + MbusByteArray(11)) & “/” & Str((MbusByteArray(12) * 256) + MbusByteArray(13)) & “/” & Str((MbusByteArray(14) * 256) + MbusByteArray(15))), “yyyy/mm/dd”)
Label19.Caption = Val(Str((MbusByteArray(16) * 256) + MbusByteArray(17)) & Str((MbusByteArray(18) * 256) + MbusByteArray(19)))
Label20.Caption = Val(Str((MbusByteArray(20) * 256) + MbusByteArray(21)) & Str((MbusByteArray(22) * 256) + MbusByteArray(23)))
Label21.Caption = Val(Str((MbusByteArray(24) * 256) + MbusByteArray(25)) & Str((MbusByteArray(26) * 256) + MbusByteArray(27)))
Label22.Caption = Val(Str((MbusByteArray(28) * 256) + MbusByteArray(29)) & Str((MbusByteArray(30) * 256) + MbusByteArray(31)))
Label23.Caption = Val(Str((MbusByteArray(32) * 256) + MbusByteArray(33)) & Str((MbusByteArray(34) * 256) + MbusByteArray(35)))
Label24.Caption = Val(Str((MbusByteArray(36) * 256) + MbusByteArray(37))) / 10
Label25.Caption = Val(Str((MbusByteArray(38) * 256) + MbusByteArray(39))) / 10
Label26.Caption = Val(Str((MbusByteArray(40) * 256) + MbusByteArray(41))) / 10
Label27.Caption = Val(Str((MbusByteArray(42) * 256) + MbusByteArray(43))) / 10
Label28.Caption = Val(Str((MbusByteArray(44) * 256) + MbusByteArray(45))) / 10
With Adodc1
.Recordset.Update
.Recordset.MoveLast
.Refresh
End With ProductionPointerNow = ProductionPointerNow + 20
If ProductionPointer = ProductionPointerNow Then
MbusStatus = 2
End If
Case 2
‘Read the Daily Production Pointer
ProductionPointer = Val(Str((MbusByteArray(10) * 256) + MbusByteArray(11)))
If ProductionPointer = ProductionPointerNow Then
MbusStatus = 3
Else
ProductionPointerNow = ProductionPointerNow + 20
MbusStatus = 1
End If
Case 3
‘Reset Daily Production Pointer to 30 (Write)
If (MbusByteArray(8) = 16) And (MbusByteArray(12) = 1) Then
MbusStatus = 4
ProductionPointerNow = 10
Else
Text1.BackColor = &HFF
End If
With Adodc1
.CommandType = adCmdTable
.RecordSource = “Production_Log”
.Refresh
.Recordset.AddNew
End With
Case 4
‘Read the Minute Log Pointer
MinutePointer = Val(Str((MbusByteArray(10) * 256) + MbusByteArray(11)))
If MinutePointer <> 670 Then
MinutePointerNow = MinutePointerNow + 10
MbusStatus = 5
Else
MbusStatus = 8
End If
Case 5
With Adodc2
.CommandType = adCmdTable
.RecordSource = “Minute_Log”
.Refresh
.Recordset.AddNew
End With
‘Read all the Minute Values
Label29.Caption = Format$((Str((MbusByteArray(10) * 256) + MbusByteArray(11)) & “/” & Str((MbusByteArray(12) * 256) + MbusByteArray(13)) & “/” & Str((MbusByteArray(14) * 256) + MbusByteArray(15))), “yyyy/mm/dd”)
Label30.Caption = Format$((Str((MbusByteArray(16) * 256) + MbusByteArray(17)) & “:” & Str((MbusByteArray(18) * 256) + MbusByteArray(19)) & “:” & Str((MbusByteArray(20) * 256) + MbusByteArray(21))), “hh:nn:ss”)
Label31.Caption = Val(Str((MbusByteArray(22) * 256) + MbusByteArray(23)) & Str((MbusByteArray(24) * 256) + MbusByteArray(25)))
Label32.Caption = Val(Str((MbusByteArray(26) * 256) + MbusByteArray(27)))
With Adodc2
.Recordset.Update
.Recordset.MoveLast
.Refresh
End With MinutePointerNow = MinutePointerNow + 10
If MinutePointer <= MinutePointerNow Then
MbusStatus = 6
End If
Case 6
‘Read the Minute Log Pointer
MinutePointer = Val(Str((MbusByteArray(10) * 256) + MbusByteArray(11)))
If MinutePointer = MinutePointerNow Then
MbusStatus = 7
Else
MinutePointerNow = MinutePointerNow + 10
MbusStatus = 5
End If
Case 7
‘Reset Minute Log Pointer to 670 (Write)
If (MbusByteArray(8) = 16) And (MbusByteArray(12) = 1) Then
MbusStatus = 8
MinutePointerNow = 660
Else
Text1.BackColor = &HFF
End If
With Adodc2
.CommandType = adCmdTable
.RecordSource = “Minute_Log”
.Refresh
.Recordset.AddNew
.Refresh
End With
Case 8
‘Read the current Daily Production Values
Label18.Caption = Format$((Str((MbusByteArray(10) * 256) + MbusByteArray(11)) & “/” & Str((MbusByteArray(12) * 256) + MbusByteArray(13)) & “/” & Str((MbusByteArray(14) * 256) + MbusByteArray(15))), “yyyy/mm/dd”)
Label19.Caption = Val(Str((MbusByteArray(16) * 256) + MbusByteArray(17)) & Str((MbusByteArray(18) * 256) + MbusByteArray(19)))
Label20.Caption = Val(Str((MbusByteArray(20) * 256) + MbusByteArray(21)) & Str((MbusByteArray(22) * 256) + MbusByteArray(23)))
Label21.Caption = Val(Str((MbusByteArray(24) * 256) + MbusByteArray(25)) & Str((MbusByteArray(26) * 256) + MbusByteArray(27)))
Label22.Caption = Val(Str((MbusByteArray(28) * 256) + MbusByteArray(29)) & Str((MbusByteArray(30) * 256) + MbusByteArray(31)))
Label23.Caption = Val(Str((MbusByteArray(32) * 256) + MbusByteArray(33)) & Str((MbusByteArray(34) * 256) + MbusByteArray(35)))
Label24.Caption = Val(Str((MbusByteArray(36) * 256) + MbusByteArray(37))) / 10
Label25.Caption = Val(Str((MbusByteArray(38) * 256) + MbusByteArray(39))) / 10
Label26.Caption = Val(Str((MbusByteArray(40) * 256) + MbusByteArray(41))) / 10
Label27.Caption = Val(Str((MbusByteArray(42) * 256) + MbusByteArray(43))) / 10
Label28.Caption = Val(Str((MbusByteArray(44) * 256) + MbusByteArray(45))) / 10
With Adodc1
.Recordset.Update
.Recordset.MoveLast
End With MbusStatus = 9
Case 9
‘Read the current Minute Log Values
Label29.Caption = Format$((Str((MbusByteArray(10) * 256) + MbusByteArray(11)) & “/” & Str((MbusByteArray(12) * 256) + MbusByteArray(13)) & “/” & Str((MbusByteArray(14) * 256) + MbusByteArray(15))), “yyyy/mm/dd”)
Label30.Caption = Format$((Str((MbusByteArray(16) * 256) + MbusByteArray(17)) & “:” & Str((MbusByteArray(18) * 256) + MbusByteArray(19)) & “:” & Str((MbusByteArray(20) * 256) + MbusByteArray(21))), “hh:nn:ss”)
Label31.Caption = Val(Str((MbusByteArray(22) * 256) + MbusByteArray(23)) & Str((MbusByteArray(24) * 256) + MbusByteArray(25)))
Label32.Caption = Val(Str((MbusByteArray(26) * 256) + MbusByteArray(27)))
With Adodc2
.Recordset.Update
.Recordset.MoveLast
End With
MbusStatus = 0
End Select
Timer1.Enabled = True ‘Set the interval between the next communication
End Sub
The last thing that we do is save and compile the VB program. I will be happy to send the complete program to you . Please go to the contact page and put Robust Logger Program in the description.
In part 10 we will display the information on a web server. We will use IIS and ASP to actively connect and display the information in the database.
If you have any questions or need further information, please contact 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




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

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.