Sign in to follow this  
Followers 0
Husanto

Problem Convert TIR and LIR instruction

8 posts in this topic

Hi Friends, I've problem about converting two instruction in Simatic S5 to Simatic S7-300. What the Similar Instruction in Simatic S7 for converting TIR and LIR instruction in Simatic S5? Please help me... Thanks Husanto

Share this post


Link to post
Share on other sites
You do not have direct memory access on S7, so you will have to determine the function of the s5 code and completely rewrite the code. S7 indirect addressing is however more flexible. There are also funtions for finding things like Data block length and current Data Block number, so I would be very surprised if you cannot duplicate s5 functions.

Share this post


Link to post
Share on other sites
Hi. I don't have the S5 Manual close to me but I try to remenber. LIR/TIR Loading to or Transferring from a 16-Bit Memory Area Indirectly The LIR and TIR instructions refer to access to memory areas in an indirect way without restriction check syntax (E, A, DBDBW.. etc). The indirectly mode in step 7 is made with different mentality. You must see the pointer ANY on documentation. For conversion need to understand the Code.. and remenber that the index of DB S5 is in a word, while in S7 is a byte. good luck. Bye

Share this post


Link to post
Share on other sites
Very Thanks for the reply. But, can you tell me how to used indirect addressing instruction in S7, i already read the manual but I don't understand about it. Maybe i don't have smart brain like you :). I really hope you can help me... thanks Husanto

Share this post


Link to post
Share on other sites
Hi. is really hard. what do you wan't to use indirect addressing for E, A, M or Db ? The best guide is in help of Step7 search "ANY" For Db quicly normaly I use the follow code ==== FUNCTION FC 1 : VOID TITLE = VERSION : 0.1 VAR_TEMP id_Nr_Db : WORD ; Id_which : DWORD ; END_VAR BEGIN NETWORK TITLE = // I want read db50 L 50; T #id_Nr_Db; // trans in wd register AUF DB [#id_Nr_Db]; // this pointer is 16 bit lenght pointer ti Nr_Db L 1; T #Id_which; L DBW [#Id_which]; // fetch the db50.dbw0 <======= T MW 10; // #Id_which multiply for 16 ( or SLD 4 ) // L #Id_which_Byte // L 16 // *I // T #Id_which_Byte // 0r L #Id_which; SLD 4; T #id_Nr_Db; //Now you have changhe the pointer L DBW [#Id_which]; // fetch the db50.dbw2 <======= T MW 10; END_FUNCTION === This is an example but it is best to read and understand the manual to use all the functions. Bye

Share this post


Link to post
Share on other sites
This is a good example, the thing which would confuse people is the * 16 or SLD4 step, this is required because with indirect addressing it is possible to address down to bit level, but in this case we are working at word level. The manuals do explain, but Siemens manuals, in my opinion, are not the best out there. There are other ways of doing this, e.g. using AR1 and a pointer. However this method is close to the DO FW or DO DW command in step5.

Share this post


Link to post
Share on other sites
Many thanks all for the help. But can you show me how to convert this DO function S5 to S7. for example this a DO function program : DO DW 45 C DB 0 Please help me...how to convert that program in s7. many thanks all. Husanto

Share this post


Link to post
Share on other sites
OPN DB[#DBNo] #DBNo is a 16bit variable which contains the DB number to be opened. In your example it would be DW45 from the DO DW45 in your statement

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0