11/6/2009 12:08 AM | |
Joined: 10/7/2005 Last visit: 4/24/2024 Posts: 3004 Rating: (1046)
|
Hello egy_eng you are RIGHT and the (AR1 based indirect addressing related) logic at the top does not make too much sense. The only explanation I have why it was programed that way is because it could be done (rather than it is a "better" or faster or more efficient way, which it of course isn't). I hope this helps |
Cheers |
|
11/8/2009 8:30 AM | |
Posts: 43 Rating: (0) |
hello fritz, thank u very musch for replying me and make me sure that i am right but i realy need to know why he made this shift is that a type of making conflict to the other users of a program some thing like copy right to the program or what and i would like to ask u a question how can i become a powerfrul plc programmer and how could u advice me to become a plc expert thank u for ur efforts best regards ahmed |
11/8/2009 8:31 AM | |
Posts: 43 Rating: (0) |
hello fritz, thank u very much for replying me and make me sure that i am right but i realy need to know why he made this shift is that a type of making conflict to the other users of a program some thing like copy right to the program or what and i would like to ask u a question how can i become a powerfrul plc programmer and how could u advice me to become a plc expert thank u for ur efforts best regards ahmed |
11/8/2009 11:04 AM | |
Posts: 8946 Rating: (999) |
Read the post of darius! |
11/8/2009 11:07 AM | |
Joined: 10/7/2005 Last visit: 4/24/2024 Posts: 3004 Rating: (1046)
|
Hello again egy_eng Jolly good question and I wish I had the answer to it. As they in general say "Practice makes perfect", I do however believe that this is not the only thing that sets a "good" Automation Engineer apart from an "average" one. I've learnt a lot by having to deal with software that was developed by others which opens your eyes to find out different ways of doing things (not all of which are good and/or useful, but they at least still serve as a bad example on how NOT to do things, just like the piece of logic you came across). My advise to you: Have an open mind,be"curious" to learn,question things if they don't make sense to you rather than just accepting it, don't assume but instead verify by either testing or using the available resources (manuals, webetc.). Most importanly though, enjoy doing what your are doing! I hope this helps |
Cheers |
|
11/8/2009 11:09 AM | |
Posts: 8946 Rating: (999) |
Not only writing, also reading. This Bats are cool...... |
11/9/2009 7:19 AM | |
Posts: 43 Rating: (0) |
hello again fritz |
11/9/2009 7:23 AM | |
Posts: 43 Rating: (0) |
hello ibn-service |
11/9/2009 3:58 PM | |
Joined: 1/4/2008 Last visit: 2/27/2024 Posts: 703 Rating: (96) |
Hello, the doubleword pointer (also known as the bit-pointer) consists of the addressand the memory area specification which is used forthe area-crossing indirect addressing. In your example is just the address used. The pointer (just with an address) has syntax P#x.y where x means byte part of the address and y means the bit part of the address.Numerical representation of this address is the 19-bit numberfrom which the lowest 3 bits are the bit part of theaddress and higher 16 bits are the byte part of theaddress. So if you have the byte address 512 you load the 512 to the accumulator and shift 3 times to the left to get theappropriate position in the pointer (the lowest 3 bits are then zero). If you wouldask why 3 bits, somebody says because 3 bits are enough to get numbers 0-7 for the bit part of an address, but actually it results from the fact that this 19-bit number is a bit offset, i.e. the number of bits and the shift instruction (which should be rather SLD instead of SLW - this you could use only when you're sure the address will not get over 8k) is the same likemultiply by 8 to get thenumber of bits frombytes. The shift instruction is used because it's more efficient than load theconstant 8 and multiply. Regards Sydney addition: link to thread with a literature attachment about the pointers |
Last edited by: Sydney at: 11/9/2009 10:42 PMadded the link to other thread about the pointers Last edited by: Sydney at: 11/9/2009 4:05 PMlanguage correction |
|
This contribution was helpful to1 thankful Users |
11/11/2009 11:25 AM | |
Joined: 1/4/2008 Last visit: 2/27/2024 Posts: 703 Rating: (96) |
Hello egy_eng, I'm glad it helped and will try to explain this part little bit more... - SLW 3 vs. SLD 3: SLW shifts just a WORD, so if you don't want to lose some data, the shifted number could be only 16-3 => 13 bits, which is 8191 (byte offset). The address could be up to 64kso the pointer has 19 bits (16 bits for the 64k in bytes and 3 bits for the bit address part), thereforewhen you write the code for a common use, you should use the SLD 3 instruction for the byte offset conversion to the bit-pointer - SLD 3 equals to multiply by 8: it results from the definition of binary code, the base is 2 so every shift to the left means multiply by 2by analogy in base-10 if you "shift" the number to the left (means add zero to the end) is the same like multiplying by 10 - shift instruction more efficient: Loading aconstant and multiplying takeslittle bit moreexecution time then SLD 3 and also uses both accumulators which means inmany cases some additional logic around. Regards Sydney |
Last edited by: Sydney at: 11/11/2009 11:29 AMlanguage correction... |
|
11/12/2009 6:44 AM | |
Posts: 43 Rating: (0) |
hello Sydney thank u very much for u rrespone and ur efforts best regards |
11/12/2009 1:28 PM | |
Joined: 1/4/2008 Last visit: 2/27/2024 Posts: 703 Rating: (96) |
Hello Ahmed, You're welcome Regards Sydney |
Follow us on