4/27/2011 12:13 PM | |
Joined: 4/27/2011 Last visit: 3/6/2025 Posts: 8 Rating:
|
Hi everybody, I'm using WinCC 2007 Advanced (but ifnecessary I can move to 2008) and I want to write a script in VBScript tosend data to a serial port; is there anyone that is able to explain me the way to do this? Thanks in advance to everybody!!! |
4/28/2011 4:51 PM | |
Posts: 327 Rating:
|
Greetings I don't think you can. You have to either do this from PLC (which requires RS-232 communication module) or do it from external program. Best regards
|
7/12/2011 8:50 PM | |
Joined: 6/4/2008 Last visit: 2/23/2025 Posts: 58 Rating:
|
Kindly find the VB Script codes to handle Serial COM Data
AttachmentCOMPORT.pdf (1787 Downloads) |
This contribution was helpful to
1 thankful Users |
7/12/2011 10:12 PM | |
Posts: 327 Rating:
|
Greetings What you posted is a Visual Basic, not VB Script. Although you could use this code to build an external program a mentioned in previous post. I would reccomend some newer version, though. Best regards
|
7/13/2011 4:59 AM | |
Joined: 1/28/2009 Last visit: 3/8/2025 Posts: 6860 Rating:
|
Hi Also check this: How can you send or receive data via the serial interface in WinCC Runtime? Regards |
This contribution was helpful to
1 thankful Users |
7/13/2011 7:26 AM | |
Posts: 327 Rating:
|
OK. But that is WinCC and he asked for WinCC flexible solution. Best regards
|
7/13/2011 8:12 PM | |
Joined: 6/4/2008 Last visit: 2/23/2025 Posts: 58 Rating:
|
The Correct Working Script with 6 Mobile Numbers Entering from WinCC Flexi Runtime with Unable Disable facility is written below.... This script works so perfectly... today only i have developed it & tested & found working perfectly with WinCC Flexible 2008 SP2 PC Runtime. Dim SMSSend Dim SMS Dim buffer, DAM_FT, DAM_INCH DAM_FT=(POND_WATER_DISPLAY) DAM_INCH=(Inch_Value) ' This is the name of the MSComm Control Dim S Dim NoArr(6) 'here you can add all the cell numbers you want to send to Set SMSSend = CreateObject("MSCommLib.MSComm") If ( NO1_MOBILE_INT=15 ) Then NoArr(0)=MOBILE_NO_1 End If If ( NO2_MOBILE_INT=15 ) Then NoArr(1)=MOBILE_NO_2 End If If ( NO3_MOBILE_INT=15 ) Then NoArr(2)=MOBILE_NO_3 End If If ( NO4_MOBILE_INT=15 ) Then NoArr(3)=MOBILE_NO_4 End If If ( NO5_MOBILE_INT=15 ) Then NoArr(4)=MOBILE_NO_5 End If If ( NO6_MOBILE_INT=15 ) Then NoArr(5)=MOBILE_NO_6 End If For S = 0 To 5 SMSSend.CommPort = 1 SMSSend.Settings = "9600,N,8,1" SMSSend.InputLen = 0 SMSSend.Handshaking = 0 SMSSend.PortOpen = True SMS="VASANA BARRAGE WATER STORAGE CURRENT LEVEL IS " INCREMENT_VALUE=INCREMENT_VALUE+1 If INCREMENT_VALUE = 10 Then SMSSend.Output = "AT" & Chr(13) End If 'Do 'buffer = buffer & SMSSend.Input 'Loop Until InStr(buffer, "OK") 'buffer = "" If INCREMENT_VALUE=12 Then SMSSend.Output = "AT+CMGF=1" & Chr(13) 'Do 'buffer = buffer & SMSSend.Input 'Loop Until InStr(buffer, "OK") 'buffer = "" End If If INCREMENT_VALUE=14 Then SMSSend.Output = "AT+CMGS=" & Chr(34)& NoArr(S) & Chr(34) & Chr(13) '& Len(SMS) / 2 & Chr$(13) End If 'Do 'buffer = buffer & SMSSend.Input 'Loop Until InStr(buffer, ">") 'buffer = "" If INCREMENT_VALUE =15 Then SMSSend.Output = SMS & DAM_FT & " Ft " & DAM_INCH & " Inch " + Chr(26) INCREMENT_VALUE=0 End If 'Do 'buffer = buffer & SMSSend.Input 'Loop Until InStr(buffer, "OK") ' try to force sends by closing the ports and reopen in loop SMSSend.PortOpen = False Next |
This contribution was helpful to
1 thankful Users |
7/17/2011 6:09 PM | |
Posts: 327 Rating:
|
Greetings Looks like you are right; I couldn't completely test it because I don't have serial port on this laptop, but it didn't report any errors during execution. Thanks for the tip! Best regards
|
10/18/2011 3:32 PM | |
Posts: 2 Rating:
|
Dear friend, I tried Your script, but there was an unknown error at row: Set SMSSend = CreateObject("MSCommLib.MSComm") I found that the object is in MSComm32.ocx file. I got the file, I loaded MSComm32.ocx file into WinCC flexible, but still not working. What do I have to do to run the script correctly? In which file is the "MSCommLib.MSComm" object? How must I install it into WinCC flexible? I found that the MSComm32.ocx file is licenced. Is the problem in the licence? Where can I get that licence? How can I install it? Thanks for reply. |
10/18/2011 4:38 PM | |
Joined: 6/4/2008 Last visit: 2/23/2025 Posts: 58 Rating:
|
dear bezz, Your problem is correct. i have got 3 laptops, amongs which this script only works with one laptop. i also have tried so many times in various 10 other desktop pcs but still this things doesnt work with wincc flexible 2008. SO i have contacted siemens germeny & they said the activx support for WinCC Flexible require tremendous execution time so it will not work on this mscomm32.ocx activx files. So instead of using Wincc flexi script you need to use some thirdparty softwares. Thanks & regards Jaydeep |
Last edited by: O_Moderator at: 10/18/2011 7:30 PMcontact data deleted |
|
Follow us on