Today is...
Tuesday, October 23, 2018
Welcome to, the global online
community of automation professionals.
Featured Video...
Featured Video
Watch an animation of a conveyor stacking operation demonstrating the use of a move on a gear command.
Our Advertisers
Help keep our servers running...
Patronize our advertisers!
Visit our Post Archive
Schneider Modicon M221 Coil Address
Problem writing to a single coil on a Schneider PLC using Libmodbus library

I'm using the Libmodbus library, with a Swift wrapper on an iOS device. I can read coils and registers no problem, but nothing happening when I try to write a single coil. The response comes back as a success, but nothing seems to be happening.

As far as I can see it's sending 5 as a function number and 0 as the coil number.

Anyone else have any experience of this sort with a Modicon M221 PLC and could help me out here?

Actually, M221 returns error ILLEGAL FUNCTION (code 1). That means PLC doesn't support function 0x05 (Write Single Coil). I found that M221 supports only writing to holding registers (%MW) and reading from all kinds of registers (%M and %MW) in spite of the Schneider's documentation.