Author Topic: Modbus TCP Function?  (Read 12283 times)

EDGAR

  • Jr. Member
  • Posts: 60
  • Automating concepts around the world!
    • View Profile
    • Kinemics
Modbus TCP Function?
« on: October 05, 2009, 07:45:11 PM »
Hello All,
The F-Series Modbus TCP, Is it possible to read/write to a discrete coil? I don't see it in the specifications. Can we write costume functions?

Thanks,
Ed
Low cost Modbus OPC DA Server, supporting Modbus RTU, ASCII, and TCP. Download your demo today! Go to www.kinemics.com/modbus.

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:Modbus TCP Function?
« Reply #1 on: October 05, 2009, 09:18:01 PM »
Discrete coil will require function 05, which is not supported by the WRITEMODBUS or WRITEMB2 command. To change a single bit you will need to read the entire 16-bit channel, change one bit and write back the channel data to the PLC.

Alternatively, you can use some DM locations and writing a 1 to it tells the PLC to turn ON a bit and writing a 0 to it tells the PLC to turn it OFF. Within the PLC program every scan of the custom function you will examine the value of the DM and use SETIO or CLRIO to affect the bit. This is the simplest way if the number of I/O involved is small.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

EDGAR

  • Jr. Member
  • Posts: 60
  • Automating concepts around the world!
    • View Profile
    • Kinemics
Re:Modbus TCP Function?
« Reply #2 on: October 06, 2009, 07:20:54 PM »
I was just wondering, some third controllers you can't access coil info using functions 3 or 4 unless they save the values on registers. I'm communicating with a PLC that if I need to get a coil value I need to use functions 1 or 2 and 5 to write. Before I start finagling with the NetCommand and other function is it possible?
Low cost Modbus OPC DA Server, supporting Modbus RTU, ASCII, and TCP. Download your demo today! Go to www.kinemics.com/modbus.

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:Modbus TCP Function?
« Reply #3 on: October 07, 2009, 09:59:33 AM »
If you are using serial port than you could write in TBASIC functions that will emulate the MODBUS function 01, 02, 05, and 06. You will need to use INCOMM and OUTCOMM since you have to handle binary data. There are examples program that you can download from the following FAQ thread:

http://www.tri-plc.com/yabbse/index.php?board=2;action=display;threadid=298

However, you can't do the same on the Ethernet channel because INCOMM(4) and OUTCOMM 4,xx are not supported and will have no effects.  Only PRINT #4 and INPUT$(4) are supported which limit handling to non-zero ASCII strings only.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS