Unofficial TwinCAT function for S7 Communication
This software is an (unofficial) opensource implementation of TF6610 | TC3 S5/S7 Communication similar to my other project BeckhoffHttpClient.
Your surely gonna love this software, but if you still need a couple of information for starring this project...
TFU002.settings.json
located C:\TwinCAT\Functions\Unofficial\BeckhoffS7Client
putting your connection parameters for all your S7 PLC in the settings file. {
"BeckhoffSettings": {
"AmsNetId": "",
"Port": 851
},
"ExtenalPlcSettings": [
{
"Name": "s7-300",
"IpAddress": "10.30.10.50",
"Port": 102,
"Rack": 0,
"Slot": 2
}
]
}
Use the S7 attribute in your project for connect your primitive variables (like an input or output) to a S7.
VAR_GLOBAL
{attribute 'S7.Out'}
{attribute 'S7.Address' := 'db2.dbx0.0'}
imAlive : BOOL;
{attribute 'S7.In'}
{attribute 'S7.Address' := 'db2.dbx1.0'}
{attribute 'S7.Plc' := 's7-300'} // you have to select a plc by name only if you have more then one
otherSystemAlive :BOOL;
END_VAR
every address has the form (case unsenible) DB<number>.<TYPE><Start>.<Length/Position>
i.e.: DB42.DBX0.7
=> (means) Datablock 42, Bit (DBX), Start: 0, Position: 7 .
Following types are supported:
DBX
=> Bit (BOOL)DBB
=> BYTE or BYTE[]INT
DINT
DUL
=> LINTD
=> REALLogfiles are saved into C:\TwinCAT\Functions\Unofficial\BeckhoffS7Client\Service.log
.
You can use TailBlazer for a live view.
Yes, please!
Try the library and feel free to open an issue or ask for support.
Don't forget to star this project!
Special thanks to JetBrains for supporting this open source project.