S7 Block transfers BSEND and BRCV

Join Date
Jun 2012
Location
England
Posts
64
I am trying to learn about block services and how to use them with an OPC Server. I have Visual Basic 6 and want to write an OPC client to transfer an array of data to a Data Block in the PLC.

There exists a Visual Basic .NET example on the Siemens website;
http://support.automation.siemens.com/WW/view/en/21523291
but it is quite complicated and I’m not familiar with the .Net programming environment. I have contacted Siemens but they don’t have any examples in VB6.

Has anybody ever done the block transfer in VB6? If so, can you possibly show me an example or a link to more info.
Thanks
 
Is there are reason that you want to use BSEND and BRCV ?
The most typical is to setup a connection from the OPC Server, and the OPC Client can then either poll or send the required data and there is no need to add any blocks in the PLC.
 
When I spoke to Siemens, I told them that I needed to send a large array of data from a file on my PC hard-drive to a Data Block in the PLC. They told me to “use BSEND/RECV on your OPC client” and directed me to the link above.

Please tell me how you would go about this transfer.

OPC Client can then either poll or send the required data

I assume polling is just sending one integer at a time and would require some programming at the PLC end to load the DB? How do I achieve the second option “send the required data”?

Thanks for your advice
 
No, polling means it is the OPC server that fetches the data in stead of the PLC sending the data. And typically the OPC server reads the data cyclically.

Send/receive allows the data to be sent on event rather than being fetched cyclically.
I could be the right thing to do in your case.

VB6 is very old and dying. I doubt you will find any information from Siemens on how to use VB6.
But as OPC isnt particularly limited to Siemens, maybe you can find some information elsewhere if you search for "OPC Client VB6".
 
Thanks Jesper. Point taken about VB6, I only use it because I have it and am familiar with it. Learning Siemens and OPC is taking all my brain power at the moment to take on another language!

I realise this must be a bit basic for you guys, but may I ask you to clarify my understanding of the OPC Server and its connection with the PLC and the client?

Setup: I have an ET200S PLC connected via Ethernet to a PC with Simatic.Net OPC Server and the Scout Client. The PLC has a data block DB1 with 100 Integer array. I have connected the PLC to the Server in NetPro and in Configure Symbols (Server Properties – S7 Tab) I can see the DB1.

Q1) When I compile NetPro and download, does this action create a namespace in the OPC Server for the DB1 with 100 elements? Is the namespace an image of the data block?

The connection between the two is still a bit grey for me. I have a ‘cycle time’ on the server and an option to ‘Establish connection when required’ on the S7 connection property.

Q2) The Cycle time (100ms) is the minimum time that the PLC & Server synchronise (update) the data in DB1 and the server image of DB1? So if DB1 had 30000 elements, would all these have to be transferred over the Ethernet every 100ms or so?

Q3) If I ‘Establish connection when required’ does this mean there is no data transfer over the Ethernet until either the PLC DB1 or Server DB1 image change? Do the PLC and Server both monitor their own DB1 for change and either can initiate transfer to the other?
 
Alternative cheaper solution.

I'm guessing that you have a PLC with built in Ethernet interface.

Use regular TCP/IP with a fixed telegram length. Download the open communication wizard for easier configuration in the PLC. In VB6 use the MSWinsock component. A quick test requires only a few rows of vb code. No OPC server needed!

If the PC application should be server then configure the S7 connection as active or if the pc is a client configure the S7 connection as passive
 
Bratt, have you tried this yourself ?
I am sure that in the S7 PN CPU, at least the blocks T_CON, T_SEND, T_EACV have to be programmed for comms to take place with the "open communication".

Q1) When I compile NetPro and download, does this action create a namespace in the OPC Server for the DB1 with 100 elements? Is the namespace an image of the data block?
Not sure what you mean by namespace. If the OPC server is setup to get the Symbols from an S7 CPU (in an integrated STEP7 project) then the OPC Server will know all the DBs and their elements by the symbolic names. If not, the OPC client will have to specify the addresses absolutely.


