Author Topic: writing coils using modbus tcp/ip protocol and button controls  (Read 3053 times)

paco

  • Newbie
  • *
  • Posts: 3
    • View Profile
Hi, I'm testing the controls of AdvancedHmi using the modbus tcp/ip driver and comunicating with a Shneider plc M212, I can read and write holding registers, read bits of a holding register (p.ex 40003.04) but I can not write a bit of a holding register and I can not write a coil register as f.ex. 00202 adress, the enviroment is soo intuitive but I'm doing something wrong...

Somebody can explain to me how to write a simple coil or a bit from a holding register?

Thank you very much in advance.

Phrog30

  • Guest

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: writing coils using modbus tcp/ip protocol and button controls
« Reply #2 on: April 29, 2018, 08:39:29 PM »
You should be able to write to coils. Are you using the coils in the PLC program that would make the PLC program over write anything the HMI sets?

paco

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: writing coils using modbus tcp/ip protocol and button controls
« Reply #3 on: May 09, 2018, 07:07:33 AM »
Hi Archie, In the plc programa I'm only using 16 coils form 1 to 16, and I want to write from the Ahmi for example the coil 100 that is not used in the plc program.

thank you very much for your's answers

larryhts

  • Jr. Member
  • **
  • Posts: 98
    • View Profile
Re: writing coils using modbus tcp/ip protocol and button controls
« Reply #4 on: May 09, 2018, 07:28:38 AM »
Here is a sample of one of my app writing based on a read from a DB.

    'Get results from DB and set The PLC Values

            If GlobalVariables.intResults = 2 Then
                Modbus51.Write("00001", True)
            Else
                Modbus51.Write("00002", True)
            End If

Good Luck.........

paco

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: writing coils using modbus tcp/ip protocol and button controls
« Reply #5 on: May 15, 2018, 02:04:23 PM »
hello everyone, I could not believe it ... but it depends on which plc does not support bit writing ... I've tested it with 2 simulators and it works perfectly.  May be I have to configure something in the plc side to enable writing commands...Thank you very much everyone for the support.

Phrog30

  • Guest
Re: writing coils using modbus tcp/ip protocol and button controls
« Reply #6 on: May 15, 2018, 08:50:27 PM »
Had you read the post I referenced, Archie explained that very thing.