5
« on: January 30, 2021, 03:11:00 PM »
Hi all and thanks to Tatin for the integration and thanks to Archie for great AdvancedHmi Project.
I tried to install and use snap7 following all indications written in this thread, but it didn't work for me. I have windows 8 64bit and visual studio 2015.
I suggest to all to make these amending on file SiemensCom.vb:
1) change the return datatype of Write function to string instead of integer as below:
Public Function Write(startAddress As String, dataToWrite As String) As String Implements MfgControl.AdvancedHMI.Drivers.IComComponent.Write
Dim temp(0) As String
temp(0) = dataToWrite
Write(startAddress, 1, temp)
Return ("1")
'Return Write(startAddress, 1, temp)
End Function
2) Chenge the return line
Pay attention Return("1")
is a compromise because the function
MfgControl.AdvancedHMI.Drivers.IComComponent.Write
returns back a string.
For easy use, in the attached file the amended SiemensCom.vb
Now I can use snap7. Easy to read and write DB, Merker, Coils etc... for example if you want set to 1 the Merker M18.2 using a BasicButton, you need just to select SetTrue the OutputType and fill M18.2 in the field PLCAddressClick.
Moreover I want underline the powerful of snap7 if compared with modbus. For example, writing a single bit inside a word with modbus, we need to read word, change it and send it back with the risk of data corruption. Snap7 has native fuction for single bit set/reset.
Best Regards e ciao Luciano