Modbus Master Siemens S7-300 - OB35?

russg

Member
Join Date
Aug 2012
Location
UK
Posts
280
Hi,

I'm setting up a modbus master on an S7-300. It seems to work in OB1 but not when I use it in OB35. Does anyone have any ideas why?

Could this be due to the process image selection in the CP cards hardware config?

Thanks

Russ
 
Are you using a CP341 as Modbus master ?
Are you using a sample project or library blocks ?
In the siemens document 'Master-Slave Communicationwith Modbus RTU Protocol forS7-300 and ET 200S Systems the blocks Modbus_master and S_MODB are called in OB1.
I speculate that the blocks must be called cyclically to 'service' the communication, and it is not allowed to have gaps in the calls.
Any reason to why you want to use OB35 and not OB1 ?

Could this be due to the process image selection in the CP cards hardware config?
Provide more details about the hardware setup and the program.
 
Are you using a CP341 as Modbus master ?
Are you using a sample project or library blocks ?
In the siemens document 'Master-Slave Communicationwith Modbus RTU Protocol forS7-300 and ET 200S Systems the blocks Modbus_master and S_MODB are called in OB1.
I speculate that the blocks must be called cyclically to 'service' the communication, and it is not allowed to have gaps in the calls.
Any reason to why you want to use OB35 and not OB1 ?


Provide more details about the hardware setup and the program.
Hi Jesper,

thanks for the response.

Yes, it is a CP341 card.

Not my choice to use OB35, I'm just following specification. The explanation is because the system should only call Modbus comms every 60ms rather than every scan of OB1.

We have a function that uses P_SND_RK and R_RCV_RK to send and receive data.

in the hardware config for the CP card I only have OB1-PI an PIP 1 for the process image.
 
The explanation is because the system should only call Modbus comms every 60ms rather than every scan of OB1.
Please elaborate. Someone specified this ?

The P_SND_RK and R_RCV_RK uses a rising edge on the REQ pin to start a send or receive sequence. I can imagine that not calling the block cyclically messes that up.
Maybe there are other potential issues if the CPU doesn't cyclically update the data exchange with the CP341.
 
In the manual SIMATIC S7-300/S7-400 Loadable Driver for Point-to-Point CPs: MODBUS protocol, RTU format, S7 is master is stated:

You will have to open the blocks P_SND_RK und P_RCV_RK several times to completely process a single MODBUS master job. The data volume you write or read determines how often you will have to open the blocks. You accelerate data exchange if you open the blocks P_SND_RK and P_RCV_RK in the OB1 cycle of the CPU. Data exchange will take longer if you open the blocks in "slow" cyclic interrupts.
So it should be possible to call in OB35.

Any code on the ERROR output pin ?
 
Please elaborate. Someone specified this ?

The P_SND_RK and R_RCV_RK uses a rising edge on the REQ pin to start a send or receive sequence. I can imagine that not calling the block cyclically messes that up.
Maybe there are other potential issues if the CPU doesn't cyclically update the data exchange with the CP341.
Yes, I think they are worried calling the modbus comms every scan will slow down the processing of the PLC. I don't think it will be an issue, but not my choice at the moment. It may end up being that way if comms are too slow or not possible via OB35.
 
It should be enough to add OB35 to the program, the CPU will then call it with a cycle as set in the hardware configuration.
The 100 ms is the standard value, maybe this is too long interval for the P_SND_RK and R_RCV_RK blocks.
Offset is used avoid multiple cyclic interrupts triggering at the same time. You don't need it.
Try with 50 ms instead of 100 ms.
Check what is the return value of ERROR.
 
Are you using a CP341 as Modbus master ?
Are you using a sample project or library blocks ?
In the siemens document 'Master-Slave Communicationwith Modbus RTU Protocol forS7-300 and ET 200S Systems the blocks Modbus_master and S_MODB are called in OB1.
I speculate that the blocks must be called cyclically to 'service' the communication, and it is not allowed to have gaps in the calls.
Any reason to why you want to use OB35 and not OB1 ?


Provide more details about the hardware setup and the program.

On ET200S you can query modbus on intervals but you need to listen after sending message. Also you can't send new message before message before is done or timeouted.
Usually called new message after several 100 or 200ms caps between different querys. Modbus sending and listening also takes several PLC cycles.
ET200SP IM & ET200SP PtP card is more easy to use on 300 CPU than than older hardwares and there is no license either needed for modbus.
 

Similar Topics

Hi All Attached a screen shot of my code - just wondering if there's a way of kinda indirect addressing the DATA_PTR parameter ? For instance on...
Replies
5
Views
1,615
Hi all, Does anyone have any experience trying to simulate a Modbus master using a PC, The PLC is a cpu 300 with a CP341 RS485. I am...
Replies
5
Views
2,716
I am trying to get Siemens 1214c dc/dc/dc cpu work as a Modbus RTU slave with RS232 communication module. As a master i have PC. I tried to get...
Replies
3
Views
3,686
Hi All I need to index a Pointer in a RTU Modbus Master block, please see attached screen shot. I have 34 VSD's which I need to Write the Speed...
Replies
4
Views
3,186
I have to set up an S7 314 plc as a modbus master. I have the hardware/dongle/firmware but the sample projects don't give a lot away!. I am...
Replies
9
Views
7,061
Back
Top Bottom