how to use ag_send & ag_recv in s7

Mclean

Member
Join Date
Apr 2003
Posts
9
hi,can anyone tell me about the ag_send and ag_recv function.must the cpu sends data use ag_send and the cpu recieves data use ag_recv?and what's those in out variables means,the comment wrote in germany,i dont't understand.
variables of ag_send:
ACT,ID,LADDR,SEND,LEN,DONE,ERROR,STATUS
variables of ag_recv:
ID,LADDR,RECV,NDR,ERROR,STATUS,LEN
what means and how to use?your help will be appreciated.
 
mclean -

ag-send does need an ag-rec in the partner cpu and vice versa. If this is a problem, use put and get (rather use get in each cpu instead of get and put!). In addition, you have to setup these send-rec connections in the netpro. With an unspecified connection using put and get the setup is easier. (but send-rec connections are better to troubleshoot...)

Look in the provided s7 sample project, you'll find communication examples.

AG-SEND:
ACT - "1" wil trigger a send
ID - logical connection ID (get the value shown in netpro)
LADDR - local adress (hex) of the cp (value shown in netpro if you have a propper hardware configuration
SEND - pointer to the block you want to send
SIZE - length of send data
DONE - "1" if block was send
ERROR - "1" if block send was not successfull
STATUS - status of the send command (refer to S7 help to get the numeric indications...)

AG-REC:
ID,LADDR - same as above
RECV - pointer to destination for received data
NDR - received new data (equal to DONE)
ERROR, STATUS, LEN - same as above

How to use:
- obtain a propper HW-Config
- set up your connections (CPU->Connections)
- get the values for ID and LADDR
- program log pulse to "1" to send
- watch DONE, ERROR and (perhaps) STATUS
- prevent a new send whlie old one ist not finished (either with DONE or ERROR)
- call AG-REC with a log "1" to actually receive data, call with log "0" to update status etc. for example use a 500ms cycle pulse to continously scan and receive new data.

that's it....
 
I would just add something to cypher63's comments - the AG_SEND and AG_RECV blocks are for use with a seperate CP comms card, either profibus or ethernet, that is not using the comms port built into the CPU, for this you need to use the SFC's in the 'standard library' system function blocks.

Paul
 
Hello !
Just wanted to give some info on the step 7 program.
When you are in the eg. Programming blocks program if you
select (mark) the standard block and press F1 you will get the help
on the block, the same works if you select blocks from the list and press F1.
Usually you will get all the info about the in/outputs in the block from there.
 

Similar Topics

I'm trying to understand how the various PLC's in our machine are communicating and I've gotten so far but come with a bit of a dead end... Basic...
Replies
15
Views
9,002
Hello! Slightly confused at the moment regarding the maximum number of bytes transferable via the AG_SEND (FC5, V4.2),AG_RECV (FC6 V4.7)...
Replies
8
Views
12,316
I am using SCL for a bit of TCP programming on an S7-400. How do I link the DB to the AG_SEND or AG_RECV FC? In the case of FBD or ST, you use...
Replies
5
Views
4,562
I'm looking for documentation for the functions PDAT_CY, PCD_SEND and PCD_RECV that are part of an existing Step-7 program. The best I can find so...
Replies
1
Views
2,407
Hi I just came back from a project where I had to help someone else with his PLC where he was using a CP342-5 to exchange data with a Profibus...
Replies
0
Views
1,510
Back
Top Bottom