Posted 17 Mar 2016 Hi Im relatively new to PLC programming and focusing mainly on Siemens PLCs. Can someone give me an example or why one would want to use OR Word (OW) and AND Word (AW). I understand that this means it is combining the contents of accu1 and accu2. But why would you want to OR/AND them. Thanks Share this post Link to post Share on other sites
Posted 17 Mar 2016 I use this function for fast reading via VIPA_SpeedBus (323-1BH70 DIO16 Alarm/ETS) PIW words precisely in one cycle PLC or for OB40 .... it´s reading hardware interrupt´s for example L PIW 550 L W#16#100 AW L W#16#100 ==I = "kwAK" //. L PIW 550 L W#16#200 AW L W#16#200 ==I = "kwRK" //. L PIW 550 L W#16#400 AW L W#16#400 ==I = "kwTouch" 1 person likes this Share this post Link to post Share on other sites
Posted 30 Mar 2016 One reason to use the OR word instruction is to add all active bits from two or more words into a single word, which might then be compared with some constant value. One application where this is handy is in summing fault bits from several fault words into one fault word. This single word is then compared, for example, to zero. If the value of the word is 0, then there are no faults. This method is faster than comparing on a bit-level basis. One reason to use the AND word instruction is to provide a mask. You can mask individual bits and pass only the bits to be examined into a register or DB. Share this post Link to post Share on other sites
Posted 20 Apr 2016 (edited) I have attached a simple shift register ladder diagram. The OR function sets the bit, The SHR function shifts all the bits to the right, then the AND function checks the status of the bit . Grab some AND OR truth tables to help you understand the basics. example : 1. 0000 0000 0000 0000 Our WORD MW100 before any action 2. 0000 0000 0000 1000 Our WORD MW100 After OR 3. 0000 0000 0000 0100 Our WORD MW100 After shifting all bits 1 place right 4. Next We Test our WORD MW100 by AND ing with 1 and put the result in our WORD MW120 5. The bottom rung compares the WORD MW120 with 1, and if TRUE sets M4.0 TRUE. 6. Step 5 will not go true until our WORD MW100 has been shifted right 2 more times so it looks like 0000 0000 0000 0001 I hope this helps shiftreg.pdf Edited 20 Apr 2016 by WeltonBoss Additional Info Share this post Link to post Share on other sites