• 沒有找到結果。

P_SEND Parameters

在文檔中 The AS-i Master 2 (頁 166-170)

Communication via Function Blocks

FB 3 P_SEND Parameters

Communication via Function Blocks 如果想去掉该提示,请访问并下载:

http://www.jisupdfeditor.com/

长沙工控帮教育科技有限公司整理

6-7

CP 340 Point-to-Point Communication ASE00053578-05

The figure below illustrates the behavior of the parameters DONE and ERROR, depending on how the REQ and R inputs are wired.

Sending request Completion without 1st/nth part of SEND RESET transmitted Completion with error RESET transmitted Completion without SEND request not executed (sending deactivated)

REQ

R

DONE

ERROR

error error

Figure 6-1 Time Sequence Chart for FB 3 P_SEND

Note

The REQ input is edge-triggered. A positive edge at the REQ input is ade-quate. It is not required that the RLO (result of logical operation) is “1” du-ring the whole transmission procedure.

Time Sequence Chart for FB 3 P_SEND

Communication via Function Blocks 如果想去掉该提示,请访问并下载:

http://www.jisupdfeditor.com/

长沙工控帮教育科技有限公司整理

6-8 CP 340 Point-to-Point Communication ASE00053578-05

The P_RCV FB transmits data from the CP 340 to an S7 data area specified by the parameters DB_NO, DBB_NO and LEN. The P_RCV FB is called statically (without conditions) for data transmission in the cycle or alternatively in a time-controlled program.

With the (static) signal state ”1” at parameter EN_R, the software checks whether data can be read by the CP 340. An active transmission can be aborted with signal state ”0” at the EN_R parameter. The aborted receive request is terminated with an error message (STATUS output). Receiving is deactivated as long as the EN_R parameter shows the signal state ”0”. A data transmission operation can run over several calls (program cycles),

depending on the amount of data involved.

If the function block recognizes signal state ”1” at the R parameter, the current transmission request is aborted and the P_RCV FB is set to the initial state. Receiving is deactivated as long as the R parameter shows the signal state ”1”. If signal state ”0” returns, the aborted message frame is received again from the beginning.

The LADDR parameter defines the CP 340 to be addressed.

The NDR output shows ”request completed without errors/data accepted” (all data read). ERROR indicates whether an error has occurred. If there was an error, the corresponding error number is displayed under STATUS (see Section 8.3). If there were no errors, STATUS has the value ”0”. NDR and ERROR/STATUS are also output when the P_RCV FB is reset (parameter LEN == 16#00) (see Fig. 6-2). In the event of an error, the binary result BR is reset. If the block is terminated without errors, the binary result has the status ”1”.

Note

The function block P_RCV does not have a parameter check, i.e. if there are invalid parameters, the CPU can branch to STOP mode.

Before the CP 340 can receive a request after the CPU has changed from STOP to RUN mode, the CP-CPU start-up mechanism of the P_RCV FB must be completed (see Section 6.5).

S7 Receives Data from a

Communication Partner

Communication via Function Blocks 如果想去掉该提示,请访问并下载:

http://www.jisupdfeditor.com/

长沙工控帮教育科技有限公司整理

6-9

CP 340 Point-to-Point Communication ASE00053578-05

Block call

STL representation LAD representation

CALL P_RCV, I_RCV

EN_R: =

R: =

LADDR: =

DB_NO: =

DBB_NO: =

NDR: =

ERROR: =

LEN: =

STATUS: =

I_RCV P_RCV

EN ENO

EN_R NDR

R ERROR

LADDR LEN

DB_NO STATUS

DBB_NO

Note

The parameters EN and ENO are only present in the graphical representation (LAD or FBD). To process these parameters, the compiler uses the binary result BR.

The binary result is set to signal state ”1” if the block was terminated with-out errors. If there was an error, the BR is set to ”0”.

The P_RCV FB works with an instance DBI_RCV of 40 bytes, whose number is specified in the call. The data in the instance DB cannot be accessed.

Note

Exception: If the error STATUS == W#16#1E0E occurs, you can consult the SFCERR variable for more details of the error (see Section 8.3). This error variable can only be loaded via a symbolic access to the instance DB.

What to Do

Assignment in the Data Area

Communication via Function Blocks 如果想去掉该提示,请访问并下载:

http://www.jisupdfeditor.com/

长沙工控帮教育科技有限公司整理

6-10 CP 340 Point-to-Point Communication ASE00053578-05

The table below lists the parameters of P_RCV (FB 2).

Table 6-3 FB 2 P_RCV Parameters

Name Type Data Type Description Permitted Values,

Comment

EN_R INPUT BOOL Enables data read

R INPUT BOOL Aborts request Active request is aborted and

receiving is blocked.

LADDR INPUT INT Basic address of CP 340 The basic address is taken from STEP 7.

DB_NO INPUT INT Data block number Receive DB No.:

CPU-specific, zero is not al-lowed

DBB_NO INPUT INT Data byte number 0  DBB_NO  8190

Received data as of data word NDR1 OUTPUT BOOL Request completed without

errors, data accepted

STATUS parameter == 16#00;

ERROR OUTPUT BOOL Request completed with

errors

STATUS parameter contains error details

LEN OUTPUT INT Length of message frame

received

1  LEN  1024,

specified in number of bytes STATUS OUTPUT WORD Error specification If ERROR == 1, STATUS

pa-rameter contains error details.

1 After a correct receive request, the NDR parameter is available for one CPU cycle!

FB 2 P_RCV

在文檔中 The AS-i Master 2 (頁 166-170)