-> Hier kostenlos registrieren
Hi,
In a project, we need to transfer some DBs from an S5 (135U) to an S7(315-2DP) and vice versa.
This is our Hardware config:
-On S5 we have a CP525 with to interface
-On S7 we have a CP341-RS422
-We have a protocol converter to convert RS232 signals from CP525 to RS422 Signals on CP341
And this is what we have done for the software:
-On S5 We programmed FB125(SYNCH) in OB20, OB21, OB22
* FB126(SEND_ALL) and FB127(RECEIVE_ALL) are called in OB1
* In CP525 we’ve adjusted the address jumpers IF0 and IF1 and on its RAM we’ve configured the R3964 Protocol.
-On S7 We’ve configured the CP341 using its parameter setting in hwconfig.
*We’ve used the example project for CP341. It uses FB8 to SEND and FETCH data. We’ve configured it in SEND mode to grab DBs from S5. The below is our code in S7. It is located in FC22 and it is called in OB1:
TXD and RXD LEDs on CP341 are flashing and we also used a digital logic analyzer to inspect what is transferring on the line. and I could see the content of DB42 transferring.
But now I can’t see any change in S5 part. I thought the Data will be transferred to DB10 of the S5 As I have set the DB_no to 10 in my code. What am I doing wrong? It’s been a week I’ve been working on this with no success!L
In a project, we need to transfer some DBs from an S5 (135U) to an S7(315-2DP) and vice versa.
This is our Hardware config:
-On S5 we have a CP525 with to interface
-On S7 we have a CP341-RS422
-We have a protocol converter to convert RS232 signals from CP525 to RS422 Signals on CP341
And this is what we have done for the software:
-On S5 We programmed FB125(SYNCH) in OB20, OB21, OB22
* FB126(SEND_ALL) and FB127(RECEIVE_ALL) are called in OB1
* In CP525 we’ve adjusted the address jumpers IF0 and IF1 and on its RAM we’ve configured the R3964 Protocol.
-On S7 We’ve configured the CP341 using its parameter setting in hwconfig.
*We’ve used the example project for CP341. It uses FB8 to SEND and FETCH data. We’ve configured it in SEND mode to grab DBs from S5. The below is our code in S7. It is located in FC22 and it is called in OB1:
Code:
[COLOR=#000000][FONT=Arial] [INDENT]L 256 //LADDR
T "SEND WORK DB".P_SND_RK_WORK_LADDR
L 42 //DB_NO
T "SEND WORK DB".P_SND_RK_WORK_DB_NO
T "SEND SRC DB".P_SND_RK_DB_NO
L 0 //DBB_NO
T "SEND WORK DB".P_SND_RK_WORK_DBB_NO
T "SEND SRC DB".P_SND_RK_DBB_NO
L 114
T "SEND WORK DB".P_SND_RK_WORK_LEN //LEN
T "SEND SRC DB".P_SND_RK_LEN //LEN
// ------------------------
// SEND with Instance-DB
// ------------------------
CALL "P_SND_RK" , "SEND IDB"
SF :='S'
REQ :="SEND WORK DB".P_SND_RK_REQ
R :="SEND WORK DB".P_SND_RK_R
LADDR :="SEND WORK DB".P_SND_RK_WORK_LADDR
DB_NO :="SEND WORK DB".P_SND_RK_WORK_DB_NO
DBB_NO :="SEND WORK DB".P_SND_RK_WORK_DBB_NO
LEN :="SEND WORK DB".P_SND_RK_WORK_LEN
R_CPU_NO:=1
R_TYP :='D'
R_NO :=10
R_OFFSET:=0
R_CF_BYT:=255
R_CF_BIT:=
DONE :="SEND WORK DB".P_SND_RK_DONE
ERROR :="SEND WORK DB".P_SND_RK_ERROR
STATUS :="SEND WORK DB".P_SND_RK_WORK_STATUS
// ------------------------
// Generate edge P_SND_RK_REQ
// ------------------------
AN "SEND WORK DB".P_SND_RK_REQ //P_SND_RK_REQ
S "SEND WORK DB".P_SND_RK_REQ //set P_SND_RK_REQ
O "SEND WORK DB".P_SND_RK_DONE //P_SND_RK_DONE
O "SEND WORK DB".P_SND_RK_ERROR //P_SND_RK_ERROR
R "SEND WORK DB".P_SND_RK_REQ //P_SND_RK_REQ
// -------------------------------
// Check "Complete without error"
// -------------------------------
AN "SEND WORK DB".P_SND_RK_DONE //check P_SND_RK_DONE
JC CHER //if P_SND_RK_DONE equals 0, jump to CHER
//and check P_SND_RK_ERROR
// -------------------------------
// "Complete without error"
// P_SND_RK_DONE = 1
// -------------------------------
L "SEND SRC DB".P_SND_RK_COUNTER_OK //"Complete without Error"
+ 1 //increment counter
T "SEND SRC DB".P_SND_RK_COUNTER_OK
NOP 0
NOP 0 //further user functions
NOP 0
BE
// -------------------------------
// Check "Complete with error"
// P_SND_RK_ERROR = 1
// -------------------------------
CHER: AN "SEND WORK DB".P_SND_RK_ERROR //check P_SND_RK_ERROR
BEC //if no error occured, jump to end
// -------------------------------
// "Complete with error"
// -------------------------------
L "SEND SRC DB".P_SND_RK_COUNTER_ERR //"Complete with error"
+ 1 //increment counter
T "SEND SRC DB".P_SND_RK_COUNTER_ERR
L "SEND WORK DB".P_SND_RK_WORK_STATUS
T "SEND WORK DB".P_SND_RK_WORK_STATUS_SAV //save STATUS
NOP 0
NOP 0 //Error-Handling
NOP 0
BE
[/INDENT]
[/FONT][/COLOR]
But now I can’t see any change in S5 part. I thought the Data will be transferred to DB10 of the S5 As I have set the DB_no to 10 in my code. What am I doing wrong? It’s been a week I’ve been working on this with no success!L