8/11/2009 1:42 PM | |
Posts: 10 Rating: (0) |
hello every body i am new in conversion i have a cpu 928 .i want to covert a pieace of s5 instruction witch contain LIR and TIR to S7:(FB1) L MD 250 L KH EC00 TIR 2 LIR 6 TIR 3 LIR 8 L KB1 T DR 0 i want to unterstand this instruction in s5 and their equivalence in S7 for more details i attached the source of s5 AttachmentBEJA42ST.zip (996 Downloads) |
8/11/2009 8:53 PM | |
Joined: 3/21/2006 Last visit: 12/2/2024 Posts: 10229 Rating: (1181) |
Hello, Look at /tf/WW/en/Posts/12597 Hope this will helps. Best regards, Hristo Mihalev |
8/12/2009 2:31 AM | |
Joined: 10/7/2005 Last visit: 12/6/2024 Posts: 3028 Rating: (1057) |
Hello Aymen here's first of all an explanation of what your code snippet does (I hopefully got it right as it's been a while and my LIR/TIR skills are starting to get "rusty"): L MD 250 // Load the value of MD250 into accu1 (accu1-H = MW250, accu1-L=MW252) L KH EC00 // Load value EC00hex into accu1 (MD250 value now in accu2) TIR 2// Transfer the value in register 2 (accu2-H = MW250) into the addressnominated by accu1 (which is EC00 = Counter 0 memory address). Result: Transfer MW250 to C0 (C0 seems tobe used purely asscratch memory in this case) LIR 6 // Load Register 6 (DBA=Datablock Start address) with the value of the addressnominated by accu1 (i.e C0 value which is the value of MW250). Result: If MW250 is 10, your "DB start address" of the currently open DBis now DW10! Execution of for example "L DW 0"will actually be executed as "L DW 10". TIR 3 //Transfer the value in register3 (accu2-L = MW252)into the addressnominated by accu1 (which is still EC00 = Counter 0 memory address). Result: Transfer MW252 to C0 (C0 seems to be used purely asscratch memory in this case). LIR 8 // Load Register8 (DBL) withe value of the addressnominated by accu1 (i.e C0 value which is now the value of MW252). Result: "Declare" the lenght of currently open DB as per value of MW252 L KB1 // Load a value of 1 into accu1 T DR 0 // and store it in Low byte of "DW0+offset as perDBA"of currently open DB. In sums, lets assume MW250 has a value of 10 and MW252 a value of 200, this is what your code does: "Inform" the CPU that the lenght of the currently open DB is 200(done to ensure that address access monitoring still works correctly since the "DBA" was changed). Store a value of 1in DR 10 (DR0 + DBA offset) in currently open DB. Translated into Step7, yourlogic could looklike this: [code]// first make sure correct DB is open!! LAR1 P#0.0// point AR1 to address 0.0 L MB 251 // use oly MB251 (just in case MB250 has some value in it) SLD 4 // convert to S7 Byte.Bit pointer (SLD 3) and multiply with 2 (to accomodate S5 WORD/S7 BYTE addressing differences) L 1 T DBB [AR1,P#1.0] // P#1.0 offset to aim for "DR" Byte [/code] I hope the above explanantiondoes help, you'll find all the required info forverifying this and working out other LIR/TIR stuff in the CPU manual, links to them are below: CPU 928 programming manual CPU 928B programming manual |
Last edited by: fritz at: 8/16/2009 11:09 PMLast edited by: fritz at: 8/14/2009 2:46 AM"Unrusted" my rusty LIR/TIR skills and corrected LIR 6 explanation, the "in sums" example and S7 code example (and hoepfully got it right this time). Last edited by: fritz at: 8/12/2009 3:12 AMAdded S7 code Cheers |
|
8/14/2009 2:55 AM | |
Joined: 10/7/2005 Last visit: 12/6/2024 Posts: 3028 Rating: (1057) |
Hello Aymen you got it basically right (and I had to seriously edit my previous post asI incorrectly explained the LIR 6, I must be getting old ). Just one minor thing thatshould be corrected in your understanding: Change: "LIR 6 // the ofset in the db opned is in MD250" to "LIR 6 // the ofset in the db opned is in MW250" This "offsetting" via the DBA also only applies if and when your logic does the jump to "M001" label andM195.5 is "0". |
Last edited by: fritz at: 8/14/2009 10:28 AMCheers |
|
11/3/2009 6:19 PM | |
Posts: 2 Rating: (0) |
hello ayman i am have someyour proplem you solved it if yes please told me thank you ...... |
This contribution was helpful to1 thankful Users |
Follow us on