Open DaveyGiesen opened 8 years ago
Hello,
I do not work on this project anymore because I have no PLC system anymore but I am going to help you anyway. As far as I know, reading from the PLC system was working fine for me. Did you get any console output in Xcode?
With kind regards
Dear Agrippa, Oh sorry to hear that. Thank you anyway for helping me.
I have a test with the following code:
let client = S7Client()
client.connect("192.168.2.180", rack: 0, slot: 0) {
NSLog("connect test: %x", $0)
client.read("DB2.DBW36", defaultValue: false) {
NSLog("Readed DB2.DBW36 \($0)")
}
}
This is the output:
2015-11-27 16:45:42.211 PLC[4508:537869] connect test: 0
When I open the app and I want to create a connection with Verbindungen -> Click address -> Verbinden I get a box: Connection has been successfully established!
I have a good connection but I think the return values are not parsed good. A lot of values are DEC_UNSIGNED (following the S7App). I use a S7-1200 PLC by the way.
Could you point me in the right way?
Okay, that sounds really strange. Are the rack and slot numbers the same as defined in the hardware configuration?
Internally I use SNAP7 as a communication service between the PLC and iOS. It's an Open Source library written in C++ which can be embedded in any programm. If you are familiar with C++, you can give a try on a small console application which creates a connection to your PLC. With a few lines of code you should be able to read decimal values from your system. If it's not working there, then this is an internal problem with the library itself.
Dear agrippa1994,
I would like to read a value from a Siemens S7-1200. For example: "DB2.DBW36" I use the following code:
It is a DEC value in the PLC, what is the correct code to get the value?
Greetings, Davey