4/3/2024 7:51 PM | |
Joined: 1/21/2013 Last visit: 8/18/2024 Posts: 3044 Rating:
|
Hi Christiano, I will try to give some answers. I will refer to some chapters of the programming and operating manual 'SIMATIC Statement List (STL) for S7-300 and S7-400 Programming'.
Yes. The ACCU2 register contains the difference between the two words of the DB20 at the byte address specified by #TEMP1 and #TEMP4. >=I is used to check if this value is greater than or equal to 0.
A load instruction (L) does not affect the status word (see section 9.2). The last instruction that affected the status word was the compare integer (>=I) (see section 2.2). So this will trigger the conditional jump. The two load instructions may be interesting within the code after the jump label M005, but this part of the code has not been posted by you or you removed the jump label.
The first two load instructions are unnecessary because their value is never accessed before it falls out of the ACCU registers. DB20.DBW178 will contain the bitwise OR combination of the value previously found in DB20.DBW178 and the value stored in #TEMP2. After this is written, the code jumps to the missing label M005.
The first load instruction accesses memory byte 4. So it is not the value 4 that is decremented by 1, but the value stored in memory byte 4. This value is used to define the number of bit positions to shift the value of #TEMP6 to the left. And - as before - the value of DB20.DBW186 is bitwise OR combined and written back to DB20.DBW186. I hope this makes the code a little clearer for you. Kind regards |
This contribution was helpful to
1 thankful Users |
Follow us on