Author Topic: S7 1200 Modbus  (Read 728 times)

jiqn74

  • Newbie
  • *
  • Posts: 6
    • View Profile
S7 1200 Modbus
« on: May 23, 2019, 06:06:23 AM »
Good morning all,

I'm working with a S7 1200, connected with modbus to the computer. In the computer I'm using the latest AdvancedHMI (just downloaded), and MS Studio 2019 (comunity).

There are some questions, first and the most headbreaking for me. PLC is working as a server, it can only works with holding registers. I need to do some setups from the final HMI, by changing bits of a register, in order to make it works.
I'd been trying what i found in the forum, about addressing, 40001.X, or B:40001.X, and etc. But nothing works. If I use a button with a register, its value will turn 1, thats ok, but in the moment i try to address a bit of the register, nothing happens, no error, no change.

The second question is, when i try runtime with analog values, through different registers, it works perfectly, but every x seconds, it changes to a message "Address must be 4-11 digits, 0" for some seconds, and next changes back to normal, in a continuous loop.

Thank you in advance.
Regards.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5270
    • View Profile
    • AdvancedHMI
Re: S7 1200 Modbus
« Reply #1 on: May 23, 2019, 07:40:04 AM »
In order to write bits within a word the server must support function code 22 (mask write)

Check all of your PLCAddress* properties. You have an invalid address in 1 of them.

jiqn74

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: S7 1200 Modbus
« Reply #2 on: May 23, 2019, 09:14:04 AM »
The functions available in this PLC are, 1,2,3,4,5,6,11,15 and 16.

With Modbus_Poll software, it is possible to work on the independent bits.

Do you know any other way to communicate with this PLC, using AdvancedHMI?.


Kind Regards,

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5270
    • View Profile
    • AdvancedHMI
Re: S7 1200 Modbus
« Reply #3 on: May 23, 2019, 09:35:21 AM »
Is Modus Poll using function code 22 or does it read the word, set the bit, then write the full word back.

You can use the OutputType of WriteValue on the BasicButton. Then set PLCAddress to the word register and ValueToWrite to the integer equivalent of the bit (e.g. 1,2,4,8,16,32, etc.)

jiqn74

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: S7 1200 Modbus
« Reply #4 on: May 23, 2019, 10:15:27 AM »
I think modbus poll use write value directly. I has the option to use fc 22, but it doesnt work.

Next, with the other option you say, I used PLCAddressClick to put 40001, and ValueToWrite in 1 and 16 (two different buttons). Whichever i try, there is only change in bit 0. Register is 1 or 0 in both cases. Did I do something wrong?.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5270
    • View Profile
    • AdvancedHMI
Re: S7 1200 Modbus
« Reply #5 on: May 23, 2019, 10:32:41 AM »
What is your OutputType property set to?

Godra

  • Hero Member
  • *****
  • Posts: 1438
    • View Profile
Re: S7 1200 Modbus
« Reply #6 on: May 23, 2019, 01:34:58 PM »
jiqn74,

if you do find time for experimenting with alternative ModbusTCP driver, then look up this topic as well:

https://www.advancedhmi.com/forum/index.php?topic=1975.0

Make sure to read everything and use a completely new project for experimenting.

Whether you make it work or not, it is only EXPERIMENTING.