leem2209
Lifetime Supporting Member
In a project I've been working on, I am taking data from a Siemens PLC datablock and storing it in a SQL database.
The PC is communicating with a S7-1212C CPU via modbus.
I'm trying to setup the Modbus Communications and prove it's working.
In the S7 program, I have inserted the MB_SERVER block and the MB_HOLD_REG is DB2.
I have a move command to copy the data from the required datablock (DB101) into the holding register datablock (DB2). I have also inserted code to make DB101.DBX0.0 flash true for 1 second. I have done this to test the comms and I should be able to read it on my PC program if all is well.
Reading up on the Siemens Documentation for Modbus TCP using MB_server and MB_Client, it shows that the first modbus address (40001) is read from the Holding Register Datablock word 4 (DB2.DBW4).
Does this mean that the first 3 words of the holding register datablock isn't read? In which case my flashing bit, DB2.DBX0.0 will not be read, hence I cannot see it on the PC?
If I re-program to flash DB2.DBX8.0 (4th word, 1st bit) then I can see it on the PC using Modbus address 40001.... something - how is an individual bit addressed on Modbus? according to http://www.csimn.com/CSI_pages/Modbus101.html, "You cannot read just one bit from a holding register. There is no way to do that..."
In my PC program, I have set a basic indicator (using advanced HMI by the way) which I want to flash according to my flashing datablock bit. So I need to address that as a Modbus bit.
Many thanks...
The PC is communicating with a S7-1212C CPU via modbus.
I'm trying to setup the Modbus Communications and prove it's working.
In the S7 program, I have inserted the MB_SERVER block and the MB_HOLD_REG is DB2.
I have a move command to copy the data from the required datablock (DB101) into the holding register datablock (DB2). I have also inserted code to make DB101.DBX0.0 flash true for 1 second. I have done this to test the comms and I should be able to read it on my PC program if all is well.
Reading up on the Siemens Documentation for Modbus TCP using MB_server and MB_Client, it shows that the first modbus address (40001) is read from the Holding Register Datablock word 4 (DB2.DBW4).
Does this mean that the first 3 words of the holding register datablock isn't read? In which case my flashing bit, DB2.DBX0.0 will not be read, hence I cannot see it on the PC?
If I re-program to flash DB2.DBX8.0 (4th word, 1st bit) then I can see it on the PC using Modbus address 40001.... something - how is an individual bit addressed on Modbus? according to http://www.csimn.com/CSI_pages/Modbus101.html, "You cannot read just one bit from a holding register. There is no way to do that..."
In my PC program, I have set a basic indicator (using advanced HMI by the way) which I want to flash according to my flashing datablock bit. So I need to address that as a Modbus bit.
Many thanks...