Q2) The Cycle time (100ms) is the minimum time that the PLC & Server synchronise (update) the data in DB1 and the server image of DB1? So if DB1 had 30000 elements, would all these have to be transferred over the Ethernet every 100ms or so?
Not 100% sure, but I guess the OPC Server will attempt to read all the elements every 100ms. One bottleneck is that an S7-300 or IM151-8 can only handle approx 240 bytes per read or write request. If you transfer REALs then that would limit the transfer to 60 REALs per 100 ms.


Q3) If I ‘Establish connection when required’ does this mean there is no data transfer over the Ethernet until either the PLC DB1 or Server DB1 image change? Do the PLC and Server both monitor their own DB1 for change and either can initiate transfer to the other?
My guess is that the connection will only be established if there is an OPC client that wants to read or write data. An S7 CPU has only a limited number of connections, so it would make sense to not spend a connection if it is not actually used.
 
Yes i have tried and it will work but the blocks TCON/TRECIVE/TSEND must be used.
An old PLC with a cpcard and AGSend/Receive also works

Maybe it was unclear in my post i thought that the link to the open communication wizard was enough :)
 
The link actually is also to a sample project, so it is relevant.
The OC Wizard itself is not much help. It merely sets up the DB with the connection details. Something you can do yourself by reading the documentation, and understanding how it works. If you dont understand how it works the wizard will only confuse you.
 
The OC Wizard itself is not much help.

I disagree i think it helps. In real applications i rarely use the wizard but for quick tests i always use it and i think its time saving especially if you have limited S7 knowledge. But what rights for some is wrong for others.

Alternative cheaper solution.
A quick test requires only a few rows of vb code. No OPC server needed!

I can agree that the above statement is somewhat misleading regarding the programming effort in the PLC. My point was that in order to get a quick test running very little VB6 knowledge is needed
 
Not sure what you mean by namespace.
It was a word I came across in one of the many manuals, but Server Address Space seems to be a more common phrase. So, is this space an allocation of memory to mirror the addresses in the PLC?

I still haven’t cracked how to upload a block of data to the Server yet (from a client). In my setup the 100 elements of DB1 are accessible with the Scout client one at a time. I am hoping I can find something in the ‘OPC DA Auto 2.02 Specification’ that will allow this transfer. Any guidance would be appreciated.

Thanks for all your comments and thanks Bratt for suggesting the ‘Open Comms’ solution. I have spent all day reading all the various literature on OC and experimenting with the OC Wizard.

As you say the OC wizard only sets up the DB used to establish the connection. As always the examples fill in the gaps and give more confidence of understanding. Without the example the OC Wizard would be very confusing!
 
I’m not too worried about 64bit, it has been out over 10 years already and they are still producing 32bit operating systems.:confused: and I still see XP everywhere, it’ll probably out-live me!

Right, I’m off to find out how to use a windsock…:whistle:
Cheers for all the help.
 

Similar Topics

A new Forum member named LEOMENA resurrected a decade-old thread about SLC-500 M-Files and 1747-SN RIO Scanner block transfers. In order to keep...
Replies
4
Views
1,715
Hi guy. well im having a hard time figuring out how to make a numeric entry in an already made PV program but i've never worked with scanners and...
Replies
9
Views
2,761
Hi! I have a general question about Block Transfers. If, say, you want to use I/O 10-17 for the transfers, but also for normal I/O communication...
Replies
2
Views
1,815
Hello, all. I am working with a PLC-5/20 and i am trying to set up block transfer instructions for dealing with the transfer of analog data...
Replies
2
Views
1,582
I have several "smart" PLC-5 modules (Analog ins and outs, etc) in a RIO remote rack that I need to communicate with via block transfers. From...
Replies
4
Views
1,883
Back
Top Bottom