Convert S5 to S7 instruction

Husanto

Member
Join Date
Mar 2009
Location
Indonesia
Posts
7
Hi,

Can anybody help me how to convert this sample code below from S5 to S7.

C DB 4
L KH 7E00
T DW 70

L KF +4
SLW 1
L DW 70
+F
LIR 0
T FW 240


I already analize that's code and i don't know how to write it in S7 instruction. If Any body know, please help me...o_O

Thanks
 
LIR is an indirect register load instruction. There's no equivalent for this instrcution in S7. Basically what this program does is copying the contents of memory address 7E08 to FW240. I'm not sure what the contents of memory address 7E08 is, this depends on the type of S5 PLC you're using.

The program itself is as follows:

C DB 4     ;Open datablock 4
L KH 7E00 ;Place the hex value 7E00 in dataword 70
T DW 70

L KF +4 ;Take the value 4
SLW 1 ;Shift Left Word 1 position - basically a multiply by 2 operation - resulting in the value 8
L DW 70 ;add this to the contents of dataword 70
+F ;the accumulator now holds the value 7E08
LIR 0 ;load the contents of memory addresses 7E08 (and 7E09)
T FW 240 ;and move these to FW 240

 
Converting S5 to S7

Thank you for the reply.

I understand how that code work. But I don't know how to compare or convert the code into the code in the S7..

Thanks
 
As I said before: how you have to convert this is dependent on the type of S5 PLC you're talking about. Since you didn't give us that info, I doubt if there is anybody here who can help you any further.

Kind regards,
 
Converting S5 to S7

Thank you Mr Jean,

Yes, I want to convert from S5-95U to S7-300. Hope you can help me....:)

Many Thanks...
 
7E08 is an absolute memory address, to know what it is doing then you would need the memory map of the PLC that you are using.

Once you know what its doing, then you can look at options in step 7.
 
Converting S5 to S7

Thanks Mr Peter.

I already try to find what the similar function for that code in S5, but i don't find the function in S7 because i know that in S7 can't do absolut indirect addressing..
 
Hustanto,

The code segment that you posted seems to be only a fragment. As Jean Pierre says, without knowing which processor it's not easy to say what resides at that address (7E08). I suspect that it will be the memory address for a block. I did a job a couple of years ago that used this method to determine the memory address of a datablock so that it could be transferred to another block. For example if address 7E00 contained the start address of DB1 then address 7E08 would contain the start address of DB4. I may be wide of the mark here.

Edit: Ahh I see another post now about 95U

Nick
 
Nick,

that's correct. BTW, 7E00 is the start address of the DB list in the S5-95U and thus contains the start address of DB0, not DB1. 7E08 contains the start address of DB4, i.e. the address of DW0 within DB4.

Kind regards,
 
Many thanks Nick,

You all right, 7E00 is the start of the DB0. But,I am confused What the code in S7 that used to change the code that i post previous. Maybe you know what the start address for DB1 in S7.

For information : I use S7-300 with CPU 312 and for old PLC is S5 -95U.
 
Last edited:
Husanto,

This is why I made the comment about it being a fragment of code. Without seeing the rest of the code it isn't posible to tell what use is being made of the address. I suspect that it is going to be used for a transfer of data from one data block to another. The S7 way of doing this would be to use SFC20 instead.

Nick
 
A few things:

1. LIR is used to access a variable calculated offset, so why does the code use constants. It could have just directly accessed it in this case.

2. If my memory is correct DB0 is a standard DB where you set parameters for the operation of the PLC.

3. Step 7, there may not be an equivalent.
 

Similar Topics

Hello, I need some help to convert PMCR instruction from Omron CQM1H that using CQM1H-SCB41 to CJ2M using CJ1W-SCU4, The problem is on the old...
Replies
1
Views
841
Please, your support is needed to convert the following S5 function code to equivalent in S7 ; ( it transfer 8 words (W0 to W7) in data block...
Replies
1
Views
2,007
Hello all, I'm currently working on a servo motor linear positioning system (ball screw). I'm all set up regarding communication between my HMI...
Replies
1
Views
90
I have an application using an incremental encoder and then I convert it to degree (0-360) using calculation program. For a while, the calculation...
Replies
7
Views
239
Hi all. Me again still learning Rockwell. So I'll be polling an INT data array from a Modbus SE power meter with a L82 (with a Modbus ProSoft in...
Replies
56
Views
1,382
Back
Top Bottom