emokar
April 25th, 2007, 02:51 PM
Hello,
I am working on a project of converting an S5 plc to S7-300.
I used the converter tool provided with Simatic Manager and it converted most of the program quite succesfully. I have some problems , and i thougt i could get some help here.
Problem 1 : 'ASM' command in S5 STL.
Here is a list of special function blocks in which the 'asm' command is used.
FB238 COMPR
FB239 DELETE
FB240 COD:B4
FB241 COD:16
FB242 MUL:16
FB243 DIV:16
FB244 SEND
FB245 RECEIVE
FB246 FETCH
FB247 CONTROL
FB248 RESET
FB249 SYNCHRON
FB250 RLG:AE
FB251 RLG:AA
And here is an example of how it is used. The usage is the same in every block.
FB 248 C:CTCSONST.S5D LEN=22
Page 1
Segment 1
Name :RESET
Decl :SSNR I/Q/D/B/T/C: D KM/KH/KY/KS/KF/KT/KC/KG: KY
Decl :A-NR I/Q/D/B/T/C: D KM/KH/KY/KS/KF/KT/KC/KG: KY
Decl :PAFE I/Q/D/B/T/C: Q BI/BY/W/D: BY
:ASM KH 0000
:BE
I could not find anywhere, what this command does. A stanger thing is that none of those special FB's are called in the rest of the program. They are defined, and in all of them only two commands are used just the same way in the example i gave above.
I could not understand the reason of defining the blocks. Why did the programmer defined them if they aren't called in any line of the code?
I mean, wouldn't the system work without those unused blocks? If they aren't called anywhere, does that mean that it is ok if i avoid them while programming the s7-300? If so , i don't need to deal with 'asm' code , too.
Problem 2: Special OB's. OB21,OB22 and OB31.
OB21 and OB22 are special OB's for hot and warm restart. I have converted them into OB101 and OB100 in s7. is this correct?
OB31 is used for set cycle monitoring time.
the only code written in ob 31 is :
OB 31 C:CTCSONST.S5D LEN=8
Page 1
Segment 1
:NOP 1
:BE
I could not understand its use and so i could not decide if i should use anything to stand for OB31 in the s7 program.
Problem 3: FB167 and FB168, counter module IP240.
There is an encoder in the system and it is read with ip240 counter module. In the program, FB168 and FB167 are called several times. there are some variables like KANR,BGAD etc. I found explanations for all those parameters. But i could not find out from which address the counted value is going to taken. Here is an example of FB168's use:
FB 140 C:CTCSONST.S5D LEN=29
Page 1
Segment 1
Name :X-ACHSE
:C DB 140
:JU FB 168
Name :STEU.POS
DBNR : KF +140
FKT : KY 1,0
PAFE : FY 200
:
:L FY 200
:L KH 0000
:><F
:S F 145.7
:
:L DR 28
:T FY 146
:L DR 29
:T FY 143
PAFE parameter is addressed at FY200 and it represents the error byte. So, in the block above, an error check is processed. But where is the counted value?
Here is an example of FB167's use:
Segment 4
:JU FB 167
Name :STRU.POS
BGAD : KF +128
KANR : KF +1
DBNR : KF +140
AFL : KF +1
IMP : KF +0
BCD : KY 0,0
PRA1 : KM 00000000 00000000
PRA2 : KM 00000000 00011101
RUND : KF +0
LOSE : KF +0
DAV : KF +0
PAFE : FY 200
:
:L FY 200
:L KF +0
:><F
:S F 145.7
:
:C DB 140
:L DW 10
:C DB 142
:T DW 0
Same problem, i could not understand where is the value written or read from the counter card? How should i convert the parts related with counter card to s7?
I am desperately looking forward to get some help. Please help me if you can.
Thank you for your attention,
Regards,
I am working on a project of converting an S5 plc to S7-300.
I used the converter tool provided with Simatic Manager and it converted most of the program quite succesfully. I have some problems , and i thougt i could get some help here.
Problem 1 : 'ASM' command in S5 STL.
Here is a list of special function blocks in which the 'asm' command is used.
FB238 COMPR
FB239 DELETE
FB240 COD:B4
FB241 COD:16
FB242 MUL:16
FB243 DIV:16
FB244 SEND
FB245 RECEIVE
FB246 FETCH
FB247 CONTROL
FB248 RESET
FB249 SYNCHRON
FB250 RLG:AE
FB251 RLG:AA
And here is an example of how it is used. The usage is the same in every block.
FB 248 C:CTCSONST.S5D LEN=22
Page 1
Segment 1
Name :RESET
Decl :SSNR I/Q/D/B/T/C: D KM/KH/KY/KS/KF/KT/KC/KG: KY
Decl :A-NR I/Q/D/B/T/C: D KM/KH/KY/KS/KF/KT/KC/KG: KY
Decl :PAFE I/Q/D/B/T/C: Q BI/BY/W/D: BY
:ASM KH 0000
:BE
I could not find anywhere, what this command does. A stanger thing is that none of those special FB's are called in the rest of the program. They are defined, and in all of them only two commands are used just the same way in the example i gave above.
I could not understand the reason of defining the blocks. Why did the programmer defined them if they aren't called in any line of the code?
I mean, wouldn't the system work without those unused blocks? If they aren't called anywhere, does that mean that it is ok if i avoid them while programming the s7-300? If so , i don't need to deal with 'asm' code , too.
Problem 2: Special OB's. OB21,OB22 and OB31.
OB21 and OB22 are special OB's for hot and warm restart. I have converted them into OB101 and OB100 in s7. is this correct?
OB31 is used for set cycle monitoring time.
the only code written in ob 31 is :
OB 31 C:CTCSONST.S5D LEN=8
Page 1
Segment 1
:NOP 1
:BE
I could not understand its use and so i could not decide if i should use anything to stand for OB31 in the s7 program.
Problem 3: FB167 and FB168, counter module IP240.
There is an encoder in the system and it is read with ip240 counter module. In the program, FB168 and FB167 are called several times. there are some variables like KANR,BGAD etc. I found explanations for all those parameters. But i could not find out from which address the counted value is going to taken. Here is an example of FB168's use:
FB 140 C:CTCSONST.S5D LEN=29
Page 1
Segment 1
Name :X-ACHSE
:C DB 140
:JU FB 168
Name :STEU.POS
DBNR : KF +140
FKT : KY 1,0
PAFE : FY 200
:
:L FY 200
:L KH 0000
:><F
:S F 145.7
:
:L DR 28
:T FY 146
:L DR 29
:T FY 143
PAFE parameter is addressed at FY200 and it represents the error byte. So, in the block above, an error check is processed. But where is the counted value?
Here is an example of FB167's use:
Segment 4
:JU FB 167
Name :STRU.POS
BGAD : KF +128
KANR : KF +1
DBNR : KF +140
AFL : KF +1
IMP : KF +0
BCD : KY 0,0
PRA1 : KM 00000000 00000000
PRA2 : KM 00000000 00011101
RUND : KF +0
LOSE : KF +0
DAV : KF +0
PAFE : FY 200
:
:L FY 200
:L KF +0
:><F
:S F 145.7
:
:C DB 140
:L DW 10
:C DB 142
:T DW 0
Same problem, i could not understand where is the value written or read from the counter card? How should i convert the parts related with counter card to s7?
I am desperately looking forward to get some help. Please help me if you can.
Thank you for your attention,
Regards,