Ken Crow - 2008-09-03

I found a bug of creating a new connection using ISO TCP interface in Libnodave v0.8.4.4.

When you want to connect to PLC by ISO TCP interface you usually should assign rack and slot:

dc=daveNewConnection(di, MPI, rack, slot)...

Try for example: rack=1 and slot=2.

You attept to connect to PLC mounted in rack=1 will fail.
Naturally the parameter rack in the function daveNewConnection is not a rack asignment. This is a connection function assignment.

Connection function can be: PG=1,OP=2,S7=3. So when you give a rack parameter value = 0 you assign connection function PG. And when you give value = 1 ... you just assign connection function OP. But rack number still remains = 0 :(
So Libnodave based program will connect correctly only with PLCs mounted in rack=0.
But you can overcome this bug with encoding the rack number using a simple formula for slot parameter:  slot = rack*32 + slot ... ;)