8/24/2009 3:33 PM | |
Joined: 4/24/2006 Last visit: 9/5/2024 Posts: 8734 Rating:
|
Dear mexflexx, Yes, it looks like indirect addressing. I know my limits, I'm afraid someone else should help you. I'm sorry. Please have a look at this thread, perhaps it helps: /tf/WW/en/Posts/12597 Good luck, Wizard |
Last edited by: Wizard at: 8/24/2009 3:34 PM |
|
8/24/2009 4:22 PM | |
Posts: 131 Rating:
|
why? is it that hard topic the indirect addressing?? |
8/25/2009 3:25 AM | |
Joined: 10/7/2005 Last visit: 9/5/2024 Posts: 3018 Rating:
|
Dear all let's NOT confuseindirect addressing with"Absolute (or direct) memory access". The latter is something that was specific to S5 (and required/useful in certain cases) and can NOT be doneanymore in S7 (and isn't really needed anymore in S7, even though I personally do miss it sometimes Anyhow, absolute (or direct) memory access requires knowledge of the S5 CPU's memory structure/organisation which differes between the various S5 CPU's! For example, if you have a 115U 941,2,3or4 CPU, address E400hex is the absolute memory address in whichDB0's current start address "resides". If you however have a 135U 928 CPU, address E400hex is the absolute memory start address of the "S Flags" area (and Baskharan address list is only valid this case). The next thing to note about absolutememory accessis the followong warning from the manual: Only experienced system programmers should use operations that work with absolute addresses! While you don't want to program these I mention this here simply to remove some of the frustration in trying to understand it Having said the above dear mexflexx, here's what we need to know from you in order to be able to helpyou in your quest to work out what the S5 logic does and how to implement in S7? 1.) S5 CPU type (e.g. (115U CPU 943 or 135 CPU 928, ideally you post"6ES5" part number). 2.) The whole S5 program or at least FB101 (you code snippet does not reveal what writes into MW202 and MW204). What I'd like you you to do is to get hold of the CPU's manual yourself so you will alsobe able to verify "things" yourself (the manuals can be found and downloaded from theSiemens service and support web). I hope this helps and more can be advised when you post the above requested info |
Last edited by: fritz at: 8/25/2009 3:33 AMCheers |
|
8/25/2009 3:15 PM | |
Posts: 131 Rating:
|
dear all, i appreciate ur help.the thing is that we are a siemens partner in the middle east and we have sometimes projects that involves s5-s7 conversion..but the problem of indirect addressing is very new to us. anywy, we have a s5-115u cpu and i attached the s5d file..hope u can help.. P.S.: plz rename the file by deleting the .zip extension and writing .s5d instead.its not a zip file..thank u. AttachmentFOLDA1ST.zip (181 Downloads) |
8/29/2009 2:52 PM | |
Joined: 10/7/2005 Last visit: 9/5/2024 Posts: 3018 Rating:
|
Hello again mexflexx Alright, so it is a 115U (you didn’t say which CPU, but we assume it to be a 941,2,3 or 4). First thing to note is that absolute memory address E400hex is the start of the DB address list (see “Block Address List in the CPU manual for more on this). This means that DB0’s current start address in the CPU’s RAM can be found in memory address E400&E401hex (DB1’s is in E402&E403hex and so on). You can compare the functionality of these address lists to a File allocation table on your harddisk, they allow the CPU to determine where the DB’s are in the RAM, allow downloaded of individual blocks as well as being able to handle a compressing of the RAM.Anyhow, I commented Segment 4 of your FB101 as an example and guide (and hopefully got it right), but my advise to you is this: Try to get hold of a commented S5 program (the supplied one seems to be an online backup and comments will greatly help in understanding the logic). Take the example below as a guide only and verify this yourself (I assume you have the downloaded manual by now). Get hold of a test 115U CPU and test the S5 logic (this is what I would do if I had to convert an S5 program like yours, alternatively engage someone with the required S5 expert level to help you with the task). C DB 100 L DW 241 // assumed to be a value of “1” forthis exampleL KF +100 +F T FW 200 // value “101” in FW200 (in this example) L KH E400 // Load the absolute address which “holds” DB0’s start address L FW 200 // Load “101” SLW 1 // *2 , done because every DB address entry occupies 2 addresses +F // = absolute address which "holds"DB101’s start address LIR 0 // Load DB101’s current start address into register 0 (=accu1) L KF +137 +F // add 137 to it T FW 202 // store in FW202 (=DB101’s DW137 absolute address) L KF +140 +F // add 140 to it T FW 204 // store in FW202 (=DB101’s DW277 absolute address) L KH E400 //Load the absolute address which “holds” DB0’s start address L KF +200 +F // =absolute address which "holds" DB100’s start address LIR 0 // Load DB100’s DW0 current start address into register 0 (=accu1) L KF +137 +F // add 137 to it T FW 206 // store in FW206 (=DB100’s DW137 absolute address) L KF +140 +F // add 140 to it T FW 208 // store in FW208 (=DB100’s DW277 absolute address) L FW 208 // DB100’s DW277 absolute address (=END address Destination) L FW 204 // DB101’s DW277 absolute address (=END address Source) TNB 140 // Copy 140 bytes (downwards) from above Source to Destination L FW 206 // DB100’s DW137 absolute address (=END address Destination) L FW 202 // DB101’s DW137 absolute address (=END address Source) TNB 138 // Copy 138 bytes (downwards) from above Source to Destination I hope this helps |
Last edited by: fritz at: 9/2/2009 12:32 AMcorrected PLC number typing mistake Cheers |
|
9/2/2009 12:28 PM | |
Joined: 10/7/2005 Last visit: 9/5/2024 Posts: 3018 Rating:
|
Dear mexflex there is an old Chinese proverb: "Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime". Regretably, it seems my aimto teach you how to fish failed and I am concerned that you are heading down a dangerous path with your S5 conversion. Your assumption to use "DB101’s DW277" as the BLKMOV is wrong on a number of levels: For one, any S5 DB address "doubles up" when converted to S7 so it wouldbe "DB101’s DW544 (S5 used WORD based DB addresses, S7 uses BYTE based DB addresses), ". Secondly, even using "DB101’s DW544" will not work. S5 TNB requires the END addresses of the Source/Destination data area that is copied, S7 BLKMOV requires the START addresses. Thirdly, my commented S5 code exampleis justan example and more importantly based on a (randomly picked) example value of 1 in DB100 DW241! I am reasonably confident that DW241 in DB100 can/will have other values in it during code execution, which will change the source DB number andlead to copying of DB's other than the example result of DB101. Last but not least, use <F1> on SFC20to get the S7 inbuilt help which will tell you how to correctly declare the source and destination ANY pointer (this is a continuation of the "fishing lesson" Please realise that the S5 logic you are dealing with is "hardcore" stuff and I believe that you do not (yet) have the know how to evaluate/analyse it properly (I do notmean tooffend you with this assertion, but rathertry to outline the reality of the situation). As advised before, I do as such strongly urge you to do this: 1.) Try to get hold of a commented S5 program (the supplied one seems to be an online backup and comments will greatly help in understanding the logic). 2.) Take myexample as a guide only and verify this yourself (I assume you have the downloaded manual by now). 3.) Get hold of a test 115U CPU and test the S5 logic (this is what I would do if I had to convert an S5 program like yours, alternatively engage someone with the required S5 expert level to help you with the task). I hope this helps and good luck |
Cheers |
|
Follow us on