Set a Omron plc clock with a VB application


Thread Starter


I want to set my plc clock with my IBM server every day at noon with an VB application. I have some activeX control like Omron plc clock component. But I don't have any document on it ?? Please help me ??

Peter Veselosvky, konnexis

Here is code that uses mscomm to send current time date to an Omron PLC over Host Link protocol psValue = Format(Now(), "yymmddhhmmss") & "01" psCmd = "FA1000000000702" & psValue msSiteNode is the host link address. Command = "@" & msSiteNode & psCmd & FCS("@" & msSiteNode & psCmd) & "*" & vbCr mscomm1.output = command Check sum function: Public Function FCS(rsString As String) Dim L As Integer Dim A As Integer Dim i As Integer Dim TJ As String Dim checksum As String L = Len(rsString) A = 0 For i = 1 To L TJ$ = Mid$(rsString, i, 1) A = Asc(TJ$) Xor A Next i checksum = Hex$(A) If Len(checksum) = 1 Then checksum = "0" & checksum 'Text2.Text = CheckSum FCS = checksum End Function Peter Veselovsky, P.Eng [email protected] konnexis Dunrobin, Ontario